123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- var Unibase;
- (function (Unibase) {
- let Apps;
- (function (Apps) {
- let Automation;
- (function (Automation) {
- class RuleReConfigure extends Unibase.Platform.Core.BaseComponent {
- jsFiles() {
- return ["platform/tag/managers/tagmanager.js", "platform/apps/managers/appmanager.js", "apps/transact/managers/interfaces/automation/irulemanager.js", "apps/transact/managers/automation/rulemanager.js"];
- }
- cssFiles() {
- return [];
- }
- html(id, containerid) {
- var html = `<div class="b-b bg-white modal-header"><strong class="text-dark">Re-Configure</strong> </div>
- <div class="modal-body" id="CardViewer_modal">
- <div class="card">
- <div class="card-body" style="">
- <div class="row" id="div_Kanban">
- <div class="col-sm-2"><button type="button" class="btn btn-success" id="reconfigure">Re-Configure</button></div>
- </div>
- </div>
- </div>
- </div>
- <div class="bg-white modal-footer">
- <a class="btn btn-light btn-sm btn-center mr-auto" id="btnClose">Close</a>
- </div>`;
- return html;
- }
- load(id, containerid, callback) {
- $("#btnClose").click(function () {
- $('#' + containerid).modal('hide');
- $('#' + containerid).remove();
- });
- var instance = this;
- var appid = instance.appSettings.InstalledAppId;
- $("#reconfigure").click(function () {
- Unibase.Platform.Apps.Managers.AppManager.Instance().getInstallApp(appid).then(function (resu) {
- if (resu.result.AppTitle == "Credit Limit Rule") {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshCreditRule(0).then(function (res) {
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- });
- }
- else {
- if (resu.result.AppTitle == "Order Approval Rules") {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshcreditlimitrules("0", "OrderApproval Rule", 0).then(function (response) {
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- });
- }
- else if (resu.result.AppTitle == "Price Code Rules") {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshPriceCodeRule(0).then(function (res) {
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- });
- }
- else {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshcreditlimitrules("0", "PaymentTerm Rule", 0).then(function (res) {
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- });
- }
- }
- });
- });
- }
- refreshWidgets() {
- var Installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var ModalContainers = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds;
- var ContainerId = ModalContainers[ModalContainers.length - 1];
- Unibase.Themes.Compact.Components.Details.Instance().loadWidgets(Installedappid, Number($(".nav-link.active").find("#hf_PortletId").val()), "#" + ContainerId);
- var detailInstance = Unibase.Themes.Compact.Components.Details.Instance();
- var panel = "#" + detailInstance._containerId;
- var obj = Unibase.Themes.Compact.Components.Details.Instance();
- obj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
- obj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- detailInstance.loadAppDefaultWidget(obj, panel, detailInstance._containerId, function () {
- });
- }
- updatePriceCodeRuleContact(ContactDefaultId, ContactId, LobId, IsPriceCodeAutomated, IsPriceCodeExcluded) {
- let instance = this;
- let Msg = "";
- if (IsPriceCodeAutomated == 0) {
- Msg = "Do you really want to Delete Contact from this Rule ?";
- }
- else {
- if (!IsPriceCodeExcluded) {
- Msg = "Do you really want to Exclude Contact from this Rule ?";
- IsPriceCodeExcluded = true;
- }
- else {
- Msg = "Do you really want to Include Contact into this Rule ?";
- IsPriceCodeExcluded = false;
- }
- }
- bootbox.confirm(Msg, function (result) {
- if (result) {
- let PriceCodeRuleId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_pricecoderuleid"; })[0].Value;
- let PriceCodeId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_pricecodeid"; })[0].Value;
- let postData = {
- ContactDefaultId: ContactDefaultId,
- PriceCodeRuleId: PriceCodeRuleId,
- ContactIds: (ContactId).toString(),
- IsPriceCodeAutomated: IsPriceCodeAutomated,
- IsPriceCodeExcluded: IsPriceCodeExcluded,
- LobId: LobId,
- PriceCodeId: PriceCodeId,
- ContactId: Number(ContactId)
- };
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/transact/managers/interfaces/automation/irulemanager.js", "apps/transact/managers/automation/rulemanager.js"], function () {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().UpdatePriceCodeRuleContact(postData).then(function (res) {
- instance.refreshWidgets();
- });
- });
- }
- });
- }
- updateCreditLimitRuleContact(ContactDetailId, ContactId, CreditLimit, IsAutomated, IsExcluded) {
- let instance = this;
- let Msg = "";
- if (IsAutomated == 0) {
- Msg = "Do you really want to Delete Contact from this Rule ?";
- }
- else {
- if (!IsExcluded) {
- Msg = "Do you really want to Exclude Contact from this Rule ?";
- IsExcluded = true;
- }
- else {
- Msg = "Do you really want to Include Contact into this Rule ?";
- IsExcluded = false;
- }
- }
- bootbox.confirm(Msg, function (result) {
- if (result) {
- var CreditRuleId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_creditruleid"; })[0].Value;
- let postData = {
- ContactDetailId: ContactDetailId,
- CreditRuleId: CreditRuleId,
- ContactIds: ContactId.toString(),
- CreditLimit: CreditLimit,
- IsAutomated: IsAutomated,
- IsExcluded: IsExcluded,
- ContactId: Number(ContactId)
- };
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/transact/managers/interfaces/automation/irulemanager.js", "apps/transact/managers/automation/rulemanager.js"], function () {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().UpdateCreditLimitRuleContact(postData).then(function (res) {
- instance.refreshWidgets();
- });
- });
- }
- });
- }
- updatePaymentTermRuleContact(ContactDefaultId, ContactId, LobId, IsPaymentTermAutomated, IsPaymentTermExcluded) {
- let instance = this;
- let Msg = "";
- if (IsPaymentTermAutomated == 0) {
- Msg = "Do you really want to Delete Contact from this Rule ?";
- }
- else {
- if (!IsPaymentTermExcluded) {
- Msg = "Do you really want to Exclude Contact from this Rule ?";
- IsPaymentTermExcluded = true;
- }
- else {
- Msg = "Do you really want to Include Contact into this Rule ?";
- IsPaymentTermExcluded = false;
- }
- }
- bootbox.confirm(Msg, function (result) {
- if (result) {
- let PaymentTermRuleId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_paymenttermruleid"; })[0].Value;
- let PaymentTermId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_paymenttermid"; })[0].Value;
- let postData = {
- ContactDefaultId: ContactDefaultId,
- PaymentTermRuleId: PaymentTermRuleId,
- ContactIds: (ContactId).toString(),
- IsPaymentTermAutomated: IsPaymentTermAutomated,
- IsPaymentTermExcluded: IsPaymentTermExcluded,
- LobId: LobId,
- PaymentTermId: PaymentTermId,
- ContactId: Number(ContactId)
- };
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/transact/managers/interfaces/automation/irulemanager.js", "apps/transact/managers/automation/rulemanager.js"], function () {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().UpdatePaymentTermRuleContact(postData).then(function (res) {
- instance.refreshWidgets();
- });
- });
- }
- });
- }
- updateOrderApprovalRuleContact(ContactDefaultId, ContactId, LobId, IsOrderApprovalAutomated, IsOrderApprovalExcluded) {
- let instance = this;
- let Msg = "";
- if (IsOrderApprovalAutomated == 0) {
- Msg = "Do you really want to Delete Contact from this Rule ?";
- }
- else {
- if (!IsOrderApprovalExcluded) {
- Msg = "Do you really want to Exclude Contact from this Rule ?";
- IsOrderApprovalExcluded = true;
- }
- else {
- Msg = "Do you really want to Include Contact into this Rule ?";
- IsOrderApprovalExcluded = false;
- }
- }
- bootbox.confirm(Msg, function (result) {
- if (result) {
- let OrderApprovalRuleId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.filter(function (o) { return o.Key === "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_orderapprovalruleid"; })[0].Value;
- let postData = {
- ContactDefaultId: ContactDefaultId,
- OrderApprovalRuleId: OrderApprovalRuleId,
- ContactIds: (ContactId).toString(),
- IsOrderApprovalAutomated: IsOrderApprovalAutomated,
- IsOrderApprovalExcluded: IsOrderApprovalExcluded,
- LobId: 0,
- OrderApprovalId: 0,
- ContactId: Number(ContactId)
- };
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/transact/managers/interfaces/automation/irulemanager.js", "apps/transact/managers/automation/rulemanager.js"], function () {
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().UpdateOrderApprovalRuleContact(postData).then(function (res) {
- instance.refreshWidgets();
- });
- });
- }
- });
- }
- reconfigurePaymentTerm() {
- $(".li_DetailSetting_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_Re-Configure").click(function () {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/automation/rulemanager.js", function () {
- let pkid = Unibase.Themes.Providers.DetailHelper.recordId;
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshPaymentTermRule(pkid);
- });
- });
- }
- reconfigureOrderApprovalRule() {
- $(".li_DetailSetting_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_Re-Configure").click(function () {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/automation/rulemanager.js", function () {
- let pkid = Unibase.Themes.Providers.DetailHelper.recordId;
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshOrderApprovalRule(pkid);
- });
- });
- }
- reconfigureCreditLimitRule() {
- $(".li_DetailSetting_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_Re-Configure").click(function () {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/automation/rulemanager.js", function () {
- let pkid = Unibase.Themes.Providers.DetailHelper.recordId;
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshCreditRule(pkid);
- });
- });
- }
- reconfigurePriceCodeRule() {
- $(".li_DetailSetting_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_Re-Configure").click(function () {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/automation/rulemanager.js", function () {
- let pkid = Unibase.Themes.Providers.DetailHelper.recordId;
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshPriceCodeRule(pkid);
- });
- });
- }
- reconfigureSkuRecommendation() {
- $(".li_DetailSetting_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_Re-Configure").click(function () {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/automation/rulemanager.js", function () {
- let pkid = Unibase.Themes.Providers.DetailHelper.recordId;
- MessageHelper.Instance().showSuccess("We Will Notify Once The Process Is Done", '');
- Bizgaze.Apps.Transact.Managers.RuleManager.Instance().refreshSkuRecommendation(pkid);
- });
- });
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new RuleReConfigure();
- return this._instance;
- }
- }
- Automation.RuleReConfigure = RuleReConfigure;
- })(Automation = Apps.Automation || (Apps.Automation = {}));
- })(Apps = Unibase.Apps || (Unibase.Apps = {}));
- })(Unibase || (Unibase = {}));
|