Ver Fonte

240702-1553-Kim

hokky há 4 meses atrás
pai
commit
02a794fe35

+ 1 - 1
dabory/para/erp/ko_KR/copy/body-copy/stock/genio-genio.json

@@ -1,6 +1,6 @@
 {
     "General": {
-        "Title": "재고조정 항목 복사",
+        "Title": "재고 항목복사",
         "PageApi": "body-copy-page",
         "ActApi": "body-copy-mact"
     },

+ 34 - 0
dabory/para/erp/ko_KR/copy/copy-to-another/stock/genio-genio.json

@@ -0,0 +1,34 @@
+{
+    "General": {
+        "Title": "상품재고에서 상품재고로 복사",
+        "ActApi": "copy-to-another",
+        "PickApi": "genio-pick",
+        "SourceTable": "stock/genio",
+        "TargetTable": "genio"
+    },
+
+    "//FormVars": "ListVars[0]-Caption",
+    "FormVars": [
+        {
+            "SourceButton": "복사할 수불번호",
+            "TargetButton": "복사될 수불번호",
+            "EqualLabel": "복사할 번호를 복사될 번호의 컬럼에 복사하기",
+            "ItemCopyLabel": "전체 품목 복사 선택",
+            "CopyItemRadio": "복사 함",
+            "DontCopyRadio": "복사 않음"
+        }
+    ],
+
+    "//CopyToAnotherPopupVars": "[0]-filter, [1]-component, [2]-parameter",
+    "CopyToAnotherPopupVars": [
+        {
+            "Source": "slip_no"
+        },
+        {
+            "Source": "slip"
+        },
+        {
+            "Source": "/search/slip-search/stock/genio"
+        }
+    ]
+}

+ 22 - 9
public/js/modals-controller/b-type/common.js

@@ -35,6 +35,7 @@
     Btype.get_slip_form_init = async function (query_name = undefined) {
         if (isEmpty(query_name)) {
             query_name = formB['QueryVars']['QueryName']
+            // console.log('query_name : ', query_name);
         }
         const response = await get_api_data('slip-form-init', {
             QueryVars: {
@@ -44,7 +45,7 @@
 
         return response.data;
     };
-
+    // 배열의 각 요소들을 순환하면서 option태그를 생성해줌
     Btype.create_deal_type_select_box_options = async function (page, dom_val = '#deal-type-select') {
         // let page = await get_select_box_options_data('deal-type-page', 'deal_category="purch"')
         let html =  page.reduce(function (accumulator, item) {
@@ -128,6 +129,7 @@
 
     Btype.call_act_api = function (data, callback, act_api = undefined, argObj = '#frm', namespace = 'window') {
         let url = eval(namespace).formB.General.ActApi;
+
         if (! isEmpty(act_api)) { url = act_api; }
 
         $('.save-button').prop('disabled', true);
@@ -158,19 +160,26 @@
         });
     };
 
+    // input 요소를 통해 상위 요소 제어
     Btype.bd_cursor_click = function ($this) {
         let table = $($this).closest('table');
         let th = $(table).find('thead th');
         let tr = $($this).closest('tr');
 
+        // th 순회하며 #이 붙지 않은 요소들 활성/비활성화
         $(th).each(function (index) {
             if (! trim($(this).text()).includes('#')) {
                 Btype.able_or_disable_txt_box($(tr).children(`td:eq(${index})`).find('input'));
                 Btype.able_or_disable_txt_box($(tr).children(`td:eq(${index})`).find('select'));
             }
         })
+        // 현재 선택된 input요소의 tr에서 첫번째 td의 input 요소의 name
+        // let cursor = $(tr).find('td:eq(0) input').attr('name')
+        let cursor = $(tr).find('td:eq(0) input');
+        if(cursor.is(':hidden')){
+            cursor = $(tr).find('td:eq(1) input').attr('name')
+        }
 
-        let cursor = $(tr).find('td:eq(0) input').attr('name')
         $(table).find(`input[name='${cursor}']`).each(function (i) {
             if (! $(this).is(':checked')) {
                 let tr = $(this).closest('tr');
@@ -184,7 +193,10 @@
             }
         })
 
-        $($($this).closest('tr')).children(`td:eq(${Btype.get_first_required_th_index(table)})`).find('input').focus();
+        let currentInput = $this;
+        currentInput.focus();
+        currentInput.select();
+        // $($($this).closest('tr')).children(`td:eq(${Btype.get_first_required_th_index(table)})`).find('input').focus();
     };
 
     Btype.table_td_focus = function ($this) {
@@ -250,6 +262,7 @@
                 {Id: item_id }
             ]
         })
+
         let item = response.data.Page[0];
         let next_input = eval(namespace).set_item_data_to_textbox(item)
 
@@ -257,6 +270,7 @@
         next_input.focus();
     };
 
+    // 첫번째 필수항목(th) 찾기
     Btype.get_first_required_th_index = function (table, start_index) {
         let th = $(table).find('thead th')
         let first_index = start_index
@@ -611,7 +625,6 @@
 
     Btype.get_name_pick_api = async function (url, id) {
         const response = await get_api_data(url, { Page: [ { Id:  parseInt(id) } ] })
-
         return response.data.Page[0]
     };
 
@@ -669,6 +682,7 @@
     };
 
     Btype.btn_act_save = function (argObj = '#frm', callback = undefined, namespace = 'window') {
+        // argObj 입력창 필수요소 체크
         if (dom_required_check(`${argObj} input`) || dom_required_check(`${argObj} select`)) {
             iziToast.warning({
                 title: 'Warning',
@@ -677,9 +691,10 @@
             return false;
         }
 
-        Btype.call_act_api(eval(namespace).get_parameter(), function() {
+        test = Btype.call_act_api(eval(namespace).get_parameter(), function() {
             if (! isEmpty(callback)) { callback(); }
         }, undefined, argObj, namespace);
+
         return true;
     };
     // end head act btn
@@ -697,10 +712,6 @@
             Page: [ eval(namespace).get_parameter() ]
         });
         const page = response.data.Page
-
-        // console.log(eval(namespace).get_parameter())
-        // console.log(response)
-        // console.log(page)
         if (page) {
             set_as_response_id(page[0].Id, argObj)
             return true
@@ -737,7 +748,9 @@
             // $(argObj).find('.end-date').val(end_date)
 
             // $(`input:radio[name='query-speed']:radio[value='${query['SlipSearchVars']['QuerySpeed']}']`).prop('checked', true);
+            // 캐시데이터가 있으면 캐시데이터에 저장된 값을 가져온다
             $(argObj).find('.slip-no').val(query['SlipSearchVars']['SlipNo'])
+            // console.log('SlipNo : ', query['SlipSearchVars']['SlipNo'])
             $(argObj).find('.company-name').val(query['SlipSearchVars']['CompanyName'])
             $(argObj).find('.item-code').val(query['SlipSearchVars']['ItemCode'])
             $(argObj).find(`.modal-line-select`).val(query['PageVars']['Limit'])

+ 48 - 2
resources/views/front/dabory/erp/stock/genio.blade.php

@@ -6,6 +6,17 @@
     <div class="row">
         <div class="col-xl-12">
             <div class="mb-1 pt-2 text-right">
+                <button type="button" hidden
+                    class="btn btn-success btn-open-modal window item-modal-btn"
+                    data-target="item"
+                    data-clicked="Btype.get_item_id"
+                    data-variable="itemModal">
+                </button>
+
+                <button type="button" hidden
+                    class="btn btn-success btn-open-modal modal-btn">
+                </button>
+
                 <button type="button"
                     class="btn btn-success btn-open-modal"
                     data-target="slip"
@@ -218,6 +229,28 @@
 
 @endsection
 
+@foreach ($formB['HeadSelectOptions'] as $selectOption)
+    @if (! empty($selectOption['Parameter']))
+        @push('modal')
+            @include($selectOption['BladeRoute'], [
+                'moealSetFile' => $selectOption['Parameter'],
+                'modalClassName' => $selectOption['ModalClassName']
+            ])
+        @endpush
+    @endif
+@endforeach
+
+@foreach ($formB['BodySelectOptions'] as $selectOption)
+    @if (! empty($selectOption['Parameter']))
+        @push('modal')
+            @include($selectOption['BladeRoute'], [
+                'moealSetFile' => $selectOption['Parameter'],
+                'modalClassName' => $selectOption['ModalClassName']
+            ])
+        @endpush
+    @endif
+@endforeach
+
 @section('modal')
     @include('front.outline.static.slip', ['moealSetFile' => $genioModal])
     @include('front.outline.static.company', ['moealSetFile' => $companyModal])
@@ -267,6 +300,7 @@
                 switch( $(this).data('value') ) {
                     case 'save': Btype.btn_act_save('#genio-form #frm'); break;
                     case 'new': btn_act_new(); break;
+                    case 'copy-to-another': btn_act_copy_to_another(str_replace_hyphen($(this).data('parameter'), '/')); break;
                     case 'save-and-new': Btype.btn_act_save_and_new('#genio-form #frm'); break;
                     case 'delete': Btype.btn_act_del('#genio-form #frm'); break;
                 }
@@ -275,7 +309,6 @@
             $('#remarks-txt-area').on('dblclick', function () {
                 $('#modal-memo2').find('#memo-textarea').val('')
                 $('#modal-memo2').data('txtarea_id', '#remarks-txt-area')
-                // 모달창 textarea에 입력한 값을 넣어줌
                 $('#modal-memo2').find('#memo-textarea').val($('#remarks-txt-area').val())
                 $('#modal-memo2').modal('show');
             });
@@ -381,6 +414,20 @@
             $('#our-contact-select').html(our_contact);
         }
 
+        // start head act btn
+        function btn_act_copy_to_another(parameter_name) {
+            console.log('parameter_name : ',parameter_name);
+            let data = formB['HeadSelectOptions'].filter(selectOption => selectOption['ModalClassName'] == parameter_name)[0];
+            console.log('parameter : ', data['Parameter']);
+            // $(`#modal-copy-to-another.${parameter_name}`).find('.target-slip-no-txt').data('slip-no', $('#auto-slip-no-txt').val())
+            $(`#modal-copy-to-another.${parameter_name}`).find('.source-slip-no-txt').val($('#auto-slip-no-txt').val())
+            $('.stock').find('.modal-btn').data('target', 'copy-to-another')
+            $('.stock').find('.modal-btn').data('variable', data['Parameter'])
+            $('.stock').find('.modal-btn').data('class', parameter_name)
+            $('.stock').find('.modal-btn').trigger('click')
+            console.log('test : ', $(`#modal-copy-to-another.${parameter_name}`))
+        }
+
         function bd_update_due_to_vat_rate_change() {
             let data = [];
 
@@ -447,7 +494,6 @@
             $('#auto-slip-no-txt').val(hd_page.GenioNo)
             $('#genio-date').val(moment(to_date(hd_page.GenioDate)).format('YYYY-MM-DD'))
             $('#deal-type-select').val(hd_page.DealTypeId)
-
             $('#supplier-txt').val(hd_page.CompanyName)
             $('#supplier-txt').data('id', hd_page.CompanyId)
             $('#supplier-txt').data('contact', hd_page.CompanyContact)

+ 19 - 0
resources/views/front/dabory/erp/stock/tab/genio-correct.blade.php

@@ -177,6 +177,25 @@
                     GenioCorrect.add_tr();
                 }
             };
+
+            GenioCorrect.btn_bd_act_body_copy = async function (parameter_name) {
+            if (parseInt($('#frm').find('#Id').val()) == 0) {
+                return iziToast.error({
+                    title: 'Error',
+                    message: @json(_e('Can NOT copy in the status')),
+                });
+            }
+
+            // $(`#modal-bodycopy.${parameter_name}`).find('.slip_no-txt').val($('#auto-slip-no-txt').val())
+            $(`#modal-bodycopy.${parameter_name}`).find('.company_name-txt').val($('#supplier-txt').val())
+            let data = formB['BodySelectOptions'].filter(selectOption => selectOption['ModalClassName'] == parameter_name)[0];
+            // console.log('data : ', data);
+            $('.stock').find('.modal-btn').data('target', 'bodycopy')
+            $('.stock').find('.modal-btn').data('variable', data['Parameter'])
+            $('.stock').find('.modal-btn').data('class', parameter_name)
+            $('.stock').find('.modal-btn').trigger('click')
+            $(`#modal-bodycopy.${parameter_name}`).find('.body-copy-act').data('slip_no', $('#auto-slip-no-txt').val() )
+        }
             // end body act btn
 
             GenioCorrect.add_tr = async function () {

+ 26 - 22
resources/views/front/outline/static/body-copy.blade.php

@@ -1,5 +1,6 @@
 <!--- body-copy-search --->
 @php $modalClassName = $modalClassName ?? ''; @endphp
+
 <div class="modal fade modal-red {{ $modalClassName }}" id="modal-bodycopy" aria-hidden="true" data-backdrop="static" style="display: none; z-index: 1050;">
     <div class="modal-dialog m-auto pt-4" style="max-width: 1250px;">
         <button type="button" hidden
@@ -75,23 +76,25 @@
                 <div class="jumbotron jumbotron-fluid w-100 mb-2 py-2">
                     <div class="col-12 d-flex flex-row flex-wrap  align-items-md-center py-2">
 						<!--날짜-->
-						<div class="d-flex flex-column mb-2 sel-date">
-                            <label class="m-0">{{ $moealSetFile['FormVars']['Title']['DayFromTodayOption'] }}</label>
-                            <select class="rounded w-100 day-from-today-select">
-                                <option value="10">10</option>
-                                <option value="20">20</option>
-                                <option value="30" selected>30</option>
-                                <option value="40">40</option>
-                                <option value="50">50</option>
-                                <option value="60">60</option>
-                                <option value="70">70</option>
-                                <option value="80">80</option>
-                                <option value="90">90</option>
-                                <option value="150">150</option>
-                                <option value="300">300</option>
-                                <option value="10000">10000</option>
-                            </select>
-                        </div>
+                        @if(isset($moealSetFile['FormVars']['Title']['DayFromTodayOption']) && !empty($moealSetFile['FormVars']['Title']['DayFromTodayOption']))
+                            <div class="d-flex flex-column mb-2 sel-date">
+                                <label class="m-0">{{ $moealSetFile['FormVars']['Title']['DayFromTodayOption'] }}</label>
+                                <select class="rounded w-100 day-from-today-select">
+                                    <option value="10">10</option>
+                                    <option value="20">20</option>
+                                    <option value="30" selected>30</option>
+                                    <option value="40">40</option>
+                                    <option value="50">50</option>
+                                    <option value="60">60</option>
+                                    <option value="70">70</option>
+                                    <option value="80">80</option>
+                                    <option value="90">90</option>
+                                    <option value="150">150</option>
+                                    <option value="300">300</option>
+                                    <option value="10000">10000</option>
+                                </select>
+                            </div>
+                        @endif
                         <!--//날짜 -->
 
                         <div class="d-flex align-items-stretch align-items-md-center flex-column flex-md-row mb-2 mb-md-0 px-0 px-md-1">
@@ -104,10 +107,12 @@
                                 @endforeach
                             </select>
                         </div>
-                        <div class="d-flex align-items-stretch align-items-md-center flex-column flex-md-row mb-2 mb-md-0 px-0 px-md-1 pl-3">
-                            <input type="checkbox" value="1" class="text-md-center w-100 overflow-hidden text-nowrap" name="ShowOnlyClosedChecked" id="{{ $modalClassName }}-ShowOnlyClosedChecked">
-                            <label class="m-0 text-nowrap" for="{{ $modalClassName }}-ShowOnlyClosedChecked">{{ $moealSetFile['FormVars']['Title']['ShowOnlyClosedChecked'] }}</label>
-                        </div>
+                        @if(isset($moealSetFile['FormVars']['Title']['ShowOnlyClosedChecked']) && !empty($moealSetFile['FormVars']['Title']['ShowOnlyClosedChecked']))
+                            <div class="d-flex align-items-stretch align-items-md-center flex-column flex-md-row mb-2 mb-md-0 px-0 px-md-1 pl-3">
+                                <input type="checkbox" value="1" class="text-md-center w-100 overflow-hidden text-nowrap" name="ShowOnlyClosedChecked" id="{{ $modalClassName }}-ShowOnlyClosedChecked">
+                                <label class="m-0 text-nowrap" for="{{ $modalClassName }}-ShowOnlyClosedChecked">{{ $moealSetFile['FormVars']['Title']['ShowOnlyClosedChecked'] }}</label>
+                            </div>
+                        @endif
                     </div>
                 </div>
 
@@ -150,7 +155,6 @@
 <script>
     function body_copy_show_modal(modal_class_name, key) {
         let func_name = `get_${bodyCopy[modal_class_name]['BodyCopyPopupVars']['Filter'][key]}`;
-
         // 첫 번째 show 했을 때만 호출
         if (! $(`#modal-bodycopy.${modal_class_name}`).find('.modal-btn').data('first')) {
             first_slip_date_rang(`#${modal_class_name}slip-date-navi-div`)