Jelajahi Sumber

241007-1119-Kim

hokky 1 bulan lalu
induk
melakukan
0cc991834f

+ 0 - 38
dabory/para/erp/ko_KR/popup/popup-setup/form-a/theme-setup-example.json

@@ -1,38 +0,0 @@
-{
-    "General": {
-        "PickApi": "theme-setup-pick",
-        "ActApi": "theme-setup-act"
-    },
-
-    "SelectButtonOptions": [
-
-    ],
-
-    "//FormVars": "ListVars[0]-Caption, ListVars[1]-hidden",
-    "FormVars": [
-        {
-            "SaveButton": "저장",
-            "SetupName": "설정이름",
-            "SetupCode": "설정코드",
-            "SeqNo": "순서",
-            "BrandCode": "브랜드코드",
-            "Component": "컴포넌트",
-            "Parameter": "파라메터",
-            "IsOnUse": "사용",
-            "IsDefault": "기본적용",
-            "SetupJson": "설정 Json"
-        },
-        {
-            "SaveButton": "center",
-            "SetupName": "center",
-            "SetupCode": "center",
-            "SeqNo": "center",
-            "BrandCode": "center",
-            "Component": "center",
-            "Parameter": "center",
-            "IsOnUse": "center",
-            "IsDefault": "center",
-            "SetupJson": "center"
-        }
-    ]
-}

+ 12 - 23
resources/views/front/dabory/erp/list-type/setup-type1.blade.php

@@ -253,38 +253,28 @@
             })
         }
 
