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 / 299
{#
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 = ['product', 'product_master'] %}
{% block title %}商品管理{% endblock %}
{% block sub_title %}商品マスター{% endblock %}
{% form_theme searchForm 'Form/bootstrap_3_horizontal_layout.html.twig' %}
{% block stylesheet %}
<link rel="stylesheet" href="{{ app.config.admin_urlpath }}/assets/css/bootstrap-datetimepicker.min.css">
{% endblock stylesheet %}
{% block javascript %}
<script src="{{ app.config.admin_urlpath }}/assets/js/vendor/moment.min.js"></script>
<script src="{{ app.config.admin_urlpath }}/assets/js/vendor/moment-ja.js"></script>
<script src="{{ app.config.admin_urlpath }}/assets/js/vendor/bootstrap-datetimepicker.min.js"></script>
<script>
$(function() {
    var inputDate = document.createElement('input');
    inputDate.setAttribute('type', 'date');
    if (inputDate.type !== 'date') {
        $('input[id$=_date_start]').datetimepicker({
            locale: 'ja',
            format: 'YYYY-MM-DD',
            useCurrent: false,
            showTodayButton: true
        });
        $('input[id$=_date_end]').datetimepicker({
            locale: 'ja',
            format: 'YYYY-MM-DD',
            useCurrent: false,
            showTodayButton: true
        });
    }
    // フォーム値を確認し、アコーディオンを制御
    // 値あり : 開く / 値なし : 閉じる
    (function($, f) {
        //フォームがないページは処理キャンセル
        var $ac = $(".accpanel");
        if (!$ac) {
            return false
        }
        //フォーム内全項目取得
        var c = f();
        if (c.formState()) {
            if ($ac.css("display") == "none") {
                $ac.siblings('.toggle').addClass("active");
                $ac.slideDown(0);
            }
        } else {
            $ac.siblings('.toggle').removeClass("active");
            $ac.slideUp(0);
        }
    })($, formPropStateSubscriber);
});
</script>
<script>
    function fnConfirm(action) {
        document.search_form.action = action;
        document.search_form.submit();
    }
    function fnCopy(action) {
        if (confirm('この商品情報を複製しても宜しいですか?')) {
            document.search_form.action = action;
            document.search_form.submit();
        }
    }
