123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- require(['config'], function() {
- require([
- ], function($) {
- mobPageObj.init();
- });
- });
- /*API URL*/
- const API_MOBILE_INIT_INFO = '/api/pomng/init-pchReq';
- const API_MOBILE_SAVE = '/api/pomng/save-pchReq';
- const API_POP_SEARCH_LIST = '/api/whs/mng/pop-whs-search';
- const API_POP_ITEM_LIST = '/api/item/pop-grid-list';
- let mobPageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- this.ready();
- },
- ui: {
- init: function () {
- this.info();
- },
- info: function() {
- $('input:hidden[id$="_BRAND_ID"]').val(fn_make_user_info.get('brandId'));
- $('input:hidden[id$="_STORE_ID"]').val(fn_make_user_info.get('storeId'));
- }
- },
- event: {
- init: function() {
- this.button();
- },
- button: function() {
- $('button[id^="ITP_BTN_MPOMNG01010_DETAIL"]').on('click', function() {
- if($(this).is('[data-call-popup]')) {
- mobPopObj.show($(this).data('call-popup'));
- } else {
- var id = $(this).attr('id');
- switch (id) {
- case 'ITP_BTN_MPOMNG01010_DETAIL_ADDROW': contPopObj.list.addRow(); break;
- case 'ITP_BTN_MPOMNG01010_DETAIL_DELROW': contPopObj.list.delRow(); break;
- case 'ITP_BTN_MPOMNG01010_DETAIL_DELETE_WHS_NM': break;
- case 'ITP_BTN_MPOMNG01010_DETAIL_TEMP_SAVE': break;
- case 'ITP_BTN_MPOMNG01010_DETAIL_CANCEL':break;
- }
- }
- return false;
- });
- }
- },
- ready: function() {
- contPopObj.init();
- }
- };
- let contPopObj = {
- init: function() {
- this.data.load();
- },
- data: {
- initPchReq: null,
- load: function() {
- var _this = this;
- var callbackFn = function(result) {
- _this.initPchReq = result;
- $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_BRAND_ID').val(result.brandId);
- $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_STORE_ID').val(result.storeId);
- $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_DVSN').val(result.loanDvsn);
- $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_LOAN_MGNT_UNQ_NO').val(result.loanMgntUnqNo);
- $('#ITP_FORM_MPOMNG01010_DETAIL #ITP_FORM_MPOMNG01010_DETAIL_PCH_REQ_DVSN').val(result.pchReqDvsn);
- $('#ITP_FORM_MPOMNG01010_DETAIL .fnOrdUseAmt').text(itp_fn_set_comma(result.ordUseAmt) + '원');
- };
- const key = {brandId:fn_make_user_info.get('brandId'), storeId:fn_make_user_info.get('storeId')};
- fn_ajax_call(API_MOBILE_INIT_INFO, key, callbackFn, 'GET');
- }
- },
- list: {
- addRow: function() {
- var _this = this;
- var callbackFn = function(result) {
- mobPopObj.addRow.init(result);
- };
- let param = $('#ITP_FORM_MPOMNG01010_POPUP_ITEM').serializeObject();
- param.gridSize = 10;
- fn_ajax_call(API_POP_ITEM_LIST, JSON.stringify(param), callbackFn, 'POST');
- },
- delRow: function() {
- }
- }
- };
- let mobPopObj = {
- addRow: {
- rows: [],
- init: function(rows) {
- this.rows = rows;
- mobPopObj.show('ITP_POP_MPOMNG01010_ITEM_NM');
- this.view();
- },
- view: function() {
- $.each(this.rows, function (i, item) {
- $('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWS').append($('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWCOPY').html());
- var li = $('#ITP_LIST_MPOMNG01010_POP_ITEM_ROWS .panel-group > .row_2:last');
- $(li).find('#ITP_FORM_MPOMNG01010_POP_ITEM_CHECKBOX').val(item.itemId);
- $(li).find('.fnItemNm').text(item.itemNm);
- $(li).data('brandUnitUnqNo', item.brandUnitUnqNo);
- $(li).data('podrPssblDvsn', item.podrPssblDvsn);
- $(li).data('spplyId', item.spplyId);
- $(li).data('stddQty', item.stddQty);
- $(li).data('storeUnitUnqNo', item.storeUnitUnqNo);
- $(li).data('unit', item.unit);
- $(li).data('unitAmt', item.unitAmt);
- $(li).data('unitGubun', item.unitGubun);
- });
- },
- search: function() {
- },
- choice: function() {
- }
- },
- show: function(id, args, fn) {
- this.button();
- $('#' + id).show();
- },
- button: function() {
- var _this = this;
- $('button[id^="ITP_BTN_MPOMNG01010_POP"]').off('click').on('click', function() {
- var id = $(this).attr('id');
- if($(this).hasClass('btn-pop-close')) {
- _this.hide(id);
- return;
- }
- switch (id) {
- case 'ITP_BTN_MPOMNG01010_POP_CONFIRM': break;
- case 'ITP_BTN_MPOMNG01010_POP_SEARCH':
- break;
- }
- return false;
- });
- },
- hide: function(id) {
- $('#' + id).closest('.mobile-pop-close').hide();
- }
- };
|