{#
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 '@admin/default_frame.twig' %}

{% set menus = ['order', 'order_master'] %}

{% block title %}{{ 'admin.order.output_delivery_note_short'|trans }}{% endblock %}
{% block sub_title %}{{ 'admin.order.order_management'|trans }}{% endblock %}

{% form_theme form '@admin/Form/bootstrap_4_horizontal_layout.html.twig' %}

{% block stylesheet %}
    <link rel="stylesheet" href="{{ asset('assets/css/tempusdominus-bootstrap-4.min.css', 'admin') }}">
    <style type="text/css">
        .datepicker-days th.dow:first-child,
        .datepicker-days td:first-child {
            color: #f00;
        }

        .datepicker-days th.dow:last-child,
        .datepicker-days td:last-child {
            color: #00f;
        }

        .c-container {
            min-width: inherit;
            margin-top: 0;
        }

        .c-headerBar {
            display: none;
            height: inherit;
        }

        .c-headerBar__toggleBtn,
        .c-mainNavArea {
            display: none;
        }
    </style>
{% endblock stylesheet %}

{% block javascript %}
    <script type="text/javascript">
        $(function() {
            if ($('[type="date"]').prop('type') != 'date') {
                // input type属性でdateが利用できるかどうか(カレンダー表示できないブラウザ対応)
                $.when(
                    $.getScript("{{ asset('assets/js/vendor/moment.min.js', 'admin') }}"),
                    $.getScript("{{ asset('assets/js/vendor/moment-with-locales.min.js', 'admin') }}"),
                    $.getScript("{{ asset('assets/js/vendor/tempusdominus-bootstrap-4.min.js', 'admin') }}")
                ).done(function() {
                    $('input[id$=_issue_date]').datetimepicker({
                        locale: '{{ eccube_config.locale }}',
                        format: 'YYYY-MM-DD',
                        useCurrent: true,
                        buttons: {
                            showToday: true,
                            showClose: true
                        }
                    });
                });
            }

            var close = $('#windowclose');

            $('.btn-ec-regular').on('click', function() {
                window.open('about:blank', '_self').close();
            });

        });

        Ladda.bind('button[type="submit"]', {timeout: 3000});

    </script>
{% endblock %}

{% block main %}
    <form role="form" name="order_pdf_form" id="order_pdf_form" method="post" action="{{ url('admin_order_pdf_download') }}">
        {{ form_widget(form._token) }}
        <div class="c-contentsArea__cols">
            <div class="c-contentsArea__primaryCol">
                <div class="c-primaryCol">
                    <div class="card rounded border-0 mb-4">
                        <div class="card-header">
                            <h4 class="box-title font-weight-bold">{{ 'admin.order.output_delivery_note'|trans }}</h4>
                        </div>

                        <div class="card-body">
                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_create_date'|trans }}</label>
                                {{ form_widget(form.issue_date) }}
                                {{ form_errors(form.issue_date) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.shipping_id'|trans }}</label>
                                {{ form_widget(form.ids) }}
                                {{ form_errors(form.ids) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_title'|trans }}</label>
                                {{ form_widget(form.title) }}
                                {{ form_errors(form.title) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_output_format'|trans }}</label>
                                {{ form_widget(form.download_kind) }}
                                {{ form_errors(form.download_kind) }}
                            </div>

                            <div class="font-weight-bold">{{ 'admin.order.delivery_note_message'|trans }}</div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line1'|trans }}</label>
                                {{ form_widget(form.message1) }}
                                {{ form_errors(form.message1) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line2'|trans }}</label>
                                {{ form_widget(form.message2) }}
                                {{ form_errors(form.message2) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line3'|trans }}</label>
                                {{ form_widget(form.message3) }}
                                {{ form_errors(form.message3) }}
                            </div>

                            <div class="font-weight-bold">{{ 'admin.order.delivery_note_memo'|trans }}</div>
                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line1'|trans }}</label>
                                {{ form_widget(form.note1) }}
                                {{ form_errors(form.note1) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line2'|trans }}</label>
                                {{ form_widget(form.note2) }}
                                {{ form_errors(form.note2) }}
                            </div>

                            <div class="form-group">
                                <label>{{ 'admin.order.delivery_note_line3'|trans }}</label>
                                {{ form_widget(form.note3) }}
                                {{ form_errors(form.note3) }}
                            </div>

                            <div class="form-group text-right">
                                {{ form_widget(form.default) }}
                                {{ form_errors(form.default) }}
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="c-conversionArea">
            <div class="c-conversionArea__container">
                <div class="row justify-content-between align-items-center">
                    <div class="col-6">
                        <div class="c-conversionArea__leftBlockItem">
                            <button class="btn btn-ec-regular px-5" type="button">{{ 'admin.common.close'|trans }}</button>
                        </div>
                    </div>
                    <div class="col-6">
                        <div class="row align-items-center justify-content-end">
                            <div class="col-auto">
                                <button class="btn btn-ec-conversion px-5" type="submit">{{ 'admin.common.create'|trans }}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
{% endblock %}
