var Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(r){class u extends n.Platform.Core.BaseComponent{constructor(){super(...arguments);this.RecipientProviders=[];this.TokensData=[]}jsFiles(){return["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"]}cssFiles(){return[]}html(){return`
`}load(i,r){var e=this,u,f;$("#btnCloseNotification").click(function(){$("#"+r).modal("hide");$("#"+r).remove()});$("#btnSaveNotification").click(function(){n.Platform.Communications.Components.InstantReminder.Instance().SaveInstantReminder(r)});$("#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");$("#chkDefault").is(":checked")&&$("#chkDefault").prop("checked",!1);$(".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 t=Number($("#select2_Report option:selected").val());n.Platform.Communications.Components.InstantReminder.Instance().LoadDynamicFilters(t);n.Platform.Communications.Components.InstantReminder.Instance().LoadContactColumns(t)});u=_appsettings.server_url()+"/apis/v4/unibase/platform/analytics/reports";AutoCompleteHelper.getHelper().Create("#select2_Report","hdnselect2_Report",u,function(n){var t=n});$("#select2_Report").change(function(){let t=Number($("#select2_Report option:selected").val());$(".ContactColumns").html("");$(".Row_DynamicFilers").html("");n.Platform.Communications.Components.InstantReminder.Instance().LoadMsgSubjectTokens(t);n.Platform.Communications.Components.InstantReminder.Instance().LoadMsgBodyTokens(t)});$("#ddl_SubjectTokens").change(function(){var n=$("#txtNotifications_MessageSubject").val(),t="{{"+$("#ddl_SubjectTokens option:selected").text()+"}}";$("#txtNotifications_MessageSubject").val(n+t);$("#ddl_SubjectTokens").val(0)});f=t.Helpers.FileCacheHelper.Instance();f.loadJsFileAsync("platform/automation/components/actions/externalattachments.js",function(){let t=n.Platform.Automation.Components.ExternalAttachments.Instance().init("instantreminderattachments",!0,"Unibase_Actions_ValidationSummary");jQuery("#instantreminderattachments").html(t);$(".drag").css("border","3px dashed #cccccc");n.Platform.Automation.Components.ExternalAttachments.Instance().dragNdrop("instantreminderattachments")});$("#date_ExecutionDate").daterangepicker({autoUpdateInput:!1,timePicker:!0,timePicker24Hour:!0,locale:{format:"DD/MM/YYYY HH:mm"},singleDatePicker:!0,showDropdowns:!0,minYear:1901,maxDate:new Date(2050,11,31)});$(".summernote_MessageBody").summernote({height:100,minHeight:null,maxHeight:null,placeholder:"Message Body",disableDragAndDrop:!0,codemirror:{mode:"text/html",lineNumbers:!0},toolbar:[["font",["bold","italic","underline"]],["color",["color"]],["view",["fullscreen","codeview","help"]],],hint:{match:/\B[@!](\w*)$/,search:function(t,i){i($.grep(n.Platform.Communications.Components.InstantReminder.Instance().TokensData,function(n){var i=n;return i.indexOf(t)===0}))},content:function(n){var t=n;return $("{{"+t+"}}<\/span>")[0]}}});n.Platform.Communications.Components.InstantReminder.Instance().GetActions();$("#smsinstantreminder").addClass("d-none");$("#mailinstantreminder").addClass("d-none");$('input[name="ReminderType"]').change(function(){$("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")):$("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")):$("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"))});n.Platform.Communications.Components.InstantReminder.Instance().getDefaultSmsSender();n.Platform.Communications.Components.InstantReminder.Instance().getDefaultMailServer()}loadForm(t,i,r){u.Instance().init(i,null);n.Platform.Apps.Managers.AppManager.Instance().getAppConfiguration(r).then(function(n){u.installedappid=n.result.InstalledAppId})}loadInstantReminderForm(t){var i=0;t||(i=n.Themes.Providers.DetailHelper.recordId);this.navigationHelper.popup(i,"",n.Platform.Communications.Components.InstantReminder.Instance(),null,n.Platform.Helpers.Size.DockLeft)}init(n,t){this.render(n,t)}render(t){this.navigationHelper.popup(t,"",n.Platform.Communications.Components.InstantReminder.Instance(),null,n.Platform.Helpers.Size.DockLeft)}SaveInstantReminder(t){let r=new n.Platform.Communications.Requests.InstantReminder,u="",e=n.Platform.Communications.Components.InstantReminder.Instance().GetFilters(),o=n.Platform.Communications.Components.InstantReminder.Instance().GetDefaultReport(),s=n.Platform.Communications.Components.InstantReminder.Instance().getContactColumns(),f=n.Platform.Automation.Components.ExternalAttachments.Instance().getFiles("instantreminderattachments");$("input[name='ReminderType']:checked").val()=="Notification"?u="Send Notification":$("input[name='ReminderType']:checked").val()=="SMS"?(u="Send Sms",r.String1=$("#Autocomplete_ProviderName option:selected").val().toString(),r.String2=$("#Autocomplete_SenderName option:selected").val().toString()):$("input[name='ReminderType']:checked").val()=="Email"&&(u="Send Email",r.String1=$("#Autocomplete_MailServer option:selected").val().toString(),r.String2=$("#Autocomplete_MailAccount option:selected").val().toString(),r.String3=f.length>0?JSON.stringify(f):"");var h=$(".summernote_MessageBody").summernote("code"),c=$("

"+h+"<\/p>").text();if(r.Subject=$("#txtNotifications_MessageSubject").val().toString(),r.Body=c,r.ReportId=$("#select2_Report option:selected").val()==undefined?0:Number($("#select2_Report option:selected").val()),r.ActionId=n.Platform.Communications.Components.InstantReminder.ActionsArray.find(n=>n.ActionName==u).ActionId,r.Users=s,r.IsScheduled=!1,$("#date_ExecutionDate").val()!=""&&$("#date_ExecutionDate").val()!=null){let t=n.Platform.Helpers.DateTimeHelper.Instance().formatServerDateTime($("#date_ExecutionDate").val());r.ExecutionDate=new Date(t);r.IsScheduled=!0}r.ReminderFilters=e;r.DefaultReminderReport=o;i.Managers.ReminderManager.Instance().saveInstantReminder(r).then(function(i){i.status==n.Data.Status.Error?MessageHelper.Instance().showError(i.message,"Unibase_Actions_ValidationSummary"):(MessageHelper.Instance().showSuccess(i.message,"Unibase_Actions_ValidationSummary"),$("#"+t).modal("hide"),$("#"+t).remove(),n.Platform.Helpers.NavigationHelper.Instance().loadList(n.Platform.Communications.Components.InstantReminder.installedappid,null))})}LoadMsgSubjectTokens(t){n.Platform.Analytics.Managers.ReportManager.Instance().getColumns(t).then(function(n){var t,i;let r=document.getElementById("ddl_SubjectTokens");$("#ddl_SubjectTokens").empty();t=document.createElement("option");t.text="Select Token";t.value="0";r.appendChild(t);for(let t=0;t<=n.result.length-1;t++)i=document.createElement("option"),i.text=n.result[t].ReportColumnName,i.value=n.result[t].ReportColumnId.toString(),r.appendChild(i)})}LoadMsgBodyTokens(t){n.Platform.Analytics.Managers.ReportManager.Instance().getColumns(t).then(function(t){var i=[],r;for(let n=0;n<=t.result.length-1;n++)r=t.result[n].ReportColumnName,i.push(r);n.Platform.Communications.Components.InstantReminder.Instance().TokensData=i})}GetActions(){n.Platform.Automation.Managers.RuleManager.Instance().getActions().then(function(t){for(var i=0;i<=t.length-1;i++)n.Platform.Communications.Components.InstantReminder.ActionsArray.push(t[i])})}LoadContactColumns(t){n.Platform.Analytics.Managers.ReportManager.Instance().getIsContactReportColumns(t).then(function(n){if(n!=null)for(let t=0;t<=n.result.length-1;t++){let i="";i+='