Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

templatenotes.min.js 33KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(i){class r extends t.Core.BaseComponent{jsFiles(){return["platform/automation/managers/rulemanager.js","platform/datasources/managers/doctypemanager.js","platform/analytics/managers/reportmanager.js","platform/forms/managers/formmanager.js","platform/automation/requests/eventtemplatenote.js","platform/automation/requests/eventtemplatekey.js","platform/automation/requests/eventtemplate.js"]}cssFiles(){return[]}html(){return`<form id="frmUnibase_TemplateNotes" data-validate="parsley" data-isdynamic="false">
  2. <div class="card bg-light">
  3. <div class="b-b bg-white card-header header">
  4. <strong class="text-dark title" id="templateheadertext">Create TemplateNotes</strong>
  5. <span class="pull-right" id="Notes">
  6. <a href="javascript:;" id="link_ResetNotes" class="pull-right ml-4">Reset Notes</a>
  7. <a href="javascript:;" id="link_RefreshNotes" class="pull-right mr-4">Refresh Notes</a>
  8. </span>
  9. </div>
  10. <div class="card-body scrollable" style="overflow-y: scroll;">
  11. <div class="bg-white card" id="TemplateNotess">
  12. <div id="unibase_ValidationSummary" class="clear"></div>
  13. <div class="card-body">
  14. <div class="row">
  15. <div class="col-sm-4">
  16. DocType
  17. <select id="Doctype_AutoComplete" class="required form-control value-control" data-isdynamic="true" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().ChangeDoctype()">
  18. <option value="0">Select</option>
  19. </select>
  20. <input type="hidden" id="hf_DocType" />
  21. </div>
  22. <div class="col-sm-3">
  23. Language
  24. <select id="Language_AutoComplete" class="required form-control value-control" data-isdynamic="true">
  25. <option value="0">Select</option>
  26. <option value="1">English</option>
  27. <option value="2">Hindi</option>
  28. <option value="3">Telugu</option>
  29. </select>
  30. <input type="hidden" id="hf_Language" />
  31. </div>
  32. <div class="col-sm-2 mt-4 d-none" style="position:relative;top:12px"><input type="checkbox" class="chk_GlobalReport"><span class="labledata ml-1">IsGlobalReport</span></div>
  33. <div class="col-sm-3 GlobalReportdiv d-none mt-4">
  34. <select id="GlobalReport_AutoComplete" class="required form-control value-control" data-isdynamic="true"></select>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="bg-white card hidden" id="divTemplateColumns">
  40. <div class="card-body">
  41. <div class="row">
  42. <div class="col-sm-12 Notes">
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="bg-white card-footer footer" id="CreateTemplateNotesFooter">
  49. <button id="btnCloseTemplateNotes" class="btn btn-secondary btn-sm mr-auto">Close</button>
  50. <button id="btnSaveTemplateNotes" class="btn btn-primary btn-sm pull-right">Save</button>
  51. </div>
  52. </div>
  53. </form>`}load(t,i){return __awaiter(this,void 0,void 0,function*(){$("#btnCloseTemplateNotes").click(function(){$("#"+i).modal("hide");$("#"+i).remove();r.EventResponse=[];n.Platform.Automation.Components.TemplateNotes.DocProperties=[]});$("#btnSaveTemplateNotes").click(function(){n.Platform.Automation.Components.TemplateNotes.Instance().Save(i)});$(".chk_GlobalReport").change(function(){$(this).is(":checked")?$(".GlobalReportdiv").removeClass("d-none"):$(".GlobalReportdiv").addClass("d-none")});$("#link_ResetNotes").click(function(){let t=Number($("#Doctype_AutoComplete option:selected").val()),i=Number($("#Language_AutoComplete option:selected").val());t==0||i==0?MessageHelper.Instance().showError("Please Select Doctype And Language","unibase_ValidationSummary"):n.Platform.Automation.Components.TemplateNotes.Instance().ResetNotes(t)});$("#link_RefreshNotes").click(function(){let t=Number($("#Doctype_AutoComplete option:selected").val()),i=Number($("#Language_AutoComplete option:selected").val());t==0||i==0?MessageHelper.Instance().showError("Please Select Doctype And Language","unibase_ValidationSummary"):n.Platform.Automation.Managers.RuleManager.Instance().refreshNotes(t,!0).then(function(){MessageHelper.Instance().showSuccess("Successfully reset notes","")})});n.Platform.DataSources.Managers.DocTypeManager.Instance().getDoctypes().then(function(n){var i=[],t;for(let r=0;r<n.result.length;r++)t=n.result[r],i.push({id:t.DocTypeId,text:t.DocTypeName});$("#Doctype_AutoComplete").select2({placeholder:"Select Doctype",data:i})});yield n.Platform.Analytics.Managers.ReportManager.Instance().getReports().then(function(t){for(let r=0;r<t.length;r++){var i=t[r];n.Platform.Automation.Components.TemplateNotes.Reports.push({id:i.ReportId,text:i.ReportName})}});$("#GlobalReport_AutoComplete").select2({placeholder:"Select Report",data:n.Platform.Automation.Components.TemplateNotes.Reports});$("#Language_AutoComplete").change(function(){$(".templatemaindiv").html("");n.Platform.Automation.Components.TemplateNotes.Instance().GetTemplateNotes().then(function(){n.Platform.Automation.Components.TemplateNotes.Instance().LoadTemplateKeys()})});t!=0&&n.Platform.Automation.Components.TemplateNotes.Instance().Edit(t)})}ChangeDoctype(){$(".Notes").html("");$("#Language_AutoComplete").val(0);$("#divTemplateColumns").addClass("hidden");n.Platform.Automation.Components.TemplateNotes.DocProperties=[];n.Platform.Automation.Components.TemplateNotes.Instance().LoadDoctypeColumns()}loadForm(n,t){r.Instance().init(t,null)}init(n,t){this.render(n,t)}render(i){this.navigationHelper.popup(i,"",n.Platform.Automation.Components.TemplateNotes.Instance(),null,t.Helpers.Size.DockLeft)}EventAliasName(n){$("#IsAlias_"+n).is(":checked")?($("#txt_EventAlias_"+n).val(""),$("#txt_EventAlias_"+n).removeClass("d-none")):$("#txt_EventAlias_"+n).addClass("d-none")}loadEventsTemplateForm(t){var i=0;t||(i=n.Themes.Providers.DetailHelper.recordId);this.init(i,null)}DeleteEventTemplateKey(t,i){bootbox.confirm("Do You Want To Delete?",function(r){if(r){var u=Number(t),f=Number(i),e=$(".templatekeyhidden_"+u+"_"+f).val();Number(e)!=0&&n.Platform.Automation.Managers.RuleManager.Instance().DeleteTemplateKeys(Number(e)).then(function(){});$("#row_"+u+"_"+f).remove();$(".deletetrash_"+u+"_"+f).remove()}else return})}ResetNotes(t){bootbox.confirm("Do You Want To Reset Notes? All Notes Will Be Revert",function(i){if(i)n.Platform.Automation.Managers.RuleManager.Instance().refreshNotes(t,!1).then(function(){MessageHelper.Instance().showSuccess("Successfully reset notes","")});else return})}LoadDoctypeColumns(){return __awaiter(this,void 0,void 0,function*(){let i=Number($("#Doctype_AutoComplete option:selected").val()),t=$("#Doctype_AutoComplete option:selected").text();return yield n.Platform.DataSources.Managers.DocTypeManager.Instance().getDocProperties(i).then(function(i){var u,e,r;let f="";f+='<div class="row TemplateNotesRow" id="TemplateNote_0"><div class="col-sm-5 mt-3"><div class="row"><span class="chk mr-4 col-sm-4"><input type="checkbox" class="Chk_Alias ml-2" id="IsAlias_0" onclick=" Unibase.Platform.Automation.Components.TemplateNotes.Instance().EventAliasName(0)"><label class="isaliasname ml-1" style="color:black">IsAlias<\/label><\/span><span class="col-sm-6"><label id="TemplateColumn_0">'+t+' Created<\/label><label class="hidden" id="Templatelable_0">'+t+'_Created<\/label><label class="hidden h_templateid" id="TemplateId_0"><\/label><label class="hidden" id="EventId_0"><\/label><label class="hidden" id="TemplateNoteId_0"><\/label><\/div><\/div><div class="col-sm-6"><input type="text" id="txt_templatenote_0" class="form-control templatenotes" /><\/span><\/div><div class="col-sm-1 mt-2" id="AddKey"><span class="pull-right"><a id="" title="Create"><i class="fa fa-plus keysymbol" id="faplus_0" onclick=Unibase.Platform.Automation.Components.TemplateNotes.Instance().EditKeys(0)><\/i><\/a><\/span><\/div><\/div><div class="row eventaliasnamediv mb-1 mt-1 ml-1"><input type="text" id="txt_EventAlias_0" class="form-control d-none col-sm-5 eventaliastext" placeholder="Event Alias-Name"><\/div><div class="row templatemaindiv" id="Templatekeys_0"><\/div>';f+='<div class="row TemplateNotesRow" id="TemplateNote_1"><div class="col-sm-5 mt-3"><div class="row"><span class="chk mr-4 col-sm-4"><input type="checkbox" class="Chk_Alias ml-2" id="IsAlias_1" onclick=" Unibase.Platform.Automation.Components.TemplateNotes.Instance().EventAliasName(1)"><label class="isaliasname ml-1" style="color:black">IsAlias<\/label><\/span><span class="col-sm-6"><label id="TemplateColumn_1">'+t+' Deleted<\/label><label class="hidden" id="Templatelable_1">'+t+'_Deleted<\/label><label class="hidden h_templateid" id="TemplateId_1"><\/label><label class="hidden" id="EventId_1"><\/label><label class="hidden" id="TemplateNoteId_1"><\/label><\/div><\/div><div class="col-sm-6"><input type="text" id="txt_templatenote_1" class="form-control templatenotes" /><\/span><\/div><div class="col-sm-1 mt-2" id="AddKey"><span class="pull-right"><a id="" title="Create"><i class="fa fa-plus keysymbol" id="faplus_1" onclick="Unibase.Platform.Automation.Components.TemplateNotes.Instance().EditKeys(1)"><\/i><\/a><\/span><\/div><\/div><div class="row eventaliasnamediv mb-1 ml-1 mt-1"><input type="text" id="txt_EventAlias_1" class="form-control d-none col-sm-5 eventaliastext" placeholder="Event Alias-Name"><\/div><div class="row templatemaindiv" id="Templatekeys_1"><\/div>';u=i.result;i.result.length>0&&(u=i.result.filter(n=>n.IsExcludeFromAudit==!1));for(let t=0;t<i.result.length;t++)e=i.result[t],n.Platform.Automation.Components.TemplateNotes.DocProperties.push({id:e.DocPropertyId,text:e.DocPropertyName});for(r=0;r<u.length;r++)n.Platform.Automation.Components.TemplateNotes.index=r+2,f+='<div class="row TemplateNotesRow" id="TemplateNote_'+n.Platform.Automation.Components.TemplateNotes.index+'"><div class="col-sm-5 mt-3"><div class="row"><span class="chk mr-4 col-sm-4"><input type="checkbox" class="Chk_Alias ml-2" id="IsAlias_'+n.Platform.Automation.Components.TemplateNotes.index+'"onclick="Unibase.Platform.Automation.Components.TemplateNotes.Instance().EventAliasName('+n.Platform.Automation.Components.TemplateNotes.index+')"><label class="isaliasname ml-1" style="color:black">IsAlias<\/label><\/span><span class="col-sm-6"><label id="TemplateColumn_'+n.Platform.Automation.Components.TemplateNotes.index+'">'+u[r].PropColumnName+' Updated <\/label><label class="hidden" id="Templatelable_'+n.Platform.Automation.Components.TemplateNotes.index+'">'+t+"_"+u[r].PropColumnName+'_Updated<\/label><label class="hidden h_templateid" id="TemplateId_'+n.Platform.Automation.Components.TemplateNotes.index+'"><\/label><label class="hidden" id="EventId_'+n.Platform.Automation.Components.TemplateNotes.index+'"><\/label><label class="hidden" id="TemplateNoteId_'+n.Platform.Automation.Components.TemplateNotes.index+'"><\/label><\/span><\/div><\/div><div class="col-sm-6"><input type="text" id="txt_templatenote_'+n.Platform.Automation.Components.TemplateNotes.index+'" class="form-control templatenotes" /><\/div><div class="col-sm-1 mt-2" id="AddKey"><span class="pull-right"><a id="" title="Create"><i class="fa fa-plus keysymbol" id="faplus_'+n.Platform.Automation.Components.TemplateNotes.index+'" onclick="Unibase.Platform.Automation.Components.TemplateNotes.Instance().EditKeys('+n.Platform.Automation.Components.TemplateNotes.index+')"><\/i><\/a><\/span><\/div><\/div><div class="row eventaliasnamediv mb-1 mt-1 ml-1"><input type="text" id="txt_EventAlias_'+n.Platform.Automation.Components.TemplateNotes.index+'" class="form-control d-none col-sm-5 eventaliastext" palceholder="Event Alias-Name"><\/div><div class="row templatemaindiv" id="Templatekeys_'+n.Platform.Automation.Components.TemplateNotes.index+'"><\/div>';$(".Notes").append(f);$("#divTemplateColumns").removeClass("hidden")})})}EditKeys(t){if($("#faplus_"+t).hasClass("fa-pencil")){$("#Templatekeys_"+t).removeClass("d-none");$("#faplus_"+t).addClass("fa-plus").removeClass("fa-pencil");return}n.Platform.Automation.Components.TemplateNotes.Instance().AddKey(t)}LoadTemplateKeys(){return __awaiter(this,void 0,void 0,function*(){let i=$(".TemplateNotesRow").length;for(var t=0;t<i;t++){let i=Number($("#TemplateId_"+t+"").text());yield n.Platform.Automation.Managers.RuleManager.Instance().getEventTemplateKeys(i).then(function(i){var u,f,r,e,c,o,s,h;if(i!=null&&i.length>0)for(u=0;u<i.length;u++){f="";r=i[u];let c=t;n.Platform.Automation.Components.TemplateNotes.keysindex=u+1;r.ReportId!=0&&(e=()=>__awaiter(this,void 0,void 0,function*(){return yield n.Platform.Automation.Components.TemplateNotes.Instance().OnChangeReport(c,n.Platform.Automation.Components.TemplateNotes.keysindex)}),e());f+='<div class="TemplateKeysRow_'+c+' row col-sm-12" id="row_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><input type="hidden" class="templatekeyhidden_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value='+r.TemplateKeyId+'><div class="col-sm-2"><input type="text" id="txt_KeyName_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="form-control required value-control floating-label-control" data-isdynamic="false"><\/div><div class="col-sm-2"><div id="div_DocProperties" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_DocProperties_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_DocProperties value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeDocproperties('+c+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_DocProperties_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="Report_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_Reports" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_Reports_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_Reports value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeReport('+c+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_Reports_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="ReportColumn_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_ReportColumns" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_ReportColumns_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_ReportColumns value-control form-control text-control" style="width:100%;" onchange=""><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_ReportColumns_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="ResultColumn_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_ResultColumns" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_ResultColumns_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_ResultColumns value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeResultColumn('+c+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_ResultColumns_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-1 mt-2"><div class="custom-control custom-checkbox checkbox-primary"><input type="checkbox" name="Keys" onclick="Unibase.Platform.Automation.Components.TemplateNotes.Instance().Cheked('+c+","+n.Platform.Automation.Components.TemplateNotes.keysindex+');" class="custom-control-input" id="chk_Key_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><label class="custom-control-label" id="lblcontact" for="chk_Key_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><\/label><\/div><\/div><div class="deletetrash_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'col-sm-1 mt-2"><i class="fa fa-trash pull right deleteeventkey" id = "fatrash_'+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" onclick=" Unibase.Platform.Automation.Components.TemplateNotes.Instance().DeleteEventTemplateKey('+c+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+')"><\/i><\/div><\/div>';$("#faplus_"+c).removeClass("fa-plus").addClass("fa-pencil");$("#Templatekeys_"+c+"").append(f).addClass("d-none");$("#txt_KeyName_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").val(r.KeyName);n.Platform.Automation.Components.TemplateNotes.Instance().LoadDocPropertys(c,n.Platform.Automation.Components.TemplateNotes.keysindex);$("#select2_Reports_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").select2({placeholder:"Select Report",data:n.Platform.Automation.Components.TemplateNotes.Reports});c=new Option(r.DocpropertyName,r.DocpropertyId.toString(),!0,!0);$("#select2_DocProperties_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+" option[value="+r.DocpropertyId+"]").prop("selected",!0);r.ReportId!=0&&($("#Report_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").removeClass("hidden"),$("#ReportColumn_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").removeClass("hidden"),$("#ResultColumn_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").removeClass("hidden"),$("#chk_Key_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").prop("checked",!0),o=new Option(r.ReportName,r.ReportId.toString(),!0,!0),$("#select2_Reports_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").append(o),s=new Option(r.ReportColumnName,r.ReportColumnId.toString(),!0,!0),$("#select2_ReportColumns_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").append(s),h=new Option(r.ResultColumnName,r.ResultColumnId.toString(),!0,!0),$("#select2_ResultColumns_"+c+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").append(h))}else $("#faplus_"+t).removeClass("fa-pencil").addClass("fa-plus")})}})}GetTemplateNotes(){return __awaiter(this,void 0,void 0,function*(){let t=Number($("#Doctype_AutoComplete option:selected").val()),i=Number($("#Language_AutoComplete option:selected").val());return yield n.Platform.Automation.Managers.RuleManager.Instance().getEventTemplateNotesByLanguageId(t,i).then(function(n){var t,u,i;if(n!=null&&n.length>0){r.EventResponse=n;let f=$(".TemplateNotesRow").length;for(t=0;t<f;t++)if(u=$("#Templatelable_"+t+"").text(),i=n.filter(n=>n.EventName==u.toLocaleLowerCase())[0],i!=undefined){let n=i.NotesText,r=i.EventId,u=i.TemplateId,f=i.TemplateNoteId;$("#txt_templatenote_"+t+"").val(n);$("#TemplateId_"+t+"").text(u);$("#EventId_"+t+"").text(r);$("#TemplateNoteId_"+t+"").text(f);i.EventAliasName!=""&&($("#IsAlias_"+t).prop("checked",!0),$("#txt_EventAlias_"+t).removeClass("d-none").val(i.EventAliasName))}}else $(".templatenotes").val(""),$(".h_templateid").text(0),$(".Chk_Alias").prop("checked",!1),$(".eventaliastext").addClass("d-none").val("")})})}LoadDocPropertys(t,i){var u='<option value="0">select DocProperty<\/option>',r=n.Platform.Automation.Components.TemplateNotes.DocProperties;for(let n=0;n<r.length;n++)u+="<option value="+r[n].id+">"+r[n].text+"<\/opion>";$("#select2_DocProperties_"+t+"_"+i+"").html("").html(u)}AddKey(t){n.Platform.Automation.Components.TemplateNotes.keysflag=0;let i="";if(n.Platform.Automation.Components.TemplateNotes.keysindex=$(".TemplateKeysRow_"+t+"").length,n.Platform.Automation.Components.TemplateNotes.keysindex=n.Platform.Automation.Components.TemplateNotes.keyscount?n.Platform.Automation.Components.TemplateNotes.keyscount:n.Platform.Automation.Components.TemplateNotes.keysindex+1,i+='<div class="TemplateKeysRow_'+t+' row col-sm-12 templatekey_rowdata" id="row_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div class="col-sm-2"><input type="text" id="txt_KeyName_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="form-control required value-control floating-label-control" data-isdynamic="false"><\/div><div class="col-sm-2"><div id="div_DocProperties" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_DocProperties_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_DocProperties value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeDocproperties('+t+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_DocProperties_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="Report_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_Reports" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_Reports_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_Reports value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeReport('+t+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_Reports_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="ReportColumn_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_ReportColumns" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_ReportColumns_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_ReportColumns value-control form-control text-control" style="width:100%;" onchange=""><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_ReportColumns_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-2 hidden" id="ResultColumn_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><div id="div_ResultColumns" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><select id="select2_ResultColumns_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" class="select2_0_ResultColumns value-control form-control text-control" style="width:100%;" onchange="Unibase.Platform.Automation.Components.TemplateNotes.Instance().OnChangeResultColumn('+t+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+');"><option value="0">Select<\/option><\/select><input type="hidden" id="hfSelect2Id_ResultColumns_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" value="0" class="form-control text-control" data-isdynamic="true" /><\/div><\/div><div class="col-sm-1 mt-2"><div class="custom-control custom-checkbox checkbox-primary"><input type="checkbox" name="Keys" onclick="Unibase.Platform.Automation.Components.TemplateNotes.Instance().Cheked('+t+","+n.Platform.Automation.Components.TemplateNotes.keysindex+');" class="custom-control-input" id="chk_Key_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><label class="custom-control-label" id="lblcontact" for="chk_Key_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'"><\/label><\/div><\/div><div class="deletetrash_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+' col-sm-1 mt-2" ><i class="fa fa-trash pull right deleteeventkey" id = "fatrash_'+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+'" onclick=" Unibase.Platform.Automation.Components.TemplateNotes.Instance().DeleteEventTemplateKey('+t+", "+n.Platform.Automation.Components.TemplateNotes.keysindex+')"><\/i><\/div><\/div>',n.Platform.Automation.Components.TemplateNotes.keysflag==0){if($("#Templatekeys_"+t+"").append(i),$("#txt_KeyName_"+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").val("Key"+n.Platform.Automation.Components.TemplateNotes.keysindex+""),n.Platform.Automation.Components.TemplateNotes.Instance().LoadDocPropertys(t,n.Platform.Automation.Components.TemplateNotes.keysindex),$("#select2_Reports_"+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").select2({placeholder:"Select Report",data:n.Platform.Automation.Components.TemplateNotes.Reports}),$(".chk_GlobalReport").is(":checked")){var r=$("#select2_Reports_"+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+" option:selected").val(),u=$("#select2_Reports_"+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+" option:selected").text(),f=new Option(u,r.toString(),!0,!0);$("#select2_Reports_"+t+"_"+n.Platform.Automation.Components.TemplateNotes.keysindex+"").append(f)}n.Platform.Automation.Components.TemplateNotes.keyscount=0;n.Platform.Automation.Components.TemplateNotes.keysflag=0}else n.Platform.Automation.Components.TemplateNotes.keysindex=n.Platform.Automation.Components.TemplateNotes.keysindex-1}Cheked(n,t){$("#chk_Key_"+n+"_"+t+"").prop("checked")==!0?($("#Report_"+n+"_"+t+"").removeClass("hidden"),$("#ReportColumn_"+n+"_"+t+"").removeClass("hidden"),$("#ResultColumn_"+n+"_"+t+"").removeClass("hidden")):($("#Report_"+n+"_"+t+"").addClass("hidden"),$("#ReportColumn_"+n+"_"+t+"").addClass("hidden"),$("#ResultColumn_"+n+"_"+t+"").addClass("hidden"))}Save(t){var i=Number($("#Language_AutoComplete option:selected").val());if(i!=0){let u=[],i=n.Platform.Automation.Components.TemplateNotes.Instance().EventTemplatesArray();for(let n=0;n<i.length;n++)u.push({TemplateId:i[n].TemplateId,EventId:i[n].EventId,EventAliasName:i[n].EventAliasName,EventTempNotes:i[n].EventTempNotes,EventTempKeys:i[n].EventTempKeys});n.Platform.Automation.Managers.RuleManager.Instance().saveEventTemplates(u).then(function(){n.Platform.Automation.Components.TemplateNotes.DocProperties=[];r.EventResponse=[];$("#"+t).modal("hide");$("#"+t).remove();MessageHelper.Instance().showSuccess("SucessFully Saved","")})}else MessageHelper.Instance().showError("Mandatory fields are missing","unibase_ValidationSummary")}Edit(t){n.Platform.DataSources.Managers.DocTypeManager.Instance().getDoctype(t).then(function(t){var i=new Option(t.result.DocTypeName,t.result.DocTypeId.toString(),!0,!0);$("#Doctype_AutoComplete").append(i);n.Platform.Automation.Components.TemplateNotes.Instance().LoadDoctypeColumns().then(function(){$("#hf_Language").val(1);$("#Language_AutoComplete").val(Number($("#hf_Language").val()));n.Platform.Automation.Components.TemplateNotes.Instance().GetTemplateNotes().then(function(){n.Platform.Automation.Components.TemplateNotes.Instance().LoadTemplateKeys()})})})}OnChangeDocproperties(n,t){$("#txt_KeyName_"+n+"_"+t+"").val($("#select2_DocProperties_"+n+"_"+t+" option:selected").text())}OnChangeReport(t,i){return __awaiter(this,void 0,void 0,function*(){let u=Number($("#select2_Reports_"+t+"_"+i+" option:selected").val());var r=[];return $("#select2_ReportColumns_"+t+"_"+i+"").empty(),$("#select2_ResultColumns_"+t+"_"+i+"").empty(),yield n.Platform.Analytics.Managers.ReportManager.Instance().getColumns(u).then(function(n){var u=n.result;if(u!=null){for(let n=0;n<u.length;n++)r.push({id:u[n].ReportColumnId,text:u[n].ReportColumnName});$("#select2_ReportColumns_"+t+"_"+i+"").select2({placeholder:"Select ReportColumn",data:r});$("#select2_ResultColumns_"+t+"_"+i+"").select2({placeholder:"Select ResultColumn",data:r})}})})}OnChangeResultColumn(n,t){$("#txt_KeyName_"+n+"_"+t+"").val($("#select2_ResultColumns_"+n+"_"+t+" option:selected").text())}EventTemplatesArray(){let n=[];return $(".TemplateNotesRow").each(function(){var h,f,c,e;let o=[],s=[],u={},i={},l=$(this).find(".TemplateNotesRow"),t=l.prevObject[0].id.split("_");t=Number(t[1]);let a=$(".TemplateKeysRow_"+t+"").length;for(h=Number($("#Language_AutoComplete option:selected").val()),f=0;f<a;f++){let n={},i=f+1;c=$(".templatekeyhidden_"+t+"_"+i).val()==undefined?0:Number($(".templatekeyhidden_"+t+"_"+i).val());n.TemplateId=Number($("#TemplateId_"+t+"").text());n.ReportId=Number($("#select2_Reports_"+t+"_"+i+" option:selected").val());n.ReportColumnId=Number($("#select2_ReportColumns_"+t+"_"+i+" option:selected").val());n.ResultColumnId=Number($("#select2_ResultColumns_"+t+"_"+i+" option:selected").val());n.DocpropertyId=Number($("#select2_DocProperties_"+t+"_"+i+" option:selected").val());n.KeyName=$("#txt_KeyName_"+t+"_"+i+"").val().toString();n.TemplateKeyId=c;s.push(n)}i.TemplateNoteId=Number($("#TemplateNoteId_"+t+"").text());i.NotesText=$("#txt_templatenote_"+t+"").val().toString();i.LanguageId=h;i.IsSystemGenerated=!1;e=r.EventResponse.findIndex(n=>n.NotesText.toLowerCase()==i.NotesText.toLowerCase());e!=-1&&(i.IsSystemGenerated=r.EventResponse[e].IsSystemGenerated);o.push(i);u.EventId=Number($("#EventId_"+t+"").text());u.TemplateId=Number($("#TemplateId_"+t+"").text());u.EventTempNotes=o;u.EventTempKeys=s;u.EventAliasName=$("#txt_EventAlias_"+t).text()==undefined||$("#txt_EventAlias_"+t).val()==null||$("#txt_EventAlias_"+t).val()==""?"":$("#txt_EventAlias_"+t).val().toString();n.push(u)}),n}static Instance(){return this.instance===undefined&&(this.instance=new r),this.instance}}r.index=0;r.keysindex=0;r.keysflag=0;r.DocProperties=[];r.Reports=[];r.EventResponse=[];i.TemplateNotes=r})(r=i.Components||(i.Components={}))})(i=t.Automation||(t.Automation={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));