Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
0 / 0
100.00% covered (success)
100.00%
0 / 0
CRAP
0.00% covered (danger)
0.00%
0 / 115
{#
This file is part of EC-CUBE
Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
http://www.lockon.co.jp/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#}
{% extends 'default_frame.twig' %}
{% set menus = ['setting', 'shop', 'shop_delivery'] %}
{% block title %}ショップ設定{% endblock %}
{% block sub_title %}配送方法管理{% endblock %}
{% block javascript %}
    <script src="{{ app.config.admin_urlpath }}/assets/js/vendor/jquery.ui/jquery.ui.core.min.js"></script>
    <script src="{{ app.config.admin_urlpath }}/assets/js/vendor/jquery.ui/jquery.ui.widget.min.js"></script>
    <script src="{{ app.config.admin_urlpath }}/assets/js/vendor/jquery.ui/jquery.ui.mouse.min.js"></script>
    <script src="{{ app.config.admin_urlpath }}/assets/js/vendor/jquery.ui/jquery.ui.sortable.min.js"></script>
    <script>
        $(function() {
            var oldRanks = [];
            // 画面の中のrank一覧を保持
            $("div.tableish > .item_box").each(function() {
                oldRanks.push(this.dataset.rank);
            });
            // rsort
            oldRanks.sort(function(a,b){return a - b;}).reverse();
            $("div.tableish").sortable({
                items: '> .item_box',
                cursor: 'move',
                update: function(e, ui) {
                    $("body").append($('<div class="modal-backdrop in"></div>'));
                    updateRank();
                }
            });
            var updateRank = function() {
                // 並び替え後にrankを更新
                var newRanks = {};
                var i = 0;
                $("div.tableish > .item_box").each(function() {
                    newRanks[this.dataset.deliveryId] = oldRanks[i];
                    i++;
                });
                $.ajax({
                    url: '{{ url('admin_setting_shop_delivery_rank_move') }}',
                    type: 'POST',
                    data: newRanks
                }).done(function() {
                    $(".modal-backdrop").remove();
                }).fail(function() {
                    $(".modal-backdrop").remove();
                });
            };
        });
    </script>
{% endblock %}
{% block main %}
    <form name="form1" method="post">
    <div id="delivery_wrap" class="row">
        <div id="delivery_list_box" class="col-md-12">
            <div id="delivery_list__body" class="box">
                <div id="delivery_list__header" class="box-header">
                    <h3 class="box-title">配送方法一覧</h3>
                </div>
                {% if Deliveries|length > 0 %}
                    <div id="delivery_list__body_inner" class="box-body no-padding no-border">
                        <div id="delivery_list__sortable_area" class="sortable_list">
                            <div class="tableish">
                                {% for Delivery in Deliveries%}
                                    <div id="delivery_list__item--{{ Delivery.id }}" class="item_box tr" data-delivery-id="{{ Delivery.id }}" data-rank="{{ Delivery.rank }}">
                                        <div class="icon_sortable td">
                                            <svg class="cb cb-ellipsis-v"> <use xlink:href="#cb-ellipsis-v" /></svg>
                                        </div>
                                        <div id="delivery_list__name--{{ Delivery.id }}" class="item_pattern td">
                                            <a href="{{ url('admin_setting_shop_delivery_edit', {id: Delivery.id} ) }}">
                                                {{ Delivery.name }} / {{ Delivery.service_name }}
                                            </a>
                                        </div>
                                        <div id="delivery_list__menu_box--{{ Delivery.id }}" class="icon_edit td">
                                            <div id="delivery_list__menu_toggle--{{ Delivery.id }}" class="dropdown">
                                                <a class="dropdown-toggle" data-toggle="dropdown"><svg class="cb cb-ellipsis-h"> <use xlink:href="#cb-ellipsis-h" /></svg></a>
                                                <ul id="delivery_list__menu--{{ Delivery.id }}" class="dropdown-menu dropdown-menu-right">
                                                    <li><a href="{{ url('admin_setting_shop_delivery_edit', {id: Delivery.id} ) }}">編集</a></li>
                                                    <li><a href="{{ url('admin_setting_shop_delivery_delete', {id: Delivery.Id} ) }}" {{ csrf_token_for_anchor() }} data-method="delete">削除</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div><!-- /.item_box -->
                                {% endfor %}
                            </div>
                        </div>
                    </div><!-- /.box-body -->
                {% else %}
                    <div id="delivery_list__body_inner" class="box-body no-padding">
                        <div class="data-empty"><svg class="cb cb-inbox"> <use xlink:href="#cb-inbox" /></svg><p>データはありません</p></div>
                    </div><!-- /.box-body -->
                {% endif %}
                <!-- ▲ データがある時 ▲ -->
            </div><!-- /.box -->
        </div><!-- /.col -->
    </div>
    </form>
    <div id="delivery_list_footer" class="row">
        <div id="delivery_list_footer__button_area" class="col-xs-8 col-xs-offset-2 col-sm-4 col-sm-offset-4 text-center btn_area">
            <a href="{{ url('admin_setting_shop_delivery_new') }}" class="btn btn-primary btn-block btn-lg">配送方法{% if app.config.input_deliv_fee %}・配送料{% endif %}を新規入力</a>
        </div>
    </div>
{% endblock %}