-        function converter_setup_data(popup_option, setup_pick) {
-            var theme = "{{ env('DBR_THEME') }}";
-            const dabory_path = "{{ daboryPath('themes/' . env('DBR_THEME')) . '/erp/resources'}}";
-            // var blade_path = 'themes.'+theme;
-            // console.log('blade_path',blade_path);
-
-            // view('themes.erponly.popup-setup.form-a.theme-setup-example-form');
-            // console.log('blade_path : ', blade_path);
-            if(setup_pick == 'theme-setup-pick'){
-                popup_option['BladeRoute'] = `themes.${theme}.${popup_option['Component']}`;
+        function converter_setup_data(popup_option) {
+            if(isThemeSetup){
+                const dabory_path = "{{ daboryPath('themes/' . env('DBR_THEME')) . '/erp/resources'}}";
+                popup_option['BladeRoute'] = `${popup_option['Component']}`;
             }else{
                 popup_option['BladeRoute'] = `front.dabory.erp.${popup_option['Component']}`;
             }
-            console.log('popup_option : ', popup_option);
-            // popup_option['BladeRoute'] = `front.dabory.erp.${popup_option['Component']}`;
-            // popup_option['BladeRoute'] = `${popup_option['Component']}`;
+
+            // console.log('popup_option : ', popup_option);
             popup_option['ModalClassName'] = paramCase(popup_option['Component']);
             return popup_option;
         }
 
         async function show_select_popup(id, c1) {
             let setup_pick;
-            if(setupType1.DisplayVars.IsThemeSetup){
-                setup_pick = 'theme-setup-pick';
+            if(isThemeSetup){
+                setup_pick = 'theme-setup-pick'
                 var theme = "{{ env('DBR_THEME') }}";
                 var theme_dir = setup_pick === 'theme-setup-pick' ? `${theme}/erp` : '';
             }else{
-                setup_pick = 'setup-pick';
+                setup_pick = 'setup-pick'
             }
-            // const setup_pick = setupType1.DisplayVars.IsThemeSetup ? 'theme-setup-pick' : 'setup-pick'
-            // const theme = "{{ env('DBR_THEME') }}";
-            // const theme_dir = setup_pick === 'theme-setup-pick' ? `${theme}/erp` : '';
 
             if ($('.setupType1-table').find('#c1-tag').prop('disabled')) return;
             $('.setupType1-table').find(`input[name='bd-cursor-state']`).prop('disabled', true)
@@ -293,7 +283,7 @@
             // let response = await get_api_data('setup-pick', {
             //     Page: [ { Id: Number(id) } ]
             // })
-            console.log('setup_pick : ', setup_pick);
+
             let response = await get_api_data(setup_pick, {
                 Page: [ { Id: Number(id) } ]
             });
@@ -304,15 +294,13 @@
             let setup_json = setup.SetupJson ? JSON.parse(setup.SetupJson) : {}
             const brand_code = setup.BrandCode
             const parameter_type = camelCase(setup['Parameter'].split('/')[3])
-            console.log('setup : ', setup);
-            // return;
 
             setup = converter_setup_data({
                 Caption: setup['SetupName'],
                 Component: setup['Component'],
                 ParameterDir: setup['Parameter'],
                 ParameterType: parameter_type,
-            }, setup_pick)
+            })
 
             // response = await get_para_data(setup['ParameterType'], setup['ParameterDir'], getParameterByName('bpa'))
             response = await get_para_data(setup['ParameterType'], setup['ParameterDir'], getParameterByName('bpa'), theme_dir)
@@ -471,5 +459,6 @@
 
         let mediaModal;
         const setupType1 = {!! json_encode($setupType1) !!};
+        let isThemeSetup = setupType1.DisplayVars.IsThemeSetup;
     </script>
 @endsection

+ 0 - 156
resources/views/front/dabory/erp/popup-setup/form-a/theme-setup-example-form.blade.php

@@ -1,156 +0,0 @@
-{{-- @extends('layouts.master')
-@section('content') --}}
-
-<div id="popup-setup-form-a-theme-setup-example-form">
-    <div class="mb-1 pt-2 text-right btn-groups">
-        <button type="button" class="btn btn-sm btn-primary save-spinner-btn">
-            <span class="save-spinner spinner-border spinner-border-sm text-center" role="status" aria-hidden="true"></span>
-                Loading...
-        </button>
-        <div class="btn-group" hidden>
-            <button type="button" class="btn btn-sm btn-primary theme-setup-example-form-act save-button" data-value="save" {{ $formA['FormVars']['Hidden']['SaveButton'] }}>
-                {{ $formA['FormVars']['Title']['SaveButton'] }}
-            </button>
-        </div>
-    </div>
-    <div class="card mb-2" id="theme-setup-example-form">
-        <div class="card-header" id="frm">
-            <div class="row">
-                <div class="col-12 col-lg card-header-item">
-                    <div class="card card card-primary mb-3 mb-md-2 mb-lg-0 border-light">
-                        <div class="card-header p-0 mb-2">
-                        </div>
-                        <div class="card-body">
-                            <input type="hidden" id="Id" name="Id" value="0">
-                            {{--<div class="d-flex flex-column mb-2">--}}
-                            {{--    <label class="m-0">{{ $formA['FormVars']['Title']['SetupName'] }}</label>--}}
-                                {{--    <input type="text" id="setup-name-txt" class="rounded w-100" autocomplete="off">--}}
-                                {{--</div>--}}
-                            {{--<div class="d-flex flex-column mb-2">--}}
-                            {{--    <label class="m-0">{{ $formA['FormVars']['Title']['SetupCode'] }}</label>--}}
-                                {{--    <input type="text" id="setup-code-txt" class="rounded w-100" autocomplete="off">--}}
-                                {{--</div>--}}
-                            {{--<div class="d-flex flex-column mb-2">--}}
-                            {{--    <label class="m-0">{{ $formA['FormVars']['Title']['SeqNo'] }}</label>--}}
-                                {{--    <input type="text" id="seq-no-txt" class="rounded w-100" autocomplete="off">--}}
-                                {{--</div>--}}
-                            {{--<div class="d-flex flex-column mb-2">--}}
-                            {{--<label class="m-0">{{ $formA['FormVars']['Title']['BrandCode'] }}</label>--}}
-                                {{--<input type="text" id="brand-code-txt" class="rounded w-100" autocomplete="off">--}}
-                                {{--</div>--}}
-                            <div class="d-flex flex-column mb-2">
-                                <label class="m-0">{{ $formA['FormVars']['Title']['Component'] }}</label>
-                                <input type="text" id="component-txt" class="rounded w-100" autocomplete="off">
-                            </div>
-                            <div class="d-flex flex-column mb-2">
-                                <label class="m-0">{{ $formA['FormVars']['Title']['Parameter'] }}</label>
-                                <input type="text" id="parameter-txt" class="rounded w-100" autocomplete="off">
-                            </div>
-                            {{--<div class="align-items-center mb-2 {{ $formA['FormVars']['Display']['IsOnUse'] }}">--}}
-                            {{--    <input type="checkbox" tabindex="-1" value="1" class="text-center mr-1" id="is-on-use-check"> <label class="mb-0" for="is-on-use-check">{{ $formA['FormVars']['Title']['IsOnUse'] }}</label>--}}
-                            {{--</div>--}}
-                                {{--<div class="align-items-center mb-2 {{ $formA['FormVars']['Display']['IsDefault'] }}">--}}
-                                    {{--    <input type="checkbox" tabindex="-1" value="1" class="text-center mr-1" id="is-default-check"> <label class="mb-0" for="is-on-use-check">{{ $formA['FormVars']['Title']['IsDefault'] }}</label>--}}
-                                    {{--</div>--}}
-                                        {{--<div class="d-flex flex-column mb-2">--}}
-                                            {{--    <label class="m-0">{{ $formA['FormVars']['Title']['SetupJson'] }}</label>--}}
-                                            {{--    <input type="text" id="setup-json-txt" class="rounded w-100" autocomplete="off">--}}
-                                                {{--</div>--}}
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
-
-{{-- @endsection --}}
-
-@once
-    <script>
-        $(document).ready(async function() {
-            $('.theme-setup-example-form-act').on('click', function () {
-                // console.log($(this).data('value'))
-                switch( $(this).data('value') ) {
-                    case 'save': PopupSetupFormAThemeSetupExampleForm.btn_act_save(); break;
-                }
-            });
-
-            activate_button_group()
-        });
-
-        (function( PopupSetupFormAThemeSetupExampleForm, $, undefined ) {
-            PopupSetupFormAThemeSetupExampleForm.formA = {!! json_encode($formA) !!};
-
-            PopupSetupFormAThemeSetupExampleForm.btn_act_new_callback = function () {
-                Atype.btn_act_new('#theme-setup-example-form #frm');
-            }
-
-            PopupSetupFormAThemeSetupExampleForm.btn_act_save = function () {
-                Atype.set_parameter_callback(PopupSetupFormAThemeSetupExampleForm.parameter);
-
-                Atype.btn_act_save('#theme-setup-example-form #frm', function () {
-                    $('#modal-select-popup.show').trigger('list.requery')
-                    $('#modal-select-popup.show').modal('hide');
-                }, 'PopupSetupFormAThemeSetupExampleForm');
-            }
-
-            PopupSetupFormAThemeSetupExampleForm.parameter = function () {
-                let setup = {
-                    // SetupName:  $('#theme-setup-example-form').find('#setup-name-txt').val(),
-                    // SetupCode:  $('#theme-setup-example-form').find('#setup-code-txt').val(),
-                    // SeqNo:      $('#theme-setup-example-form').find('#seq-no-txt').val(),
-                    // BrandCode:  $('#theme-setup-example-form').find('#brand-code-txt').val(),
-                    Component:  $('#theme-setup-example-form').find('#component-txt').val(),
-                    Parameter:  $('#theme-setup-example-form').find('#parameter-txt').val(),
-                    // IsOnUse:    $('#theme-setup-example-form').find('#is-on-use-check').is(':checked'),
-                    // IsDefault:  $('#theme-setup-example-form').find('#is-default-check').is(':checked'),
-                    // SetupJson:  $('#theme-setup-example-form').find('#setup-json-txt').val(),
-                }
-                let id = Number($('#theme-setup-example-form').find('#Id').val());
-                let parameter = {
-                    Id: id,
-                    CreatedOn: get_now_time_stamp(),
-                    UpdatedOn: get_now_time_stamp(),
-                    SetupJson: JSON.stringify(setup),
-                }
-                if (id < 0) {
-                    parameter = { Id: id }
-                } else if (id > 0) {
-                    delete parameter.CreatedOn;
-                } else {
-                    delete parameter.UpdatedOn;
-                }
-
-                console.log('save : ', parameter);
-
-                return parameter;
-            }
-
-            PopupSetupFormAThemeSetupExampleForm.show_popup_callback = async function (id, setup) {
-                console.log('show_popup_callback : ', setup);
-                $('#modal-select-popup.popup-setup-form-a-theme-setup-example-form .modal-dialog').css('maxWidth', '600px');
-                Atype.btn_act_new('#theme-setup-example-form #frm');
-                $('#theme-setup-example-form').find('#Id').val(id)
-
-                PopupSetupFormAThemeSetupExampleForm.set_ui(setup)
-            }
-
-            PopupSetupFormAThemeSetupExampleForm.set_ui = function (setup) {
-                if (_.isEmpty(setup)) return
-
-                const theme_setup_example_form = $('#theme-setup-example-form')
-                // $(theme_setup_example_form).find('#setup-name-txt').val(setup['SetupName'])
-                // $(theme_setup_example_form).find('#setup-code-txt').val(setup['SetupCode'])
-                // $(theme_setup_example_form).find('#seq-no-txt').val(setup['SeqNo'])
-                // $(theme_setup_example_form).find('#brand-code-txt').val(setup['BrandCode'])
-                $(theme_setup_example_form).find('#component-txt').val(setup['Component'])
-                $(theme_setup_example_form).find('#parameter-txt').val(setup['Parameter'])
-                // $(theme_setup_example_form).find('#is-on-use-check').prop('checked', setup['IsOnUse'])
-                // $(theme_setup_example_form).find('#is-default-check').prop('checked', setup['IsDefault'])
-                // $(theme_setup_example_form).find('#setup-json-txt').val(setup['SetupJson'])
-            }
-
-        }( window.PopupSetupFormAThemeSetupExampleForm = window.PopupSetupFormAThemeSetupExampleForm || {}, jQuery ));
-    </script>
-@endonce

+ 34 - 53
resources/views/front/dabory/myapp/popup/popup-form1/form-a/member-seller-edit-form.blade.php

@@ -106,8 +106,13 @@
     @push('js')
         <script src="{{ csset('/js/modals-controller/a-type/common.js') }}"></script>
         <script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
         <script>
             $(document).ready(async function() {
+
+                $('#upload-file1').fileselect();
+                $('#upload-file2').fileselect();
+
                 $('#upload-file1').on('change', function() {
                     const input = $(this);
                     const media_input = input.closest('.form-group').find('input[type="text"]');
@@ -119,16 +124,11 @@
                     const media_input = input.closest('.form-group').find('input[type="text"]');
                     PopupPopupForm1FormAMemberSellerEditForm.file_upload(this.files[0], media_input);
                 });
-                $('#upload-file1').fileselect();
-                $('#upload-file2').fileselect();
 
                 $('.member-company-act').on('click', function () {
-                    // console.log($(this).data('value'))
-
                     switch( $(this).data('value') ) {
                         case 'save': PopupPopupForm1FormAMemberSellerEditForm.btn_act_save(); break;
                     }
-
                 });
 
                 activate_button_group()
@@ -150,7 +150,6 @@
                     })
                     const setupJson = JSON.parse(response.data['Page'][0]['SetupJson']);
                     setupJson['BrandCode']= 'post';
-                    console.log('setupJson : ', setupJson);
                     return setupJson;
                 }
 
@@ -207,7 +206,6 @@
                     let file_path_list = [];
 
                     if (file_url) {
-                        console.log('file_url : ', file_url);
                         file_path_list.push(PopupPopupForm1FormAMemberSellerEditForm.get_media_data(file_url))
                     }
 
@@ -246,8 +244,6 @@
                 }
 
                 PopupPopupForm1FormAMemberSellerEditForm.change_file_url = async function (file_name, input) {
-                    console.log('change_file_url : ', file_name);
-                    console.log('change_file_url : ', input);
                     const setup = await PopupPopupForm1FormAMemberSellerEditForm.get_setup()
                     input.val(get_curr_setup_file_path(setup, file_name))
                 }
