Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

customizedproduct.js 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. var Bizgaze;
  2. (function (Bizgaze) {
  3. let Apps;
  4. (function (Apps) {
  5. let Transact;
  6. (function (Transact) {
  7. let Controls;
  8. (function (Controls) {
  9. class CustomizedProducts extends Unibase.Platform.Core.BaseComponent {
  10. constructor() {
  11. super(...arguments);
  12. this.g_LoadedCPItems = [];
  13. this.g_SelectedItems = [];
  14. this.g_ParentItemId = 0;
  15. }
  16. init(formpropertyid, prop, callback) {
  17. }
  18. loadControl(containerid, prop) { }
  19. loadControlSettings(controlsettingjson, formpropertyid) { }
  20. loadPropertySettings(propertysettings, formpropertyid) { }
  21. bindEditFormDetails(formpropertyid, propval, DocPropertyName) { }
  22. loadCPModal(response) {
  23. let instance = this;
  24. let jsFiles = ["bundle/index.order.component.js"];
  25. instance.fileCacheHelper.loadJsFiles(jsFiles, function () {
  26. instance.fileCacheHelper.addCacheFiles(["apps/transact/infos/orders/orderitem.js", "apps/transact/controls/orders/order.component.js", "apps/transact/controls/orders/orderitems.component.js"]);
  27. instance._order = Bizgaze.Apps.Transact.Controls.Order.Instance();
  28. instance._orderItems = Bizgaze.Apps.Transact.Controls.OrderItems.Instance();
  29. instance._cartDetails = Bizgaze.Apps.Transact.Controls.CartDetails.Instance();
  30. });
  31. instance.resetAllVariables();
  32. let ModalHtml = `<div class="modal fade" id="CustomizedProductModal" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true">
  33. <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
  34. <div class="modal-content rounded-10 text-center bg-white">
  35. <div class="modal-header" style="border-style: dashed;">
  36. <h5 class="modal-title ml-auto"> Customized Products </h5>
  37. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  38. <span aria-hidden="true" class="badge badge-soft-danger font-20 rounded-circle pb-2 px-2">×</span>
  39. </button>
  40. </div>
  41. <div class="modal-body product_body customized_product_body text-center pb-30 biz-custom-scrollbar h-500p"> </div>
  42. <div class="modal-footer custmized_product_footer">
  43. <button class="btn btn-success confirm_btn" onclick="Bizgaze.Apps.Transact.Controls.CustomizedProducts.Instance().confirmCP()">Confirm </button>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>`;
  49. $("#_bizgaze_modal").html(ModalHtml);
  50. $('#CustomizedProductModal').modal();
  51. let data = response.result;
  52. instance.g_LoadedCPItems = data;
  53. instance.g_LoadedCPItems.forEach(x => {
  54. let LoadedItem_Index = instance._orderItems.g_LoadedItems.findIndex(z => z.ItemId == x.ChildItemId);
  55. if (LoadedItem_Index == -1) {
  56. instance._orderItems.g_LoadedItems.push(x);
  57. }
  58. });
  59. if (response.result.length != 0) {
  60. for (let i = 0; i < data.length; i++) {
  61. let products = data[i];
  62. let RowId = products.ChildItemId;
  63. let MinLimit = products.Minlimit;
  64. let MaxLimit = products.Maxlimit;
  65. let DefName = products.DefinitionName;
  66. let DefId = products.DefinitionId;
  67. let IsRequired = products.IsRequired ? 1 : 0;
  68. let ItemName = products.ItemName;
  69. let SKU = products.SKU;
  70. let ItemId = products.ChildItemId;
  71. let ParentItemId = products.ItemId;
  72. let Qty = products.Qty;
  73. let UnitPrice = products.UnitPrice;
  74. let valNew = Qty.split(',');
  75. instance.g_ParentItemId = ParentItemId;
  76. if ($("#CustomizedProductModal").find('.div_definition_' + DefId).length == 0) {
  77. let sno = 1;
  78. $('.card-count').each(function () {
  79. sno++;
  80. });
  81. let diverror = `<div class="def_errormsg" id="def_errormsg"></div>`;
  82. $(".product_body").append(diverror);
  83. let structure = `<div class="div_definition div_definition_` + DefId + ` bg-charcoal-light-5 rounded-0 card card-count">
  84. <input type="hidden" id="hf_minlimit" value=` + MinLimit + `>
  85. <input type="hidden" id="hf_maxlimit" value=` + MaxLimit + `>
  86. <input type="hidden" id="hf_defid" value=` + DefId + `>
  87. <input type="hidden" id="hf_typeid" value=` + products.Type + `>
  88. <input type="hidden" id="hf_isrequired" value=` + IsRequired + `>
  89. <input type="hidden" id="hf_defname" value=` + DefName + `>
  90. <input type="hidden" id="hf_iserror" class="hf_iserror" value="0">
  91. <input type="hidden" id="hf_errormsg" class="hf_errormsg" value="">
  92. <div class="card-header text-left d-flex pr-0">
  93. <div class="row col-sm-12 pr-0">
  94. <div class="col-sm-10 mt-10">
  95. <div class="row">
  96. <h4 class="list-item-main-title border-right card-header-s-no px-2">` + sno + `</h4>
  97. <h4 class="list-item-main-title px-2 cp_categoryName_` + DefId + `">` + DefName + `</h4>
  98. <span class="d-none text-danger Cmp__isrequired">*</span>
  99. </div>
  100. </div>
  101. <div class="col-sm-2 pull-right pr-0">
  102. <small class="text-danger Cmp__minlimit text-dark"> Min Limit - ` + MinLimit + `</small> <br>
  103. <small class="text-danger Cmp__maxlimit text-dark"> Max Limit - ` + MaxLimit + `</small> <br>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="card-body card_body pt-0 pb-2 bg-white card_body_` + DefId + `">
  108. <ul class="Cmp__Desc"></ul> <ul class="Cmp__item"></ul>
  109. </div>
  110. </div>`;
  111. $(".product_body").append(structure);
  112. }
  113. if (products.IsRequired == true) {
  114. $('.Cmp__isrequired').removeClass('d-none');
  115. }
  116. if (products.Type == 1) {
  117. let CmpDesc = $(`.card_body_` + DefId + ``).find('.Cmp__description');
  118. let radio = `<div class="form-check">
  119. <input class="form-check-input Cmp__radio Cmp__radio_` + DefId + `_` + RowId + `" type="radio" name="Cmp__radio" id="Cmp__radio_` + RowId + `" value="option_` + RowId + `" style="transform: scale(1.3);" >
  120. <label class="form-check-label" for="Cmp__radio_` + RowId + `"></label>
  121. </div>`;
  122. let structurebody = `<li class="d-flex align-items-center justify-content-between mt-2 px-2 def_body_` + DefId + `" id="def_body_` + DefId + `_` + RowId + `">
  123. <input type="hidden" id="hf_itemid" value=` + ItemId + `>
  124. <input type="hidden" id="hf_parentitemid" value=` + ParentItemId + `>
  125. <input type="hidden" id="hf_rowid" value=` + RowId + `>
  126. <div class="col-6 p-0 text-left">
  127. <p>` + ItemName + ` (` + SKU + `) </p>
  128. </div>
  129. <div class="col-2 p-0 text-right">
  130. <p> &#8377;` + UnitPrice + `</p>
  131. </div>
  132. <div class="col-2 p-0 text-right">` + radio + `</div>
  133. </li>`;
  134. $(`.card_body_` + DefId + ``).find(".Cmp__item").append(structurebody);
  135. if (CmpDesc.length == 0) {
  136. $(`.card_body_` + DefId + ``).find(".Cmp__Desc").append(`<div class="Cmp__description px-2 mt-2 text-left"> Description </div>`);
  137. }
  138. }
  139. else if (products.Type == 2) {
  140. let CmpDesc = $(`.card_body_` + DefId + ``).find('.Cmp__description');
  141. let structurebody = `<li class="d-flex align-items-center justify-content-between mt-2 px-2 def_body_` + DefId + `" id="def_body_` + DefId + `_` + RowId + `">
  142. <input type="hidden" id="hf_itemid" value=` + ItemId + `>
  143. <input type="hidden" id="hf_parentitemid" value=` + ParentItemId + `>
  144. <input type="hidden" id="hf_rowid" value=` + RowId + `>
  145. <div class="col-6 p-0 text-left">
  146. <p>` + ItemName + ` (` + SKU + `) </p>
  147. </div>
  148. <div class="col-2 p-0 text-right">
  149. <p> &#8377;` + UnitPrice + `</p>
  150. </div>
  151. <div class="col-2 p-0 text-right">
  152. <select class="Cmp__select rounded p-1 w-65p Cmp__select_` + DefId + `_` + RowId + `" id="` + RowId + `"
  153. </select>
  154. </div>
  155. </li> `;
  156. $(`.card_body_` + DefId + ``).find(".Cmp__item").append(structurebody);
  157. let count = 0;
  158. $('<option>').val(count).text(0).appendTo(`.Cmp__select_` + DefId + `_` + RowId + ``);
  159. for (let q = 0; q < valNew.length; q++) {
  160. let qData = valNew[q].replace(/ /g, '');
  161. $('<option>').val(qData).text(qData).appendTo(`.Cmp__select_` + DefId + `_` + RowId + ``);
  162. count++;
  163. }
  164. if (CmpDesc.length == 0) {
  165. $(`.card_body_` + DefId + ``).find(".Cmp__Desc").append(`<div class="Cmp__description px-2 mt-2 text-left">Description</div>`);
  166. }
  167. }
  168. instance.bindAllItemEvents(DefId, RowId);
  169. }
  170. let CartItems = instance._orderItems.g_CartItems_New.filter(x => x.ParentItemId == instance.g_ParentItemId);
  171. if (CartItems.length > 0) {
  172. instance.bindCPDetails();
  173. }
  174. }
  175. }
  176. resetAllVariables() {
  177. let instance = this;
  178. instance.g_SelectedItems = [];
  179. instance.g_LoadedCPItems = [];
  180. instance.g_ParentItemId = 0;
  181. instance._cartDetails.g_Categories = [];
  182. }
  183. bindAllItemEvents(DefinitionId, RowId) {
  184. let instance = this;
  185. let elem = $(".div_definition_" + DefinitionId);
  186. let MinLimit = Number($(elem).find("#hf_minlimit").val());
  187. let MaxLimit = Number($(elem).find("#hf_maxlimit").val());
  188. let DefName = $(elem).find("#hf_defname").val();
  189. $(".Cmp__select_" + DefinitionId + "_" + RowId).change(function () {
  190. let select_elem = $("#def_body_" + DefinitionId + "_" + RowId);
  191. let ItemId = Number($(select_elem).find("#hf_itemid").val());
  192. let Qty = Number($(this).val());
  193. instance.modifyItem(DefinitionId, ItemId, Qty);
  194. });
  195. $(".Cmp__radio_" + DefinitionId + "_" + RowId).click(function () {
  196. let select_elem = $("#def_body_" + DefinitionId + "_" + RowId);
  197. let ItemId = Number($(select_elem).find("#hf_itemid").val());
  198. let Qty = 1;
  199. instance.modifyItem(DefinitionId, ItemId, Qty);
  200. });
  201. instance.checkValidations(0);
  202. }
  203. modifyItem(DefId, ItemId, Qty) {
  204. let instance = this;
  205. let ItemIndex = instance.g_LoadedCPItems.findIndex(x => x.ChildItemId == ItemId);
  206. if (ItemIndex == -1) {
  207. return false;
  208. }
  209. let Item = instance.g_LoadedCPItems[ItemIndex];
  210. let ParentItemId = Item.ItemId;
  211. let Quantity = Qty;
  212. let onlyPacks = parseInt((Number(Quantity) / Number(Item.PackCount * Item.PackSize)).toString());
  213. let remainingQty = Quantity - (onlyPacks * Item.PackCount * Item.PackSize);
  214. let onlyPieces = remainingQty / Item.PackSize;
  215. let Packs = Number(onlyPacks);
  216. let Pieces = Number(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(onlyPieces, 2));
  217. let CategoryName = $(".cp_categoryName_" + DefId).text();
  218. let TypeId = Number($(".div_definition_" + DefId).find("#hf_typeid").val());
  219. let RowId = Number($(".div_definition_" + DefId).find("#hf_rowid").val());
  220. let ItemData = {
  221. OrderItemId: 0,
  222. ItemIndex: 0,
  223. TypeId: TypeId,
  224. DefId: DefId,
  225. RowId: RowId,
  226. ItemId: ItemId,
  227. ParentItemId: ParentItemId,
  228. HSNId: Item.HSNId,
  229. ItemName: Item.ItemName,
  230. Packs: Packs,
  231. Pieces: Pieces,
  232. PriceListId: Item.PriceListId,
  233. PriceListName: Item.PriceListName,
  234. UnitPrice: Item.UnitPrice,
  235. UnitPriceWithOutTax: 0,
  236. ExpectedPrice: Item.UnitPrice,
  237. ActualPrice: Item.UnitPrice,
  238. PackCount: Item.PackCount,
  239. PackSize: Item.PackSize,
  240. UnitName: Item.UnitName,
  241. Quantity: Quantity,
  242. SKU: Item.SKU,
  243. PartNo: Item.PartNo,
  244. Amount: Quantity * Item.UnitPrice,
  245. AmountWithDiscount: Quantity * Item.UnitPrice,
  246. DiscountPercent: 0,
  247. DiscountValue: 0,
  248. DiscountType: 0,
  249. DiscountAmount: 0,
  250. ItemValueAfterDiscount: 0,
  251. StrTaxPercents: null,
  252. AvailableQuantity: Item.AvailableQuantity,
  253. AvailablePacks: Item.AvailablePacks,
  254. AvailablePieces: Item.AvailablePieces,
  255. TotalAvailablePieces: 0,
  256. ExchangeDC: false,
  257. IsAfterTax: false,
  258. BaseQty: Quantity,
  259. IsFocItem: false,
  260. optoutAmount: 0,
  261. TaxGroupId: Item.TaxGroupId,
  262. TaxGroupName: Item.TaxGroupName,
  263. TaxAmount: 0,
  264. TaxRateAmount: 0,
  265. TaxRate: 0,
  266. TaxPercentage: 0,
  267. IsOfferAvailable: false,
  268. Description: "",
  269. Discountable: false,
  270. PiecePrice: 0,
  271. CompositePrice: 0,
  272. CompositePiecePrice: 0,
  273. IsCheckPendingItems: false,
  274. IsError: false,
  275. ErrorMsg: "",
  276. ErrorClass: "text-danger",
  277. IsTaxError: false,
  278. IsLeverageError: false,
  279. IsFocAdded: false,
  280. RefOrderItemId: 0,
  281. RefItemIds: "",
  282. RefItemSKUs: "",
  283. FocItemIds: "",
  284. DiscountGroupId: 0,
  285. IsOfferDiscountApplied: false,
  286. AppliedOfferVolume: 0,
  287. AppliedPlanVolumeId: 0,
  288. AppliedOfferId: 0,
  289. optoutOfferGroupId: 0,
  290. SuggestedPacks: 0,
  291. MinPacks: 0,
  292. AvgPacks: 0,
  293. InwardOrderPacks: 0,
  294. OutwardOrderPacks: 0,
  295. IsManualUOM: false,
  296. UOMs: [],
  297. IsMultipleUOMs: false,
  298. UOMSchemaId: 0,
  299. MultipleUOMs: [],
  300. SelectedUnitId: 0,
  301. SelectedUnitName: "",
  302. DefaultSize: 0,
  303. IsBoMAvailable: false,
  304. IsSpecialPrice: false,
  305. ConversionQuantity: 0,
  306. RowTotal: Item.UnitPrice * Qty,
  307. RowDiscount: 0,
  308. TaxTotal: 0,
  309. IsPacksFocus: false,
  310. IsPiecesFocus: false,
  311. CategoryName: CategoryName
  312. };
  313. let SelectedItemIndex = instance.g_SelectedItems.findIndex(x => x.ItemId == ItemId && x.DefId == DefId);
  314. if (TypeId == 1) {
  315. SelectedItemIndex = instance.g_SelectedItems.findIndex(x => x.DefId == DefId);
  316. }
  317. if (SelectedItemIndex != -1) {
  318. if (Qty == 0) {
  319. instance.g_SelectedItems.splice(SelectedItemIndex, 1);
  320. }
  321. else {
  322. instance.g_SelectedItems[SelectedItemIndex] = ItemData;
  323. }
  324. }
  325. else {
  326. instance.g_SelectedItems.push(ItemData);
  327. }
  328. instance.checkValidations(DefId);
  329. }
  330. bindCPDetails() {
  331. let instance = this;
  332. let ParentItemId = instance.g_ParentItemId;
  333. let CartItems = instance._orderItems.g_CartItems_New;
  334. let PresentCartCPItems = CartItems.filter(x => x.ParentItemId == ParentItemId);
  335. for (let i = 0; i < PresentCartCPItems.length; i++) {
  336. let CartItem = PresentCartCPItems[i];
  337. let ItemId = CartItem.ItemId;
  338. let TypeId = CartItem.TypeId;
  339. let RowId = CartItem.ItemId;
  340. let DefId = CartItem.DefId;
  341. let Qty = CartItem.Quantity;
  342. if (TypeId == 1) {
  343. $(".Cmp__radio_" + DefId + "_" + RowId).prop("checked", "true");
  344. }
  345. else if (TypeId == 2) {
  346. $(".Cmp__select_" + DefId + "_" + RowId).val(Qty);
  347. }
  348. instance.modifyItem(DefId, ItemId, Qty);
  349. }
  350. instance.checkValidations(0);
  351. }
  352. confirmCP() {
  353. let instance = this;
  354. instance._orderItems.g_IsCategory = true;
  355. let ParentItemId = instance.g_ParentItemId;
  356. let CartItems = instance._orderItems.g_CartItems_New;
  357. let PresentCartCPItems = CartItems.filter(x => x.ParentItemId == ParentItemId);
  358. PresentCartCPItems.forEach(x => {
  359. let CartItems = instance._orderItems.g_CartItems_New;
  360. let SelectedItmIndex = instance.g_SelectedItems.findIndex(y => y.ItemId == x.ItemId && y.ParentItemId == ParentItemId);
  361. if (SelectedItmIndex == -1) {
  362. let CartIndex = CartItems.findIndex(z => z.ItemId == x.ItemId && z.ParentItemId == ParentItemId);
  363. instance._orderItems.g_CartItems_New.splice(CartIndex, 1);
  364. instance._orderItems.deleteCartItems(x.ItemId);
  365. }
  366. });
  367. for (let i = 0; i < instance.g_SelectedItems.length; i++) {
  368. let SelectedItem = instance.g_SelectedItems[i];
  369. let ItemId = SelectedItem.ItemId;
  370. let DefId = SelectedItem.DefId;
  371. let TypeId = SelectedItem.TypeId;
  372. let CartItemIndex = CartItems.findIndex(x => x.ItemId == ItemId && x.DefId == DefId);
  373. if (TypeId == 1) {
  374. CartItemIndex = CartItems.findIndex(x => x.DefId == DefId);
  375. }
  376. if (CartItemIndex != -1) {
  377. instance._orderItems.g_CartItems_New[CartItemIndex] = SelectedItem;
  378. let elem = $(".cartitem-" + ItemId);
  379. instance._orderItems.updateItemsDesign(elem, "CP", true, false);
  380. }
  381. else {
  382. instance._orderItems.g_CartItems_New.push(SelectedItem);
  383. instance._orderItems.addCartItem(ItemId, false);
  384. }
  385. }
  386. $("#CustomizedProductModal").modal("hide");
  387. }
  388. getNewRowId() {
  389. let text = "";
  390. let possible = "0123456789";
  391. for (let i = 0; i < 5; i++)
  392. text += possible.charAt(Math.floor(Math.random() * possible.length));
  393. return Number(text);
  394. }
  395. getDefinitionTotal(DefinitionId) {
  396. let Total = 0;
  397. $(".def_body_" + DefinitionId).each(function () {
  398. let TypeId = Number($(".div_definition_" + DefinitionId).find("#hf_typeid").val());
  399. if (TypeId == 1) {
  400. let isChecked = $(".def_body_" + DefinitionId + " [name='Cmp__radio']").is(':checked');
  401. if (isChecked) {
  402. let MinLimit = Number($(".div_definition_" + DefinitionId).find("#hf_minlimit").val());
  403. Total = Total + MinLimit;
  404. }
  405. }
  406. else if (TypeId == 2) {
  407. Total = Total + Number($(this).find(".Cmp__select option:selected").val());
  408. }
  409. });
  410. return Total;
  411. }
  412. checkValidations(DefinitionId) {
  413. let instance = this;
  414. if (DefinitionId == 0) {
  415. $(".div_definition").each(function () {
  416. let elem = $(this);
  417. let DefId = Number($(elem).find("#hf_defid").val());
  418. instance.checkDefinitionValidation(DefId);
  419. });
  420. }
  421. else {
  422. instance.checkDefinitionValidation(DefinitionId);
  423. }
  424. let ErrorCartItems = $(".hf_iserror[value='1']");
  425. if (ErrorCartItems.length == 0) {
  426. instance.enableConfirm();
  427. for (let i = 0; i < ErrorCartItems.length; i++) {
  428. let DefinitionId = ErrorCartItems[i].DefId;
  429. $(".div_definition_" + DefinitionId).find(".card-header").removeAttr("style");
  430. $(".def_body_" + DefinitionId).find(".Cmp__select").removeAttr("disabled");
  431. }
  432. }
  433. else {
  434. instance.disableConfirm();
  435. }
  436. }
  437. checkDefinitionValidation(DefId) {
  438. let instance = this;
  439. let elem = $(".div_definition_" + DefId);
  440. let MinLimit = Number($(elem).find("#hf_minlimit").val());
  441. let MaxLimit = Number($(elem).find("#hf_maxlimit").val());
  442. let DefName = $(elem).find("#hf_defname").val();
  443. let TypeId = Number($(elem).find("#hf_typeid").val());
  444. let IsRequired = Boolean(Number($(elem).find("#hf_isrequired").val()));
  445. let IsError = $(elem).find("#hf_iserror").val();
  446. let ErrorMsg = $(elem).find("#hf_errormsg").val();
  447. let DefTotal = instance.getDefinitionTotal(DefId);
  448. $(elem).find("#hf_iserror").val(0);
  449. $(elem).find("#hf_errormsg").val("");
  450. $(elem).find(".card-header").find(".Cmp__maxlimit, .Cmp__minlimit").removeClass("text-danger").addClass("text-dark");
  451. if (DefTotal < MinLimit && IsRequired) {
  452. $(".div_definition_" + DefId).find(".card-header").find(".Cmp__minlimit").removeClass("text-dark").addClass("text-danger");
  453. $(elem).find("#hf_iserror").val(1);
  454. $(elem).find("#hf_errormsg").val(" '" + DefName + "' - Min Limit " + MinLimit + " ");
  455. instance.disableConfirm();
  456. }
  457. if (DefTotal > MaxLimit && TypeId == 2) {
  458. MessageHelper.Instance().showError(" '" + DefName + "' - Max Limit " + MaxLimit + " Exceeded", "def_errormsg");
  459. $(".div_definition_" + DefId).find(".card-header").find(".Cmp__maxlimit").removeClass("text-dark").addClass("text-danger");
  460. $(elem).find("#hf_iserror").val(1);
  461. $(elem).find("#hf_errormsg").val(" '" + DefName + "' - Max Limit " + MaxLimit + " Exceeded");
  462. instance.disableConfirm();
  463. }
  464. else {
  465. if (DefTotal == MaxLimit) {
  466. $(".def_body_" + DefId).find(".Cmp__select").each(function () {
  467. let Selectedval = $(this).val();
  468. if (Selectedval == 0) {
  469. $(this).attr("disabled", "disabled");
  470. }
  471. });
  472. }
  473. else {
  474. $(".def_body_" + DefId).find(".Cmp__select").removeAttr("disabled");
  475. }
  476. }
  477. }
  478. disableConfirm() {
  479. $(".confirm_btn").attr("disabled", "disabled");
  480. }
  481. enableConfirm() {
  482. $(".confirm_btn").removeAttr("disabled");
  483. }
  484. static Instance() {
  485. if (this.instance === undefined) {
  486. this.instance = new CustomizedProducts();
  487. }
  488. return this.instance;
  489. }
  490. }
  491. Controls.CustomizedProducts = CustomizedProducts;
  492. })(Controls = Transact.Controls || (Transact.Controls = {}));
  493. })(Transact = Apps.Transact || (Apps.Transact = {}));
  494. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  495. })(Bizgaze || (Bizgaze = {}));