app/Plugin/HigashiyamaForContact42/Resource/template/default/Contact/index.twig line 1

Open in your IDE?
  1. <style>
  2. #present_type,
  3. #illustdownload_file_name,
  4. #book_name,
  5. #order_id,
  6. #customer_id{
  7.     display:none;
  8. }
  9. input[name="contact[present_type]"]{
  10.   width: auto;
  11.   height: auto;
  12.   display: inline-block;
  13.   -webkit-appearance: auto;
  14. }
  15. </style>
  16. <script>
  17. $(function(){
  18.   $('#present_type').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  19.     $('#illustdownload_file_name').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  20.     $('#book_name').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  21.     $('#order_id').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  22.     $('#customer_id').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  23.     $('#ContactType').insertBefore($('div.table-layout > div:nth-of-type(1)'));
  24.     $('#ContactType').on('change', function(){
  25.         var ContactType = $('option:selected').val()
  26.         if(ContactType == 1) {
  27.             $('#customer_id').show();
  28.             $('#customer_id').css('display', 'flex');
  29.             $('#order_id').hide();
  30.             $('#book_name').hide();
  31.             $('#illustdownload_file_name').hide();
  32.       $('#present_type').hide();
  33.         } else if(ContactType == 2) {
  34.             $('#customer_id').hide();
  35.             $('#order_id').show();
  36.             $('#order_id').css('display', 'flex');
  37.             $('#book_name').hide();
  38.             $('#illustdownload_file_name').hide();
  39.       $('#present_type').hide();
  40.         } else if(ContactType == 3) {
  41.             $('#customer_id').hide();
  42.             $('#order_id').hide();
  43.             $('#book_name').show();
  44.             $('#book_name').css('display', 'flex');
  45.             $('#illustdownload_file_name').hide();
  46.       $('#present_type').hide();
  47.         } else if(ContactType == 4) {
  48.             $('#customer_id').hide();
  49.             $('#order_id').hide();
  50.             $('#book_name').hide();
  51.             $('#illustdownload_file_name').show();
  52.             $('#illustdownload_file_name').css('display', 'flex');
  53.       $('#present_type').hide();
  54.     } else if(ContactType == 7) {
  55.             $('#customer_id').hide();
  56.             $('#order_id').hide();
  57.             $('#book_name').hide();
  58.             $('#illustdownload_file_name').hide();
  59.       $('#present_type').show();
  60.             $('#present_type').css('display', 'flex');
  61.         } else {
  62.             $('#customer_id').hide();
  63.             $('#order_id').hide();
  64.             $('#book_name').hide();
  65.             $('#illustdownload_file_name').hide();
  66.       $('#present_type').hide();
  67.         }
  68.     });
  69.     {% if form.ContactType.vars.value == 1 %}
  70.     $('#customer_id').show();
  71.     $('#customer_id').css('display', 'flex');
  72.   {% endif %}
  73.   {% if form.ContactType.vars.value == 2 %}
  74.     $('#order_id').show();
  75.     $('#order_id').css('display', 'flex');
  76.   {% endif %}
  77.   {% if form.ContactType.vars.value == 3 %}
  78.     $('#book_name').show();
  79.     $('#book_name').css('display', 'flex');
  80.   {% endif %}
  81.   {% if form.ContactType.vars.value == 4 %}
  82.     $('#illustdownload_file_name').show();
  83.     $('#illustdownload_file_name').css('display', 'flex');
  84.   {% endif %}
  85.   {% if form.ContactType.vars.value == 7 %}
  86.     $('#present_type').show();
  87.     $('#present_type').css('display', 'flex');
  88.   {% endif %}
  89. });
  90. </script>
  91. <div class="tr" id="ContactType">
  92.   <div class="th w3">
  93.       {{ form_label(form.ContactType, 'お問い合わせ項目', { 'label_attr': { 'class': 'ec-label' }}) }}
  94.   </div>
  95.   <div class="td w9">
  96.       <div class="ec-input{{ has_errors(form.ContactType) ? ' error' }}">
  97.           {{ form_widget(form.ContactType) }}
  98.           {{ form_errors(form.ContactType) }}
  99.       </div>
  100.   </div>
  101. </div>
  102. <div class="tr" id="customer_id">
  103.   <div class="th w3">
  104.       {{ form_label(form.customer_id, '顧客コード', { 'label_attr': { 'class': 'ec-label' }}) }}
  105.   </div>
  106.   <div class="td w9">
  107.       <div class="ec-input{{ has_errors(form.customer_id) ? ' error' }}">
  108.           {{ form_widget(form.customer_id) }}
  109.           {{ form_errors(form.customer_id) }}
  110.       </div>
  111.   </div>
  112. </div>
  113. <div class="tr" id="order_id">
  114.   <div class="th w3">
  115.       {{ form_label(form.order_id, '注文No', { 'label_attr': { 'class': 'ec-label' }}) }}
  116.   </div>
  117.   <div class="td w9">
  118.       <div class="ec-input{{ has_errors(form.order_id) ? ' error' }}">
  119.           {{ form_widget(form.order_id) }}
  120.           {{ form_errors(form.order_id) }}
  121.       </div>
  122.   </div>
  123. </div>
  124. <div class="tr" id="book_name">
  125.   <div class="th w3">
  126.       {{ form_label(form.book_name, '書籍名', { 'label_attr': { 'class': 'ec-label' }}) }}
  127.   </div>
  128.   <div class="td w9">
  129.       <div class="ec-input{{ has_errors(form.book_name) ? ' error' }}">
  130.           {{ form_widget(form.book_name) }}
  131.           {{ form_errors(form.book_name) }}
  132.       </div>
  133.   </div>
  134. </div>
  135. <div class="tr" id="illustdownload_file_name">
  136.   <div class="th w3">
  137.       {{ form_label(form.illustdownload_file_name, 'ダウンロードしたい月', { 'label_attr': { 'class': 'ec-label' }}) }}
  138.   </div>
  139.   <div class="td w9">
  140.       <div class="ec-input{{ has_errors(form.illustdownload_file_name) ? ' error' }}">
  141.           {{ form_widget(form.illustdownload_file_name) }}
  142.           {{ form_errors(form.illustdownload_file_name) }}
  143.       </div>
  144.   </div>
  145. </div>
  146. <div class="tr" id="present_type">
  147.   <div class="th w3">
  148.       {{ form_label(form.present_type, '送付方法', { 'label_attr': { 'class': 'ec-label' }}) }}
  149.   </div>
  150.   <div class="td w9">
  151.       <div class="ec-input{{ has_errors(form.present_type) ? ' error' }}">
  152.           {{ form_widget(form.present_type) }}
  153.           {{ form_errors(form.present_type) }}
  154.       </div>
  155.   </div>
  156. </div>