lib.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. const CheckDecimal = x => {
  2. const realStringObj = obj && obj.toString();
  3. if (!jQuery.isArray(obj) && (realStringObj - parseFloat(realStringObj) + 1) >= 0) return false;
  4. const parts = x.toString().split(".");
  5. parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  6. return parts.join(".");
  7. }
  8. const CheckMail = email => {
  9. const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  10. const result = re.test(String(email).toLowerCase());
  11. // !result && alert('Email is invalid !!!', 'error');
  12. return result;
  13. }
  14. const CheckNum = input => !isNaN(input);
  15. const LenCheck = (input, length) => {
  16. return input.length <= length;
  17. }
  18. const CheckMinMax = (elm, min, max) => {
  19. const length = $(elm).val().length;
  20. if (length < min || length > max) {
  21. $(elm).empty();
  22. $(elm).focus();
  23. }
  24. }
  25. function setCookie(cookieName, value, expirationDate) {
  26. var cookieValue = escape(value) + ((expirationDate == null) ? '' : '; expires=' + expirationDate.toUTCString()) + ';path=/';
  27. document.cookie = cookieName + '=' + cookieValue;
  28. }
  29. function getCookie(cookieName) {
  30. var name = cookieName + '=';
  31. var decodedCookie = decodeURIComponent(document.cookie);
  32. var cookieArray = decodedCookie.split(';');
  33. for (var i = 0; i < cookieArray.length; i++) {
  34. var cookie = cookieArray[i];
  35. while (cookie.charAt(0) == ' ') {
  36. cookie = cookie.substring(1);
  37. }
  38. if (cookie.indexOf(name) == 0) {
  39. return cookie.substring(name.length, cookie.length);
  40. }
  41. }
  42. return '';
  43. }
  44. function makeTwoDigit(number) {
  45. return number < 10 ? '0' + number : number.toString();
  46. }
  47. function isEmptyArr(arr) {
  48. if(Array.isArray(arr) && arr.length === 0) {
  49. return true;
  50. }
  51. return false;
  52. }
  53. const CheckSSN = ssn => {
  54. const ssnPattern = /^[0-9]{3}\-?[0-9]{2}\-?[0-9]{4}$/;
  55. return ssnPattern.test(ssn);
  56. }
  57. const CheckRequired = inputList => {
  58. inputList.forEach(item => {
  59. const value = item.val();
  60. if (value == null || value == '' || value == undefined) {
  61. alert(`${item.data('name')} is required !!!`, 'error');
  62. return false;
  63. }
  64. })
  65. };
  66. const ComfirmPasswd = (pass, confirmPass) => pass === confirmPass;
  67. const DisableInput = elm => $(elm).prop('disabled', function (i, v) {
  68. return !v;
  69. });
  70. const BlinkObject = elm => {
  71. $(elm).fadeOut('slow', function () {
  72. $(this).fadeIn('slow', function () {
  73. BlinkObject(this);
  74. });
  75. });
  76. }
  77. const InitCheckBox = (data, name) => {
  78. let html = '';
  79. data.forEach(item => {
  80. html += `<input type="checkbox" name="${name}" value="${item}"> ${item}`;
  81. });
  82. return html;
  83. }
  84. const InitRadio = (data, name) => {
  85. let html = '';
  86. data.forEach(item => {
  87. html += `<input type="radio" name="${name}" value="${item}"> ${item}`;
  88. });
  89. return html;
  90. }
  91. const InitSelect = (data, name) => `<select name="${name}">${ArrayToOption(data)}</select>`;
  92. const ArrayToOption = array => {
  93. let html = '';
  94. array.forEach(item => {
  95. html += `<option value="${item}">${item}</option>`
  96. });
  97. return html;
  98. }
  99. function commaCheck($this) {
  100. $($this).val(function (index, value) {
  101. value = value.replace(/,/g, '');
  102. return numberWithCommas(value);
  103. });
  104. }
  105. function minusComma(value) {
  106. let formNumber = "" + trim(value);
  107. // 문자제거
  108. // value = formNumber.toString().replace(/[^\d]+/g, "");
  109. // 콤마제거
  110. value = formNumber.toString().replace(/,/g, "");
  111. return value;
  112. }
  113. function rand(min, max) {
  114. return Math.floor(Math.random() * (max - min)) + min;
  115. }
  116. function format_decimal(val, number) {
  117. let format = decimal_convert(number);
  118. return numeral(parseFloat(val).toFixed(number)).format(format);
  119. }
  120. function fill_zero(width, str) {
  121. return (str.length && width > 0) ? str + '.' + new Array(width + 1).join('0') : str;
  122. }
  123. function decimal_convert(point_name) {
  124. return fill_zero(parseInt(point_name), '0,0')
  125. }
  126. function remove_tag( html ) {
  127. return html.replace(/(<([^>]+)>)/gi, "");
  128. }
  129. function formatDateString(inputString) {
  130. // Split the input string into an array of substrings with two characters each
  131. const chunks = inputString.match(/.{1,2}/g) || [];
  132. // Initialize an empty result string
  133. let result = '';
  134. // Iterate through the chunks and process accordingly
  135. for (const chunk of chunks) {
  136. // Check if the chunk is "00"
  137. if (chunk === "00") {
  138. // If it is, break out of the loop
  139. break;
  140. }
  141. // Otherwise, add the chunk to the result string
  142. result += chunk;
  143. }
  144. return result;
  145. }
  146. function is_localhost() {
  147. if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') {
  148. return true
  149. }
  150. return false
  151. }
  152. function get_clusterize_rows_in_block() {
  153. return 10
  154. // return is_localhost() ? 10 : 10
  155. }
  156. function remove_comma_and_arithmetic(a, b, type) {
  157. switch (type) {
  158. case 'plus':
  159. return Number(minusComma(a)) + Number(minusComma(b))
  160. case 'minus':
  161. return Number(minusComma(a)) - Number(minusComma(b))
  162. }
  163. }
  164. function unixtimeFormatDate(data) {
  165. moment.locale('ko')
  166. return moment(new Date(data * 1000)).format('YYYY-MM-DD HH:mm:ss (dd)')
  167. }
  168. function format_result(data, format, display_vars = undefined) {
  169. let result = data
  170. switch (format) {
  171. case 'YYYY-MM-DD': case 'YYYY.MM.DD': case 'YYYYMMDD':
  172. case 'YY-MM-DD': case 'YY.MM.DD': case 'YYMMDD':
  173. case 'yy-mm-dd': case 'yy.mm.dd': case 'yymmdd':
  174. result = isEmpty(data) ? '' : moment(data).format(format.toUpperCase());
  175. break;
  176. case 'unixtime':
  177. result = isEmpty(data) ? '' : moment(new Date(data * 1000)).format('YY-MM-DD HH:mm:ss');
  178. break;
  179. case 'unix-yy.mm.dd':
  180. result = isEmpty(data) ? '' : moment(new Date(data * 1000)).format('YY-MM-DD');
  181. break;
  182. case '$_ThumbNail':
  183. const w = display_vars['ListWidth'] === 0 ? '100%' : display_vars['ListWidth'] + 'px';
  184. const h = display_vars['ListHeight'] === 0 ? '100%' : display_vars['ListHeight'] + 'px';
  185. result = `
  186. <div class="thumb-nail-title" style="height: ${h};">
  187. <div class="thumb-nail-img-div">
  188. <img src="${window.env['MEDIA_URL'] + data}" style="max-width:${w}; max-height:${h};"
  189. class="thumb-nail-img" onerror="this.src='/images/folder.jpg'">
  190. </div>
  191. </div>
  192. `;
  193. // <div class="m-auto" style="width: 100px; height: 100px; overflow: hidden; margin:0 auto;">
  194. // <img src="${window.env['MEDIA_URL'] + data}" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.src='/images/folder.jpg'"
  195. // </div>
  196. break;
  197. case '$_FileName':
  198. let path_list = data.split('/')
  199. result = path_list[path_list.length - 1];
  200. break;
  201. case 'check':
  202. if (data == 1 || data == true) {
  203. result = '✓';
  204. } else {
  205. result = '';
  206. }
  207. break;
  208. case 'unique':
  209. result = data.split("'").join('');
  210. break;
  211. case 'date_month':
  212. result = isEmpty(data) ? '' : moment(data).format('YY.MM');
  213. break;
  214. case 'date_week':
  215. result = isEmpty(data) ? '' : `${moment(data).format('YY.MM')}-${moment(data).isoWeek()}`;
  216. break;
  217. case 'remove_tag':
  218. result = remove_tag(data);
  219. break;
  220. default:
  221. if (! isEmpty(format) && format.match(/[A-Za-z]+\s*\(\s*'(.*?)\'\s*\)\s*/)) {
  222. const func_name = format.replace(')', `, '${data}')`);
  223. try {
  224. result = eval(`format_func_${func_name}`);
  225. } catch (err) {
  226. result = 'Invalid';
  227. }
  228. }
  229. break;
  230. }
  231. return result;
  232. }
  233. function format_conver_for(data, format, display_vars = undefined, is_split_column = false) {
  234. if (is_split_column) {
  235. if (format.includes('|')) {
  236. let data_list = data.split('|||');
  237. let format_list = format.split('|');
  238. let result_list = [];
  239. format_list.forEach(function (format, index) {
  240. if (format.startsWith("^")) {
  241. format = format.substring(1);
  242. }
  243. result_list.push(format_result(data_list[index], format, display_vars))
  244. });
  245. let r = '';
  246. result_list.forEach(function (result, index) {
  247. if (index >= result_list.length -1) {
  248. r += result
  249. } else {
  250. if (format_list[index + 1].includes('^')) {
  251. r += result + '<br/>'
  252. } else {
  253. r += result + ' | '
  254. }
  255. }
  256. })
  257. return r
  258. }
  259. }
  260. return format_result(data, format, display_vars)
  261. }
  262. function format_func_decimal(...argv) {
  263. const format = capitalize(camelCase(argv[0])) + 'Point';
  264. let data;
  265. if (window.User[format] == undefined) {
  266. return 'Invalid';
  267. }
  268. switch (argv.length) {
  269. case 2:
  270. data = format_decimal(argv[1], window.User[format]);
  271. break;
  272. case 3:
  273. data = format_decimal(argv[2], window.User[format])
  274. if (argv[1] === 'nz' && (isEmpty(data) || data == 0)) { data = 0; }
  275. else if (argv[1] === 'zn' && (isEmpty(data) || data == 0)) { data = ''; }
  276. break;
  277. }
  278. return data;
  279. }
  280. function format_func_status_update(value, data) {
  281. return { Field: 'Status', Value: format_func_status_rev(value, data), };
  282. }
  283. function format_func_status_code_update(value, data) {
  284. return { Field: 'Status', Value: data, };
  285. }
  286. function format_func_status_rev(value, data) {
  287. const status = Object.values(window.CodeTitle['status'][value]).filter(status => status.Title == data)
  288. if (isEmptyArr(status)) { return data; }
  289. return _.first(status)['Code'];
  290. }
  291. function format_func_status(value, data) {
  292. if (window.CodeTitle['status'] && window.CodeTitle['status'][value][data]) {
  293. return window.CodeTitle['status'][value][data]['Title'];
  294. }
  295. return 'Invalid';
  296. }
  297. function format_func_sort_update(value, data) {
  298. return { Field: 'Sort', Value: format_func_sort_rev(value, data), };
  299. }
  300. function format_func_sort_code_update(value, data) {
  301. return { Field: 'Sort', Value: data, };
  302. }
  303. function format_func_sort_rev(value, data) {
  304. const sort = Object.values(window.CodeTitle['sort'][value]).filter(sort => sort.Title == data)
  305. if (isEmptyArr(sort)) { return data; }
  306. return _.first(sort)['Code'];
  307. }
  308. function format_func_sort(value, data) {
  309. if (window.CodeTitle['sort'] && window.CodeTitle['sort'][value][data]) {
  310. return window.CodeTitle['sort'][value][data]['Title'];
  311. }
  312. return 'Invalid';
  313. }
  314. function format_func_deal_type_update(value, data) {
  315. return { Field: 'DealType', Value: format_func_deal_type_rev(value, data), };
  316. }
  317. function format_func_deal_type_rev(value, data) {
  318. const deal_type = Object.values(window.CodeTitle['deal-type'][value]).filter(deal_type => deal_type.Title == data)
  319. if (isEmptyArr(deal_type)) { return data; }
  320. return _.first(deal_type)['Code'];
  321. }
  322. function format_func_deal_type(value, data) {
  323. if (window.CodeTitle['deal-type'] && window.CodeTitle['deal-type'][value][data]) {
  324. return window.CodeTitle['deal-type'][value][data]['Title'];
  325. }
  326. return 'Invalid';
  327. }
  328. function format_func_paymethod_rev(value, data) {
  329. const paymethod = Object.values(window.CodeTitle['paymethod'][value]).filter(paymethod => paymethod.Title == data)
  330. if (isEmptyArr(paymethod)) { return data; }
  331. return _.first(paymethod)['Code'];
  332. }
  333. function format_func_paymethod(value, data) {
  334. if (window.CodeTitle['paymethod'] && window.CodeTitle['paymethod'][value][data]) {
  335. return window.CodeTitle['paymethod'][value][data]['Title'];
  336. }
  337. return 'Invalid';
  338. }
  339. function format_func_situation_rev(value, data) {
  340. const situation = Object.values(window.CodeTitle['situation'][value]).filter(situation => situation.Title == data)
  341. if (isEmptyArr(situation)) { return data; }
  342. return _.first(situation)['Code'];
  343. }
  344. function format_func_situation(value, data) {
  345. if (window.CodeTitle['situation'] && window.CodeTitle['situation'][value][data]) {
  346. return window.CodeTitle['situation'][value][data]['Title'];
  347. }
  348. return 'Invalid';
  349. }
  350. function format_func_bill_type_update(value, data) {
  351. return { Field: 'BillType', Value: format_func_deal_type_rev(value, data), };
  352. }
  353. function format_func_bill_type_rev(value, data) {
  354. const bill_type = Object.values(window.CodeTitle['bill-type'][value]).filter(bill_type => bill_type.Title == data)
  355. if (isEmptyArr(bill_type)) { return data; }
  356. return _.first(bill_type)['Code'];
  357. }
  358. function format_func_bill_type(value, data) {
  359. if (window.CodeTitle['bill-type'] && window.CodeTitle['bill-type'][value][data]) {
  360. return window.CodeTitle['bill-type'][value][data]['Title'];
  361. }
  362. return 'Invalid';
  363. }
  364. function format_func_setup_code_update(value, data) {
  365. return { Field: 'SetupCode', Value: format_func_setup_code_rev(value, data), };
  366. }
  367. function format_func_setup_code_rev(value, data) {
  368. const setup_code = Object.values(window.CodeTitle['setup-code'][value]).filter(setup_code => setup_code.Title == data)
  369. if (isEmptyArr(setup_code)) { return data; }
  370. return _.first(setup_code)['Code'];
  371. }
  372. function format_func_setup_code(value, data) {
  373. if (window.CodeTitle['setup-code'] && window.CodeTitle['setup-code'][value][data]) {
  374. return window.CodeTitle['setup-code'][value][data]['Title'];
  375. }
  376. return 'Invalid';
  377. }
  378. function format_func_expose_type_update(value, data) {
  379. return { Field: 'ExposeType', Value: format_func_expose_type_rev(value, data), };
  380. }
  381. function format_func_expose_type_rev(value, data) {
  382. const expose_type = Object.values(window.CodeTitle['expose-type'][value]).filter(expose_type => expose_type.Title == data)
  383. if (isEmptyArr(expose_type)) { return data; }
  384. return _.first(expose_type)['Code'];
  385. }
  386. function format_func_expose_type(value, data) {
  387. if (window.CodeTitle['expose-type'] && window.CodeTitle['expose-type'][value][data]) {
  388. return window.CodeTitle['expose-type'][value][data]['Title'];
  389. }
  390. return 'Invalid';
  391. }
  392. function format_func_ship_type_update(value, data) {
  393. return { Field: 'ShipType', Value: format_func_ship_type_rev(value, data), };
  394. }
  395. function format_func_ship_type_rev(value, data) {
  396. const ship_type = Object.values(window.CodeTitle['ship-type'][value]).filter(ship_type => ship_type.Title == data)
  397. if (isEmptyArr(ship_type)) { return data; }
  398. return _.first(ship_type)['Code'];
  399. }
  400. function format_func_ship_type(value, data) {
  401. if (window.CodeTitle['ship-type'] && window.CodeTitle['ship-type'][value][data]) {
  402. return window.CodeTitle['ship-type'][value][data]['Title'];
  403. }
  404. return 'Invalid';
  405. }
  406. function format_func_delay_type_update(value, data) {
  407. return { Field: 'DelayType', Value: format_func_delay_type_rev(value, data), };
  408. }
  409. function format_func_delay_type_rev(value, data) {
  410. const delay_type = Object.values(window.CodeTitle['delay-type'][value]).filter(delay_type => delay_type.Title == data)
  411. if (isEmptyArr(delay_type)) { return data; }
  412. return _.first(delay_type)['Code'];
  413. }
  414. function format_func_delay_type(value, data) {
  415. if (window.CodeTitle['delay-type'] && window.CodeTitle['delay-type'][value][data]) {
  416. return window.CodeTitle['delay-type'][value][data]['Title'];
  417. }
  418. return 'Invalid';
  419. }
  420. function format_func_cargo_type_update(value, data) {
  421. return { Field: 'CargoType', Value: format_func_cargo_type_rev(value, data), };
  422. }
  423. function format_func_cargo_type_rev(value, data) {
  424. const cargo_type = Object.values(window.CodeTitle['cargo-type'][value]).filter(cargo_type => cargo_type.Title == data)
  425. if (isEmptyArr(cargo_type)) { return data; }
  426. return _.first(cargo_type)['Code'];
  427. }
  428. function format_func_cargo_type(value, data) {
  429. if (window.CodeTitle['cargo-type'] && window.CodeTitle['cargo-type'][value][data]) {
  430. return window.CodeTitle['cargo-type'][value][data]['Title'];
  431. }
  432. return 'Invalid';
  433. }
  434. function format_func_condition_type_update(value, data) {
  435. return { Field: 'ConditionType', Value: format_func_condition_type_rev(value, data), };
  436. }
  437. function format_func_condition_type_rev(value, data) {
  438. const condition_type = Object.values(window.CodeTitle['condition-type'][value]).filter(condition_type => condition_type.Title == data)
  439. if (isEmptyArr(condition_type)) { return data; }
  440. return _.first(condition_type)['Code'];
  441. }
  442. function format_func_condition_type(value, data) {
  443. if (window.CodeTitle['condition-type'] && window.CodeTitle['condition-type'][value][data]) {
  444. return window.CodeTitle['condition-type'][value][data]['Title'];
  445. }
  446. return 'Invalid';
  447. }
  448. function check_dom_input_number(dom_array) {
  449. let arr = dom_array.filter(el => isNaN($(el).val()))
  450. arr.forEach(el => $(el).val('') );
  451. if (! isEmptyArr(arr)) {
  452. iziToast.error({
  453. title: 'Error',
  454. message: $('#please-enter-a-number').text(),
  455. });
  456. return true;
  457. }
  458. return false;
  459. }
  460. function show_iziToast_msg(page, callback = undefined) {
  461. if (page) {
  462. iziToast.success({
  463. title: 'Success',
  464. message: $('#action-completed').text(),
  465. });
  466. if (! isEmpty(callback)) {
  467. callback()
  468. }
  469. } else {
  470. iziToast.error({
  471. title: 'Error',
  472. message: page.data.body ?? $('#api-request-failed-please-check').text(),
  473. });
  474. }
  475. }
  476. const generate_random_string = (num) => {
  477. const characters ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  478. let result = '';
  479. const charactersLength = characters.length;
  480. for (let i = 0; i < num; i++) {
  481. result += characters.charAt(Math.floor(Math.random() * charactersLength));
  482. }
  483. return result;
  484. }
  485. function find_menu_info(data, find_code) {
  486. return data.filter(menu => menu['MenuCode'] === find_code)[0]
  487. }
  488. async function show_recrystallize_server(print_vars, type, vars) {
  489. let simple_filter = '', list_type1_vars = ''
  490. switch (type) {
  491. case 'formB':
  492. simple_filter = vars
  493. break
  494. case 'type1':
  495. list_type1_vars = vars
  496. break
  497. }
  498. if (isEmpty(window.env['REPORT_SERVER_URL'])) {
  499. return iziToast.error({ title: 'Error', message: 'REPORT_SERVER_URL 의 지정 내용이 없어 PDF를 생성할 수 없습니다.' })
  500. }
  501. const response = await get_api_data('list-type1-page', {
  502. QueryVars: {
  503. QueryName: print_vars['QueryName'],
  504. SimpleFilter: simple_filter
  505. },
  506. ListType1Vars: {
  507. ...list_type1_vars,
  508. IsntPageReturn: true,
  509. IsCrystalReport: true,
  510. IsDownloadList: true,
  511. IsAddTotalLine: false,
  512. }
  513. })
  514. // console.log(response)
  515. if (response.data['apiStatus']) {
  516. return iziToast.error({ title: 'Error', message: response.data['body'] ?? $('#api-request-failed-please-check').text() })
  517. }
  518. const reportName = print_vars['ReportPath']
  519. let url = window.env['REPORT_SERVER_URL'] + '?reportName=' + reportName + '&listToken='
  520. + response.data['ListType1Vars']['ListToken'] + '&ofcCode=' + window.User['OfcCode']
  521. if (print_vars['ExportFmt']) {
  522. url = url + '&exportfmt=' + print_vars['ExportFmt']
  523. }
  524. switch (print_vars['ExportFmt']) {
  525. case '':
  526. case 'PDF':
  527. window.open(url)
  528. break
  529. default:
  530. location.href = url
  531. break
  532. }
  533. // window.open(url)
  534. }
  535. async function show_popup(component, width, variable = '', namespace = 'window') {
  536. const popupOption = eval(namespace).popupOptions.filter(option => option.Component.includes(component))
  537. if (isEmpty(popupOption)) { return }
  538. const modal_class_name = popupOption[0]['ModalClassName'];
  539. $(`#modal-select-popup.${modal_class_name} .modal-dialog`).css('max-width', `${width}px`)
  540. eval(capitalize(camelCase(modal_class_name))).btn_act_new_callback(variable)
  541. $(`#modal-select-popup.${modal_class_name}`).modal('show')
  542. }
  543. function groupBy (data, key) {
  544. return data.reduce(function (carry, el) {
  545. var group = el[key];
  546. if (carry[group] === undefined) {
  547. carry[group] = []
  548. }
  549. carry[group].push(el)
  550. return carry
  551. }, {})
  552. }
  553. function isEmptyObject(obj){
  554. if (obj.constructor === Object && Object.keys(obj).length === 0) return true;
  555. return false;
  556. }
  557. function check_login() {
  558. if (isEmpty(window.Member)) {
  559. // location.href = '/member-login-broker'
  560. return false
  561. }
  562. return true
  563. }
  564. function chunk(data = [], size = 1) {
  565. const arr = [];
  566. for (let i = 0; i < data.length; i += size) {
  567. arr.push(data.slice(i, i + size));
  568. }
  569. return arr;
  570. }