123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- 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(r){class u extends t.Core.BaseComponent{constructor(){super(...arguments);this.RowIndex=0;this.RuleProviderId=0;this.AutomationMode=0}jsFiles(){return["platform/automation/managers/rulemanager.js","platform/automation/enums/automationmode.js","platform/automation/components/conditions.js","platform/automation/components/contactselection.js","platform/automation/requests/ruleaction.js","platform/automation/requests/rulecondition.js","platform/forms/components/formviewer/formviewer.js","libs/parsley/parsley.min.js","libs/querybuilder/query-builder.min.js","libs/querybuilder/query-builder.standalone.min.js","libs/querybuilder/query-builder.standalone.js","libs/querybuilder/sql-parser.min.js","libs/notificationbuilder/notificationbuilder.js","platform/automation/components/rulebuilder/notificationgroup.js","platform/automation/managers/notificationgroupmanager.js"]}cssFiles(){return[]}html(){return`<form id="frmUnibase_PropertyChange" data-validate="parsley" data-isdynamic="false">
- <div class="card bg-light">
- <div class="b-b bg-white card-header header">
- <strong class="text-dark title" id="Spn_PropertyChange">Create PropertyChange</strong>
- </div>
- <div class="card-body scrollable" style="overflow-y: scroll;">
- <div class="bg-white card" id="divPropertyChange">
- <div id="Validate_PropertyChnageAction" class="clear"></div>
- <div class="card-body">
- <div class="row">
- <div class="col-sm-12">
- <div class="floating-label-form-group">
- <label for="lbl" id="lbl_RuleActionName">Action<span class="text-danger required" id="spnIsRequired_RuleActionName"> *</span></label>
- <input type="text" id="txtPropertyChange_RuleActionName" class="form-control value-control required floating-label-control" placeholder="Action *" data-placeholder="Enter Action" data-label="Action *">
- <input type="hidden" id="hf_RuleActionName" />
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-6">
- <div class="input-group">
- <label for="InstalledApps" class="font-bold">InstalledApps<span class="text-danger">*</span></label>
- <select id="txtAutoComplete_InstalledApps" class="form-control text-control required" style="width:100%;" placeholder="InstalledApps" data-placeholder="InstalledApps" data-label="" data-istagselect="true"></select>
- <input type="hidden" id="hf_Autocomplete_InstalledApps" class="form-control value-control" data-isdynamic="true" />
- </div>
- </div>
- <div class="col-sm-6">
- <div class="input-group">
- <label for="AppDoctypes" class="font-bold">AppDoctypes<span class="text-danger">*</span></label>
- <select id="txtAutoComplete_AppDoctypes" class="form-control text-control required" style="width:100%;" placeholder="AppDoctypes" data-placeholder="AppDoctypes" data-label="" data-istagselect="true"></select>
- <input type="hidden" id="hf_Autocomplete_AppDoctypes" class="form-control value-control" data-isdynamic="true" />
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-6">
- <div class="input-group">
- <label for="DocProperties" class="font-bold">DocProperties<span class="text-danger">*</span></label>
- <select id="txtAutoComplete_DocProperties" class="form-control text-control required" style="width:100%;" placeholder="DocProperties" data-placeholder="DocProperties" data-label="" data-istagselect="true"></select>
- <input type="hidden" id="hf_Autocomplete_DocProperties" class="form-control value-control" data-isdynamic="true" />
- </div>
- </div>
- <div class="col-sm-6">
- <div class="floating-label-form-group">
- <label for="txt_Property" id="lbl_Property">Property Name<span class="text-danger">*</span></label>
- <input type="text" id="txt_Property" class="form-control required value-control floating-label-control" data-isdynamic="false" placeholder="Property Name*" data-placeholder="Enter Property Name" data-label="Property Name*" />
- <input type="hidden" id="hf_Property" />
- <label for="Validation" id="lblValidation_Property"></label>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- <div id="div_Parameter" class="floating-label-form-group">
- <label for="lbl_ApiParameter" id="lbl_ApiParameter">Parameter<span class="text-danger"> *</span></label>
- <div class="input-group">
- <input type="text" id="txtPropertyChange_Parameter" class="col-sm-9 form-control value-control required floating-label-control" data-placeholder="Enter Parameter" placeholder="Parameter *" data-label="Parameter *">
- <select id="ddl_PropertyChangeParameters" 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_NotificationGrp" class="floating-label-form-group col-sm-6 floating-label-form-group-with-value">
- <label for="lbl_NotificationGrp" id="lbl_NotificationGroup">Notification Group<span class="text-danger"> *</span></label>
- <select id="ddl_NotificationGrp" class="form-control"><option value="0">Select Group</option></select>
- </div><div class="col-sm-6 createbtn_grp"><button class="badge badge-primary mt-30 ml-15" id="creategrp_btn">Create Group</button></div></div>
- <div class="row">
- <div class="ResultActions col-sm-6 hidden">
- <div id="div_ResultAction" class=" floating-label-form-group floating-label-form-group-with-value">
- <label for="lbl" id="lbl_ResultAction">Result Action</label>
- <select id="ddl_ResultAction" class="form-control">
- <option value="0">Select</option>
- </select>
- <label for="Validation" id="lblValidation_ResultAction"></label><input type="hidden" id="hfFormPropertyId" value="0" />
- </div>
- </div>
- <div class="col-sm-6">
- <div class="custom-control custom-checkbox divEnablePieces checkbox-primary mt-20">
- <input type="checkbox" class="custom-control-input" id="chkAutoApprovedPropertyChange" checked>
- <label class="custom-control-label" for="chkAutoApprovedPropertyChange">Perform this Action</label> 
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="bg-white card col-sm-3" id="btn_ActionConditions">
- <button type="button" class="btn btn-primary" onclick="Unibase.Platform.Automation.Components.PropertyChange.Instance().TogglePropertyChangeConditions();">Conditions</button>
- </div>
- <div class="bg-white card hidden" id="ActionConditionsDiv">
- <div class="card-header">Condition Details</div>
- <div class="card-body">
- <div class="ActionConditions">
- <!--For Action Conditions-->
- </div>
- </div>
- </div>
- </div>
- <div class="bg-white card-footer footer" id="CreatePropertyChangeFooter">
- <a href="javascript:;" id="btnClosePropertyChange" class="btn btn-light btn-sm mr-auto "> Close</a>
- <a href="javascript:;" id="btnSavePropertyChange" class="btn btn-primary btn-sm"> Save</a>
- </div>
- </div>
- </form>`}load(t,i){return __awaiter(this,void 0,void 0,function*(){var r=this,f;n.Platform.Automation.Components.PropertyChange.Instance().ActionId=r.ActionId;n.Platform.Automation.Components.PropertyChange.Instance().RuleActionData=r.RuleActionData;n.Platform.Automation.Components.PropertyChange.Instance().RowIndex=r.RowIndex;n.Platform.Automation.Components.PropertyChange.Instance().AutomationMode=r.AutomationMode;n.Platform.Automation.Components.PropertyChange.Instance().RuleProviderId=r.RuleProviderId;n.Platform.Automation.Components.PropertyChange.Instance().ParentActionId=r.ParentActionId;n.Platform.Automation.Components.PropertyChange.Instance().IsAutomationMode=r.IsAutomationMode;yield n.Platform.Automation.Components.NotificationGroup.Instance().LoadNotificationGroups();$("#btnClosePropertyChange").click(function(){$("#"+i).modal("hide");$("#"+i).remove();n.Platform.Automation.Components.PropertyChange.Instance().AutomationMode==n.Platform.Automation.Enums.AutomationMode.NormalMode&&n.Platform.Automation.Components.PropertyChange.Instance().AutomationMode&&n.Platform.Automation.Components.PropertyChange.Instance().IsAutomationMode&&n.Platform.Automation.Components.Rule.Instance().ChangeAction(r.RowIndex,t);n.Platform.Automation.Components.Conditions.conditionArray=[]});$("#btnSavePropertyChange").click(function(){let r=n.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation("frmUnibase_PropertyChange");if(r==!1)return MessageHelper.Instance().showError("Mandatory fields are missing","Validate_PropertyChnageAction"),!1;n.Platform.Automation.Components.PropertyChange.Instance().SavePropertyChange(t,i)});$("#ddl_PropertyChangeParameters").change(function(){var n=$("#txtPropertyChange_Parameter").val(),t="{{"+$("#ddl_PropertyChangeParameters option:selected").text()+"}}";$("#txtPropertyChange_Parameter").val(n+t);$("#ddl_PropertyChangeParameters").val(0)});t!=""&&n.Platform.Automation.Components.PropertyChange.Instance().EditPropertyChange(t);let u=r.RuleProviderId;u!=0&&(n.Platform.Automation.Components.PropertyChange.Instance().LoadPropertyChangeParameters(u),n.Platform.Automation.Components.ContactSelection.Instance().loadQueryBuilder(u,null));r.RuleActionData.length!=0&&n.Platform.Automation.Components.PropertyChange.Instance().LoadPropertyChangeData(r.RuleActionData);$("#creategrp_btn").click(function(){n.Platform.Automation.Components.NotificationGroup.Instance().init(0,null,!0)});r.ParentActionId!=0&&(n.Platform.Automation.Components.ContactSelection.Instance().getResultActions(r.ParentActionId),yield n.Platform.Automation.Components.PropertyChange.Instance().GetRuleActionInfo(Number(r.ParentActionId)),$("#ddl_NotificationGrp").prop("disabled",!0),$("#creategrp_btn").addClass("d-none"));f=_appsettings.server_url()+"/apis/v4/unibase/platform/apps/installedappautocomplete";AutoCompleteHelper.getHelper().Create("#txtAutoComplete_InstalledApps","#hf_Autocomplete_InstalledApps",f,function(n){var t=n});$("#txtAutoComplete_InstalledApps").change(function(){n.Platform.Automation.Components.PropertyChange.Instance().OnChangeInstalledApp()});$("#txtAutoComplete_AppDoctypes").change(function(){n.Platform.Automation.Components.PropertyChange.Instance().OnChangeDoctype()})})}OnChangeInstalledApp(){return __awaiter(this,void 0,void 0,function*(){$("#txtAutoComplete_AppDoctypes").val(0);var n=_appsettings.server_url()+"/apis/v4/unibase/platform/doctypes/appdoctypesautocomplete/installedappid/"+Number($("#txtAutoComplete_InstalledApps option:selected").val());return yield AutoCompleteHelper.getHelper().Create("#txtAutoComplete_AppDoctypes","#hf_Autocomplete_AppDoctypes",n,function(n){var t=n})})}OnChangeDoctype(){return __awaiter(this,void 0,void 0,function*(){$("#txtAutoComplete_DocProperties").val(0);var n=_appsettings.server_url()+"/apis/v4/unibase/platform/doctypes/docpropertiesautocomplete/doctypeid/"+Number($("#txtAutoComplete_AppDoctypes option:selected").val());return yield AutoCompleteHelper.getHelper().Create("#txtAutoComplete_DocProperties","#hf_Autocomplete_DocProperties",n,function(n){var t=n})})}TogglePropertyChangeConditions(){$("#ActionConditionsDiv").toggle(function(){$("#btn_ActionConditions").addClass("hidden");$("#ActionConditionsDiv").removeClass("hidden");n.Platform.Automation.Components.ContactSelection.Instance().loadQueryBuilder(n.Platform.Automation.Components.PropertyChange.Instance().RuleProviderId,null)})}LoadPropertyChangeData(t){for(var i=0;i<t.length;i++){$("#txtPropertyChange_RuleActionName").val(t[i].RuleActionName);$("#txt_Property").val(t[i].BString1);$("#txtPropertyChange_Parameter").val(t[i].BString2);$("#txtAutoComplete_InstalledApps").append(t[i].String1);$("#txtAutoComplete_AppDoctypes").append(t[i].String2);$("#txtAutoComplete_DocProperties").append(t[i].String3);let r=Number(t[i].String1);n.Platform.Apps.Managers.AppManager.Instance().getInstallApp(r).then(function(n){var t=new Option(n.result.AppTitle,n.result.InstalledAppId.toString(),!0);$("#txtAutoComplete_InstalledApps").append(t)});let u=Number(t[i].String2);n.Platform.DataSources.Managers.DocTypeManager.Instance().getDoctype(u).then(function(n){var t=new Option(n.result.DocTypeName,n.result.DocTypeId.toString(),!0);$("#txtAutoComplete_AppDoctypes").append(t)});let f=Number(t[i].String3);n.Platform.DataSources.Managers.DocTypeManager.Instance().getDocProperty(f).then(function(n){var t=new Option(n.result.DocPropertyName,n.result.DocPropertyId.toString(),!0);$("#txtAutoComplete_DocProperties").append(t)});t[i].ExecuteStatusId!=Number(n.Platform.Automation.Enums.ExecuteActionStatus.Approved)?$("#chkAutoApprovedPropertyChange").prop("checked",!1):$("#chkAutoApprovedPropertyChange").prop("checked",!0);t[i].SqlWhere!=""&&t[i].SqlWhere!=null&&(n.Platform.Automation.Components.ContactSelection.Instance().loadQueryBuilder(n.Platform.Automation.Components.PropertyChange.Instance().RuleProviderId,t[i].SqlWhere),$("#btn_ActionConditions").addClass("hidden"),$("#ActionConditionsDiv").removeClass("hidden"));$("#div_Parameter").addClass("floating-label-form-group-with-value");eval("_floatingLabelHelper.init();")}}LoadPropertyChangeParameters(t){n.Platform.Automation.Managers.RuleManager.Instance().getTokens(t).then(function(n){var t,i;let r=document.getElementById("ddl_PropertyChangeParameters");$("#ddl_PropertyChangeParameters").empty();t=document.createElement("option");t.text="Select Token";t.value="0";r.appendChild(t);for(let t=0;t<=n.length-1;t++)i=document.createElement("option"),i.text=n[t],i.value=(t+1).toString(),r.appendChild(i)})}EditPropertyChange(t){let i=Number(t);$("#Spn_PropertyChange").text("Edit PropertyChange");n.Platform.Automation.Managers.RuleManager.Instance().getRuleAction(i).then(function(t){$("#txtPropertyChange_RuleActionName").val(t.RuleActionName);$("#txtPropertyChange_Parameter").val(t.BString2);$("#txt_Property").val(t.BString1);$("#ddl_NotificationGrp option[value="+t.NotificationGroupId+"]").prop("selected",!0);n.Platform.Automation.Components.PropertyChange.Instance().IsAutomationMode||(n.Platform.Automation.Components.PropertyChange.Instance().RuleId=t.RuleId,n.Platform.Automation.Components.PropertyChange.Instance().RuleEventId=t.RuleEventId,n.Platform.Automation.Components.PropertyChange.Instance().EventGroupId=t.EventGroupId,n.Platform.Automation.Components.PropertyChange.Instance().ActionId=t.ActionId,n.Platform.Automation.Components.PropertyChange.Instance().ParentActionId=t.ParentActionId);t.ExecuteStatusId!=Number(n.Platform.Automation.Enums.ExecuteActionStatus.Approved)?$("#chkAutoApprovedPropertyChange").prop("checked",!1):$("#chkAutoApprovedPropertyChange").prop("checked",!0);let i=Number(t.String1);n.Platform.Apps.Managers.AppManager.Instance().getInstallApp(i).then(function(n){var t=new Option(n.result.AppTitle,n.result.InstalledAppId.toString(),!0);$("#txtAutoComplete_InstalledApps").append(t)});let r=Number(t.String2);n.Platform.DataSources.Managers.DocTypeManager.Instance().getDoctype(r).then(function(n){var t=new Option(n.result.DocTypeName,n.result.DocTypeId.toString(),!0);$("#txtAutoComplete_AppDoctypes").append(t)});let u=Number(t.String3);n.Platform.DataSources.Managers.DocTypeManager.Instance().getDocProperty(u).then(function(n){var t=new Option(n.result.DocPropertyName,n.result.DocPropertyId.toString(),!0);$("#txtAutoComplete_DocProperties").append(t)});n.Platform.Automation.Components.ContactSelection.Instance().loadQueryBuilder(t.RuleProviderId,t.SqlWhere);$("#btn_ActionConditions").addClass("hidden");$("#ActionConditionsDiv").removeClass("hidden");$("#div_Parameter").addClass("floating-label-form-group-with-value");eval("_floatingLabelHelper.init();")})}GetRuleActionInfo(t){return __awaiter(this,void 0,void 0,function*(){yield n.Platform.Automation.Managers.RuleManager.Instance().getRuleAction(t).then(function(n){if(n!=null){var t="<option value="+n.NotificationGroupId+" selected>"+n.NotificationGroupName+"<\/option>";$("#ddl_NotificationGrp").html("").html(t)}})})}SavePropertyChange(t,r){let e=Number(t),f=$("#builder"),u=new n.Platform.Automation.Requests.RuleAction;if(u.RuleActionId=e,u.RuleActionName=$("#txtPropertyChange_RuleActionName").val().toString(),u.String1=$("#txtAutoComplete_InstalledApps option:selected").val().toString(),u.String2=$("#txtAutoComplete_AppDoctypes option:selected").val().toString(),u.String3=$("#txtAutoComplete_DocProperties option:selected").val().toString(),u.BString1=$("#txt_Property").val().toString(),u.BString2=$("#txtPropertyChange_Parameter").val().toString(),u.ActionId=n.Platform.Automation.Components.PropertyChange.Instance().ActionId,u.RuleId=0,u.Users="",u.NotificationGroupId=$("#ddl_NotificationGrp").val()==undefined?0:Number($("#ddl_NotificationGrp").val()),u.NotificationGroupId==0){MessageHelper.Instance().showError("Please Select Notification Group","Validate_NotificationAction");return}let o=f.queryBuilder("getSQL",!1,!0);o!=null&&(u.SqlWhere=f.queryBuilder("getSQL",!1,!0).sql.replace(/\n/g," ").replace(/LIKE/g,"ILIKE"),u.SqlWhereJson=JSON.stringify(f.queryBuilder("getSQL",!1,!0)));u.ResultActionId=Number($("#ddl_ResultAction option:selected").val());u.ResultActionName=u.ResultActionId!=0?$("#ddl_ResultAction option:selected").text():"";u.DelayTime=0;u.ParentActionId=n.Platform.Automation.Components.PropertyChange.Instance().ParentActionId;u.AutoApproved=$("#chkAutoApprovedPropertyChange").is(":checked");u.RowIndex=n.Platform.Automation.Components.PropertyChange.Instance().RowIndex;n.Platform.Automation.Components.PropertyChange.Instance().IsAutomationMode?n.Platform.Automation.Components.PropertyChange.Instance().AutomationMode==n.Platform.Automation.Enums.AutomationMode.NormalMode?(n.Platform.Automation.Components.Rule.Instance().RuleActionsArray(u),$("#"+r).modal("hide"),$("#"+r).remove(),n.Platform.Automation.Components.Conditions.conditionArray=[]):(u.RuleId=eval("bizgaze_automation_flow_main.getruleid()"),i.Managers.RuleManager.Instance().saveRuleAction(u).then(function(t){if(t.status==n.Data.Status.Error)MessageHelper.Instance().showError(t.message,"Validate_PropertyChnageAction");else{MessageHelper.Instance().showSuccess(t.message,"Validate_PropertyChnageAction");$("#"+r).modal("hide");$("#"+r).remove();n.Platform.Automation.Components.Conditions.conditionArray=[];var i=t.result.RuleActionName;eval("bizgaze_automation_flow_main.savePropertyChangeblock('"+t.result.RuleActionId+"','"+i+"')")}})):(u.RuleId=n.Platform.Automation.Components.PropertyChange.Instance().RuleId,u.EventGroupId=n.Platform.Automation.Components.PropertyChange.Instance().EventGroupId,u.RuleEventId=n.Platform.Automation.Components.PropertyChange.Instance().RuleEventId,u.ActionId=n.Platform.Automation.Components.PropertyChange.Instance().ActionId,u.ParentActionId=n.Platform.Automation.Components.PropertyChange.Instance().ParentActionId,i.Managers.RuleManager.Instance().saveRuleAction(u).then(function(t){t.status==n.Data.Status.Error?MessageHelper.Instance().showError(t.message,"Validate_PropertyChnageAction"):(MessageHelper.Instance().showSuccess(t.message,"Validate_PropertyChnageAction"),$("#"+r).modal("hide"),$("#"+r).remove(),n.Platform.Automation.Components.Conditions.conditionArray=[])}))}static Instance(){return this.instance===undefined&&(this.instance=new u),this.instance}}r.PropertyChange=u})(r=i.Components||(i.Components={}))})(i=t.Automation||(t.Automation={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));
|