form-insert.blade.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <div class="mb-1 pt-2 text-right btn-groups">
  2. <div class="btn-group">
  3. <button type="button" class="btn btn-sm btn-primary itech21-customer-insert-act save-button" data-value="save" {{ $formInsert['FormVars']['Hidden']['SaveButton'] }}>
  4. {{ $formInsert['FormVars']['Title']['SaveButton'] }}
  5. </button>
  6. </div>
  7. </div>
  8. <div class="card mb-2" id="form-insert">
  9. <div class="card-header" id="frm">
  10. <div class="row">
  11. <div class="col-12 col-lg card-header-item">
  12. <div class="card card card-primary mb-3 mb-md-2 mb-lg-0 border-light">
  13. <div class="card-header p-0 mb-2">
  14. </div>
  15. <div class="card-body">
  16. <div class="mb-2 text-danger">
  17. {!! $formInsert['NoticeVars']['Notice'] !!}
  18. </div>
  19. <div class="mb-2">
  20. {!! $formInsert['NoticeVars']['Warning'] !!}
  21. </div>
  22. <div class="d-flex flex-column mb-2">
  23. <div class="d-flex align-items-center">
  24. <input type="checkbox" value="1" class="text-center mr-1" id="truncate-table-check"> <label class="mb-0" for="truncate-table-check">{{ $formInsert['FormVars']['Title']['TruncateTable'] }}</label>
  25. </div>
  26. </div>
  27. <div class="d-flex flex-column mb-2">
  28. <div class="d-flex align-items-center">
  29. <input type="checkbox" value="1" class="text-center mr-1" id="backup-table-check"> <label class="mb-0" for="backup-table-check">{{ $formInsert['FormVars']['Title']['BackupTable'] }}</label>
  30. </div>
  31. </div>
  32. <div class="d-flex flex-column">
  33. <div class="d-flex align-items-center">
  34. <input type="checkbox" value="1" class="text-center mr-1" id="is-backup-db-check"> <label class="mb-0" for="is-backup-db-check">{{ $formInsert['FormVars']['Title']['BackupDb'] }}</label>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. @once
  44. @push('js')
  45. <script src="{{ csset('/js/modals-controller/a-type/common.js') }}"></script>
  46. <script>
  47. $(document).ready(function() {
  48. $('.itech21-customer-insert-act').on('click', function () {
  49. // console.log($(this).data('value'))
  50. switch( $(this).data('value') ) {
  51. case 'save': PopupPopupForm1FormInsert.btn_act_save(); break;
  52. }
  53. });
  54. });
  55. (function( PopupPopupForm1FormInsert, $, undefined ) {
  56. PopupPopupForm1FormInsert.formInsert = {!! json_encode($formInsert) !!};
  57. PopupPopupForm1FormInsert.parentParameter = {};
  58. PopupPopupForm1FormInsert.tdCount = 0
  59. PopupPopupForm1FormInsert.btn_act_save = async function () {
  60. if (PopupPopupForm1FormInsert.tdCount === 0 || isEmpty(PopupPopupForm1FormInsert.parentParameter['ListType1Vars']['ListToken'])) {
  61. iziToast.error({
  62. title: 'Error',
  63. message: '엑셀화일을 먼저 업로드 해주세요',
  64. });
  65. return
  66. }
  67. const form_insert = $('#form-insert')
  68. const response = await get_api_data(PopupPopupForm1FormInsert.formInsert['General']['ActApi'], {
  69. InsertVars: {
  70. QueryName: PopupPopupForm1FormInsert.formInsert['InsertVars']['QueryName'],
  71. InsertType: PopupPopupForm1FormInsert.formInsert['InsertVars']['InsertType'],
  72. ListToken: PopupPopupForm1FormInsert.parentParameter['ListType1Vars']['ListToken'],
  73. IsTruncateTable: $(form_insert).find('#truncate-table-check:checked').val() == '1',
  74. IsBackupTable: $(form_insert).find('#backup-table-check:checked').val() == '1',
  75. IsBackupDb: $(form_insert).find('#is-backup-db-check:checked').val() == '1',
  76. PreProcess: PopupPopupForm1FormInsert.formInsert['InsertVars']['PreProcess'] ?? '',
  77. PostProcess: PopupPopupForm1FormInsert.formInsert['InsertVars']['PostProcess'] ?? '',
  78. }
  79. })
  80. const d = response.data
  81. if (d.apiStatus) {
  82. return iziToast.error({
  83. title: 'Error', message: d.body ?? $('#api-request-failed-please-check').text(),
  84. })
  85. }
  86. $('#modal-multi-popup.show').trigger('list.token.init')
  87. $('#modal-multi-popup.show').modal('hide')
  88. iziToast.success({
  89. title: 'Success', message: $('#action-completed').text(),
  90. });
  91. // show_iziToast_msg(response.data.InsertVars, function () {
  92. // $('#modal-multi-popup.show').trigger('list.token.init')
  93. // $('#modal-multi-popup.show').modal('hide')
  94. // })
  95. }
  96. PopupPopupForm1FormInsert.btn_act_new = function () {
  97. $('#modal-multi-popup .modal-dialog').css('maxWidth', '800px');
  98. $('#modal-multi-popup .modal-header').removeClass('bg-dark-alpha px-0')
  99. $('#modal-multi-popup .modal-body button').removeClass('bg-dark-alpha border-dark-alpha bg-dark-alpha-hover')
  100. $('#modal-multi-popup .modal-body button').addClass('bg-danger-10 border-danger-10 bg-danger-10-hover')
  101. $('#modal-multi-popup .modal-header').addClass('bg-danger-10')
  102. if (! PopupPopupForm1FormInsert.formInsert['ConditionVars']['IsVisible']) {
  103. $('#modal-multi-popup').on('show.bs.modal', function (e) { e.preventDefault(); })
  104. PopupPopupForm1FormInsert.btn_act_save()
  105. }
  106. Atype.btn_act_new('#form-insert #frm')
  107. const form_insert = $('#form-insert')
  108. $(form_insert).find('#truncate-table-check').prop('checked', PopupPopupForm1FormInsert.formInsert['InsertVars']['IsTruncateTable'])
  109. $(form_insert).find('#backup-table-check').prop('checked', PopupPopupForm1FormInsert.formInsert['InsertVars']['IsBackupTable'])
  110. $(form_insert).find('#is-backup-db-check').prop('checked', PopupPopupForm1FormInsert.formInsert['InsertVars']['IsBackupDb'])
  111. }
  112. PopupPopupForm1FormInsert.show_popup_callback = async function (parent_parameter, parameter, td_count) {
  113. PopupPopupForm1FormInsert.tdCount = td_count
  114. PopupPopupForm1FormInsert.btn_act_new()
  115. PopupPopupForm1FormInsert.formInsert = parameter
  116. PopupPopupForm1FormInsert.parentParameter = parent_parameter
  117. }
  118. }( window.PopupPopupForm1FormInsert = window.PopupForm1FormInsert || {}, jQuery ));
  119. </script>
  120. @endpush
  121. @endonce