@@ -258,8 +254,9 @@
                         input_box_reset_for('#member-company-form')
                         return;
                     }
-                    const original_file_path = input.val();
-                    await PopupPopupForm1FormAMemberSellerEditForm.change_file_url(file.name, input);
+                    var original_file_path = input.val();
+
+                    await PopupPopupForm1FormAMemberSellerEditForm.change_file_url(PopupPopupForm1FormAMemberSellerEditForm.encrypt_file_name(file.name), input);
                     const id = Number($('#member-company-form').find('#Id').val())
                     const mediaValue = input.val();
                     const media = await PopupPopupForm1FormAMemberSellerEditForm.get_media_data(mediaValue);
@@ -268,7 +265,6 @@
                     if (! isEmpty(file)) {
                         // $('.media-btn-group button').prop('disabled', true);
                         const response = await axios.post('/file-exists', {file_path: media['path'] + media['name']});
-                        console.log('response : ', response);
                         // $('.media-btn-group button').prop('disabled', false);
                         if (response.data) {
                             const split_media_name = media['name'].split('.')
@@ -288,7 +284,6 @@
                     formData.append('_token', $('meta[name="csrf-token"]').attr('content'))
                     formData.append('file', file);
                     formData.append('media', JSON.stringify(media));
-                    // formData.append('type', 'member');
 
                     $.ajax({
                         url: "/file-upload",
@@ -297,12 +292,10 @@
                         processData: false,
                         contentType: false,
                         success: function(data) {
-                            console.log('upload succes : ', data);
-                            PopupPopupForm1FormAMemberSellerEditForm.callback_success(original_file_path)
-
+                            PopupPopupForm1FormAMemberSellerEditForm.callback_success()
                         },
                         error: function(jqXHR, textStatus, errorThrown) {
-                            console.error(jqXHR.responseText);
+                            // console.error(jqXHR.responseText);
                             iziToast.error({
                                 title: 'Error',
                                 message: '파일 업로드 중 오류가 발생했습니다: ' + errorThrown,
@@ -312,44 +305,22 @@
                 }
 
                 PopupPopupForm1FormAMemberSellerEditForm.callback_success = function (filePath) {
-                    // const test = PopupPopupForm1FormAMemberSellerEditForm.get_file_path_list(mediaValue)
-                    console.log('filePath : ', filePath);
-                    PopupPopupForm1FormAMemberSellerEditForm.delete_file(filePath)
-                    // const file_delete = await call_local_api('/file-delete', {
-                    //     file_path_list: filePath
-                    // })
-                    // $('#pace-progress-panel').attr('hidden', true)
-                    iziToast.success({
-                        title: 'Success', message: $('#action-completed').text(),
-                    });
+                    PopupPopupForm1FormAMemberSellerEditForm.btn_act_save()
+                    // PopupPopupForm1FormAMemberSellerEditForm.delete_file(filePath)
+                    // iziToast.success({
+                    //     title: 'Success', message: '업로드 성공',
+                    // });
                 }
 
                 PopupPopupForm1FormAMemberSellerEditForm.delete_file = function (filePath) {
-                    if (!confirm(`${filePath} 이전 파일을 삭제합니다.`)) {
-                        return;
-                    }
                     $.ajax({
-                    url: "/file-delete",
-                    type: 'POST',
-                    data: {
-                        _token: $('meta[name="csrf-token"]').attr('content'),
-                        file_path_list: JSON.stringify([filePath])
-                    },
-                    success: function(response) {
-                        // $(`#file-row${safeFileName}`).remove();
-                        // PopupPopupForm1FormAMemberSellerEditForm.file_list();
-                        iziToast.success({
-                            title: 'Success', message: '이전파일이 삭제되었습니다.',
-                        });
-                    },
-                    error: function(error) {
-                        console.log(error.responseJSON)
-                        iziToast.error({
-                            title: 'Error', message: '파일 삭제에 실패했습니다.',
-                        });
-                    }
-                });
-
+                        url: "/file-delete",
+                        type: 'POST',
+                        data: {
+                            _token: $('meta[name="csrf-token"]').attr('content'),
+                            file_path_list: JSON.stringify([filePath])
+                        }
+                    });
                 }
 
                 PopupPopupForm1FormAMemberSellerEditForm.companyParameter = function () {
@@ -368,6 +339,17 @@
                     return parameter;
                 }
 
+                PopupPopupForm1FormAMemberSellerEditForm.encrypt_file_name = function (file_name) {
+                    const last_dot_index = file_name.lastIndexOf('.');
+                    let name_without_ext = file_name;
+                    let extension = '';
+                    if (last_dot_index !== -1) {
+                        name_without_ext = file_name.substring(0, last_dot_index);
+                        extension = file_name.substring(last_dot_index);
+                    }
+                    const encryptedName = CryptoJS.SHA256(name_without_ext).toString();
+                    return `${encryptedName}${extension}`;
+                };
 
                 PopupPopupForm1FormAMemberSellerEditForm.show_popup_callback = async function (id, c1) {
                     PopupPopupForm1FormAMemberSellerEditForm.btn_act_new()
@@ -395,10 +377,9 @@
                     if (isEmpty(response.data) || response.data.apiStatus) return;
                     const member_company_form = $('#member-company-form')
                     const member = response.data.Page[0]
-
                     const member_ext = member_ext_page.data.Page[0]
                     const company = company_page.data.Page[0]
-                    console.log('company : ', company);
+
                     $(member_company_form).find('#Id').val(member.Id)
                     $(member_company_form).find('#BuyerId').val(member.BuyerId)
                     $(member_company_form).find('#company-name-txt').val(company.CompanyName)

+ 3 - 9
routes/web.php

@@ -528,17 +528,11 @@ Route::middleware('check.gate.token')->group(function () {
         if (!$request->hasFile('file')) {
             return response('error', 500);
         }
-        // $type = $request->input('type');
+
         $media = json_decode(request('media'), true);
-        $file = $request->file('file');
 
-        // if (isset($type) && !empty($type)) {
-        //     $path = $media['path'] ?? 'default/path'; // 기본 경로 설정
-        //     $filePath = \Storage::disk(getDisk())->put($path, $file);
-        //     // return $filePath;
-        //     return response($filePath, 201);
-        // }
-        // $file->storeAs($media['path'], $media['name'], ['disk' => getDisk()]);
+        $file = $request->file('file');
+        $file->storeAs($media['path'], $media['name'], ['disk' => getDisk()]);
 
         $bdPage = [];
         if ($media['type'] == 'image') {