app/Plugin/Recommend42/Resource/template/admin/index.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. {#
  10. [コンテンツ]-[おすすめ商品]-[一覧・検索]画面
  11. #}
  12. {% extends '@admin/default_frame.twig' %}
  13. {% set menus = ['content', 'plugin_recommend'] %}
  14. {% block title %}{{ 'plugin_recommend.admin.index.title'|trans }}{% endblock %}
  15. {% block sub_title %}{{ 'plugin_recommend.admin.index.subtitle'|trans }}{% endblock %}
  16. {% block stylesheet %}
  17.     <style type="text/css">
  18.         .list-group-item:hover {
  19.             z-index: inherit;
  20.         }
  21.     </style>
  22. {% endblock stylesheet %}
  23. {% block javascript %}
  24.     <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.core.min.js', 'admin') }}"></script>
  25.     <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.widget.min.js', 'admin') }}"></script>
  26.     <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.mouse.min.js', 'admin') }}"></script>
  27.     <script src="{{ asset('assets/js/vendor/jquery.ui/jquery.ui.sortable.min.js', 'admin') }}"></script>
  28.     <script type="text/javascript">
  29.         $(function () {
  30.             // 初期表示時のsort noを保持.
  31.             var oldSortNos = [];
  32.             $('.sortable-item').each(function () {
  33.                 oldSortNos.push(this.dataset.sortNo);
  34.             });
  35.             oldSortNos.sort(function (a, b) {
  36.                 return a - b;
  37.             }).reverse();
  38.             // 並び替え後にsort noを更新
  39.             var updateSortNo = function () {
  40.                 var newSortNos = {};
  41.                 var i = 0;
  42.                 $('.sortable-item').each(function () {
  43.                     newSortNos[this.dataset.id] = oldSortNos[i];
  44.                     i++;
  45.                 });
  46.                 $.ajax({
  47.                     url: '{{ url('plugin_recommend_rank_move') }}',
  48.                     type: 'POST',
  49.                     data: newSortNos
  50.                 }).always(function () {
  51.                     $(".modal-backdrop").remove();
  52.                 });
  53.             };
  54.             // オーバレイ後, 表示順の更新を行う
  55.             var moveSortNo = function () {
  56.                 $('body').append($('<div class="modal-backdrop show"></div>'));
  57.                 updateSortNo();
  58.             };
  59.             // Drag and Drop
  60.             $(".sortable-container").sortable({
  61.                 items: '> .sortable-item',
  62.                 cursor: 'move',
  63.                 update: function (e, ui) {
  64.                     moveSortNo();
  65.                 }
  66.             });
  67.         })
  68.     </script>
  69. {% endblock javascript %}
  70. {% block main %}
  71.     <div class="c-contentsArea__cols">
  72.         <div class="c-contentsArea__primaryCol">
  73.             <div class="c-primaryCol">
  74.                 <div class="card rounded border-0 mb-4">
  75.                     <div class="card-header"><span class="normal">{{ 'plugin_recommend.admin.index.total_num'|trans({'%number%' : total_item_count})|raw }}</span></div>
  76.                     <div class="card-body p-0">
  77.                         {% if pagination %}
  78.                             <ul class="list-group list-group-flush sortable-container">
  79.                                 <li class="list-group-item">
  80.                                     <div class="row justify-content-around">
  81.                                         <div class="col-auto"><strong>&nbsp;&nbsp;</strong></div>
  82.                                         <div class="col-2"><strong>{{ 'plugin_recommend.admin.index.col2'|trans }}</strong></div>
  83.                                         <div class="col-2"><strong>{{ 'plugin_recommend.admin.index.col3'|trans }}</strong></div>
  84.                                         <div class="col-auto"><strong>{{ 'plugin_recommend.admin.index.col4'|trans }}</strong></div>
  85.                                         <div class="col"><strong></strong></div>
  86.                                     </div>
  87.                                 </li>
  88.                                 {% for RecommendProduct in pagination %}
  89.                                     <li class="list-group-item sortable-item" data-sort-no="{{ RecommendProduct.sort_no }}" data-id="{{ RecommendProduct.id }}">
  90.                                         <div class="row justify-content-around">
  91.                                             <div class="col-auto d-flex align-items-center"><i class="fa fa-bars text-ec-gray"></i></div>
  92.                                             <div class="col-2">
  93.                                                 <a href="{{ url('plugin_recommend_edit', { id : RecommendProduct.id }) }}" >
  94.                                                     <img src="{{ asset(RecommendProduct.Product.mainFileName|no_image_product, 'save_image') }}" style="max-width: 100px;"/>
  95.                                                 </a>
  96.                                             </div>
  97.                                             <div class="col-2 d-flex align-items-center">
  98.                                                 <a href="{{ url('plugin_recommend_edit', { id : RecommendProduct.id }) }}" >
  99.                                                     {{ RecommendProduct.Product.name }}
  100.                                                     <br>
  101.                                                     {{ RecommendProduct.Product.code_min }}
  102.                                                     {% if RecommendProduct.Product.code_min != RecommendProduct.Product.code_max %} ~ {{ RecommendProduct.Product.code_max }}
  103.                                                     {% endif %}
  104.                                                 </a>
  105.                                             </div>
  106.                                             <div class="col-6 d-flex">{{ RecommendProduct.comment|raw|purify|nl2br }}</div>
  107.                                             <div class="col text-end">
  108.                                                 <a href="{{ url('plugin_recommend_edit', { id : RecommendProduct.id }) }}"
  109.                                                    class="btn btn-ec-actionIcon me-3 action-edit"
  110.                                                    data-bs-toggle="tooltip"
  111.                                                    data-bs-placement="top"
  112.                                                    title="{{ 'admin.common.edit'|trans }}"><i
  113.                                                             class="fa fa-pencil fa-lg text-secondary"></i></a>
  114.                                                 <a
  115.                                                         class="btn btn-ec-actionIcon me-3"
  116.                                                         data-bs-toggle="modal"
  117.                                                         data-bs-target="#confirmModal-{{ RecommendProduct.id }}"
  118.                                                         data-bs-tooltip="tooltip"
  119.                                                         data-bs-placement="top"
  120.                                                         title="{{ 'admin.common.delete'|trans }}"><i
  121.                                                             class="fa fa-close fa-lg text-secondary"></i></a>
  122.                                             </div>
  123.                                             <div class="modal fade" id="confirmModal-{{ RecommendProduct.id }}" tabindex="-1"
  124.                                                  role="dialog"
  125.                                                  aria-labelledby="confirmModal-{{ RecommendProduct.id }}" aria-hidden="true">
  126.                                                 <div class="modal-dialog" role="document">
  127.                                                     <div class="modal-content">
  128.                                                         <div class="modal-header">
  129.                                                             <h5 class="modal-title font-weight-bold">
  130.                                                                 {{ 'plugin_recommend.admin.index.delete.confirm'|trans }}</h5>
  131.                                                             <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
  132.                                                         </div>
  133.                                                         <div class="modal-body text-start">
  134.                                                             <p class="text-start">
  135.                                                                 {{ 'plugin_recommend.admin.index.delete.confirm'|trans }}</p>
  136.                                                         </div>
  137.                                                         <div class="modal-footer">
  138.                                                             <button class="btn btn-ec-sub" type="button"
  139.                                                                     data-bs-dismiss="modal">{{ 'common.cancel'|trans }}
  140.                                                             </button>
  141.                                                             <a href="{{ url('plugin_recommend_delete', {'id' : RecommendProduct.id}) }}" class="btn btn-ec-delete" data-confirm="false" {{ csrf_token_for_anchor() }} data-method="delete">
  142.                                                                 {{ 'common.delete'|trans }}
  143.                                                             </a>
  144.                                                         </div>
  145.                                                     </div>
  146.                                                 </div>
  147.                                             </div>
  148.                                         </div>
  149.                                     </li>
  150.                                 {% endfor %}
  151.                             </ul>
  152.                         {% endif %}
  153.                     </div><!-- /.box -->
  154.                 </div><!-- /.col -->
  155.                 <p>{{'plugin_recommend.admin.notice'|trans}}</p>
  156.             </div>
  157.             <div class="card rounded border-0">
  158.                 <div class="card-body p-4">
  159.                     <div class="text-center">
  160.                         <a href="{{ url('plugin_recommend_new') }}" class="btn btn-ec-regular pl-4 pr-4">{{ 'plugin_recommend.admin.new'|trans }}</a>
  161.                     </div>
  162.                 </div>
  163.             </div>
  164.         </div>
  165.     </div>
  166. {% endblock %}