hokky 1 mese fa
parent
commit
0c8a6de4da

+ 34 - 10
resources/views/front/dabory/erp/basic-settings/monthly-settle.blade.php

@@ -4,7 +4,6 @@
     <div class="content">
         <div class="row">
             <div class="col-xl-12">
-                <h2>{{ $formA['General']['Title'] }}</h2>
                 <div class="card" id="monthly-settle-form">
                     <div class="card-body mt-2" id="frm">
                         <input type="hidden" id="Id" name="Id" value="0">
@@ -31,13 +30,13 @@
                         </div>
 
                         <div class="form-group mb-3" {{ $formA['FormVars']['Hidden']['YyyyMm'] }}>
-                            <label>{{ $formA['FormVars']['Title']['YyyyMm'] }}</label>
+                            <label class="m-0">{{ $formA['FormVars']['Title']['YyyyMm'] }}</label>
                             <br>
-                            <input type="text" id="yyyy-txt" data-copy="true"
+                            <input type="text" class="rounded w-sm-auto" id="yyyy-txt" data-copy="true"
                                 maxlength="{{ $formA['FormVars']['MaxLength']['YyyyMm'] }}"
-                                {{ $formA['FormVars']['Required']['YyyyMm'] }}>
+                                {{ $formA['FormVars']['Required']['YyyyMm'] }}>&nbsp;&nbsp;년&nbsp;&nbsp;
                             @php $todayMonth = date('n');@endphp
-                            <select id = "mm-select">
+                            <select id = "mm-select" class="rounded">
                                 @foreach($monthArr as $index => $month)
                                     <option value="{{ $index + 1 }}" @if($todayMonth == $index + 1) selected @endif>
                                         {{ $month }}
@@ -90,7 +89,7 @@
                 });
             });
 
-            console.log('parameters : ', parameters);
+            // console.log(parameters);
             return parameters;
         }
 
@@ -118,6 +117,28 @@
             $('#modal-setting_monthly_settle').modal('hide');
         }
 
+        MonthlySettleForm.change_tbl_name = async function (tbl_name) {
+            let check_name;
+            switch(tbl_name){
+                case "bal_buyer":
+                    check_name = "{{ $formA['FormVars']['Title']['IsBalBuyer'] }}"
+                    break;
+                case "bal_supplier":
+                    check_name = "{{ $formA['FormVars']['Title']['IsBalSupplier'] }}"
+                    break;
+                case "bal_item":
+                    check_name = "{{ $formA['FormVars']['Title']['IsBalItem'] }}"
+                    break;
+                case "bal_reward":
+                    check_name = "{{ $formA['FormVars']['Title']['IsBalReward'] }}"
+                    break;
+                case "bal_credit":
+                    check_name = "{{ $formA['FormVars']['Title']['IsBalCredit'] }}"
+                    break;
+            }
+            return check_name;
+        }
+
         MonthlySettleForm.check_input = async function (parameters) {
             if ($('#yyyy-txt').val() == '') {
                 return iziToast.error({ title: 'Error', message: '정산년도를 입력해주세요. ex)2024' });
@@ -125,7 +146,6 @@
             if(parameters.length == 0){
                 return iziToast.error({ title: 'Error', message: '체크박스를 1개이상 체크해주세요.' });
             }
-
         }
 
         MonthlySettleForm.btn_re_cal = async function () {
@@ -134,13 +154,17 @@
 
             for (const parameter of parameters) {
                 const response = await get_api_data('monthly-settle', parameter);
-
+                // const table_name = parameter['TableName'];
+                const table_name = await MonthlySettleForm.change_tbl_name(parameter['TableName']);
+                console.log('table_name : ', table_name);
                 if (response && response.data.apiStatus) {
+                    const status = response.data.apiStatus;
+                    const message = response.data.body;
                     console.log(response);
-                    return iziToast.error({ title: 'Error', message: 'API Error' });
+                    return iziToast.error({ title: 'Error', message: `${table_name} : ${status}, ${message}` });
                 }
 
-                iziToast.success({ title: 'Success', message: '재정산 완료' });
+                iziToast.success({ title: 'Success', message: `${table_name} 완료` });
                 // console.log(response);
             }
         };