{#
    /**
     * This file is part of FacturaScripts
     * Copyright (C) 2017-2020 Carlos Garcia Gomez <carlos@facturascripts.com>
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as
     * published by the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
     *
     * You should have received a copy of the GNU Lesser General Public License
     * along with this program. If not, see http://www.gnu.org/licenses/.
     */
#}
{% extends "Master/MicroTemplate.html.twig" %}

{% block body %}
    <!-- Macros Template Imports -->
    {% import 'Macro/Forms.html.twig' as forms %}
    {% set codimpuesto = appSettings.get('default', 'codimpuesto') %}
    {% set codretencion = appSettings.get('default', 'codretencion') %}

    <div class="bg-primary pt-5 pb-5">
        <br/>
        <br/>
        <br/>
    </div>
    <div class="container card shadow" style="margin-top: -100px;">
        <div class="row">
            <div class="col-12">
                <h1 class="h3 mt-3">
                    <i class="fas fa-magic" aria-hidden="true"></i> {{ i18n.trans('wizard') }}
                    <a href="{{ fsc.url() }}" class="btn btn-sm btn-outline-secondary" title="{{ i18n.trans('refresh') }}">
                        <i class="fas fa-redo" aria-hidden="true"></i>
                    </a>
                </h1>
                <p>{{ i18n.trans('wizard-p') }}</p>
                <hr/>
            </div>
        </div>
        <form action="#" method="post" class="form" id="formWizard">
            <input type="hidden" name="action" value="step2" />
            <div class="row align-items-end">
                <div class="col-sm-4">
                    <div class="form-group">
                        {{ forms.simpleSelect('regimeniva', 'regimeniva', fsc.empresa.regimeniva, fsc.getRegimenIva(), i18n.trans('vat-regime')) }}
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        {{ forms.simpleSelect('codimpuesto', 'codimpuesto', codimpuesto, fsc.getSelectValues('Impuesto', true), i18n.trans('default-tax')) }}
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        {{ forms.simpleSelect('codretencion', 'codretencion', codretencion, fsc.getSelectValues('Retencion', true), i18n.trans('default-retention')) }}
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="form-group">
                        {{ i18n.trans('cost-price-policy') }}
                        <select name="costpricepolicy" class="form-control">
                            <option value="">------</option>
                            <option value="last-price">{{ i18n.trans('last-purchase-price') }}</option>
                            <option value="average-price">{{ i18n.trans('average-purchase-price') }}</option>
                            <option value="actual-price">{{ i18n.trans('actual-cost-price') }}</option>
                        </select>
                    </div>
                </div>
                <div class="col-sm">
                    <div class="form-group form-check">
                        <input type="checkbox" name="ventasinstock" value="1" id="cbNoStock" class="form-check-input" />
                        <label for="cbNoStock">{{ i18n.trans('allow-sale-without-stock') }}</label>
                    </div>
                </div>
            </div>
            <div class="row mt-4">
                <div class="col-sm">
                    <div class="form-group form-check">
                        <input type="checkbox" name="defaultplan" value="1" id="checkboxPlan" class="form-check-input" checked="" />
                        <label for="checkboxPlan">{{ i18n.trans('load-def-acc-plan') }}</label>
                    </div>
                </div>
                <div class="col-sm text-right">
                    <button type="submit" class="btn btn-primary" id="btnWizard">
                        {{ i18n.trans('continue') }}
                    </button>
                </div>
            </div>
        </form>
    </div>
{% endblock %}

{% block css %}
    {{ parent() }}
    <link rel="stylesheet" href="{{ asset('Dinamic/Assets/CSS/custom.css') }}" />
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script src="{{ asset('node_modules/pace-js/pace.min.js') }}"></script>
    <script src="{{ asset('Dinamic/Assets/JS/Custom.js') }}"></script>
    <script>
        $(document).ready(function () {
            $("#formWizard").submit(function () {
                $("#btnWizard").prop('disabled', true);
                $("#btnWizard").html('<i class="fas fa-spinner fa-spin"></i>');
            });
        });
    </script>
{% endblock %}