app/Plugin/Recommend42/Resource/template/admin/regist.twig line 1

Open in your IDE?
  1. {#
  2.  * This file is part of the Recommend Product plugin
  3.  *
  4.  * Copyright (C) EC-CUBE CO.,LTD. All Rights Reserved.
  5.  *
  6.  * For the full copyright and license information, please view the LICENSE
  7.  * file that was distributed with this source code.
  8. #}
  9. {% extends '@admin/default_frame.twig' %}
  10. {% set menus = ['content', 'plugin_recommend'] %}
  11. {% block title %}{{ 'plugin_recommend.admin.edit.title'|trans }}{% endblock %}
  12. {% block sub_title %}{{ 'plugin_recommend.admin.edit.subtitle'|trans }}{% endblock %}
  13. {% form_theme form '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}
  14. {% form_theme searchProductModalForm '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}
  15. {% block stylesheet %}
  16.     <style type="text/css">
  17.         .col-sm-2 {
  18.             max-width: none;
  19.         }
  20.     </style>
  21. {% endblock stylesheet %}
  22. {% block javascript %}
  23.     <script type="text/javascript">
  24.         var recommend = JSON.parse('{{ recommend_products|raw }}');
  25.         $(function() {
  26.             $('#showSearchProductModal').on('click', function() {
  27.                     var tbody = $('#searchProductModalList tbody');
  28.                     tbody.children().remove();
  29.                     $('div.box-footer').remove();
  30.                 }
  31.             );
  32.             $('#searchProductModalButton').on('click', function() {
  33.                 var list = $('#searchProductModalList');
  34.                 list.children().remove();
  35.                 $.ajax({
  36.                     type: 'POST',
  37.                     dataType: 'html',
  38.                     data: {
  39.                         'id' : $('#admin_search_product_id').val(),
  40.                         'category_id' : $('#admin_search_product_category_id').val()
  41.                     },
  42.                     url: '{{ url('plugin_recommend_search_product') }}',
  43.                     success: function(data) {
  44.                         // モーダルに結果を書き出し.
  45.                         $('#searchProductModalList').html(data);
  46.                     },
  47.                     error: function() {
  48.                         alert('Search product failed.');
  49.                     }
  50.                 });
  51.             });
  52.         });
  53.     </script>
  54. {% endblock javascript %}
  55. {% block main %}
  56.     <form role="form" name="form1" id="form1" method="post">
  57.         {{ form_widget(form._token) }}
  58.         <div class="c-contentsArea__cols">
  59.             <div class="c-contentsArea__primaryCol">
  60.                 <div class="c-primaryCol">
  61.                     <div class="card rounded border-0 mb-4">
  62.                         <div class="card-header">
  63.                             <span>{{ 'plugin_recommend.admin.edit.header'|trans }}</span>
  64.                         </div><!-- /.box-header -->
  65.                         <div class="card-body">
  66.                             <div class="row" style="display: none;">
  67.                                 <div class="col-3">{{ form_label(form.id) }}</div>
  68.                                 <div class="col mb-2">
  69.                                     {{ form_widget(form.id) }}
  70.                                     {{ form_errors(form.id) }}
  71.                                 </div>
  72.                             </div>
  73.                             {# 商品ID #}
  74.                             <div class="row">
  75.                                 <div class="col-3">{{ form_label(form.id) }}</div>
  76.                                 <div class="col mb-2">
  77.                                     {% if Product is not null %}
  78.                                         <div id="product_image">
  79.                                             <a href="{{ url('admin_product_product_edit', { id : Product.id }) }}" id="product_image_link">
  80.                                                 <img src="{{ asset(Product.mainFileName|no_image_product, "save_image") }}" style="max-width: 135px;" id="product_image_img"/>
  81.                                             </a>
  82.                                         </div>
  83.                                         <p id="product_name">
  84.                                             {{ Product.name }}
  85.                                         </p>
  86.                                         <p id="product_code">
  87.                                             {{ Product.code_min }}
  88.                                             {% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}
  89.                                             {% endif %}
  90.                                         </p>
  91.                                     {% else %}
  92.                                         <div id="product_image" class="d-none">
  93.                                             <a href="" id="product_image_link">
  94.                                                 <img src="" style="max-width: 135px;" id="product_image_img"/>
  95.                                             </a>
  96.                                         </div>
  97.                                         <p id="product_name" class="d-none"></p>
  98.                                         <p id="product_code" class="d-none"></p>
  99.                                     {% endif %}
  100.                                     <a id="showSearchProductModal" class="btn btn-ec-regular me-2" data-bs-toggle="modal" data-bs-target="#searchProductModal">{{ 'plugin_recommend.admin.edit.search'|trans }}</a>
  101.                                     <div class="clearfix"></div>
  102.                                     {{ form_widget(form.Product) }}
  103.                                     {{ form_errors(form.Product) }}
  104.                                     <div id="warning" class="text-info"></div>
  105.                                 </div>
  106.                             </div>
  107.                             {# コメント #}
  108.                             <div class="row">
  109.                                 <div class="col-3">{{ form_label(form.comment) }}</div>
  110.                                 <div class="col mb-2">
  111.                                     {{ form_widget(form.comment, { attr : { rows : "8"} }) }}
  112.                                     {{ form_errors(form.comment) }}
  113.                                     <p class="text-muted" style="text-align: right">{{ 'plugin_recommend.admin.edit.comment.help'|trans({'%number%' : eccube_config['plugin_recommend.text_area_len']}) }}</p>
  114.                                 </div>
  115.                             </div>
  116.                         </div>
  117.                     </div>
  118.                 </div>
  119.                 <div class="c-conversionArea">
  120.                     <div class="c-conversionArea__container">
  121.                         <div class="row justify-content-between align-items-center">
  122.                             <div class="col-6">
  123.                                 <div class="c-conversionArea__leftBlockItem">
  124.                                     <a class="c-baseLink" href="{{ url('plugin_recommend_list') }}">
  125.                                         <i class="fa fa-backward" aria-hidden="true"></i><span>{{ 'common.back'|trans }}</span></a>
  126.                                 </div>
  127.                             </div>
  128.                             <div class="col-6">
  129.                                 <div class="row align-items-center justify-content-end">
  130.                                     <div class="col-auto">
  131.                                         <button type="submit" class="btn btn-ec-conversion px-5">{{ 'admin.common.save'|trans }}</button>
  132.                                     </div>
  133.                                 </div>
  134.                             </div>
  135.                         </div>
  136.                     </div>
  137.                 </div>
  138.             </div>
  139.         </div>
  140.     </form>
  141.     {#
  142.     // =======================================
  143.     // 商品検索モーダル ダイアログ表示
  144.     // =======================================
  145.     #}
  146.     <div class="modal" id="searchProductModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  147.         <div class="modal-dialog">
  148.             <div class="modal-content">
  149.                 <div class="modal-header">
  150.                     <h4 class="modal-title" id="searchProductModalLabel">{{ 'plugin_recommend.admin.edit.product_search.header'|trans }}</h4>
  151.                     <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
  152.                 </div>
  153.                 <div class="modal-body">
  154.                     <div class="mb-3">
  155.                         {{ form_widget(searchProductModalForm.id, { attr : { placeholder : 'admin.product.product_name_and_code'|trans } }) }}
  156.                     </div>
  157.                     <div class="mb-3">
  158.                         {{ form_widget(searchProductModalForm.category_id) }}
  159.                     </div>
  160.                     <div class="text-center mb-3">
  161.                         <button type="button" id="searchProductModalButton" class="btn btn-ec-conversion" >{{ 'plugin_recommend.admin.edit.product_search.button'|trans }}</button>
  162.                     </div>
  163.                     <div id="searchProductModalList">
  164.                     </div>
  165.                 </div>
  166.             </div>
  167.         </div>
  168.     </div>
  169. {% endblock %}