var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Bizgaze; (function (Bizgaze) { let Apps; (function (Apps) { let CRM; (function (CRM) { let Controls; (function (Controls) { class BankBranchDetails extends Unibase.Platform.Core.BaseComponent { init(Id) { var instance = this; instance.fileCacheHelper.loadJsFile('apps/crm/companies/managers/companymanager.js', function () { Bizgaze.Apps.CRM.Companies.Managers.CompanyManager.Instance().getBankBranchDetails(Id).then(function (response) { var data = response; $(".labelSection_BankDetails").empty(); var html = '
Bank Details' + '
' + 'Bank Name : ' + response.result.BankName + '
' + 'IFSC : ' + response.result.IFSCCode + '
' + 'Branch Address : ' + response.result.BranchAddress + '
' + 'City Name : ' + response.result.CityName + '
' + '
'; $(".labelSection_BankDetails").append(html); }); }); } refreshportlets() { var instance = this; var _recordId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_recordid").Value); var detailobj = Unibase.Themes.Compact.Components.Details.Instance(); detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId; detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id"); var idetailObj = detailobj; detailobj.loadPortlets(idetailObj); } Validate() { var instance = this; var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; var newstageid = 0; var showindex; instance.fileCacheHelper.loadJsFile('tenants/themes/compact/components/details/details.js', function () { instance.fileCacheHelper.loadJsFile('apps/crm/contacts/managers/contactmanager.js', function () { Unibase.Platform.Apps.Managers.StageManager.Instance().getStages(InstalledAppId).then(function (response) { var index = 100; for (let x of response.result) { if (x.StageName == "Submitted to RM" || x.StageName == "LP Submitted to RM") { newstageid = x.StageId; } } var stagename = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_stagename").Value; if (stagename == "Customer Initiated" || stagename == "Contact Initiated") { $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForApproval").removeClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForLoyality").removeClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_UpgradetoE-Coupon").addClass('hidden'); } else if (stagename == "Contact Activated for LP") { $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForApproval").addClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForLoyality").addClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_UpgradetoE-Coupon").removeClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_UpgradetoE-Coupon").removeClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitforE-CouponAndLoyalty").addClass('hidden'); } else { $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForApproval").addClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitForLoyality").addClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_UpgradetoE-Coupon").addClass('hidden'); $("._bizgaze_detail_container:visible").find("#li_DetailSetting_" + InstalledAppId + "_SubmitforE-CouponAndLoyalty").addClass('hidden'); } var recordid = Unibase.Themes.Providers.DetailHelper.recordId; $("#DetailSetting_" + InstalledAppId + "_SubmitforE-CouponAndLoyalty").unbind().click(function () { var data = response; var stgeid = response.result.filter(function (o) { return o.StageName === "Documents Submited"; })[0].StageId; Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().contactsAddrNStageValidation(stgeid, recordid); }); $("#DetailSetting_" + InstalledAppId + "_UpgradetoE-Coupon").unbind().click(function () { var stgeid = response.result.filter(function (o) { return o.StageName === "Documents Submited"; })[0].StageId; Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().contactsAddrNStageValidation(stgeid, recordid); }); $("#DetailSetting_" + InstalledAppId + "_SubmitForApproval").unbind().click(function () { Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().addressvalidate(newstageid, recordid); }); $("#DetailSetting_" + InstalledAppId + "_SubmitForLoyality").unbind().click(function () { return __awaiter(this, void 0, void 0, function* () { var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId; yield Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().addressvalidate(newstageid, recordid); }); }); }); }); }); } contactstagechange(newstageid, installedappid) { return __awaiter(this, void 0, void 0, function* () { var instance = this; yield Unibase.Themes.Compact.Components.Details.Instance().changeStage(newstageid, installedappid); instance.navigationHelper.hideLoading(); }); } addressvalidate(stgeid, recordid) { debugger; var instance = this; Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().getAddressByContactId(recordid).then(function (res) { if (res.result != "") { Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().StageChange(stgeid); } else { bootbox.confirm({ message: "Please Create Address", closeButton: false, callback: function (result) { if (result) { } } }); } instance.navigationHelper.hideLoading(); }); } contactsAddrNStageValidation(stgeid, recordid) { Bizgaze.Apps.Crm.Contacts.Managers.ContactManager.Instance().getAddressByContactId(recordid).then(function (res) { if (res.result != "") { Bizgaze.Apps.CRM.Controls.BankBranchDetails.Instance().StageChangeByDocumentGroupValidation(stgeid); } else { bootbox.confirm({ message: "Please Create Address", closeButton: false, callback: function (result) { if (result) { } } }); } }); } ContactValidate() { var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; var newstageid = 0; var stagename = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_stagestatusname").Value; if (stagename == "Lead") { $(".li_DetailSetting_" + InstalledAppId + "_SubmitForApproval").removeClass('hidden'); } else { $(".li_DetailSetting_" + InstalledAppId + "_SubmitForApproval").addClass('hidden'); } } StageChange(stageid) { var instance = this; instance.fileCacheHelper.loadJsFile('platform/core/infos/status.js', function () { }); var recordid = Unibase.Themes.Providers.DetailHelper.recordId; var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId; debugger; instance.fileCacheHelper.loadJsFile('platform/files/managers/filemanager.js', function () { debugger; Unibase.Platform.Files.Managers.FileManager.Instance().validateDocument(recordid, installedappid).then(function (response) { if (response.status == Unibase.Data.Status.Error) { bootbox.confirm({ message: response.message, closeButton: false, callback: function (result) { if (result) { } } }); } else { instance.fileCacheHelper.loadJsFile('tenants/themes/compact/components/details/details.js', function () { Unibase.Themes.Compact.Components.Details.Instance().changeStage(stageid, installedappid); }); } }); }); } StageChangeByDocumentGroupValidation(stageid) { var instance = this; instance.fileCacheHelper.loadJsFile('platform/core/infos/status.js', function () { }); instance.fileCacheHelper.loadJsFile('platform/files/managers/filemanager.js', function () { debugger; var recordid = Unibase.Themes.Providers.DetailHelper.recordId; var installedappid = Unibase.Themes.Providers.DetailHelper.installedAppId; Unibase.Platform.Files.Managers.FileManager.Instance().validateDocumentByGroup(recordid, installedappid).then(function (response) { if (response.status == Unibase.Data.Status.Error) { var msg = response.message + " has files less than required count."; bootbox.confirm({ message: msg, closeButton: false, callback: function (result) { if (result) { } } }); } else { instance.fileCacheHelper.loadJsFile('tenants/themes/compact/components/details/details.js', function () { Unibase.Themes.Compact.Components.Details.Instance().changeStage(stageid, installedappid); }); } }); }); } static Instance() { if (this._instance === undefined) this._instance = new BankBranchDetails(); return this._instance; } } Controls.BankBranchDetails = BankBranchDetails; })(Controls = CRM.Controls || (CRM.Controls = {})); })(CRM = Apps.CRM || (Apps.CRM = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));