{% set sub_title = "出荷手配依頼" %}
{% extends 'inc/layout.html.twig' %}
{% block header %}
<section class="fixedHeader">
<header class="header" role="banner">
<div class="header-block">
<h1 class="header-title"><img src="img/icon/delivery.png" alt="">出荷手配依頼</h1>
<div class="header-refine">
<div class="header-refine-ctrl">
<!--
<input type="text" name="" value="{{ today }}" class="header-refine-input" readonly>
-->
<div class="js-flatpickr">
<div class="header-refine-ctrl">
<form action="" method="post">
<input type="text" name="today" value="{{ today }}" class="header-refine-input -changeable" readonly data-input onchange="this.form.submit()">
</form>
</div>
</div>
</div>
</div>
</div>
<div class="header-sub">
<p class="header-back"><a href="./">ダッシュボードへ</a></p>
</div>
</header>
<section class="upperSection">
<form method="post" id="search-form">
<input type="hidden" name="search_shipment_id" value="" >
<input type="hidden" name="search_keyword" value="" >
<input type="hidden" name="search_okinawa_flg" value="" >
<input type="hidden" name="search_category_key" value="" >
<input type="hidden" name="today" value="{{ today }}" >
</form>
<ul class="upperSection-link">
{% for shipment_id, shipment in shipment_list %}
{% if shipment_count[shipment_id] > 0 %}
<li><a href="#" data-shipping-id="{{ shipment_id }}" {% if search["shipment_id"] == shipment_id %} class="is-active" {% endif %}>{{ shipment_id }}</a></li>
{% endif %}
{% endfor %}
</ul>
<div class="upperSection-container">
<div class="upperSection-search">
<div class="upperSection-search-keyword">
<form>
<div class="upperSection-search-box">
<input type="search" name="keyword" value="{{ search["keyword"] }}" placeholder="キーワード検索" class="upperSection-search-input">
</div>
<div class="upperSection-search-check">
<label for="check-okinawa-flg-0">
<input type="radio" id="check-okinawa-flg-0" name="okinawa_flg" value="0" {% if search["okinawa_flg"] == "0" or search["okinawa_flg"] == "" %} checked {% endif %}>全体合計
</label>
<label for="check-okinawa-flg-2">
<input type="radio" id="check-okinawa-flg-2" name="okinawa_flg" value="2" {% if search["okinawa_flg"] == "1" %} checked {% endif %}>沖縄除く合計
</label>
<label for="check-okinawa-flg-1">
<input type="radio" id="check-okinawa-flg-1" name="okinawa_flg" value="1" {% if search["okinawa_flg"] == "1" %} checked {% endif %}>沖縄のみ
</label>
</div>
<button type="button" class="upperSection-search-submit" id="btn-search">検索</button>
</form>
</div>
<div class="upperSection-search-cat">
<select name="category" class="upperSection-search-select" id="select-search-category">
<option value="">▼カテゴリー</option>
{% for key, value in top_categories %}
<option value="{{ key }}" {% if search["category_key"] == key %}selected{% endif %}>{{ key }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="upperSection-sub">
<ul class="upperSection-anchor">
{% for delivery_id, delivery in delivery_list %}
<li><a href="#anchor-{{ delivery_id }}">{{ delivery }}</a></li>
{% endfor %}
</ul>
</div>
</div>
</section>
</section>
{% endblock %}
{% block main %}
<main class="contents" role="main">
<div style="overflow: auto;height: calc(100svh - 180px);">
{% for shipment_id, shipment in shipment_list %}
<section class="shipping" id="shipping-{{ shipment_id }}" data-shipping-id="{{ shipment_id}}" style="display:none;">
{% for delivery_id, delivery in delivery_list %}
{% if items[shipment_id][delivery] is defined %}
<section class="shipping-section" id="anchor-{{ delivery_id }}" data-shipment="{{ shipment }}" data-delivery="{{ delivery }}">
<h2 class="shipping-heading">{{ delivery }}</h2>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="shipping-table">
<tbody>
{% for item_code, item in items[shipment_id][delivery] %}
{% if loop.index % 2 != 0 %}
<tr>
{% endif %}
<th scope="row">{{ item.name }}</th>
<td>
<div class="switch-checkbox">
<input type="checkbox" value="1" data-key="{{ item.item_key }}" {% if item.checked %} checked {% endif %}>
</div>
</td>
<td>
<span class="total_qty">{{ item.qty }}</span>
<span class="okinawa_qty" style="display:none">{{ item.okinawa_qty }}</span>
<span class="not_okinawa_qty" style="display:none">{{ (item.qty - item.okinawa_qty) }}</span>
</td>
{% if loop.index % 2 == 0 %}
</tr>
{% endif %}
{% endfor %}
{% if (items[shipment_id][delivery]|length) % 2 != 0 %}
<th scope="row"></th><td></td>
</tr>
{% endif %}
</tbody>
</table>
</section>
{% endif %}
{% endfor %}
</section>
{% endfor %}
{#
<form action='{{ url('shipping_set_complete') }}' method="post">
<input type="text" name="date" value="{{today}}">
<input type="text" name="checked" value="1">
<input type="text" name="key" value="1-西濃運輸-002-000000-29">
<button>submit</button>
</form>
#}
</div>
</main>
{% endblock %}
{# スタイルシートの設定 #}
{% block stylesheet %}
<link rel="stylesheet" href="common/css/reset.css">
<link rel="stylesheet" href="common/css/common.css">
<link rel="stylesheet" href="common/css/contents.css">
<link rel="stylesheet" href="common/css/flatpickr.min.css">
<style>
.shipping-table th:has(+ td >.switch-checkbox input:checked),
.shipping-table td:has(.switch-checkbox input:checked),
.shipping-table td:has(.switch-checkbox input:checked) + td
{
background: #e4f0fb;
}
.switch-checkbox input[type=checkbox] {
position: relative;
cursor: pointer;
width: 4.5rem;
height: 2.1rem;
border-radius: 5px;
background-color: #aaa;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
vertical-align: middle;
transition: .5s;
padding: 0.1em;
}
.switch-checkbox input[type=checkbox]:checked {
color: white;
}
.switch-checkbox input[type=checkbox]::before {
position: absolute;
top: 50%;
left: 2rem;
transform: translateY(-50%);
width: 2.6rem;
padding: 0.2rem 0rem;
background-color: #ddd;
text-align: center;
content: '未';
transition: .5s;
border-radius: 5px;
font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "游ゴシック Medium", "Yu Gothic Medium", 游ゴシック体, YuGothic, 游ゴシック, "Yu Gothic", sans-serif;
font-weight: 600;
}
.switch-checkbox input[type=checkbox]:checked::before {
background-color: #1b69b6;
left: 0rem;
content: '済';
}
</style>
{% endblock %}
{# JavaScriptの設定 #}
{% block javascript %}
<script src="common/js/jquery.js"></script>
<script src="common/js/common.js"></script>
<script src="common/js/utility.js"></script>
<script src="common/js/page_shipping.js?v=1.01"></script>
<script src="common/js/flatpickr.js"></script>
<script>
// 商品データをjsonでセットしておく
const item_list = JSON.parse('{{ json_items|raw }}');
//カテゴリをjsonでセットしておく
const categories = JSON.parse('{{ json_top_categories|raw }}');
const complete_url = '{{ url('shipping_set_complete') }}';
const config = {
enableTime: false,
// mode: "range",
showMonths: 2,
// minDate: "today",
wrap: true,
locale: "ja",
dateFormat: "Y-m-d",
}
flatpickr('.js-flatpickr', config);
</script>
{% endblock %}