</script>
{% endblock javascript %}
{% block main %}
            <!--検索条件設定テーブルここから-->
            <div id="search_wrap" class="search-box">
                <form name="search_form" id="search_form" method="post" action="{{ url('admin_product') }}">
                    {{ form_widget(searchForm._token) }}
                    <div id="search_box" class="row">
                        <div class="col-md-12 accordion">
                            {{ form_widget(searchForm.id, { attr: { placeholder: '商品名・ID・コード', class : 'input_search' } } ) }}
                            <a id="search_box__toggle" href="#" class="toggle{% if active %} active{% endif %}">
                                <svg class="cb cb-minus"> <use xlink:href="#cb-minus"/></svg> <svg class="cb cb-minus"> <use xlink:href="#cb-minus"/></svg>
                            </a>
                            <div id="search_box___body" class="search-box-inner accpanel" {% if active %} style="display: block;"{% endif %}>
                                <div class="row">
                                    <div id="search_box__body_inner" class="col-sm-12 col-lg-10 col-lg-offset-1 search">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div id="search_box__category_id" class="form-group">
                                                    <label>カテゴリ</label>
                                                    {{ form_widget(searchForm.category_id) }}
                                                </div>
                                            </div>
                                            <div id="search_box__status" class="col-md-6">
                                                <label>種別</label>
                                                <div class="form-group">
                                                    {{ form_widget(searchForm.status) }}
                                                </div>
                                            </div>
                                        </div><!-- /.row -->
                                        <div class="row">
                                            <div id="search_box__create_date" class="col-sm-6">
                                                <label>登録日</label>
                                                <div class="form-group range">
                                                    {{ form_widget(searchForm.create_date_start, {'attr': {'class': 'input_cal'}}) }} ~ {{ form_widget(searchForm.create_date_end, {'attr': {'class': 'input_cal'}}) }}
                                                </div>
                                            </div>
                                            <div id="search_box__update_date" class="col-sm-6">
                                                <label>更新日</label>
                                                <div class="form-group range">
                                                    {{ form_widget(searchForm.update_date_start, {'attr': {'class': 'input_cal'}}) }} ~ {{ form_widget(searchForm.update_date_end, {'attr': {'class': 'input_cal'}}) }}
                                                </div>
                                            </div>
                                            <div class="extra-form col-md-12">
                                                {% for f in searchForm.getIterator %}
                                                    {% if f.vars.name matches '[^plg*]' %}
                                                        <div class="form-group">
                                                            {{ form_label(f) }}
                                                            {{ form_widget(f) }}
                                                            {{ form_errors(f) }}
                                                        </div>
                                                    {% endif %}
                                                {% endfor %}
                                            <div class="col-sm-6">
                                                {{ form_rest(searchForm) }}
                                            </div>
                                        </div><!-- /.row -->
                                        <div id="search_box_inner__footer" class="row">
                                            <div id="search_box__clear_button" class="col-sm-12">
                                                <p class="text-center"><a href="#" class="search-clear">検索条件をクリア</a></p>
                                            </div>
                                        </div><!-- /.row -->
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- /.col -->
                    </div>
                    <div id="search_box__footer" class="row btn_area">
                        <div id="search_box__search_button" class="col-xs-8 col-xs-offset-2 col-sm-4 col-sm-offset-4 text-center">
                            <button type="submit" class="btn btn-primary btn-block btn-lg">
                                検索する <svg class="cb cb-angle-right"><use xlink:href="#cb-angle-right"></svg>
                            </button>
                        </div>
                        <!-- /.col -->
                    </div>
                </form>
            </div>
            <!--検索条件設定テーブルここまで-->
        {% if pagination %}
            <div id="result_list" class="row">
                <div class="col-md-12">
                    <div id="result_list_main" class="box">
                        {% if pagination|length > 0 %}
                        <div id="result_list__header" class="box-header with-arrow">
                            <h3 class="box-title">検索結果 <span class="normal"><strong>{{ pagination.totalItemCount }} 件</strong> が該当しました</span></h3>
                        </div><!-- /.box-header -->
                        <div id="result_list__body" class="box-body no-padding">
                            <div id="result_list__menu" class="row">
                                <div class="col-md-6">
                                    <ul id="result_list__status_menu" class="link-with-bar">
                                    <li>
                                        {% if page_status is null %}
                                        <a>すべて</a>
                                        {% else %}
                                        <a href="{{ path('admin_product_page', {'page_no': page_no} ) }}">すべて</a>
                                        {% endif %}
                                    </li>
                                    {% for disp in disps %}
                                      <li>
                                      {% if page_status == disp.id %}
                                      <a>{{ disp.name|e }}</a>
                                      {% else %}
                                      <a href="{{ path('admin_product_page', {'page_no': page_no, 'status': disp.id} ) }}">{{ disp.name|e }}</a>
                                      {% endif %}
                                      </li>
                                    {% endfor %}
                                      <li>
                                      {% if page_status == app.config.admin_product_stock_status %}
                                          <a>{{ app.translator.trans('admin.product.search.stock') }}</a>
                                      {% else %}
                                          <a href="{{ path('admin_product_page', {'page_no': page_no, 'status': app.config.admin_product_stock_status} ) }}">{{ app.translator.trans('admin.product.search.stock') }}</a>
                                      {% endif %}
                                      </li>
                                    </ul>
                                </div>
                                <div class="col-md-6">
                                    <ul class="sort-dd">
                                    <li id="result_list__pagemax_menu" class="dropdown">
                                        {% for pageMax in pageMaxis if pageMax.name == page_count %}
                                            <a class="dropdown-toggle" data-toggle="dropdown">{{ pageMax.name|e }}件<svg class="cb cb-angle-down icon_down"><use xlink:href="#cb-angle-down"></svg></a>
                                            <ul class="dropdown-menu">
                                        {% endfor %}
                                        {% for pageMax in pageMaxis if pageMax.name != page_count %}
                                                <li><a href="{{ path('admin_product_page', {'page_no': 1, 'page_count': pageMax.name}) }}">{{ pageMax.name|e }}件</a></li>
                                        {% endfor %}
                                            </ul>
                                    </li>
                                    <li id="result_list__csv_menu" class="dropdown">
                                        <a class="dropdown-toggle" data-toggle="dropdown">CSVダウンロード<svg class="cb cb-angle-down icon_down"><use xlink:href="#cb-angle-down"></svg></a>
                                        <ul class="dropdown-menu">
                                            <li><a href="{{ url('admin_product_export') }}">CSVダウンロード</a></li>
                                            <li><a href="{{ url('admin_setting_shop_csv', { id : constant('\\Eccube\\Entity\\Master\\CsvType::CSV_TYPE_PRODUCT') }) }}">出力項目設定</a></li>
                                        </ul>
                                    </li>
                                    </ul>
                                </div>
                            </div>
                            <div id="result_list__list" class="item_list">
                                <div class="tableish tableish-striped">
                                    {% for Product in pagination %}
                                        <div id="result_list__item--{{ Product.id }}" class="item_box tr">
                                            <div id="result_list__id--{{ Product.id }}" class="item_id td">
                                                {{Product.id}}
                                            </div>
                                            <div id="result_list__image--{{ Product.id }}" class="item_photo td">
                                                <a href="{{ url('admin_product_product_edit', { id : Product.id }) }}">
                                                    <img src="{{ app.config.image_save_urlpath }}/{{ Product.mainFileName|no_image_product }}" />
                                                </a>
                                            </div>
                                            <div id="result_list__name--{{ Product.id }}" class="item_detail td">
                                                <a href="{{ url('admin_product_product_edit', { id : Product.id }) }}">
                                                    {{ Product.name }}
                                                </a><br>
                                                <span  id="result_list__code--{{ Product.id }}">
                                                    {{ Product.code_min }}
                                                    {% if Product.code_min != Product.code_max %} ~ {{ Product.code_max }}
                                                    {% endif %}
                                                </span>
                                            </div>
                                            <div id="result_list__item_menu_box--{{ Product.id }}"class="icon_edit td">
                                                <div id="result_list__item_menu_toggle--{{ Product.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="result_list__item_menu--{{ Product.id }}" class="dropdown-menu dropdown-menu-right">
                                                    <li><a href="{{ url('admin_product_product_class', { id : Product.id }) }}">規格</a></li>
                                                    <li><a href="{{ url('admin_product_product_display', {'id' : Product.id}) }}" target="_blank">確認</a></li>
                                                    <li><a href="{{ url('admin_product_product_copy', {'id' : Product.id}) }}" {{ csrf_token_for_anchor() }} data-method="post" data-message="商品情報を複製してもよろしいですか?">複製</a></li>
                                                    <li><a href="{{ url('admin_product_product_delete', {'id' : Product.id}) }}" {{ csrf_token_for_anchor() }} data-method="delete" data-message="商品情報を削除してもよろしいですか?">削除</a></li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div><!-- /.item_box -->
                                    {% endfor %}
                                </div>
                            </div>
                        </div><!-- /.box-body -->
                        {% if pagination.totalItemCount > 0 %}
                            {% include "pager.twig" with { 'pages' : pagination.paginationData, 'routes' : 'admin_product_page' } %}
                        {% endif %}
                        {% else %}
                        <div id="result_list__header" class="box-header with-arrow">
                            <h3 class="box-title">検索条件に該当するデータがありませんでした。</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body no-padding">
                            <div class="row">
                                <div class="col-md-6">
                                    <ul class="link-with-bar">
                                        <li>
                                            {% if page_status is null %}
                                                <a>すべて</a>
                                            {% else %}
                                                <a href="{{ path('admin_product_page', {'page_no': page_no} ) }}">すべて</a>
                                            {% endif %}
                                        </li>
                                        {% for disp in disps %}
                                            <li>
                                                {% if page_status == disp.id %}
                                                    <a>{{ disp.name|e }}</a>
                                                {% else %}
                                                    <a href="{{ path('admin_product_page', {'page_no': page_no, 'status': disp.id} ) }}">{{ disp.name|e }}</a>
                                                {% endif %}
                                            </li>
                                        {% endfor %}
                                        <li>
                                            {% if page_status == app.config.admin_product_stock_status %}
                                                <a>{{ app.translator.trans('admin.product.search.stock') }}</a>
                                            {% else %}
                                                <a href="{{ path('admin_product_page', {'page_no': page_no, 'status': app.config.admin_product_stock_status} ) }}">{{ app.translator.trans('admin.product.search.stock') }}</a>
                                            {% endif %}
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div><!-- /.box-body -->
                        {% endif %}
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div>
        {% endif %}
{% endblock %}