app/template/admin/Backup/index.twig line 1

Open in your IDE?
  1. {% extends '@admin/default_frame.twig' %}
  2. {% set menus = ['setting', 'system', 'migrate'] %}
  3. {% block title %}データ移行{% endblock %}
  4. {% block sub_title %}{% endblock %}
  5. {% form_theme form '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}
  6. {% block stylesheet %}
  7. <style>
  8.     .icon-edit{
  9.         width: 20%;
  10.         text-align: center;
  11.         color: black;
  12.     }
  13.     .icon-edit i{
  14.         margin-right: 15px;
  15.         color: black;
  16.         cursor: pointer;
  17.     }
  18.     th,td{
  19.         padding: 10px !important;
  20.     }
  21.     .control-label{
  22.         font-weight: bold;
  23.         margin-bottom: 30px;
  24.         text-align: center;
  25.     }
  26.     form{
  27.         margin-top:30px;
  28.     }
  29.     .checkbox-inline{
  30.         margin-bottom: 15px;
  31.     }
  32.     .form-check-label{
  33.         margin-left: 10px;
  34.     }
  35.     .form-content{
  36.         border: 1px solid #ddd;
  37.         padding: 20px;
  38.     }
  39.     .col-auto{
  40.         text-align: center;
  41.     }
  42.     .btn-ec-migrate{
  43.         color: white !important;
  44.     }
  45.     #btnMigrate{
  46.         color: #fff;
  47.         background-color: #C04949;
  48.     }
  49. </style>
  50. {% endblock stylesheet %}
  51. {% block javascript %}
  52. <script>
  53.     $('a[data-bs-toggle="modal"]').click(function(){
  54.         if($('#backup_migrate_data input:checked').length == 0){
  55.             alert('データを選択してください。');
  56.             return false;
  57.         }
  58.         $('#migrateModal').modal();
  59.         $('#backup_mode').val($(this).data('mode'));
  60.     });
  61.     $('#btnMigrate').click(function(){
  62.         //$('.btn-ec-sub',$(this).closest('.modal')).remove();
  63.         $('.restore_alert').text('データ移行中。この処理には数分かかる場合があります。画面をリロードせずにこのままお待ち下さい。');
  64.         $form = $('#formMigrate');
  65.         $.ajax({
  66.             url: $form.attr('action'),
  67.             type: $form.attr('method'),
  68.             method: 'POST',
  69.             data: $form.serialize(),
  70.             dataType: 'json'
  71.         }).done(function(data) {
  72.             location.reload();
  73.         }).fail(function(data) {
  74.             alert('データ移行中にエラーが発生しました。');
  75.         }).always(function(data) {
  76.         });
  77.     });
  78. </script>
  79. {% endblock javascript %}
  80. {% block main %}
  81.     <div class="container-fluid">
  82.         <div class="card rounded border-0 mb-4 d-block p-5">
  83.             <div class="card-body p-0">
  84.                 <form id="formMigrate" method="post" action="{{ url('admin_setting_system_migrate') }}">
  85.                 {{ form_widget(form._token) }}
  86.                     <div class="form-group row">
  87.                         <div class="col-sm-3 col-lg-3 offset-sm-5 form-content">
  88.                             <h2 class="control-label">データ選択</h2>
  89.                             {{ form_widget(form.migrate_data) }}
  90.                             {{ form_errors(form.migrate_data) }}
  91.                             {{ form_widget(form.mode) }}
  92.                             {{ form_errors(form.mode) }}
  93.                         </div>
  94.                     </div>
  95.                 </form>
  96.                 <div class="text-center mt-5">
  97.                     <a class="btn btn-ec-migrate btn-ec-conversion" type="button" id="btnMigratePtoT" data-mode="1" data-bs-toggle="modal" data-bs-target="#migrateModal">本番DBからテストDBにデータを移行</a>
  98.                     <a class="btn btn-ec-migrate btn-ec-conversion" type="button" id="btnMigrateTtoP" data-mode="2" data-bs-toggle="modal" data-bs-target="#migrateModal">テストDBから本番DBにデータを移行</a>
  99.                 </div>
  100.             </div>
  101.         </div>
  102.         <div class="modal fade" id="migrateModal" tabindex="-1" role="dialog" aria-labelledby="discontinuance" aria-hidden="true" data-keyboard="false" data-backdrop="static">
  103.             <div class="modal-dialog" role="document">
  104.                 <div class="modal-content">
  105.                     <div class="modal-header">
  106.                         <h5 class="modal-title fw-bold">データ移行</h5>
  107.                         <button class="close" type="button" data-bs-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
  108.                     </div>
  109.                     <div class="modal-body text-left">
  110.                         <p class="text-left restore_alert">移行先のデータは上書きされますがよろしいですか?</p>
  111.                     </div>
  112.                     <div class="modal-footer">
  113.                         <button class="btn btn-ec-sub" type="button" data-bs-dismiss="modal">{{ 'admin.common.cancel'|trans }}</button>
  114.                         <a class="btn btn-ec-action btn-ec-sub" type="button" id="btnMigrate">はい</a>
  115.                     </div>
  116.                 </div>
  117.             </div>
  118.         </div>
  119.     </div>
  120. {% endblock %}