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

Open in your IDE?
  1. <script>
  2.     $(function() {
  3.         $('#admin_product_class_delivery_duration').closest('#basicConfig > .card-body').append(
  4.             '<div class="row">' +
  5.                 '<div class="col-3">' +
  6.                     '<span>定期回数別商品金額割引</span>' +
  7.                 '</div>' +
  8.                 '<div class="col mb-2">' +
  9.                     '<select id="admin_product_class_RegularDiscount" name="admin_product[class][RegularDiscount]" class="form-control">' +
  10.                         '<option value="">選択してください</option>' +
  11.                         {% for key, child in form.class.RegularDiscount.vars.choices %}
  12.                         {% set Discount = form.class.RegularDiscount.vars.choices[key].data %}
  13.                         '<option value="{{ Discount }}" {% if form.class.RegularDiscount.vars.value == Discount %}selected="selected"{% endif %}>{{ form.class.RegularDiscount.vars.choices[key].label }}</option>' +
  14.                         {% endfor %}
  15.                     '</select>' +
  16.                     {% if form.class.RegularDiscount.vars.errors|length > 0 %}
  17.                         {% for error in form.class.RegularDiscount.vars.errors %}
  18.                             '<span class="invalid-feedback d-block">' +
  19.                                 '<span class="d-block">' +
  20.                                     '<span class="form-error-icon badge bg-danger text-uppercase">エラー</span> <span class="form-error-message">{{ error.message }}</span>' +
  21.                                 '</span>' +
  22.                             '</span>' +
  23.                         {% endfor %}
  24.                     {% endif %}
  25.                 '</div>' +
  26.             '</div>'
  27.         );
  28.         var regularSaleTypeId = '{{ regularSaleTypeId }}';
  29.         changeRegularDiscountForm($('#admin_product_class_sale_type option:selected').val(), regularSaleTypeId);
  30.         {# 販売種別変更時に、定期サイクルフォームの使用可、不可を設定 #}
  31.         $('#admin_product_class_sale_type').on('change', function() {
  32.             var selectedSaleTypeId = $(this).val();
  33.             changeRegularDiscountForm(selectedSaleTypeId, regularSaleTypeId);
  34.         });
  35.         function changeRegularDiscountForm(selectedSaleTypeId, regularSaleTypeId) {
  36.             if (selectedSaleTypeId === regularSaleTypeId) {
  37.                 $('#admin_product_class_RegularDiscount').prop('disabled', false);
  38.             } else {
  39.                 $('#admin_product_class_RegularDiscount').prop('disabled', true);
  40.             }
  41.         }
  42.     });
  43. </script>