123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- 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 = {}));
|