123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625 |
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- //화면변수
- const POMNG04010_GRID_ID = '#ITP_POMNG04010_jqGrid';
- const POMNG04010_GRID_LIST = '#ITP_POMNG04010_jqGrid_list';
- const POMNG04010_GRID_PAGER = '#ITP_POMNG04010_jqGridPager';
- const POMNG04010_GRID_EMPTY = '#ITP_POMNG04010_jqGridEmpty';
- const POMNG04010_DETAIL_GRID_ID = '#ITP_POMNG04010_DETAIL_jqGrid';
- const POMNG04010_DETAIL_GRID_LIST = '#ITP_POMNG04010_DETAIL_jqGrid_list';
- const POMNG04010_DETAIL_GRID_PAGER = '#ITP_POMNG04010_DETAIL_jqGridPager';
- const POMNG04010_DETAIL_GRID_EMPTY = '#ITP_POMNG04010_DETAIL_jqGridEmpty';
- let ITP_PODR_DTL_ST_CD = fn_make_common_cd_list(CODE_LIST, 'PODR_DTL_ST_CD', true, '구매발주상세상태코드');
- //API URL
- let API_POMNG_PO_DETAIL_GRID_LIST = '/api/pomng/po/detail-grid-list';
- let API_POMNG_PO_INFO_PCHODR = '/api/pomng/po/info-pchOdr';
- let API_POMNG_PO_CANCEL_PCHPO = '/api/pomng/po/cancel-pchPo';
- //화면 grid ColModel
- const gridColModel = {
- list:[
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'PCH_PODR_UNQ_NO', name: 'pchPodrUnqNo',
- label: ITP_MSG_LOCALE.label.pchPodrUnqNo, // 발주번호
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'PCH_ODR_ST_NM', name: 'pchOdrStNm',
- label: ITP_MSG_LOCALE.label.pchOdrStNm, // 발주상태명
- width: '7', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'PODR_DT', name: 'podrDt',
- label: ITP_MSG_LOCALE.label.podrDt, // 발주일자
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'DLV_DVSN', name: 'dlvDvsn',
- label: ITP_MSG_LOCALE.label.dlvDvsnNm, // 배송구분
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: true, classes: 'ui-ellipsis'
- },
- {
- index: 'DLV_DVSN_NM', name: 'dlvDvsnNm',
- label: ITP_MSG_LOCALE.label.dlvDvsnNm, // 배송구분명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'WHS_NM', name: 'whsNm',
- label: ITP_MSG_LOCALE.label.locationNm, // 입고처
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'SPPLY_NM', name: 'spplyNm',
- label: ITP_MSG_LOCALE.label.spplyNm, // 공급업체명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'PODR_TOTAL_AMT', name: 'podrTotalAmt',
- label: ITP_MSG_LOCALE.label.podrTotalAmt, // 총 발주금액
- width: '8', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'PODR_ITEM_QTY', name: 'podrItemQty',
- label: ITP_MSG_LOCALE.label.podrItemQty, // 발주품목수
- width: '8', fixed: false, align: 'right',
- sortable: false, hidden: false
- },
- {
- index: 'PODR_MGR_NM', name: 'podrMgrNm',
- label: ITP_MSG_LOCALE.label.podrMgrNm, // 발주담당자
- width: '9', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, // 브랜드명
- width: '10', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- }
- ],
- view: [],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'ITEM_ID', name: 'itemId',
- label: ITP_MSG_LOCALE.label.itemId, // 품목번호
- width: '8', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ITEM_NM', name: 'itemNm',
- label: ITP_MSG_LOCALE.label.itemNm, // 품목명
- width: '6', fixed: false, align: 'left',
- sortable: false, hidden: false, classes: 'ui-ellipsis'
- },
- {
- index: 'UNIT_AMT', name: 'unitAmt',
- label: ITP_MSG_LOCALE.label.unitAmt, // 단가
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'UNIT', name: 'unit',
- label: ITP_MSG_LOCALE.label.unit, // 기본단위
- width: '3', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'PODR_QTY', name: 'podrQty',
- label: ITP_MSG_LOCALE.label.podrQty, // 발주수량
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false
- },
- {
- index: 'PODR_AMT', name: 'podrAmt',
- label: ITP_MSG_LOCALE.label.podrAmt, // 발주금액
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false,
- formatter: 'integer', formatoptions: {thousandsSeparator: ','}
- },
- {
- index: 'WHS_PASS_QTY', name: 'whsPassQty',
- label: ITP_MSG_LOCALE.label.whsPassQty, // 출고가능수량
- width: '5', fixed: false, align: 'right',
- sortable: false, hidden: false
- },
- {
- index: 'PCH_PODR_DTL_NO', name: 'pchPodrDtlNo',
- label: ITP_MSG_LOCALE.label.pchPodrDtlNo, // 발주항번
- width: '3', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'PODR_DTL_ST_CD', name: 'podrDtlStCd',
- label: ITP_MSG_LOCALE.label.podrDtlStCd, // 구매발주상세상태코드
- width: '5', fixed: false, align: 'center',
- sortable: false, hidden: false, formatter: 'select', edittype: 'select',
- editoptions: {value: ITP_PODR_DTL_ST_CD}
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function() {
- this.ui.init();
- this.event.init();
- },
- ui: {
- init: function() {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('POMNG04010');
- // 공통코드 표시
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
- // 조회일자 지정
- var now = new Date();
- var fromDate = new Date(now);
- fromDate.setDate(now.getDate() - 7);
- var toDate = new Date(now);
- $('#ITP_TAB_POMNG04010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- $('#ITP_FORM_POMNG04010_SEARCH_FROM_DT').datepicker('setDate', fromDate);
- $('#ITP_FORM_POMNG04010_SEARCH_TO_DT').datepicker('setDate', toDate);
- },
- grid: function() {
- itp_fn_jqgrid_resize(POMNG04010_GRID_ID, POMNG04010_GRID_LIST, 'lg');
- //listObj.empty.init();
- itp_fn_fire_window_resize();
- },
- ready: function() {
- listObj.init();
- }
- },
- event: {
- init: function() {
- this.button();
- },
- button: function() {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_POMNG04010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_POMNG04010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
- case 'ITP_BTN_POMNG04010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
- case 'ITP_BTN_POMNG04010_CANCELLIST' : modifyObj.button.cancel(); break; // 취소/목록 버튼
- case 'ITP_BTN_POMNG04010_DELETE' : modifyObj.button.del(); break; // 발주 취소 버튼(예정)
- case 'ITP_BTN_POMNG04010_EXCEL' : listObj.excelDown(); break; // 엑셀
- }
- });
- });
- }
- },
- switchScreen: function(mode) {
- $('.itp_det_head').find('button[id^="ITP_BTN_POMNG04010_"]').each(function(i) {
- $(this).hide();
- });
- $('#ITP_TAB_POMNG04010').find('div[id$="_CONTAINER"]').each(function(i) {
- $(this).hide();
- });
- if(mode == 'LIST') { // 목록
- itp_fn_fire_window_resize();
- fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_SRH', '#ITP_BTN_POMNG04010_NEWREG']);
- $('#ITP_AJAX_POMNG04010_LIST_CONTAINER').show();
- $('#ITP_FORM_POMNG04010_SEARCH #ITP_FORM_POMNG04010_SEARCH_BRAND_ID').val(fn_make_user_info.get('brandId'));
- $('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').show();
- $('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').show();
- $('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').show();
- $('#ITP_BTN_POMNG04010_DELETE_WHS_ID').show();
- $('#ITP_BTN_POMNG04010_EXCEL').show();
-
- } /*else if(mode == 'ADD') { // 등록
- $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
- $('#ITP_FORM_POMNG04010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
- $(this).attr('id') === 'ITP_FORM_POMNG04010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
- if(elem.type === 'select') {
- $(this).val('').prop('selected', true);
- }
- });
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_FILE_NO').val('');
- $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').removeAttr('readonly');
- $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').removeAttr('readonly');
- $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').removeAttr('readonly');
- $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').removeAttr('readonly');
- // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').removeAttr('disabled');
- // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').removeAttr('disabled');
- $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').show();
- $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').show();
- $('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').hide();
- $('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').show();
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(fn_make_user_info.get('afflShopId'));
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- $('.fnBrandId').text('(자동부여)');
- } */else if(mode == 'MODIFY') { // 수정
- $('#ITP_AJAX_POMNG04010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_CANCELLIST', '#ITP_BTN_POMNG04010_SAVE']);
- $('#ITP_BTN_POMNG04010_CANCELLIST').show();
- $('#ITP_BTN_POMNG04010_DELETE').show();
-
- $('#ITP_FORM_POMNG04010_DETAIL_BRAND_ID').attr('readonly', true);
- $('#ITP_FORM_POMNG04010_DETAIL_BRAND_NM').attr('readonly', true);
- $('#ITP_FORM_POMNG04010_DETAIL_BSNS_REG_NO').attr('readonly', true);
- $('#ITP_FORM_POMNG04010_DETAIL_CORP_REG_NO').attr('readonly', true);
- // $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').attr('disabled', true);
- // $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').attr('disabled', true);
- $('#ITP_FORM_POMNG04010_DETAIL_SEARCH_AFFL_SHOP').hide();
- $('#ITP_FORM_POMNG04010_DETAIL_DELETE_AFFL_SHOP').hide();
- $('#ITP_FORM_POMNG04010_DETAIL .itp_form_info').show();
- $('#ITP_FORM_POMNG04010_DETAIL .itp_form_change').hide();
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRAND_ID').val(fn_make_user_info.get('brandId'));
- } /*else if(mode == 'VIEW') { // 보기
- $('#ITP_AJAX_POMNG04010_VIEW_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_POMNG04010_MODIFY', '#ITP_BTN_POMNG04010_CANCELLIST']);
- }*/
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function() {
- this.grid.init();
- this.action();
- },
- itp_POMNG04010_param: {},
- itp_POMNG04010_search: false,
- button: {
- search: function() {
- listObj.itp_POMNG04010_search = true;
- let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- param.sidx = '0';
- $(POMNG04010_GRID_ID).data('grid-param',param);
- $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- }
- },
- empty: {
- init: function() {
-
- },
- push: function() {
-
- },
- back: function() {
-
- }
- },
- grid: {
- init: function() {
- // 데이터 없을때
- //listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_POMNG04010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.sidx = '0';
- var option = {
- gridId: POMNG04010_GRID_ID,
- colModel: gridColModel.list,
- param: param,
- url: DOMAIN + API_POMNG_PO_DETAIL_GRID_LIST,
- pager: POMNG04010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm === 'pchPodrUnqNo') {
- const pchPodrUnqNoVal = $(this).jqGrid('getCell', rowId, 'pchPodrUnqNo');
- const brandIdVal = $(this).jqGrid('getCell', rowId, 'brandId');
- const key = {pchPodrUnqNo: pchPodrUnqNoVal, brandId: brandIdVal};
- var param = $.param(key);
- modifyObj.init(param);
- }
- },
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, POMNG04010_GRID_ID, true, 'number', 'POMNG04010', listObj.itp_POMNG04010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(POMNG04010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(POMNG04010_GRID_ID).jqGrid('setCell', rowId, 'pchPodrUnqNo', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(POMNG04010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData: function() {
- $(POMNG04010_GRID_ID).jqGrid('clearGridData', true);
- $(POMNG04010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(POMNG04010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(POMNG04010_GRID_EMPTY).show();
- },
- unload: function() {
- $.jgrid.gridUnload(POMNG04010_GRID_ID);
- }
- },
- action: function() {
- var _this = this;
- // 공급업체 조회 버튼 클릭
- $('#ITP_BTN_POMNG04010_SEARCH_SPPLY_ID').on('click', function() {
- _this.popup('spply');
- });
- // 공급업체 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_POMNG04010_DELETE_SPPLY_ID').on('click', function() {
- $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val('');
- $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val('');
- });
- // 매장/창고 조회 버튼 클릭
- $('#ITP_BTN_POMNG04010_SEARCH_WHS_ID').on('click', function() {
- _this.popup('whs');
- });
- // 매장/창고 텍스트 삭제 버튼 클릭
- $('#ITP_BTN_POMNG04010_DELETE_WHS_ID').on('click', function() {
- $('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val('');
- $('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val('');
- });
- },
- popup: function(keyword) {
- var popFn = this.callback.create;
-
- if(keyword === 'spply'){
- const key = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId')};
- fn_call_popup('biz', 'BIZPOP_STORE_SPPLY', '#ITP_ASIDE', popFn, key, 'S');
- } else if(keyword === 'whs'){
- const key1 = {brandId:fn_make_user_info.get('brandId'),storeId:fn_make_user_info.get('storeId'), whsDvsn:""};
- fn_call_popup('biz', 'BIZPOP_WHS_LOCATION', '#ITP_ASIDE', popFn, key1, 'S');
- }
- },
- callback: {
- create: function(rowDataPop) {
- if(rowDataPop.hasOwnProperty('whsId') == false) {
- $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_NM').val(rowDataPop.spplyNm);
- $('#ITP_FORM_POMNG04010_DETAIL_SPPLY_ID').val(rowDataPop.spplyId);
- } else {
- $('#ITP_FORM_POMNG04010_DETAIL_WHS_NM').val(rowDataPop.whsNm);
- $('#ITP_FORM_POMNG04010_DETAIL_WHS_ID').val(rowDataPop.whsId);
- }
- }
- },
- excelDown: function() {
-
- var param = {
- 'url': API_POMNG_PO_DETAIL_GRID_LIST,
- 'param': $('#ITP_FORM_POMNG04010_SEARCH').serializeObject(),
- 'gridColumns': $(POMNG04010_GRID_ID).jqGrid('getGridParam', 'colModel'),
- 'fileName': '구매발주현황.xlsx',
- 'sheetName': '구매발주현황리스트'
- };
- itp_fn_remote_to_excel(param);
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function(param) {
- this.load(param);
- },
- itp_POMNG04010_param: {},
- itp_POMNG04010_search: false,
- button: {
- cancel: function() {
- listObj.grid.search();
- },
- del: function() {
- const formId = '#ITP_FORM_POMNG04010_DETAIL';
- itp_fn_form_clear_validate(null, formId);
- itp_fn_grid_save_rows(POMNG04010_DETAIL_GRID_ID);
- let gridUpdateData = [];
- for(var i=0; i<$(POMNG04010_DETAIL_GRID_ID).getGridParam('reccount'); i++) {
- $(POMNG04010_DETAIL_GRID_ID).jqGrid('saveCell', i+1, 2)
- }
- const selection = $(POMNG04010_DETAIL_GRID_ID).getGridParam('selarrrow');
-
- if (selection.length == 0 ) {
- alert("취소 대상 품목이 없습니다.");
- return ;
- }
-
- let param = $(formId).serializeObject();
- let newData = [];
- for(let i = 0; i < selection.length; i++){
- let before = $(POMNG04010_DETAIL_GRID_ID).getRowData(selection[i]);
- if (before.podrDtlStCd == 'POD0' ) {
- before.pchPodrUnqNo = param.pchPodrUnqNo;
- newData.push(before);
- }
- }
- param.gridUpdateData = newData;
-
- var modalFn = {
- callBack: () => {
- var searhFn = function() {
- ITP_FORM_POMNG02010_DETAIL_IS_WRITING = false;
- listObj.grid.search();
- };
- fn_ajax_call(API_POMNG_PO_CANCEL_PCHPO, JSON.stringify(param), searhFn, 'POST');
- }
- };
- itp_fn_modal_confirm('발주 취소 하시겠습니까?', modalFn);
-
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(POMNG04010_VIEW_GRID_EMPTY).on('click', function() {
- _this.back();
- viewObj.itp_POMNG04010_param.gridSize = $.jgrid.defaults.rowNum;
- $(POMNG04010_GRID_ID).setGridParam({'postData': JSON.stringify(viewObj.itp_POMNG04010_param)}).trigger('reloadGrid');
- });
- },
- push: function() {
- let param = $('#ITP_FORM_POMNG04010_DETAIL').serializeObject();
- viewObj.itp_POMNG04010_param = param;
- },
- back: function() {
- $('#ITP_FORM_POMNG04010_SERVICE_BRAND_TYPE').val(viewObj.itp_POMNG04010_param.brandType);
- $('#ITP_FORM_POMNG04010_SERVICE_ST_CD').val(viewObj.itp_POMNG04010_param.stCd);
- $('#ITP_FORM_POMNG04010_SEARCH_BRAND_NM').val(viewObj.itp_POMNG04010_param.brandNm);
- }
- },
- load: function(param) {
- fn_ajax_call(API_POMNG_PO_INFO_PCHODR, param, this.callback, 'GET');
- },
- callback: function(result) {
- // 그리드 전화번호 '-' 함수
- function convertTel(value){
- answer = (value.startsWith('0')) ? value.replace(/[^0-9]/g, "")
- .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
- .replace("--", "-") : '';
- return answer;
- }
- let telNo = convertTel(result.podrMgrTelNo);
- pageObj.switchScreen('MODIFY');
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_AFFL_SHOP_ID').val(result.afflShopId);
- $('#ITP_FORM_POMNG04010_DETAIL .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnPchPodrUnqNo').text(result.pchPodrUnqNo);
- $('#ITP_FORM_POMNG04010_DETAIL .fnSpplyNm').text(result.spplyNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnPodrDt').text(result.podrDt);
- $('#ITP_FORM_POMNG04010_DETAIL .fnPchOdrStCd').text(result.pchOdrStNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnPodrTotalAmt').text(result.podrTotalAmt.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','));
- $('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNm').text(result.podrMgrNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnPodrMgrNo').text(telNo);
- $('#ITP_FORM_POMNG04010_DETAIL .fnDlvDvsn').text(result.dlvDvsnNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnDlvReqDt').text(result.dlvReqDt);
- $('#ITP_FORM_POMNG04010_DETAIL .fnShmtWhsNm').text(result.shmtWhsNm);
- $('#ITP_FORM_POMNG04010_DETAIL .fnWhsNm').text(result.whsNm);
-
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_BRANDID').val(result.brandId);
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_DLV_DVSN').val(result.dlvDvsn);
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_PCH_PODR_UNQ_NO').val(result.pchPodrUnqNo);
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_STORE_ID').val(result.storeId);
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_LOCATION').val(result.shmtLocation);
- $('#ITP_FORM_POMNG04010_DETAIL #ITP_FORM_POMNG04010_DETAIL_SHM_WHS_ID').val(result.shmtWhsId);
- if (fn_make_user_info.get('shmtColProcType') == '20') {
- $('#ITP_BTN_POMNG04010_DELETE').hide();
- } else {
- $('#ITP_BTN_POMNG04010_DELETE').show();
- }
- modifyObj.grid.init('MODIFY', result.pchOdrDtlList)
- },
- grid: {
- init: function(mode, gridData) {
- this.mode = mode;
- this.gridId = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_ID : POMNG04010_DETAIL_GRID_ID;
- this.gridList = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_LIST : POMNG04010_DETAIL_GRID_LIST;
- this.gridEmpty = (mode === 'VIEW') ? POMNG04010_VIEW_GRID_EMPTY : POMNG04010_DETAIL_GRID_EMPTY;
- this.unload();
- this.load(mode, gridData);
- },
- mode: '',
- colModel: gridColModel.view,
- load: function(mode, gridData) {
- var _this = this;
- var option = {
- gridId: _this.gridId,
- colModel: gridColModel.detail,
- data: gridData,
- multiselect: true,
- onSelectRow: function(index, status) {
- if(index) {
- var row = $(POMNG04010_DETAIL_GRID_ID).jqGrid('getRowData', index);
- if(row.podrDtlStCd == 'POD2') {
- $("#jqg_ITP_POMNG04010_DETAIL_jqGrid_" + index).prop("checked", false);
- }
- }
- },
- onSelectAll: function(rowIds, status) {
- for(let i = 0; i < rowIds.length; i++){
- let podrDtlStCd = $(POMNG04010_DETAIL_GRID_ID).getCell(rowIds[i], 'podrDtlStCd');
- if(podrDtlStCd == 'POD2') {
- $("#jqg_ITP_POMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", false);
- } else {
- $("#jqg_ITP_POMNG04010_DETAIL_jqGrid_" + rowIds[i]).prop("checked", status);
- }
- }
- },
- loadComplete: function(data) {
- let datas = data.rows;
- for(let i = 0; i < datas.length; i++) {
- let podrDtlStCd = datas[i].podrDtlStCd;
- if(podrDtlStCd == 'POD2') {
- $('#jqg_ITP_POMNG04010_DETAIL_jqGrid_' + (i + 1)).attr('disabled', true);
- }
- }
- itp_fn_grid_load_complete(data, POMNG04010_DETAIL_GRID_ID, true, 'number', 'POMNG04010', modifyObj.itp_POMNG04010_search, modifyObj.empty, true, data.gridRecords, true);
- }
- };
- itp_fn_grid_make_local(option);
- },
- unload: function() {
- $.jgrid.gridUnload(this.gridId);
- }
- },
- isValid: function(formId) {
- var isValid = false;
- $(formId).find('input, select, checkbox, textarea').each(function(k) {
- if($(this).data('check-required')) {
- var arry = $(this).data('check-required').split(',');
- isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined);
- if(!isValid) return false;
- }
- });
- return isValid;
- },
- };
|