app/Plugin/EccubePaymentLite42/Resource/template/admin/Product/regular_cycle_form.twig line 1

Open in your IDE?
  1. <script>
  2.     function changeRegularCycleForm(selectedSaleTypeId, regularSaleTypeId) {
  3.         if (selectedSaleTypeId === regularSaleTypeId) {
  4.             $('input[id^=admin_product_class_RegularCycle]').prop('disabled', false);
  5.         } else {
  6.             $('input[id^=admin_product_class_RegularCycle]').prop('disabled', true);
  7.         }
  8.     }
  9.     $(function() {
  10.         {# 定期サイクルフォームの追加 #}
  11.         $('#admin_product_class_delivery_duration').closest('#basicConfig > .card-body').append(
  12. {#
  13.             '<div class="row">' +
  14.                 '<div class="col-3">' +
  15.                     '<span>定期サイクル</span>' +
  16.                 '</div>' +
  17.                 '<div class="col mb-2">' +
  18.                     '<div id="admin_product_class_RegularCycle">' +
  19.                         {% for key, child in form.class.RegularCycle.vars.choices %}
  20.                         {% set Cycle = form.class.RegularCycle.vars.choices[key].data %}
  21.                         '<div class="form-check">' +
  22.                             '<input type="checkbox" id="admin_product_class_RegularCycle_{{ key }}" name="admin_product[class][RegularCycle][]" class="form-check-input" {% for key2, child2 in form.class.RegularCycle.vars.value %}{% if child2 == key %}checked="checked"{% endif %}{% endfor %} value="{{ key }}">' +
  23.                             '<label class="form-check-label" for="admin_product_class_RegularCycle_{{ key }}">{{ Cycle }}</label>' +
  24.                         '</div>' +
  25.                         {% endfor %}
  26.                     '</div>' +
  27.                     {% if form.class.RegularCycle.vars.errors|length > 0 %}
  28.                         {% for error in form.class.RegularCycle.vars.errors %}
  29.                             '<span class="invalid-feedback d-block">' +
  30.                                 '<span class="d-block">' +
  31.                                     '<span class="form-error-icon badge bg-danger text-uppercase">エラー</span> <span class="form-error-message">{{ error.message }}</span>' +
  32.                                 '</span>' +
  33.                             '</span>' +
  34.                         {% endfor %}
  35.                     {% endif %}
  36.                 '</div>' +
  37.             '</div>'
  38. #}
  39.         );
  40.         var regularSaleTypeId = '{{ regularSaleTypeId }}';
  41.         {# 定期サイクルフォーム初期読み込み時、使用可、不可を設定 #}
  42.         changeRegularCycleForm($('#admin_product_class_sale_type option:selected').val(), regularSaleTypeId);
  43.         {# 販売種別変更時に、定期サイクルフォームの使用可、不可を設定 #}
  44.         $('#admin_product_class_sale_type').on('change', function() {
  45.             var selectedSaleTypeId = $(this).val();
  46.             changeRegularCycleForm(selectedSaleTypeId, regularSaleTypeId);
  47.         });
  48.     });
  49. </script>