var Bizgaze; (function (Bizgaze) { let Apps; (function (Apps) { let Transact; (function (Transact) { let Components; (function (Components) { let Offers; (function (Offers) { class ChangeOfferstatus extends Unibase.Platform.Core.BaseComponent { cssFiles() { throw new Error("Method not implemented."); } jsFiles() { return ['apps/transact/managers/offers/offermanager.js', 'apps/transact/components/offers/changeofferstatus.js']; } html(id, containerid) { throw new Error("Method not implemented."); } load(id, containerid, callback) { throw new Error("Method not implemented."); } init() { } changeofferstatus(offerid, statusid) { var instance = this; if (statusid == 2) var msg = "Are you sure you want to De-Activate ?"; else var msg = "Are you sure you want to Activate ?"; bootbox.confirm({ message: msg, closeButton: false, buttons: { confirm: { label: 'Yes', className: 'btn-success' }, cancel: { label: 'No', className: 'btn-danger' } }, callback: function (result) { if (result) { var Status = ""; var Statusid; if (statusid == 2) { Status = "Activate"; Statusid = 2; $("#Id_" + offerid + "").removeClass('text-danger'); $("#Id_" + offerid + "").addClass('text-success'); } else { Status = "activate"; Statusid = 1; $("#Id_" + offerid + "").removeClass('text-success'); $("#Id_" + offerid + "").addClass('text-danger'); } var _recordId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_recordid").Value); var postdata = { offerid, Statusid, }; instance.fileCacheHelper.loadJsFile('apps/transact/managers/offers/offermanager.js', function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().ChangeOfferStatus(postdata).then(function (response) { if (response.status == Unibase.Data.Status.Success) { var obj = Unibase.Themes.Compact.Components.Details.Instance(); obj._recordId = _recordId; var _installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; var containerid = $("._bizgaze_detail_container:visible").attr("id"); Unibase.Platform.Helpers.NavigationHelper.Instance().close(containerid, null); instance.navigationHelper.loadDetail(_recordId, _installedAppId, null); MessageHelper.Instance().showSuccess(response.message, ""); } else { } }); }); } } }); } gettabscheme(planid, actualvalue, tabpercent, target, incidentpercent, incidents) { var instance = this; instance.fileCacheHelper.loadJsFile('apps/transact/managers/offers/offermanager.js', function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().gettabsachemedata(planid).then(function (response) { var amount = response.result; var amt = (amount / 100000).toFixed(3); $(actualvalue).val(amt); $(actualvalue).attr("disabled", "disabled"); $(tabpercent).change(function () { var tabpercentage = Number($(tabpercent).val()); var targetvalue = ((amount * (tabpercentage / 100)) / 100000).toFixed(3); var targetamount = Number(targetvalue); $(target).val(targetvalue); $(target).attr("disabled", "disabled"); $(incidentpercent).change(function () { var incidentpercentagevalue = Number($(incidentpercent).val()); var incidensvalue = (targetamount * (incidentpercentagevalue / 100)).toFixed(3); $(incidents).val(incidensvalue); $(incidents).attr("disabled", "disabled"); }); }); }); }); } changeplanstatus(containerid) { var instance = this; var postdata = []; $(`#${containerid}`).find(".Offer_Plan_Checked").each(function () { postdata.push({ OfferId: Number($(this).attr("id")), PlanId: Number($(this).attr("value")), Planstatus: $(this).is(":checked"), }); }); instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) { if (response.errors == null) { MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully'); } else { MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed'); } }); }); } ActiveAllPlans() { var instance = this; var postdata = []; $(".Offer_Plan_Checked").each(function () { postdata.push({ OfferId: Number($(this).attr("id")), PlanId: Number($(this).attr("value")), Planstatus: 1, }); }); if (postdata.length > 0) { bootbox.confirm("Are you sure you want Activate All Plans ?", function (result) { if (result == true) { instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) { if (response.errors == null) { var detail_instance = Unibase.Themes.Compact.Components.Details.Instance(); Unibase.Themes.Compact.Components.Details.Instance().loadPortlets(detail_instance); MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully'); } else { MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed'); } }); }); } }); } } InactiveAllPlans() { var instance = this; var postdata = []; $(".Offer_Plan_Checked").each(function () { postdata.push({ OfferId: Number($(this).attr("id")), PlanId: Number($(this).attr("value")), Planstatus: 2, }); }); if (postdata.length > 0) { bootbox.confirm("Are you sure you want In-Active All Plans ?", function (result) { if (result == true) { instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().changeplanstatus(postdata).then(function (response) { if (response.errors == null) { var detail_instance = Unibase.Themes.Compact.Components.Details.Instance(); Unibase.Themes.Compact.Components.Details.Instance().loadPortlets(detail_instance); MessageHelper.Instance().showSuccess(response.message, 'Plan Status Updated Successfully'); } else { MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed'); } }); }); } }); } } updateplanstatus(planid) { var instance = this; instance.fileCacheHelper.loadJsFile("apps/transact/managers/offers/offermanager.js", function () { Bizgaze.Apps.Transact.Managers.OfferManager.Instance().updateplanstatus(planid).then(function (response) { if (response.errors == null) { MessageHelper.Instance().showSuccess(response.message, ''); } else { MessageHelper.Instance().showError(response.message, 'Plan Status Updated Failed'); } }); }); } static Instance() { if (this._instance === undefined) this._instance = new ChangeOfferstatus(); return this._instance; } } Offers.ChangeOfferstatus = ChangeOfferstatus; })(Offers = Components.Offers || (Components.Offers = {})); })(Components = Transact.Components || (Transact.Components = {})); })(Transact = Apps.Transact || (Apps.Transact = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));