|
@@ -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)
|