Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

eb.component.js 31KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  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 Eb extends Unibase.Platform.Core.BaseComponent {
  10. constructor() {
  11. super(...arguments);
  12. this.ebcontainer = "";
  13. this.deleted_EBs = new Array();
  14. this.itemIds = new Array();
  15. }
  16. init(formpropertyid, prop, callback) {
  17. let instance = this;
  18. let jsFiles = ["apps/transact/controls/invoices/invoiceitem.component.js", "apps/crm/contacts/managers/contactmanager.js", "apps/transact/managers/invoicemanager.js", "platform/core/helpers/numberhelper/numberhelper.js", "libs/jquery/pagination/jquery.pagination.js"];
  19. instance.fileCacheHelper.loadJsFiles(jsFiles, function () {
  20. instance._invoiceItems = Bizgaze.Apps.Transact.Controls.InvoiceItem.Instance();
  21. instance.deleted_EBs = [];
  22. instance.itemIds = [];
  23. instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
  24. instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
  25. });
  26. }
  27. loadControl(containerid, prop) {
  28. var instance = this;
  29. let html = `<div class="form-group EBContainer m-t" id="divEBs">
  30. <div class="m-l m-r">
  31. <div class="EB_header row bg-white border-2 border-bottom border-grey mx-0 py-10">
  32. <div class="col-sm-7 text-left font-weight-600">EB Name</div>
  33. <div class="col-sm-3 text-center font-weight-600">Fill Type</div>
  34. <div class="col-sm-2 text-right font-weight-600">Volume</div></div></div></div>
  35. <div class="EB-row hidden"></div>
  36. <div class="col-xs-6 m-l m-r">
  37. <input type = "hidden" id = "hdn_customcontrol" class="value-control" value = "Bizgaze.Apps.Transact.Controls.Eb.Instance().getEbItems();">
  38. <a id="addEBrow" href="javascript: Bizgaze.Apps.Transact.Controls.Eb.Instance().addEBDatarow();" class="btn btn-outline-primary" title="Add EB">Add EB</a>
  39. </div></div></div>`;
  40. $("#" + containerid).html(html);
  41. instance.ebcontainer = containerid;
  42. }
  43. loadControlSettings(controlsettingjson, formpropertyid) {
  44. var instance = this;
  45. instance.loadEBs();
  46. }
  47. loadPropertySettings(propertysettings, formpropertyid) {
  48. return null;
  49. }
  50. bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
  51. return null;
  52. }
  53. getEbItems() {
  54. var instance = this;
  55. var EBs = instance.getEBs();
  56. return EBs;
  57. }
  58. addEBDatarow() {
  59. var instance = this;
  60. $('.divDescriptionDetails').addClass('hidden');
  61. instance.addEBRow(0, 0, 0, "", 0.0, 0, 1, "", null);
  62. }
  63. addEBRow(orderId, EBId, EBContactId, EBName, volume, InvoiceId, FillType, Notes, EBItemList) {
  64. var instance = this;
  65. var padding = "";
  66. if (EBId) {
  67. padding = "m-t";
  68. }
  69. var html = '<div class="form-group EB-row addedEB-row">' +
  70. '<div class="row mx-0 EBdata"><div class="EB-Name col-sm-7 d-flex align-items-center ' + padding + '">' +
  71. '<a class="input-group-addon no-border EBdelete" href="javascript:;" title="Remove row"><i class="fa fa-trash-o fa-lg mr-2 text-danger delete" aria-hidden="true"></i></a>' +
  72. '<div><input type="hidden" class="hfOrderEBId" value="0" />' +
  73. '<div class="input-group">';
  74. if (EBId != 0) {
  75. html += '<a class="default EBName-link" href="javascript:;">' + EBName + '</a>';
  76. }
  77. else {
  78. html += `<select class="txt_EBName ui-autocomplete form-control col-sm-6" data-placeholder="Select"
  79. placeholder="EB Name" value="' + EBName + '">`;
  80. }
  81. html +=
  82. '<input type="hidden" class="hf_EBId" value="' + EBContactId + '" />' +
  83. '</div>' +
  84. '</div></div>' +
  85. '<div class="col-sm-3 m-t text-center">' +
  86. '<select id="cmbFillType" class="form-control"><option value="1">Initial Fill</option><option value="2">Service Fill</option></select></div>' +
  87. '<div class="col-sm-2">' +
  88. '<div class="EB_Volume floating-label-form-group text-right"><b class="text-dark">' + volume + '</b></div></div></div>' +
  89. '<div class="divDescriptionDetails bg-secondary-light-5 pa-10 mt-10 hidden">' +
  90. '<div class="clear m-b-sm"> <div class="EB-Itemrow hidden"></div>';
  91. html += '<div class="col-xs-6 m-l m-r m-t"><a id="addEBItemrow" class="btn btn-outline-primary" title="Add EB Item">Add EB Item</a></div>';
  92. html += '<div class="col-sm-12 mt-10">' +
  93. '<div class="floating-label-form-group item-desc min-padding floating-label-form-group-with-value">' +
  94. '<input type="text" class="EBDesc form-control" value="' + Notes + '" placeholder="Notes" />' +
  95. '</div>' +
  96. '</div></div></div>' +
  97. '</div>';
  98. $(".EB-row:last").after(html);
  99. var element = $(".EB-row:last");
  100. element.find('.EB_Volume').on('click', function () {
  101. $(".divDescriptionDetails").addClass("hidden");
  102. $(this).parents('.addedEB-row').find(".divDescriptionDetails").removeClass('hidden');
  103. });
  104. if (EBItemList != null || EBItemList != undefined) {
  105. for (var i = 0; i < EBItemList.length; i++) {
  106. instance.addEBItemrow(EBItemList[i], element);
  107. }
  108. }
  109. else {
  110. instance.addEBItemrow(null, element);
  111. }
  112. element.find(".EBDesc").val(Notes);
  113. element.find("#cmbFillType").val(FillType);
  114. var TotalVolume = 0;
  115. element.find(".EB-Itemrow").each(function () {
  116. if ($(this).find(".EBItem_Volume").val() != 0 && $(this).find(".EBItem_Volume").val() != undefined) {
  117. TotalVolume += Number($(this).find(".EBItem_Volume").val());
  118. }
  119. });
  120. element.find(".EB_Volume").text(TotalVolume);
  121. element.find(".txt_EBName,.EBName-link").focusin(function () {
  122. if (element.find(".hf_EBId").val() != -1) {
  123. $(".divDescriptionDetails").addClass("hidden");
  124. element.find(".divDescriptionDetails").toggleClass("hidden");
  125. }
  126. });
  127. var txtEBName = element.find(".txt_EBName");
  128. var hfSelectedEBId = element.find(".hf_EBId");
  129. if (hfSelectedEBId.val() == -1) {
  130. $("#addEBrow").addClass('hidden');
  131. }
  132. var url = _appsettings.server_url() + '/apis/v4/bizgaze/crm/contacts/getcontactebs';
  133. AutoCompleteHelper.getHelper().Create(txtEBName, hfSelectedEBId, url, function (response) {
  134. if (hfSelectedEBId.val() != 0) {
  135. element.find(".EB_volume").removeClass('hidden');
  136. $(".divDescriptionDetails").addClass('hidden');
  137. element.find(".divDescriptionDetails").removeClass('hidden');
  138. }
  139. if (hfSelectedEBId.val() == -1) {
  140. $(".divDescriptionDetails").addClass('hidden');
  141. $("#addEBrow").addClass('hidden');
  142. }
  143. else {
  144. var hfSelectedEBItemId = element.find(".hf_EBItemId");
  145. instance.loadItemAutoComplete(element, "0", hfSelectedEBItemId);
  146. }
  147. $('.txt_EBName + .select2-container').width(421.987);
  148. });
  149. element.find(".EBdelete").on('click', function () {
  150. bootbox.confirm("You are about to delete the EB. Are you sure?", function (result) {
  151. if (result) {
  152. element.find(".EB-Itemrow").each(function () {
  153. var Ebid = $(this).find(".hf_InvEBId").val();
  154. element.remove();
  155. if (Ebid != "0" && Ebid != undefined) {
  156. instance.deleted_EBs.push(Number(Ebid));
  157. }
  158. });
  159. if (hfSelectedEBId.val() == -1) {
  160. $("#addEBrow").removeClass('hidden');
  161. }
  162. }
  163. });
  164. });
  165. element.find("#addEBItemrow").on('click', function () {
  166. instance.addEBItemrow(null, element);
  167. });
  168. }
  169. addEBItemrow(EBItemList, EBelement) {
  170. var instance = this;
  171. var ItemName = "";
  172. var ItemId = 0;
  173. var Volume = 0;
  174. var EBId = 0;
  175. var SKU = "";
  176. if (EBItemList != null || EBItemList != undefined) {
  177. EBId = EBItemList.EBId;
  178. ItemName = EBItemList.ItemName;
  179. ItemId = EBItemList.ItemId;
  180. Volume = EBItemList.Volume;
  181. SKU = EBItemList.SKU;
  182. }
  183. var floting = "";
  184. if (ItemId == 0) { }
  185. floting = "floating-label-form-group";
  186. var html = '<div class="EB-Itemrow row mx-0 mb-15">' +
  187. '<div class="EB_Item-Name col-sm-7 d-flex align-items-center"><input type="hidden" class="hf_InvEBId" value="' + EBId + '" />' +
  188. '<a class="input-group-addon no-border EBItemdelete" href = "javascript:;" title = "Remove row"><i class="fa fa-trash-o fa-lg mr-2 text-danger"> </i></a> <input type = "hidden" class="hf_EBItemId" value = "' + ItemId + '" /> ';
  189. if (ItemId != 0) {
  190. html += '<a class="default EBItemName-link" href="javascript:;">' + SKU + "-" + ItemName + '</a>';
  191. }
  192. else {
  193. html += '<select class="txt_EBItemName ui-autocomplete form-control" data-placeholder="Select" placeholder="EB Item Name" value="' + ItemName + '"></select>';
  194. }
  195. html += '</div><div class="col-sm-3"></div>' +
  196. '<div class="col-sm-2 pr-0">' +
  197. '<input type="text" class="EBItem_Volume form-control text-right" placeholder="volume" onkeypress="return isNumberKey(event)" value="' + Volume + '" /></div></div>';
  198. EBelement.find(".EB-Itemrow:last").after(html);
  199. var element = EBelement.find(".EB-Itemrow:last");
  200. var lobid = $(".hfAutoCompleteId_lobid").val();
  201. var Dcid = Controls.InvoiceItem.Instance().dcid;
  202. if (lobid == 0)
  203. lobid = $("#cmbInv_Lob").val();
  204. var txtEBItemName = element.find(".txt_EBItemName");
  205. var hfSelectedEBItemId = element.find(".hf_EBItemId");
  206. var selectitemids = "";
  207. EBelement.find(".EB-Itemrow").each(function () {
  208. if ($(this).find(".hf_EBItemId").val() != 0 && $(this).find(".hf_EBItemId").val() != undefined) {
  209. selectitemids += $(this).find(".hf_EBItemId").val() + ",";
  210. }
  211. });
  212. var url = "";
  213. var invoiceid = $(".hdn_invoiceid").val();
  214. if (selectitemids == '')
  215. selectitemids = '0';
  216. if ($(".hdn_invoiceid").val() != 0 && $(".hdn_invoiceid").val() != undefined) {
  217. url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/invoices/autopendingebitemsforinvoicebyinvoiceid/invoiceid/' + $(".hdn_invoiceid").val() + '/itemids/' + selectitemids;
  218. AutoCompleteHelper.getHelper().Create(txtEBItemName, hfSelectedEBItemId, url, function (response) {
  219. var data = response;
  220. });
  221. }
  222. else {
  223. instance.loadItemAutoComplete(element, selectitemids, hfSelectedEBItemId);
  224. }
  225. element.find(".EBItemdelete").on('click', function () {
  226. bootbox.confirm("You are about to delete the EB. Are you sure?", function (result) {
  227. if (result) {
  228. var Ebid = element.find(".hf_InvEBId").val();
  229. element.remove();
  230. if (Ebid != "0") {
  231. $(this).parent().find(".EB_Volume").val();
  232. instance.deleted_EBs.push(Number(Ebid));
  233. var TotalVolume = Number(EBelement.find(".EB_Volume").html());
  234. TotalVolume -= Number(element.find(".EBItem_Volume").val());
  235. EBelement.find(".EB_Volume").text(TotalVolume);
  236. }
  237. }
  238. });
  239. });
  240. element.find(".EBItem_Volume").blur(function () {
  241. var TotalVolume = 0;
  242. if (element.find(".hf_EBItemId").val() == 0) {
  243. MessageHelper.Instance().showError("please select EB Item", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  244. return false;
  245. }
  246. var checkingInvoiceItemQty = true;
  247. $(".InvoiceItems").find(".item-row").each(function () {
  248. if ($(this).children().length > 0) {
  249. if ($(this).find(".selectedItemId").val() == element.find(".hf_EBItemId").val()) {
  250. if ($(this).find(".selectedItemId").val() != "" && $(this).find(".selectedItemId").val() != "0" && $(this).find(".prodQuantity").val() > 0) {
  251. var invoiceQty = Number($(this).find(".prodQuantity").val());
  252. if (checkingInvoiceItemQty)
  253. checkingInvoiceItemQty = instance.checkingInvoiceItemQuantitywithEBItemQuantity(invoiceQty, $(this).find(".selectedItemId").val());
  254. }
  255. }
  256. }
  257. });
  258. if (!checkingInvoiceItemQty) {
  259. if ($(".hdn_invoiceid").val() != 0)
  260. MessageHelper.Instance().showError("EB Volume must be less than or equal to invoiced Quantity", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  261. else
  262. MessageHelper.Instance().showError("Please Adjust the EB Volumes", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  263. element.find(".EBItem_Volume").val(0);
  264. return false;
  265. }
  266. EBelement.find(".EB-Itemrow").each(function () {
  267. if ($(this).find(".EBItem_Volume").val() != 0 && $(this).find(".EBItem_Volume").val() != undefined) {
  268. TotalVolume += Number($(this).find(".EBItem_Volume").val());
  269. }
  270. });
  271. EBelement.find(".EB_Volume").text(TotalVolume);
  272. });
  273. }
  274. checkingInvoiceItemQuantitywithEBItemQuantity(invoiceItemQty, ItemId) {
  275. var EBItemQuantity = 0;
  276. $(".EB-row").each(function () {
  277. if ($(this).find(".hf_EBId").val() != undefined || $(this).find(".hf_EBId").val() != -1) {
  278. $(this).find(".EB-Itemrow").each(function () {
  279. if ($(this).find(".hf_EBItemId").val() != undefined && $(this).find(".hf_EBItemId").val() == ItemId) {
  280. EBItemQuantity += Number($(this).find(".EBItem_Volume").val());
  281. }
  282. });
  283. }
  284. });
  285. if (EBItemQuantity > invoiceItemQty) {
  286. return false;
  287. }
  288. else
  289. return true;
  290. }
  291. loadEBs() {
  292. var instance = this;
  293. $('.addedEB-row').remove();
  294. var url = "";
  295. if ($(".hdn_invoiceid").val() != 0)
  296. url = '/apis/v4/bizgaze/transact/invoices/GetOpportunityEBsByInvoiceId/InvoiceId/' + $(".hdn_invoiceid").val();
  297. else
  298. url = '/apis/v4/bizgaze/transact/invoices/GetEBsDetailsByOrderId/OrderId/' + Number($(".hdn_orderid").val());
  299. Bizgaze.Apps.Transact.Managers.InvoiceManager.Instance().loadEbs(url).then(function (response) {
  300. var data = response;
  301. if (data.result.length > 0) {
  302. var EbsList = instance.EBsgroupByEbContactId(data.result, 'EBContactId');
  303. Object.keys(EbsList).forEach(function (k) {
  304. var Ebdata = EbsList[k];
  305. var EBItemList = new Array();
  306. for (var i = 0; i < Ebdata.length; i++) {
  307. EBItemList.push({
  308. EBId: Number(Ebdata[i].EBId),
  309. ItemId: Number(Ebdata[i].ItemId),
  310. Volume: Number(Ebdata[i].Volume),
  311. ItemName: Ebdata[i].ItemName,
  312. SKU: Ebdata[i].SKU
  313. });
  314. }
  315. instance.addEBRow(Ebdata[0].OrderId, Ebdata[0].EBId, Ebdata[0].EBContactId, Ebdata[0].EBName, Ebdata[0].Volume, Ebdata[0].InvoiceId, Ebdata[0].FillType, Ebdata[0].Notes, EBItemList);
  316. });
  317. }
  318. else {
  319. instance.addEBRow(0, 0, 0, "", 0.0, 0, 1, "", null);
  320. }
  321. }, function (response) {
  322. Unibase.Platform.Forms.Components.FormViewer.Instance().showError(response.responseText);
  323. });
  324. }
  325. EBsgroupByEbContactId(objectArray, property) {
  326. return objectArray.reduce((acc, obj) => {
  327. const key = obj[property] + '-' + obj["FillType"];
  328. if (!acc[key]) {
  329. acc[key] = [];
  330. }
  331. acc[key].push(obj);
  332. return acc;
  333. }, {});
  334. }
  335. getEBs() {
  336. var instance = this;
  337. var checkingInvoiceItemQty = true;
  338. $(".InvoiceItems").find(".item-row").each(function () {
  339. if ($(this).find(".selectedInvoiceItemId").val() != undefined) {
  340. if ($(this).find(".selectedItemId").val() != "" && $(this).find(".selectedItemId").val() != "0" && $(this).find(".prodQuantity").val() > 0) {
  341. var invoiceQty = Number($(this).find(".prodQuantity").val());
  342. if (checkingInvoiceItemQty)
  343. checkingInvoiceItemQty = instance.checkingInvoiceItemQuantitywithEBItemQuantity(invoiceQty, $(this).find(".selectedItemId").val());
  344. }
  345. }
  346. });
  347. if (!checkingInvoiceItemQty) {
  348. if ($(".hdn_invoiceid").val() != 0)
  349. MessageHelper.Instance().showError("EB Volume must be less than or equal to invoiced Quantity", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  350. else
  351. MessageHelper.Instance().showError("EB volume (EB Info section) cannot be more than Total volume", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  352. return;
  353. }
  354. var EBList = new Array();
  355. $(".EB-row").each(function () {
  356. if ($(this).find(".hf_EBId").val() != undefined) {
  357. if ($(this).find(".hf_EBId").val() != "" && $(this).find(".hf_EBId").val() != "0") {
  358. var OrderId = Number($(this).find("hfOrderEBId").val());
  359. var EBContactId = Number($(this).find(".hf_EBId").val());
  360. var FillType = Number($(this).find('#cmbFillType').val());
  361. var Notes = $(this).find('.EBDesc').val();
  362. if (OrderId == null)
  363. OrderId = 0;
  364. if ($(this).find(".hf_EBId").val() != -1) {
  365. $(this).find(".EB-Itemrow").each(function () {
  366. if ($(this).find(".hf_EBItemId").val() != undefined && $(this).find(".hf_EBItemId").val() != 0) {
  367. EBList.push({
  368. OrderId: isNaN(OrderId) ? 0 : OrderId,
  369. EBId: Number($(this).find(".hf_InvEBId").val()),
  370. EBContactId: Number(EBContactId),
  371. Volume: Number($(this).find(".EBItem_Volume").val()),
  372. InvoiceId: 0,
  373. ItemId: Number($(this).find(".hf_EBItemId").val()),
  374. FillType: FillType,
  375. Notes: Notes,
  376. DeletedEbs: []
  377. });
  378. }
  379. });
  380. }
  381. else {
  382. EBList.push({
  383. OrderId: isNaN(OrderId) ? 0 : OrderId,
  384. EBId: isNaN(Number($(this).find(".hf_InvEBId").val())) ? 0 : Number($(this).find(".hf_InvEBId").val()),
  385. EBContactId: EBContactId,
  386. Volume: 0,
  387. InvoiceId: 0,
  388. ItemId: 0,
  389. FillType: FillType,
  390. Notes: Notes,
  391. DeletedEbs: []
  392. });
  393. }
  394. }
  395. }
  396. });
  397. if ($('.section_Ebs').is(":visible") && EBList.length == 0) {
  398. MessageHelper.Instance().showError("EB information is mandatory.", $("#form-container-" + $("#hf_FormId").val()).find(".bizgaze_FormErrorMessages").attr('id'));
  399. return false;
  400. }
  401. else if (instance.deleted_EBs.length > 0) {
  402. EBList[0].DeletedEbs = instance.deleted_EBs;
  403. }
  404. return EBList;
  405. }
  406. loadItemAutoComplete(element, selectitemids, hfSelectedEBItemId) {
  407. let userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  408. let sessionid = userinfo.sessionId;
  409. let postData = null;
  410. var selecteditems = selectitemids.split(',');
  411. var ids = [];
  412. for (var i = 0; i <= Controls.InvoiceItem.instance.itemIds.length; i++) {
  413. let index = Controls.InvoiceItem.instance.itemIds.findIndex(x => x == selecteditems[i]);
  414. if (index == -1 && Controls.InvoiceItem.instance.itemIds[i] != null) {
  415. ids.push(Controls.InvoiceItem.instance.itemIds[i]);
  416. }
  417. }
  418. element.find(".txt_EBItemName").select2({
  419. placeholder: "Select",
  420. tags: false,
  421. allowClear: true,
  422. theme: "default select2ErrorClass w-100",
  423. data: [],
  424. ajax: {
  425. url: function (request) {
  426. let reqUrl = _appsettings.server_url() + '/apis/v4/bizgaze/transact/items/getebitemsforinvoice';
  427. return reqUrl;
  428. },
  429. type: "POST",
  430. contentType: 'application/json',
  431. dataType: 'json',
  432. data: function (params) {
  433. let Term = params.term;
  434. sessionid = sessionid.replace('#', '');
  435. if (selectitemids == '') {
  436. ids = Controls.InvoiceItem.instance.itemIds;
  437. }
  438. postData = {
  439. LobId: Number($(".hfAutoCompleteId_lobid").val()),
  440. ItemIds: ids,
  441. term: Term,
  442. };
  443. return JSON.stringify(postData);
  444. },
  445. beforeSend: function (xhr) {
  446. if (userinfo !== undefined && userinfo !== null) {
  447. xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
  448. xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
  449. }
  450. },
  451. processResults: function (data) {
  452. return {
  453. results: jQuery.map(JSON.parse(data.result), function (item) {
  454. return {
  455. id: item.Value,
  456. text: item.SelectText,
  457. addlInfo: item.addlData
  458. };
  459. })
  460. };
  461. },
  462. },
  463. }).on('select2:select', function (e) {
  464. var result = e.params.data;
  465. $(hfSelectedEBItemId).val(result.id);
  466. });
  467. }
  468. static Instance() {
  469. if (this.instance === undefined) {
  470. this.instance = new Eb();
  471. }
  472. return this.instance;
  473. }
  474. }
  475. Controls.Eb = Eb;
  476. })(Controls = Transact.Controls || (Transact.Controls = {}));
  477. })(Transact = Apps.Transact || (Apps.Transact = {}));
  478. })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
  479. })(Bizgaze || (Bizgaze = {}));