This commit is contained in:
2023-03-11 17:30:20 +00:00
commit b6c4e025bc
5124 changed files with 1153349 additions and 0 deletions
@@ -0,0 +1,134 @@
var Unibase;
(function (Unibase) {
let Platform;
(function (Platform) {
let Communications;
(function (Communications) {
let Components;
(function (Components) {
class ImportInstantReminder extends Unibase.Platform.Core.BaseComponent {
jsFiles() {
return ['platform/communications/managers/reminders/remindermanager.js',
"platform/forms/components/formviewer/formviewer.js",
'libs/parsley/parsley.min.js',
'platform/core/infos/status.js', '/platform/core/helpers/file/filehelper.js'];
}
cssFiles() {
return [];
}
;
html(id, containerid) {
var instance = this;
let html = '<form id="form_ImportInstantReminder" data-validate="parsley" data-isdynamic="false"><div id="div_importmessage" class="clear"></div><div class="b-b bg-white header dataApiHeader"><strong>Import InstantReminder</strong></div><div data-simplebar class="simple-scroll-bar scrollable import-export-body"><div class="card" id="importexportsection"><div class="card-header">Select file to import</div><div class="card-body"><div class="" id="div_Import"><input type="file" id="import_File" class="bg-light d-none d-sm-block required"><hr /><a href="javascript:;" id="fileUpload" class="btn btn-warning text-white" onclick=" Unibase.Platform.Communications.Components.ImportInstantReminder.Instance().FileUpload(\'' + containerid + '\',' + ImportInstantReminder.IsAlltenants + ');">Upload</a></div></div></div><div class="hidden" id="div_Export"><span id="sp_formName"></span><a href="javascript:;" id="fileExport" class="btn btn-primary text-white">Download</a></div></div><div class="bg-white footer"><button id="btn_CloseImport" class="btn btn-sm mr-auto btn-close">Close</button></div></form>';
return html;
}
showImport(IsAllTenants) {
ImportInstantReminder.IsAlltenants = IsAllTenants;
this.navigationHelper.popup(0, '', Unibase.Platform.Communications.Components.ImportInstantReminder.Instance(), null, Platform.Helpers.Size.Large);
}
FileUpload(containerid, IsAllTenants) {
var instance = this;
instance.navigationHelper.showLoading();
var url = _appsettings.server_url() + '/apis/v4/unibase/instantreminders/platform/ImportInSigleTenant/np';
if (IsAllTenants) {
url = _appsettings.server_url() + '/apis/v4/unibase/instantreminders/platform/ImportToAllTenants/np';
}
Platform.Helpers.FileHelper.Instance().upload(url, Unibase.Platform.Communications.Components.ImportInstantReminder.fileData).then(function (response) {
if (response.status == Unibase.Data.Status.Error) {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showError(response.message, "div_importmessage");
}
else {
instance.navigationHelper.hideLoading();
MessageHelper.Instance().showSuccess(response.message, "div_importmessage");
$('#' + containerid).modal('hide');
$('#' + containerid).remove();
}
});
}
load(id, containerid, callback) {
var instance = this;
$("#btn_CloseImport").click(function () {
$('#' + containerid).modal('hide');
$('#' + containerid).remove();
});
$("#btn_Import").click(function () {
$("#importexportsection").removeClass("hidden");
$("#div_Import").removeClass("hidden");
});
$('#import_File').change(function (e) {
Unibase.Platform.Communications.Components.ImportInstantReminder.Instance().fileEvent(e);
});
$("#txt_Icon").focus(function () {
$(".div_Icons").fadeIn();
$("#icons").toggleClass("hidden");
$(".div_Icons").removeClass('hidden');
});
$("#txt_Icon").focusout(function () {
$(".div_Icons").fadeOut();
});
}
fileEvent($event) {
const fileSelected = $event.target.files[0];
Unibase.Platform.Communications.Components.ImportInstantReminder.fileData = new FormData();
Unibase.Platform.Communications.Components.ImportInstantReminder.fileData.append(fileSelected.name, fileSelected);
}
ExportSingleInstantReminder() {
var instantreminderid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_recordid").Value;
var instance = this;
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/communications/managers/reminders/remindermanager.js", function () {
Unibase.Platform.Communications.Managers.ReminderManager.Instance().ExportSingleInstantReminder(instantreminderid).then(function (response) {
var filename = "InstantReminder.xml";
var xmltext = response;
var pom = document.createElement('a');
var bb = new Blob([xmltext], { type: 'text/plain' });
pom.setAttribute('href', window.URL.createObjectURL(bb));
pom.setAttribute('download', filename);
pom.dataset.downloadurl = ['text/plain', pom.download, pom.href].join(':');
pom.draggable = true;
pom.classList.add('dragout');
pom.click();
});
});
}
ExportInstantReminders() {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/communications/managers/reminders/remindermanager.js", function () {
Unibase.Platform.Communications.Managers.ReminderManager.Instance().ExportInstantReminders().then(function (response) {
var filename = "InstantReminders.xml";
var xmltext = response;
var pom = document.createElement('a');
var bb = new Blob([xmltext], { type: 'text/plain' });
pom.setAttribute('href', window.URL.createObjectURL(bb));
pom.setAttribute('download', filename);
pom.dataset.downloadurl = ['text/plain', pom.download, pom.href].join(':');
pom.draggable = true;
pom.classList.add('dragout');
pom.click();
});
});
}
SendToAllTenants() {
var refguid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_refguid").Value;
Unibase.Platform.Communications.Managers.ReminderManager.Instance().SendToAll(refguid).then(function (response) {
if (response.status = Unibase.Data.Status.Success) {
alert("Failed To Update");
}
else {
alert("SucessFully Updated");
}
});
}
static Instance() {
if (this.instance == undefined) {
this.instance = new ImportInstantReminder();
}
return this.instance;
}
}
ImportInstantReminder.fileData = new FormData();
ImportInstantReminder.IsAlltenants = false;
Components.ImportInstantReminder = ImportInstantReminder;
})(Components = Communications.Components || (Communications.Components = {}));
})(Communications = Platform.Communications || (Platform.Communications = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
var Unibase;
(function (Unibase) {
let Platform;
(function (Platform) {
let Communications;
(function (Communications) {
let Components;
(function (Components) {
let Remainders;
(function (Remainders) {
class Facebook extends Unibase.Platform.Core.BaseComponent {
cssFiles() {
throw new Error("Method not implemented.");
}
jsFiles() {
throw new Error("Method not implemented.");
}
html(id, containerid) {
var html = '';
return html;
}
load(id, containerid, callback) {
throw new Error("Method not implemented.");
}
init(containerid) {
debugger;
this.loaddesign(containerid);
}
loaddesign(containerid) {
var html = '<div class="h-40p w-320p mx-auto d-flex flex-row"><img src="https://pngimg.com/uploads/facebook_logos/facebook_logos_PNG19748.png" class="ml-1 py-1 w-5p h-5p img-fluid"><span class="ml-2 font-18 my-auto text-dark font-weight-500">Facebook</span></div><div class="d-flex w-320p mx-auto"><iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FexxonMobil&tabs=timeline&width=320&height=590&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId" width="320" height="590" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe></div>';
debugger;
$("." + containerid).append(html);
}
static Instance() {
if (this.instance === null || this.instance === undefined)
this.instance = new Facebook();
return this.instance;
}
}
Remainders.Facebook = Facebook;
})(Remainders = Components.Remainders || (Components.Remainders = {}));
})(Components = Communications.Components || (Communications.Components = {}));
})(Communications = Platform.Communications || (Platform.Communications = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));
@@ -0,0 +1 @@
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["facebook.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CAkDhB;AAlDD,WAAU,OAAO;IACb,IAAiB,QAAQ,CAgDxB;IAhDD,WAAiB,QAAQ;QACrB,IAAiB,cAAc,CA8C9B;QA9CD,WAAiB,cAAc;YAC3B,IAAiB,UAAU,CA4C1B;YA5CD,WAAiB,UAAU;gBACvB,IAAiB,UAAU,CA0C1B;gBA1CD,WAAiB,UAAU;oBACvB,MAAa,QAAS,SAAQ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa;wBAE7D,QAAQ;4BACJ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,OAAO;4BACH,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,IAAI,CAAC,EAAO,EAAE,WAAmB;4BAC7B,IAAI,IAAI,GAAE,EAAE,CAAC;4BACb,OAAO,IAAI,CAAC;wBAEhB,CAAC;wBACD,IAAI,CAAC,EAAO,EAAE,WAAmB,EAAE,QAAkB;4BAEjD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,IAAI,CAAC,WAAW;4BACZ,QAAQ,CAAA;4BAGR,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;wBAEjC,CAAC;wBACD,UAAU,CAAC,WAAW;4BAGlB,IAAI,IAAI,GAAG,wtBAAwtB,CAAC;4BACpuB,QAAQ,CAAC;4BAET,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAGtC,CAAC;wBAED,MAAM,CAAC,QAAQ;4BACX,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;gCACrD,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;4BACnC,OAAO,IAAI,CAAC,QAAQ,CAAC;wBACzB,CAAC;qBACJ;oBAxCY,mBAAQ,WAwCpB,CAAA;gBACL,CAAC,EA1CgB,UAAU,GAAV,qBAAU,KAAV,qBAAU,QA0C1B;YACL,CAAC,EA5CgB,UAAU,GAAV,yBAAU,KAAV,yBAAU,QA4C1B;QACL,CAAC,EA9CgB,cAAc,GAAd,uBAAc,KAAd,uBAAc,QA8C9B;IACL,CAAC,EAhDgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAgDxB;AACL,CAAC,EAlDS,OAAO,KAAP,OAAO,QAkDhB"}
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i extends n.Platform.Core.BaseComponent{cssFiles(){throw new Error("Method not implemented.");}jsFiles(){throw new Error("Method not implemented.");}html(){return""}load(){throw new Error("Method not implemented.");}init(n){this.loaddesign(n)}loaddesign(n){$("."+n).append('<div class="h-40p w-320p mx-auto d-flex flex-row"><img src="https://pngimg.com/uploads/facebook_logos/facebook_logos_PNG19748.png" class="ml-1 py-1 w-5p h-5p img-fluid"><span class="ml-2 font-18 my-auto text-dark font-weight-500">Facebook<\/span><\/div><div class="d-flex w-320p mx-auto"><iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FexxonMobil&tabs=timeline&width=320&height=590&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId" width="320" height="590" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"><\/iframe><\/div>')}static Instance(){return(this.instance===null||this.instance===undefined)&&(this.instance=new i),this.instance}}t.Facebook=i})(i=t.Remainders||(t.Remainders={}))})(i=t.Components||(t.Components={}))})(i=t.Communications||(t.Communications={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"version":3,"file":"instagram.js","sourceRoot":"","sources":["instagram.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CA6ChB;AA7CD,WAAU,OAAO;IACb,IAAiB,QAAQ,CA2CxB;IA3CD,WAAiB,QAAQ;QACrB,IAAiB,cAAc,CAyC9B;QAzCD,WAAiB,cAAc;YAC3B,IAAiB,UAAU,CAuC1B;YAvCD,WAAiB,UAAU;gBACvB,IAAiB,UAAU,CAqC1B;gBArCD,WAAiB,UAAU;oBACvB,MAAa,SAAU,SAAQ,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa;wBAE9D,QAAQ;4BACJ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,OAAO;4BACH,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,IAAI,CAAC,EAAO,EAAE,WAAmB;4BAC7B,IAAI,IAAI,GAAE,EAAE,CAAC;4BACb,OAAO,IAAI,CAAC;wBAEhB,CAAC;wBACD,IAAI,CAAC,EAAO,EAAE,WAAmB,EAAE,QAAkB;4BAEjD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC/C,CAAC;wBACD,IAAI,CAAC,WAAW;4BACZ,QAAQ,CAAA;4BACR,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;wBAEjC,CAAC;wBACD,UAAU,CAAC,WAAW;4BAElB,IAAI,IAAI,GAAG,s1NAAs1N,CAAC;4BACl2N,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;4BAClC,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;wBAE/D,CAAC;wBAED,MAAM,CAAC,QAAQ;4BACX,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS;gCACrD,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;4BACpC,OAAO,IAAI,CAAC,QAAQ,CAAC;wBACzB,CAAC;qBACJ;oBAnCY,oBAAS,YAmCrB,CAAA;gBACL,CAAC,EArCgB,UAAU,GAAV,qBAAU,KAAV,qBAAU,QAqC1B;YACL,CAAC,EAvCgB,UAAU,GAAV,yBAAU,KAAV,yBAAU,QAuC1B;QACL,CAAC,EAzCgB,cAAc,GAAd,uBAAc,KAAd,uBAAc,QAyC9B;IACL,CAAC,EA3CgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA2CxB;AACL,CAAC,EA7CS,OAAO,KAAP,OAAO,QA6ChB"}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,177 @@
var Unibase;
(function (Unibase) {
let Platform;
(function (Platform) {
let Communications;
(function (Communications) {
let Components;
(function (Components) {
class InstantReminders_Widget extends Platform.Core.BaseComponent {
constructor() {
super(...arguments);
this.instantReminderId = 0;
this.isduplicate = true;
}
cssFiles() {
return [];
}
jsFiles() {
return ["platform/communications/managers/reminders/remindermanager.js", "platform/communications/requests/reminders/instantreminder.js", "platform/communications/infos/reminders/instantreminder.js", "platform/communications/requests/reminders/instantreminder.js", "libs/jquery/pagination/jquery.pagination.js", "platform/communications/enums/reminders/instantreminderstatus.js"];
}
html(id, containerid) {
var html = `<form id="frmUnibase_ActionsData" data-validate="parsley" data-isdynamic="false">
<div class="card bg-light">
<div class="b-b bg-white card-header header">
<span class="record_count"><b>Count:</b><span class="badge-light badge rounded ml-1 mb-1" id="response_count">0</span></span>
<span class="isDuplicate mr-10"><input type="radio" name="instantreminder_option" class="isduplicate mr-1">Isduplicate</span>
<span class="data mr-10"><input type="radio" name="instantreminder_option" class="isunique" >IsUnique</span>
</div>
<div class="card-body scrollable" style="overflow-y: scroll;">
<div class="row">
<table class="table">
<thead>
<tr id="Reminders_Row" class="bg-primary">
</tr>
</thead>
<tbody class="ActionsDatalist_body"></tbody>
</table>
</div>
</div>
<div class="bg-white card-footer footer" id="instantreminder_footer">
<a href="javascript:;" id="btnCloseInstantreminder" class="btn btn-light btn-sm mr-auto "> Close</a><div class="pagination pagination-rounded custom-pagination mb-2" id="divpagination"></div>
</div>
</div>
</form>`;
return html;
}
load(id, containerid, callback) {
$('#btnCloseInstantreminder').click(function () {
$('#' + containerid).modal('hide');
$('#' + containerid).remove();
});
$('input[name="instantreminder_option"]').change(function () {
var isduplicate = $('.isduplicate').is(":checked");
Unibase.Platform.Communications.Managers.ReminderManager.Instance().updateIsDuplicate(InstantReminders_Widget.Instance().instantReminderId, isduplicate).then(function (response) {
if (response.result != null) {
InstantReminders_Widget.Instance().isduplicate = response.result;
MessageHelper.Instance().showSuccess(response.message, "message_div");
$('.ActionsDatalist_body').html('');
Unibase.Platform.Communications.Managers.ReminderManager.Instance().getRecipients(InstantReminders_Widget.Instance().instantReminderId, response.result).then(function (response) {
if (response.result != null) {
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loadrecipients(response.result);
}
});
}
});
});
if (InstantReminders_Widget.Instance().isduplicate) {
$('.isduplicate').prop("checked", true);
}
else {
$('.isunique').prop("checked", true);
}
}
init(containerid) {
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length > 0) {
for (let obj of Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters) {
if (obj.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_recordid") {
InstantReminders_Widget.Instance().instantReminderId = Number(obj.Value);
}
}
}
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loadJsFiles();
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().render(containerid);
}
render(containerid) {
var html = `<div class="instantremainders"><div id="message_div"></div>
<div class="bg-white card-header"><div class"remainder_datails mb-7 text-dark">
<b>Reminder Details</b></div><table class="table">
<thead style="background-color:#a1a1a1"><tr><th><b>Subject</b></th><th><b>Body</b>
</th><th><b>Recipients</b></th><th></th></tr></thead><tbody class="card-body">
</tbody></div></div>`;
$("." + containerid).append(html);
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddetails(InstantReminders_Widget.Instance().instantReminderId);
}
loaddetails(instantreminderid) {
Unibase.Platform.Communications.Managers.ReminderManager.Instance().getInstantReminder(instantreminderid).then(function (response) {
if (response.result != null) {
InstantReminders_Widget.Instance().isduplicate = response.result.IsDuplicate;
var html = '<tr><td>' + response.result.Subject + '</td><td>' + response.result.Body + '</td><td><a href="#"onclick="Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loadpopup();">Recipients</a></td><td><span class="badge send_btn hidden pull-right" onclick="Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().sendReminder(' + InstantReminders_Widget.Instance().instantReminderId + ')" style="background-color:#00B0FF;color:#e9e8e8;cursor:pointer">Send</span></td></tr>';
$('.card-body').html(html);
if (response.result.ReminderStatus == Number(Unibase.Platform.Communications.Enums.InstantReminderStatus.Draft)) {
$('.send_btn').removeClass('hidden');
}
}
});
}
loadpopup(containerid) {
this.navigationHelper.popup(InstantReminders_Widget.Instance().instantReminderId, containerid, Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance(), null, null);
Unibase.Platform.Communications.Managers.ReminderManager.Instance().getRecipients(InstantReminders_Widget.instance.instantReminderId, InstantReminders_Widget.Instance().isduplicate).then(function (response) {
if (response.result != null) {
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loadrecipients(response.result);
}
});
}
loadrecipients(response) {
var properties = Object.getOwnPropertyNames(response[0]);
var headerhtml = '';
for (let j = 0; j < properties.length; j++) {
headerhtml += '<th>' + properties[j] + '</th>';
}
headerhtml = '<th>S.no</th>' + headerhtml;
$('#Reminders_Row').html(headerhtml);
$('#response_count').text(response.length);
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddata(0, response, properties);
var ele;
ele = $('#divpagination');
ele.pagination(response.length, 10, {
current_page: 0,
callback: function (page, component) {
Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddata(page, response, properties);
}
});
}
loaddata(page, response, properties) {
$('.ActionsDatalist_body').html('');
var len = (page + 1) * 10;
var initialval = len - 10;
var html = '';
for (let i = initialval; i < len; i++) {
if (response.length > i) {
var innerhtml = '';
for (let j = 0; j < properties.length; j++) {
innerhtml += '<td>' + response[i][properties[j]] + '</td>';
}
html += '<tr><td>' + (i + 1) + '</td>' + innerhtml + '</tr>';
}
else {
break;
}
}
$('.ActionsDatalist_body').html(html);
}
loadJsFiles() {
var jsfiles = Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().jsFiles();
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(jsfiles, function () {
});
}
sendReminder(instantReminderId) {
var instantReminder = new Unibase.Platform.Communications.Requests.InstantReminder();
instantReminder.InstantReminderId = instantReminderId;
instantReminder.ReminderStatus = Number(Unibase.Platform.Communications.Enums.InstantReminderStatus.Active);
Unibase.Platform.Communications.Managers.ReminderManager.Instance().sendInstantReminder(instantReminder).then(function (response) {
$('.send_btn').addClass('d-none');
});
}
static Instance() {
if (this.instance == undefined) {
this.instance = new InstantReminders_Widget();
}
return this.instance;
}
}
Components.InstantReminders_Widget = InstantReminders_Widget;
})(Components = Communications.Components || (Communications.Components = {}));
})(Communications = Platform.Communications || (Platform.Communications = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
@@ -0,0 +1,28 @@
var Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(i){class r extends t.Core.BaseComponent{constructor(){super(...arguments);this.instantReminderId=0;this.isduplicate=!0}cssFiles(){return[]}jsFiles(){return["platform/communications/managers/reminders/remindermanager.js","platform/communications/requests/reminders/instantreminder.js","platform/communications/infos/reminders/instantreminder.js","platform/communications/requests/reminders/instantreminder.js","libs/jquery/pagination/jquery.pagination.js","platform/communications/enums/reminders/instantreminderstatus.js"]}html(){return`<form id="frmUnibase_ActionsData" data-validate="parsley" data-isdynamic="false">
<div class="card bg-light">
<div class="b-b bg-white card-header header">
<span class="record_count"><b>Count:</b><span class="badge-light badge rounded ml-1 mb-1" id="response_count">0</span></span>
<span class="isDuplicate mr-10"><input type="radio" name="instantreminder_option" class="isduplicate mr-1">Isduplicate</span>
<span class="data mr-10"><input type="radio" name="instantreminder_option" class="isunique" >IsUnique</span>
</div>
<div class="card-body scrollable" style="overflow-y: scroll;">
<div class="row">
<table class="table">
<thead>
<tr id="Reminders_Row" class="bg-primary">
</tr>
</thead>
<tbody class="ActionsDatalist_body"></tbody>
</table>
</div>
</div>
<div class="bg-white card-footer footer" id="instantreminder_footer">
<a href="javascript:;" id="btnCloseInstantreminder" class="btn btn-light btn-sm mr-auto "> Close</a><div class="pagination pagination-rounded custom-pagination mb-2" id="divpagination"></div>
</div>
</div>
</form>`}load(t,i){$("#btnCloseInstantreminder").click(function(){$("#"+i).modal("hide");$("#"+i).remove()});$('input[name="instantreminder_option"]').change(function(){var t=$(".isduplicate").is(":checked");n.Platform.Communications.Managers.ReminderManager.Instance().updateIsDuplicate(r.Instance().instantReminderId,t).then(function(t){t.result!=null&&(r.Instance().isduplicate=t.result,MessageHelper.Instance().showSuccess(t.message,"message_div"),$(".ActionsDatalist_body").html(""),n.Platform.Communications.Managers.ReminderManager.Instance().getRecipients(r.Instance().instantReminderId,t.result).then(function(t){t.result!=null&&n.Platform.Communications.Components.InstantReminders_Widget.Instance().loadrecipients(t.result)}))})});r.Instance().isduplicate?$(".isduplicate").prop("checked",!0):$(".isunique").prop("checked",!0)}init(t){if(n.Themes.Providers.Detail_Settings.Instance().InputParameters.length>0)for(let t of n.Themes.Providers.Detail_Settings.Instance().InputParameters)t.Key==="hf_"+n.Themes.Providers.DetailHelper.installedAppId+"_recordid"&&(r.Instance().instantReminderId=Number(t.Value));n.Platform.Communications.Components.InstantReminders_Widget.Instance().loadJsFiles();n.Platform.Communications.Components.InstantReminders_Widget.Instance().render(t)}render(t){var i=`<div class="instantremainders"><div id="message_div"></div>
<div class="bg-white card-header"><div class"remainder_datails mb-7 text-dark">
<b>Reminder Details</b></div><table class="table">
<thead style="background-color:#a1a1a1"><tr><th><b>Subject</b></th><th><b>Body</b>
</th><th><b>Recipients</b></th><th></th></tr></thead><tbody class="card-body">
</tbody></div></div>`;$("."+t).append(i);n.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddetails(r.Instance().instantReminderId)}loaddetails(t){n.Platform.Communications.Managers.ReminderManager.Instance().getInstantReminder(t).then(function(t){if(t.result!=null){r.Instance().isduplicate=t.result.IsDuplicate;var i="<tr><td>"+t.result.Subject+"<\/td><td>"+t.result.Body+'<\/td><td><a href="#"onclick="Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().loadpopup();">Recipients<\/a><\/td><td><span class="badge send_btn hidden pull-right" onclick="Unibase.Platform.Communications.Components.InstantReminders_Widget.Instance().sendReminder('+r.Instance().instantReminderId+')" style="background-color:#00B0FF;color:#e9e8e8;cursor:pointer">Send<\/span><\/td><\/tr>';$(".card-body").html(i);t.result.ReminderStatus==Number(n.Platform.Communications.Enums.InstantReminderStatus.Draft)&&$(".send_btn").removeClass("hidden")}})}loadpopup(t){this.navigationHelper.popup(r.Instance().instantReminderId,t,n.Platform.Communications.Components.InstantReminders_Widget.Instance(),null,null);n.Platform.Communications.Managers.ReminderManager.Instance().getRecipients(r.instance.instantReminderId,r.Instance().isduplicate).then(function(t){t.result!=null&&n.Platform.Communications.Components.InstantReminders_Widget.Instance().loadrecipients(t.result)})}loadrecipients(t){var i=Object.getOwnPropertyNames(t[0]),r="",u;for(let n=0;n<i.length;n++)r+="<th>"+i[n]+"<\/th>";r="<th>S.no<\/th>"+r;$("#Reminders_Row").html(r);$("#response_count").text(t.length);n.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddata(0,t,i);u=$("#divpagination");u.pagination(t.length,10,{current_page:0,callback:function(r){n.Platform.Communications.Components.InstantReminders_Widget.Instance().loaddata(r,t,i)}})}loaddata(n,t,i){var r;$(".ActionsDatalist_body").html("");var u=(n+1)*10,e=u-10,f="";for(let n=e;n<u;n++)if(t.length>n){r="";for(let u=0;u<i.length;u++)r+="<td>"+t[n][i[u]]+"<\/td>";f+="<tr><td>"+(n+1)+"<\/td>"+r+"<\/tr>"}else break;$(".ActionsDatalist_body").html(f)}loadJsFiles(){var t=n.Platform.Communications.Components.InstantReminders_Widget.Instance().jsFiles();n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(t,function(){})}sendReminder(t){var i=new n.Platform.Communications.Requests.InstantReminder;i.InstantReminderId=t;i.ReminderStatus=Number(n.Platform.Communications.Enums.InstantReminderStatus.Active);n.Platform.Communications.Managers.ReminderManager.Instance().sendInstantReminder(i).then(function(){$(".send_btn").addClass("d-none")})}static Instance(){return this.instance==undefined&&(this.instance=new r),this.instance}}i.InstantReminders_Widget=r})(r=i.Components||(i.Components={}))})(i=t.Communications||(t.Communications={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,597 @@
var Unibase;
(function (Unibase) {
let Platform;
(function (Platform) {
let Communications;
(function (Communications) {
let Components;
(function (Components) {
class InstantReminder extends Unibase.Platform.Core.BaseComponent {
constructor() {
super(...arguments);
this.RecipientProviders = [];
this.TokensData = [];
}
jsFiles() {
var jsfiles = ["platform/automation/managers/rulemanager.js", "platform/communications/managers/reminders/remindermanager.js", "platform/analytics/managers/reportmanager.js", "platform/communications/requests/reminders/instantreminder.js", "platform/communications/infos/reminders/instantreminder.js", "platform/analytics/managers/reportmanager.js", "platform/communications/requests/reminders/instantreminder.js", "platform/communications/requests/reminders/defaultreminderreport.js", "platform/communications/requests/reminders/reminderfilter.js", "apps/communications/managers/mails/mailmanager.js", "apps/communications/managers/sms/smsmanager.js"];
return jsfiles;
}
cssFiles() {
return [];
}
html(id, containerid) {
let html = `<form id="frmUnibase_InstantReminder" data-validate="parsley" data-isdynamic="false">
<div class="card bg-light">
<div class="bg-white modal-header"> <strong class="text-dark title" id="Spn_InstantReminder">Create Notifications</strong> </div>
<div data-simplebar class="modal-body simple-scrollbar">
<div class="bg-white card" id="divInstantReminder">
<div id="Unibase_Actions_ValidationSummary" class="clear"></div>
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<label for="lbl_ReminderType" id="lbl_ReminderType">Choose Option For Sending Message<span class="text-danger"> *</span></label>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="custom-control custom-radio">
<input type="radio" id="rdb_Notification" name="ReminderType" value="Notification" class="custom-control-input" checked="checked">
<label class="custom-control-label" for="rdb_Notification">Notification</label>
<input type="hidden" id="hfId_Notification" value=""> </div>
</div>
<div class="col-sm-3">
<div class="custom-control custom-radio">
<input type="radio" id="rdb_SMS" name="ReminderType" value="SMS" class="custom-control-input">
<label class="custom-control-label" for="rdb_SMS">SMS</label>
<input type="hidden" id="hfId_SMS" value=""> </div>
</div>
<div class="col-sm-3">
<div class="custom-control custom-radio">
<input type="radio" id="rdb_Email" name="ReminderType" value="Email" class="custom-control-input">
<label class="custom-control-label" for="rdb_Email">Email</label>
<input type="hidden" id="hfId_Email" value=""> </div>
</div>
<div class="col-sm-3 hidden">
<div class="custom-control custom-radio">
<input type="radio" id="rdb_WhatsApp" name="ReminderType" value="WhatsApp" class="custom-control-input">
<label class="custom-control-label" for="rdb_WhatsApp">WhatsApp</label>
<input type="hidden" id="hfId_WhatsApp" value=""> </div>
</div>
</div>
</div>
</div>
<div class="bg-white card" id="SendToContactsDiv">
<div class="card-header">Send To Contacts</div>
<div class="card-body">
<div class="row">
<div class="col-sm-6 mt-10" id="Lbl_ContactsReport"><u><b style="font-weight: bold;" class="" id="Txt_ContactsReport">Select Contacts Report</b></u></div>
<div class="col-sm-12 hidden" id="ContactsReportDiv">
<div class="bg-white card" style="border:groove">
<div class="card-header hidden" id="Header_ReportName"> <span id="Spn_ReportName"></span>
<div id="ChangeReport" class="pull-right"> <u><b style="font-weight:normal;" id="txt_ChangeReport">Change Report</b></u> </div>
</div>
<div class="card-body">
<div class="row" id="Row_Report">
<div class="col-sm-6">
<div id="div_Report" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;">
<input type="hidden" id="hdnselect2_Report" class="value-control" value="0">
<select id="select2_Report" class="type-control select2_Report form-control text-control" style="width:100%;"></select>
</div>
</div>
</div>
<div class="row pull-right" id="Row_Buttons"> <a href="javascript:;" id="btnCancel" class="btn btn-danger btn-sm mr-10"> Cancel</a> <a href="javascript:;" id="btnApply" class="btn btn-green btn-sm"> Apply</a> </div>
<div class="row Row_DynamicFilers"> </div>
<div class="row ContactColumns mt-10"> </div>
<div class="row hidden pull-right" id="Row_IsDefault">
<div class="custom-control custom-checkbox chkIsDefault checkbox-primary">
<input type="checkbox" class="custom-control-input" id="chkDefault">
<label class="custom-control-label" for="chkDefault">Set As Default</label>&nbsp </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white card" id="RemindersContentDiv">
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<div id="div_Subject" class="floating-label-form-group">
<label for="lbl_MessageSubject" id="lbl_MessageSubject">Subject<span class="text-danger"> *</span></label>
<div class="input-group">
<input type="text" id="txtNotifications_MessageSubject" class="col-sm-9 form-control value-control required floating-label-control" data-placeholder="Enter Subject" placeholder="Subject *" data-label="Subject *">
<select id="ddl_SubjectTokens" class="col-sm-3 form-control value-control">
<option value="0">Select Token</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div id="div_MessageBody" class="TextEditor col-sm-12">
<label for="lbl_MessageBody" id="lbl_MessageBody">Description<span class="text-danger"> *</span></label>
<inpu type="hidden" id="txthdn_MessageBody" class="value-control" value=""> <span class="text-danger" id="spnIsRequired_MessageBody"></span>
<div class="type-control summernote_MessageBody" style="display: block;" id="summernote_MessageBody" data-propdoctypename="MessageBody" data-required="" placeholder="Message Body" data-placeholder="Message Body" data-label="Message Body"></div>
<label for="Validation" id="lblValidation"></label>
</inpu>
</div>
</div>
</div>
</div>
<div class="bg-white card d-none" id="smsinstantreminder">
<div class="card-header">Send From Details</div>
<div class="card-body">
<div class="row SendFrom">
<div class="col-sm-6">
<div class="input-group">
<label for="lbl_ProviderName" id="lbl_ProviderName">Provider Name <span class="text-danger" id="span_ProviderName">*</span> </label>
<select id="Autocomplete_ProviderName" class="form-control text-control required" style="width:100%;" placeholder="ProviderName" data-placeholder="ProviderName" data-label="" data-istagselect="true"></select>
<input type="hidden" id="hf_ProviderName" class="form-control value-control" data-isdynamic="true" /> </div>
</div>
<div class="col-sm-6">
<div class="input-group">
<label for="lbl_SendSmsFrom" id="lbl_SendFrom">Sender Name <span class="text-danger" id="span_smssendfrom">*</span> </label>
<select id="Autocomplete_SenderName" class="form-control text-control required" style="width:100%;" placeholder="Sender Name" data-placeholder="Sender Name" data-label="" data-istagselect="true"></select>
<input type="hidden" id="hf_SenderName" class="form-control value-control" data-isdynamic="true" /> </div>
</div>
</div>
</div>
</div>
<div class="bg-white card d-none" id="AttachmentsDiv">
<div class="card-header">Attachments</div>
<div class="card-body" id="instantreminderattachments">
</div></div>
<div class="bg-white card" id="mailinstantreminder">
<div class="card-header">Send From Details</div>
<div class="card-body">
<div class="row SendFrom">
<div class="col-sm-6">
<div class="input-group">
<label for="lbl_MailServer" id="lbl_MailServer">Mail Server<span class="text-danger" id="span_MailServer">*</span></label>
<select id="Autocomplete_MailServer" class="form-control text-control required" style="width:100%;" placeholder="MailServer" data-placeholder="MailServer" data-label="" data-istagselect="true"></select>
<input type="hidden" id="hf_MailServer" class="form-control value-control" data-isdynamic="true" /> </div>
</div>
<div class="col-sm-6">
<div class="input-group">
<label for="lbl_MailAccount" id="lbl_MailAccount">Mail Account<span class="text-danger" id="span_MailAccount">*</span></label>
<select id="Autocomplete_MailAccount" class="form-control text-control required" style="width:100%;" placeholder="MailAccount" data-placeholder="MailAccount" data-label="" data-istagselect="true"></select>
<input type="hidden" id="hf_MailAccount" class="form-control value-control" data-isdynamic="true" /> </div>
</div>
</div>
</div>
</div>
<div class="bg-white card" id="ScheduleSendMessage">
<div class="card-header">Schedule Message</div>
<div class="card-body">
<div class="col-sm-6 mt-10" id="ScheduleMessageDiv"><u><b style="font-weight: bold;" class="" id="Txt_ScheduleMessage">Schedule This Message</b></u></div>
<div class="col-sm-6 hidden" id="ScheduleExecutionDateDiv">
<div class="floating-label-form-group" id="div_ExecutionDate">
<label for="lbl" id="lbl_ExecutionDate">Execution Date<span class="text-danger" id="spnIsRequired_ExecutionDate"> *</span></label>
<div class="input-group">
<input type="text" id="date_ExecutionDate" class="form-control type-control datepicker-input hasDatepicker value-control floating-label-control" placeholder="Execution Date *" data-placeholder="dd/mm/yyyy hh:mm" data-label="Execution Date *"> <span class="input-group-addon mt-10"><i class="fa fa-calendar"></i></span>
<input type="hidden" id="hf_ExecutionDate" /> </div>
</div>
</div>
</div>
</div>
</div>
<div class="bg-white modal-footer" id="CreateNotificationFooter"> <a href="javascript:;" id="btnCloseNotification" class="btn btn-light btn-sm mr-auto "> Close</a> <a href="javascript:;" id="btnSaveNotification" class="btn btn-primary btn-sm"> Save</a> </div>
</form>`;
return html;
}
load(id, containerid, callback) {
var instance = this;
$("#btnCloseNotification").click(function () {
$('#' + containerid).modal('hide');
$('#' + containerid).remove();
});
$("#btnSaveNotification").click(function () {
Unibase.Platform.Communications.Components.InstantReminder.Instance().SaveInstantReminder(containerid);
});
$('#ScheduleMessageDiv').click(function () {
$('#ScheduleMessageDiv').addClass('hidden');
$('#ScheduleExecutionDateDiv').removeClass('hidden');
});
$('#Lbl_ContactsReport').click(function () {
$('#Lbl_ContactsReport').addClass('hidden');
$('#ContactsReportDiv').removeClass('hidden');
});
$('#ChangeReport').click(function () {
$('#Row_Report').removeClass('hidden');
$('#Row_Buttons').removeClass('hidden');
$('#Header_ReportName').addClass('hidden');
$('#Row_IsDefault').addClass('hidden');
if ($('#chkDefault').is(':checked')) {
$("#chkDefault").prop("checked", false);
}
$(".Row_DynamicFilers").html("");
});
$('#btnApply').click(function () {
$('#Row_Report').addClass('hidden');
$('#Row_Buttons').addClass('hidden');
$('#Header_ReportName').removeClass('hidden');
$('#Row_IsDefault').removeClass('hidden');
$('#Spn_ReportName').text($("#select2_Report option:selected").text());
let reportid = Number($("#select2_Report option:selected").val());
Unibase.Platform.Communications.Components.InstantReminder.Instance().LoadDynamicFilters(reportid);
Unibase.Platform.Communications.Components.InstantReminder.Instance().LoadContactColumns(reportid);
});
var url = _appsettings.server_url() + '/apis/v4/unibase/platform/analytics/reports';
AutoCompleteHelper.getHelper().Create("#select2_Report", "hdnselect2_Report", url, function (response) {
var data = response;
});
$("#select2_Report").change(function () {
let reportid = Number($("#select2_Report option:selected").val());
$(".ContactColumns").html("");
$(".Row_DynamicFilers").html("");
Unibase.Platform.Communications.Components.InstantReminder.Instance().LoadMsgSubjectTokens(reportid);
Unibase.Platform.Communications.Components.InstantReminder.Instance().LoadMsgBodyTokens(reportid);
});
$("#ddl_SubjectTokens").change(function () {
var textAreaTxt = $("#txtNotifications_MessageSubject").val();
var txtToAdd = '{{' + $("#ddl_SubjectTokens option:selected").text() + '}}';
$("#txtNotifications_MessageSubject").val(textAreaTxt + txtToAdd);
$("#ddl_SubjectTokens").val(0);
});
var _fileCacheHelper = Platform.Helpers.FileCacheHelper.Instance();
_fileCacheHelper.loadJsFileAsync("platform/automation/components/actions/externalattachments.js", function () {
let IsMultiple = true;
let ValidationDiv = "Unibase_Actions_ValidationSummary";
let externalattchmentshtml = Unibase.Platform.Automation.Components.ExternalAttachments.Instance().init("instantreminderattachments", IsMultiple, ValidationDiv);
jQuery("#instantreminderattachments").html(externalattchmentshtml);
$(".drag").css("border", "3px dashed #cccccc");
Unibase.Platform.Automation.Components.ExternalAttachments.Instance().dragNdrop("instantreminderattachments");
});
$("#date_ExecutionDate").daterangepicker({
autoUpdateInput: false,
timePicker: true,
timePicker24Hour: true,
locale: {
format: 'DD/MM/YYYY HH:mm',
},
singleDatePicker: true,
showDropdowns: true,
minYear: 1901,
maxDate: new Date(2050, 11, 31)
});
$(".summernote_MessageBody").summernote({
height: 100,
minHeight: null,
maxHeight: null,
placeholder: "Message Body",
disableDragAndDrop: true,
codemirror: {
mode: 'text/html',
lineNumbers: true
},
toolbar: [
['font', ['bold', 'italic', 'underline']],
['color', ['color']],
['view', ['fullscreen', 'codeview', 'help']],
],
hint: {
match: /\B[@!](\w*)$/,
search: function (keyword, callback) {
callback($.grep(Unibase.Platform.Communications.Components.InstantReminder.Instance().TokensData, function (i) {
var user = i;
return user.indexOf(keyword) === 0;
}));
},
content: function (i) {
var user = i;
return $('<span>{{' + user + '}}</span>')[0];
}
}
});
Unibase.Platform.Communications.Components.InstantReminder.Instance().GetActions();
$("#smsinstantreminder").addClass("d-none");
$("#mailinstantreminder").addClass("d-none");
$('input[name="ReminderType"]').change(function () {
if ($("input[name='ReminderType']:checked").val() == "Notification") {
$("#smsinstantreminder").addClass("d-none");
$("#mailinstantreminder").addClass("d-none");
$("#AttachmentsDiv").addClass("d-none");
$('#txtNotifications_MessageSubject').removeClass('d-none');
$('#ddl_SubjectTokens').removeClass('d-none');
}
else if ($("input[name='ReminderType']:checked").val() == "SMS") {
$("#mailinstantreminder").addClass("d-none");
$("#smsinstantreminder").removeClass("d-none");
$("#AttachmentsDiv").addClass("d-none");
$('#txtNotifications_MessageSubject').addClass('d-none');
$('#ddl_SubjectTokens').addClass('d-none');
}
else if ($("input[name='ReminderType']:checked").val() == "Email") {
$("#smsinstantreminder").addClass("d-none");
$("#mailinstantreminder").removeClass("d-none");
$("#AttachmentsDiv").removeClass("d-none");
$('#txtNotifications_MessageSubject').removeClass('d-none');
$('#ddl_SubjectTokens').removeClass('d-none');
}
});
Unibase.Platform.Communications.Components.InstantReminder.Instance().getDefaultSmsSender();
Unibase.Platform.Communications.Components.InstantReminder.Instance().getDefaultMailServer();
}
loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
InstantReminder.Instance().init(Pk_Value, null);
Unibase.Platform.Apps.Managers.AppManager.Instance().getAppConfiguration(AppConfigurationId).then(function (response) {
InstantReminder.installedappid = response.result.InstalledAppId;
});
}
loadInstantReminderForm(iscreate) {
var Pk_Value = 0;
if (!iscreate) {
Pk_Value = Unibase.Themes.Providers.DetailHelper.recordId;
}
this.navigationHelper.popup(Pk_Value, '', Unibase.Platform.Communications.Components.InstantReminder.Instance(), null, Unibase.Platform.Helpers.Size.DockLeft);
}
init(id, callback) {
this.render(id, callback);
}
render(id, callback) {
this.navigationHelper.popup(id, '', Unibase.Platform.Communications.Components.InstantReminder.Instance(), null, Unibase.Platform.Helpers.Size.DockLeft);
}
SaveInstantReminder(containerid) {
let model = new Unibase.Platform.Communications.Requests.InstantReminder();
let ActionName = "";
let reminderFilters = Unibase.Platform.Communications.Components.InstantReminder.Instance().GetFilters();
let defaultReminderReport = Unibase.Platform.Communications.Components.InstantReminder.Instance().GetDefaultReport();
let contactcolumns = Unibase.Platform.Communications.Components.InstantReminder.Instance().getContactColumns();
let ExternalAttachments = Unibase.Platform.Automation.Components.ExternalAttachments.Instance().getFiles("instantreminderattachments");
if ($("input[name='ReminderType']:checked").val() == "Notification") {
ActionName = "Send Notification";
}
else if ($("input[name='ReminderType']:checked").val() == "SMS") {
ActionName = "Send Sms";
model.String1 = $('#Autocomplete_ProviderName option:selected').val().toString();
model.String2 = $('#Autocomplete_SenderName option:selected').val().toString();
}
else if ($("input[name='ReminderType']:checked").val() == "Email") {
ActionName = "Send Email";
model.String1 = $('#Autocomplete_MailServer option:selected').val().toString();
model.String2 = $('#Autocomplete_MailAccount option:selected').val().toString();
model.String3 = ExternalAttachments.length > 0 ? JSON.stringify(ExternalAttachments) : "";
}
var contents = $('.summernote_MessageBody').summernote('code');
var plainText = $("<p>" + contents + "</p>").text();
model.Subject = $("#txtNotifications_MessageSubject").val().toString();
model.Body = plainText;
model.ReportId = ($("#select2_Report option:selected").val() == undefined) ? 0 : Number($("#select2_Report option:selected").val());
model.ActionId = Unibase.Platform.Communications.Components.InstantReminder.ActionsArray.find(x => x.ActionName == ActionName).ActionId;
model.Users = contactcolumns;
model.IsScheduled = false;
if ($("#date_ExecutionDate").val() != '' && $("#date_ExecutionDate").val() != null) {
let ExecutionDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDateTime($("#date_ExecutionDate").val());
model.ExecutionDate = new Date(ExecutionDate);
model.IsScheduled = true;
}
model.ReminderFilters = reminderFilters;
model.DefaultReminderReport = defaultReminderReport;
Communications.Managers.ReminderManager.Instance().saveInstantReminder(model).then(function (response) {
if (response.status == Unibase.Data.Status.Error) {
MessageHelper.Instance().showError(response.message, "Unibase_Actions_ValidationSummary");
}
else {
MessageHelper.Instance().showSuccess(response.message, "Unibase_Actions_ValidationSummary");
$('#' + containerid).modal('hide');
$('#' + containerid).remove();
Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(Unibase.Platform.Communications.Components.InstantReminder.installedappid, null);
}
});
}
LoadMsgSubjectTokens(reportid) {
Unibase.Platform.Analytics.Managers.ReportManager.Instance().getColumns(reportid).then(function (response) {
let cmbConditionProperties = document.getElementById('ddl_SubjectTokens');
$('#ddl_SubjectTokens').empty();
var defaultOpt1 = document.createElement("option");
defaultOpt1.text = "Select Token";
defaultOpt1.value = "0";
cmbConditionProperties.appendChild(defaultOpt1);
for (let i = 0; i <= response.result.length - 1; i++) {
var opt = document.createElement("option");
opt.text = response.result[i].ReportColumnName;
opt.value = response.result[i].ReportColumnId.toString();
cmbConditionProperties.appendChild(opt);
}
});
}
LoadMsgBodyTokens(reportid) {
Unibase.Platform.Analytics.Managers.ReportManager.Instance().getColumns(reportid).then(function (response) {
var Data = new Array();
for (let i = 0; i <= response.result.length - 1; i++) {
var result = response.result[i].ReportColumnName;
Data.push(result);
}
Unibase.Platform.Communications.Components.InstantReminder.Instance().TokensData = Data;
});
}
GetActions() {
Unibase.Platform.Automation.Managers.RuleManager.Instance().getActions().then(function (response) {
for (var i = 0; i <= response.length - 1; i++) {
Unibase.Platform.Communications.Components.InstantReminder.ActionsArray.push(response[i]);
}
});
}
LoadContactColumns(reportid) {
Unibase.Platform.Analytics.Managers.ReportManager.Instance().getIsContactReportColumns(reportid).then(function (response) {
if (response != null) {
for (let i = 0; i <= response.result.length - 1; i++) {
let html = '';
html += '<div class="col-sm-3"><div class="custom-control custom-checkbox divEnablePieces checkbox-primary"><input type="checkbox" class="type-control custom-control-input" id="chk_' + response.result[i].ReportColumnName + '" name="Contactcolumns" onclick="' + onclick + '"><label class="custom-control-label" for="chk_' + response.result[i].ReportColumnName + '">' + response.result[i].ReportColumnName + '</label><span></span>&nbsp</div></div>';
$(".ContactColumns").append(html);
}
}
});
}
GetFilters() {
let dynamicfilters = new Array();
$(".dynamicfilter").each(function () {
let dynamicfilter = new Unibase.Platform.Communications.Requests.ReminderFilter();
let id = $(this).find(".dynamicfilter");
let index = (id.prevObject[0].id).split('_');
index = index[1];
dynamicfilter.ColumnName = $(this).find(".propvalue").text();
let columnname = $(this).find(".propname").text();
let selectid = "select2_" + columnname + "";
let filtervalues = Unibase.Platform.Communications.Components.InstantReminder.Instance().getSelectedValues(selectid);
dynamicfilter.ColumnValues = filtervalues;
dynamicfilter.ReportId = ($("#select2_Report option:selected").val() == undefined) ? 0 : Number($("#select2_Report option:selected").val());
dynamicfilters.push(dynamicfilter);
});
return dynamicfilters;
}
GetDefaultReport() {
let defaultreminderreport = new Unibase.Platform.Communications.Requests.DefaultReminderReport();
defaultreminderreport.IsDefault = $('#chkDefault').is(':checked');
defaultreminderreport.ReportId = ($("#select2_Report option:selected").val() == undefined) ? 0 : Number($("#select2_Report option:selected").val());
return defaultreminderreport;
}
getSelectedValues(selectid) {
let Recipientcount = new Array();
Recipientcount = $('#' + selectid).val();
let Recipient = "";
for (var i = 0; i < Recipientcount.length; i++) {
Recipient += "|" + Recipientcount[i];
}
if (Recipient != "")
Recipient += "|";
return Recipient;
}
getContactColumns() {
var contactcolumns = "";
$.each($("input[name='Contactcolumns']:checked"), function () {
var Contact = $(this).parents("label");
Contact = Contact.prevObject[0].labels[0].innerText;
contactcolumns += "|" + Contact;
});
if (contactcolumns != "")
contactcolumns += "|";
return contactcolumns;
}
LoadDynamicFilters(ReportId) {
Unibase.Platform.Analytics.Managers.ReportManager.Instance().getDynamicFilters(ReportId).then(function (response) {
let data = response;
for (var i = 0; i <= response.length - 1; i++) {
if (response[i].DatalistId != 0) {
let html = '';
html += '<div class="col-sm-6 dynamicfilter"><div id="div_' + response[i].TextColumn + '" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><label for= "lbl" id = "lbl_' + response[i].TextColumn + '" >' + response[i].TextColumn + '</label ><label class="hidden propname">' + response[i].TextColumn + '</label><label class="hidden propvalue">' + response[i].ValueColumn + '</label>' +
'<input type="hidden" id="hdnselect2_' + response[i].TextColumn + '" class="value-control" value="0">' +
'<select id="select2_' + response[i].TextColumn + '" class="type-control select2_' + response[i].TextColumn + ' form-control text-control" multiple="multiple" style="width:100%;"></select>' +
'</div></div>';
$(".Row_DynamicFilers").append(html);
let selectid = "select2_" + response[i].TextColumn + "";
let reportid = response[i].ReportId;
let columnname = response[i].TextColumn;
let ismultiple = true;
var obj = {
datalistId: response[i].DatalistId,
valueColumn: response[i].ValueColumn,
textColumn: response[i].TextColumn,
isFilterableColumn: response[i].IsFilterableColumn,
};
Unibase.Platform.Communications.Components.InstantReminder.Instance().loadSelect2(selectid, reportid, ismultiple, 0, obj);
}
}
});
}
getDefaultSmsSender() {
Unibase.Apps.Communications.Managers.SmsManager.Instance().getDefaultSmsSender().then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
var smsprovideroption = new Option(response.result.SmsProviderName, response.result.SmsProviderId.toString(), true);
$("#Autocomplete_ProviderName").append(smsprovideroption);
var url = _appsettings.server_url() + '/apis/v4/bizgaze/communications/sms/SmsSenderAutocomplete/smsproviderid/' + Number($("#Autocomplete_ProviderName option:selected").val());
AutoCompleteHelper.getHelper().Create("#Autocomplete_SenderName", "#hf_SenderName", url, function (res) {
var data = res;
var smssenderoption = new Option(response.result.SmsSenderName, response.result.SmsSenderId.toString(), true);
$("#Autocomplete_SenderName").append(smssenderoption);
});
}
});
}
getDefaultMailServer() {
Unibase.Apps.Communications.Managers.MailManager.Instance().getUserDefaultMailAccount().then(function (response) {
if (response.status == Unibase.Data.Status.Success) {
var mailserveroption = new Option(response.result.ServerName, response.result.MailServerId.toString(), true);
$("#Autocomplete_MailServer").append(mailserveroption);
var mailaccountoption = new Option(response.result.UserName, response.result.MailAccountId.toString(), true);
$("#Autocomplete_MailAccount").append(mailaccountoption);
}
});
}
loadSelect2(select2id, reportid, isMultiple, containerid, res) {
var data = [];
var Ids = 0;
var instance = this;
var userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
var url = _appsettings.server_url() + '/apis/v4/unibase/platform/analytics/getdynamicfilterdata';
$("#" + select2id).select2({
placeholder: "Select",
multiple: isMultiple,
allowClear: true,
data: data,
ajax: {
url: function (request) {
var reqUrl = url;
return reqUrl;
},
contentType: 'application/json',
type: "POST",
delay: 250,
data: function (params) {
let encoded_term = (params.term) ? btoa(params.term) : "";
var obj = {
ReportId: reportid,
DataListId: res.datalistId,
IsFilterableColumn: res.isFilterableColumn,
TextColumn: res.textColumn,
ValueColumn: res.valueColumn,
Term: encoded_term,
AuthToken: userinfo.sessionId,
};
return JSON.stringify(obj);
},
beforeSend: function (xhr) {
if (userinfo !== undefined && userinfo !== null) {
xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
}
},
processResults: function (data) {
var selectData = [];
var Data;
var result = JSON.parse(data.result);
if (!result.Data) {
selectData.push({ id: 123456, text: "No results found", disabled: true });
}
else {
Data = JSON.parse(result.Data);
for (var i = 0; i < Data.length; i++) {
selectData.push({
id: Data[i][res.valueColumn],
text: Data[i][res.textColumn]
});
}
;
}
return { results: selectData };
}
},
templateResult: function (item) { return item.text; },
templateSelection: function (item) { return item.text; },
});
$("#" + select2id).val(Ids).trigger('change');
}
static Instance() {
if (this.instance === undefined) {
this.instance = new InstantReminder();
}
return this.instance;
}
}
InstantReminder.ActionsArray = [];
Components.InstantReminder = InstantReminder;
})(Components = Communications.Components || (Communications.Components = {}));
})(Communications = Platform.Communications || (Platform.Communications = {}));
})(Platform = Unibase.Platform || (Unibase.Platform = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long