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 Transact; (function (Transact) { let Managers; (function (Managers) { class PriceListManager extends Unibase.Platform.Core.BaseManager { saveMrp(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/savemrp'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { return response; }); }); } getItem(itemid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/transact/items/getitem/itemid/' + itemid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } editMrp(MrpId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/getmrp/mrpid/' + MrpId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } exportList(PriceListId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelist/export/pricelistid/' + PriceListId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveBatch(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/savebatch'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { return response; }); }); } getbatch(batchid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelist/getbatch/batchid/' + batchid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result !== '') response.result = JSON.parse(response.result); return response; }); }); } getpricecodes(lobid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/pricecode/' + lobid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getPriceCodeByContact(ContactId, LobId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelist/getpricecodebycontact/contactid/' + ContactId + '/lobid/' + LobId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result != "") response.result = JSON.parse(response.result); return response; }); }); } getpricelists(pricelistid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/pricelist/' + pricelistid; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } postdatafilter(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/savepricelist'; return yield this.dataHelper().postAsync(url, request).then(function (response) { return response; }); }); } pricelistvalues(request) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/savepricevalues'; return yield this.dataHelper().postAsync(url, request).then(function (response) { Unibase.Apps.Transact.Controls.CreatePriceList.Instance().editPriceList(Number($("#gridPager2").find('.pagination').find(".active").text()) - 1, 2, ""); return response; }); }); } CreatePriceListItems(voucherid, contactid, page, searchtext) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/getpricelistitems/id/' + voucherid + '/page/' + page + '/rows/10/query/' + searchtext; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result != "") response.result = JSON.parse(response.result); return response; }); }); } EditPriceListItems(voucherid, contactid, page, searchtext) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/pricelistitems/id/' + voucherid + '/page/' + page + '/rows/10/query/' + searchtext; return yield this.dataHelper().getAsync(url).then(function (response) { return response; }); }); } getlobs(ContactId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/automationrules/getruleautotaggroups/' + ContactId; return yield this.dataHelper().getAsync(url).then(function (response) { return JSON.parse(response.result); }); }); } saveContactDefault(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelists/contactdefault'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { return response; }); }); } getPriceValue(itemid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/bizgaze/transact/pricelist/getlatestpricevalue/itemid/' + itemid + '/mrpid/0/lobid/0'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result !== '') response.result = JSON.parse(response.result); return response; }); }); } static Instance() { if (this._instance === undefined) this._instance = new Bizgaze.Apps.Transact.Managers.PriceListManager(); return this._instance; } } Managers.PriceListManager = PriceListManager; })(Managers = Transact.Managers || (Transact.Managers = {})); })(Transact = Apps.Transact || (Apps.Transact = {})); })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {})); })(Bizgaze || (Bizgaze = {}));