{#
This file is part of EC-CUBE
Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
http://www.ec-cube.co.jp/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'default_frame.twig' %}
{% set body_class = 'cart_page' %}
{% block stylesheet %}
<link rel="stylesheet" type="text/css" href="/html/user_data/assets/css/calendar.css">
{% endblock %}
{% block javascript %}
<script>
const rental_setting = '{{ rental_setting }}';
</script>
<script src="/html/user_data/assets/js/calendar.js"></script>
<script>
$(function() {
$('.ec-cartTable').each(function() {
if ($(this).find('.ec-cartRow__periodColumn').length > 0) {
$(this).find('ol li').eq(2).text('レンタル期間');
}
});
let reserved = '{{ reserved }}';
if (reserved) {
reserved = reserved.split('|');
$('.ec-cartRow').each(function(index) {
let cal = $(this).find('.cal_root');
if (cal.length > 0) {
cal.data('period', reserved[index]);
}
});
}
let valied = '{{ valied }}';
valied = valied.split('|');
$('.period_error_msg').each(function(index) {
if (!valied[index]) {
$(this).show();
$('.ec-cartRole__actions').eq(index).find('.ec-blockBtn--action').hide();
}
else {
$('.ec-cartRole__cart').eq(index).find('.cal_root').removeClass('cal_root');
}
});
$('body').addClass('script_loaded');
});
</script>
{% endblock %}
{% block main %}
<div class="ec-role">
<div class="ec-pageHeader">
<h1>{{ 'ショッピングカート'|trans }}</h1>
</div>
</div>
<div class="ec-cartRole">
<div class="ec-cartRole__progress">
<ul class="ec-progress">
{% set step = 1 %}
<li class="ec-progress__item is-complete">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'カートの商品'|trans }}
</div>
</li>
{% if is_granted('ROLE_USER') == false %}
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'お客様情報'|trans }}
</div>
</li>
{% endif %}
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'ご注文手続き'|trans }}
</div>
</li>
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ 'ご注文内容確認'|trans }}
</div>
</li>
<li class="ec-progress__item">
<div class="ec-progress__number">{{ step }}{% set step = step + 1 %}
</div>
<div class="ec-progress__label">{{ '完了'|trans }}
</div>
</li>
</ul>
</div>
{% set productStr = app.session.flashbag.get('eccube.front.request.product') %}
{% for error in app.session.flashbag.get('eccube.front.request.error') %}
{% set idx = loop.index0 %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{% if productStr[idx] is defined %}
{{ error|trans({'%product%':productStr[idx]})|nl2br }}
{% else %}
{{ error|trans|nl2br }}
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% for error in app.session.flashbag.get('eccube.front.cart.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
{% if totalQuantity > 0 %}
<div class="ec-cartRole__totalText">
<p>
{{ '商品の合計金額は「<strong>%price%</strong>」です。'|trans({ '%price%': totalPrice|price })|raw }}
</p>
</div>
{% if Carts|length > 1 %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__text">
{{ '同時購入できない商品がカートに含まれています。'|trans|nl2br }}
</div>
</div>
</div>
{% endif %}
<form name="form" id="form_cart" class="ec-cartRole" method="post" action="{{ url('cart') }}">
<div id="valid_check" style="display:none"></div>
{% for CartIndex,Cart in Carts %}
{% set cartKey = Cart.cart_key %}
{% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
<div class="ec-cartRole__cart">
<p class="period_error_msg" style="color:red;display:none">レンタル期間が揃っていません。</p>
<div class="ec-cartTable">
<ol class="ec-cartHeader">
<li class="ec-cartHeader__label">{{ '削除'|trans }}</li>
<li class="ec-cartHeader__label">{{ '商品内容'|trans }}</li>
<li class="ec-cartHeader__label">{{ '数量'|trans }}</li>
<li class="ec-cartHeader__label">{{ '小計'|trans }}</li>
</ol>
{% for CartItem in Cart.CartItems %}
{% set ProductClass = CartItem.ProductClass %}
{% set Product = ProductClass.Product %}
<ul class="ec-cartRow">
<li class="ec-cartRow__delColumn">
<a href="{{ url('cart_handle_item', {'operation': 'remove', 'productClassId': ProductClass.id }) }}" {{ csrf_token_for_anchor() }} class="ec-icon" data-method="put" data-message="カートから商品を削除してもよろしいですか?">
<img src="{{ asset('assets/icon/cross.svg') }}" alt="delete">
</a>
</li>
<li class="ec-cartRow__contentColumn">
<div class="ec-cartRow__img">
<a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">
<img src="{{ asset(Product.MainListImage|no_image_product, 'save_image') }}" alt="{{ Product.name }}"/>
</a>
</div>
<div class="ec-cartRow__summary">
<div class="ec-cartRow__name">
<a target="_blank" href="{{ url('product_detail', {id : Product.id} ) }}">{{ Product.name }}</a>
{% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
<br>{{ ProductClass.ClassCategory1.ClassName.name }}:{{ ProductClass.ClassCategory1 }}
{% endif %}
{% if ProductClass.ClassCategory2 and ProductClass.ClassCategory2.id %}
<br>{{ ProductClass.ClassCategory2.ClassName.name }}:{{ ProductClass.ClassCategory2 }}
{% endif %}
</div>
<div class="ec-cartRow__unitPrice">{{ CartItem.price|price }}</div>
<div class="ec-cartRow__sutbtotalSP">{{ '小計:'|trans }}{{ CartItem.total_price|price }}</div>
</div>
</li>
{% if ProductClass.ClassCategory1 and ProductClass.ClassCategory1.id %}
<li class="ec-cartRow__amountColumn ec-cartRow__periodColumn">
<div class="cal_root" data-period="">
{% if CartItem.period %}
{% if CartItem.really_period %}<span>{{ CartItem.really_period }}</span>{% endif %}
<p>{{ CartItem.period }}</p>
<div class="cal_wrap"></div>
<a href="{{ url('cart_item_update_period', {'cartItemId': CartItem.id, 'period': 'upldate_period' }) }}" {{ csrf_token_for_anchor() }} class="period_change_link" data-method="put" data-confirm="false"></a>
{% else %}
期間が選択されていません。
{% endif %}
</div>
</li>
{% else %}
<li class="ec-cartRow__amountColumn">
<div class="ec-cartRow__amount">{{ CartItem.quantity|number_format }}</div>
<div class="ec-cartRow__amountSP">{{ '数量:'|trans }}{{ CartItem.quantity|number_format }}</div>
<div class="ec-cartRow__amountUpDown">
{% if CartItem.quantity > 1 %}
<a href="{{ url('cart_handle_item', {'operation': 'down', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountDownButton load-overlay" data-method="put" data-confirm="false">
<span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus-dark.svg') }}" alt="reduce"></span>
</a>
{% else %}
<div class="ec-cartRow__amountDownButtonDisabled">
<span class="ec-cartRow__amountDownButton__icon"><img src="{{ asset('assets/icon/minus.svg') }}" alt="reduce"></span>
</div>
{% endif %}
<a href="{{ url('cart_handle_item', {'operation': 'up', 'productClassId': ProductClass.id}) }}" {{ csrf_token_for_anchor() }} class="ec-cartRow__amountUpButton load-overlay" data-method="put" data-confirm="false">
<span class="ec-cartRow__amountUpButton__icon"><img src="{{ asset('assets/icon/plus-dark.svg') }}" alt="increase"></span>
</a>
</div>
</li>
{% endif %}
<li class="ec-cartRow__subtotalColumn">
<div class="ec-cartRow__sutbtotal">{{ CartItem.total_price|price }}</div>
</li>
</ul>
{% endfor %}
</div>
</div>
<div class="ec-cartRole__progress">
{% if BaseInfo.delivery_free_amount and BaseInfo.delivery_free_quantity %}
<br/>
{% if is_delivery_free[cartKey] %}
{{ '現在送料無料です。'|trans }}
{% else %}
{{ 'あと「<strong>%price%</strong>」または「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price, '%quantity%': quantity[cartKey]|number_format })|raw }}
{% endif %}
{% elseif BaseInfo.delivery_free_amount %}
<br/>
{% if is_delivery_free[cartKey] %}
{{ '現在送料無料です。'|trans }}
{% else %}
{{ 'あと「<strong>%price%</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%price%': least[cartKey]|price })|raw }}
{% endif %}
{% elseif BaseInfo.delivery_free_quantity %}
<br/>
{% if is_delivery_free[cartKey] %}
{{ '現在送料無料です。'|trans }}
{% else %}
{{ 'あと「<strong>%quantity%個</strong>」のお買い上げで<strong class="ec-color-red">送料無料</strong>になります。'|trans({ '%quantity%': quantity[cartKey]|number_format })|raw }}
{% endif %}
{% endif %}
</div>
<div class="ec-cartRole__actions">
<div class="ec-cartRole__total">{{ '合計:'|trans }}<span class="ec-cartRole__totalAmount">{{ Cart.totalPrice|price }}</span>
</div>
<a class="ec-blockBtn--action" href="{{ path('cart_buystep', {'cart_key':cartKey}) }}">{{ 'レジに進む'|trans }}</a>
{% if loop.last %}
<a class="ec-blockBtn--cancel" href="{{ path('homepage') }}">{{ 'お買い物を続ける'|trans }}</a>
{% endif %}
</div>
{% endfor %}
</form>
{% else %}
{% for CartIndex,Cart in Carts %}
{% set cartKey = Cart.cart_key %}
{% for error in app.session.flashbag.get('eccube.front.cart.' ~ cartKey ~ '.request.error') %}
<div class="ec-cartRole__error">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">
{{ error|trans|nl2br }}
</div>
</div>
</div>
{% endfor %}
{% endfor %}
<div class="ec-role">
<div class="ec-off3Grid">
<div class="ec-off3Grid__cell">
<div class="ec-alert-warning">
<div class="ec-alert-warning__icon"><img src="{{ asset('assets/icon/exclamation-white.svg') }}"></div>
<div class="ec-alert-warning__text">{{ '現在カート内に商品はございません。'|trans }}</div>
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}