{#
/**
 * This file is part of FacturaScripts
 * Copyright (C) 2017-2025 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 messages %}
    <div class="bg-primary pt-5 pb-5">
        <div class="container">
            <div class="row">
                <div class="col">{{ parent() }}</div>
            </div>
        </div>
        <br/>
        <br/>
        <br/>
    </div>
{% endblock %}

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

    <div class="container" style="margin-top: -100px;">
        <form action="#" method="post" class="form" id="formWizard">
            {{ formToken() }}
            <input type="hidden" name="action" value="step2"/>
            <div class="card shadow mb-5">
                <div class="card-body">
                    <h1 class="h3">
                        <i class="fa-solid fa-wand-magic-sparkles me-2"></i> {{ trans('wizard') }}
                        <a href="{{ fsc.url() }}" class="btn btn-sm btn-outline-secondary float-end"
                           title="{{ trans('refresh') }}">
                            <i class="fa-solid fa-redo" aria-hidden="true"></i>
                        </a>
                    </h1>
                    <p>{{ trans('wizard-p') }}</p>
                    <hr/>
                    <div class="row gx-2">
                        <div class="col-lg-4 col-md-6">
                            <div class="mb-3">
                                {{ forms.simpleSelect('regimeniva', 'regimeniva', fsc.empresa.regimeniva,
                                    fsc.getRegimenIva(), trans('vat-regime')) }}
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-6">
                            <div class="mb-3">
                                {{ forms.simpleSelect('codimpuesto', 'codimpuesto', codimpuesto,
                                    fsc.getSelectValues('Impuesto', true), trans('default-tax')) }}
                            </div>
                        </div>
                        <div class="col-lg-4 col-md-6">
                            <div class="mb-3">
                                <label class="mb-1">{{ trans('cost-price-policy') }}</label>
                                <select name="costpricepolicy" class="form-select">
                                    <option value="">------</option>
                                    <option value="last-price">{{ trans('last-purchase-price') }}</option>
                                    <option value="average-price">{{ trans('average-purchase-price') }}</option>
                                    <option value="actual-price">{{ trans('actual-cost-price') }}</option>
                                    <option value="high-price">{{ trans('high-purchase-price') }}</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row gx-2">
                        <div class="col-auto">
                            <div class="mb-3 form-check pe-3">
                                <input type="checkbox" name="defaultplan" value="1" id="checkboxPlan"
                                       class="form-check-input" checked/>
                                <label for="checkboxPlan">{{ trans('load-def-acc-plan') }}</label>
                            </div>
                        </div>
                        <div class="col-auto">
                            <div class="mb-3 form-check pe-3">
                                {% if settings('default', 'ventasinstock') %}
                                    <input type="checkbox" name="ventasinstock" value="1" id="cbNoStock"
                                           class="form-check-input" checked/>
                                {% else %}
                                    <input type="checkbox" name="ventasinstock" value="1" id="cbNoStock"
                                           class="form-check-input"/>
                                {% endif %}
                                <label for="cbNoStock">{{ trans('allow-sale-without-stock-n') }}</label>
                            </div>
                        </div>
                        <div class="col-auto">
                            <div class="mb-3 form-check">
                                {% if settings('default', 'updatesupplierprices') %}
                                    <input type="checkbox" name="updatesupplierprices" value="1"
                                           id="cbUpdateSupplierPrices" class="form-check-input" checked/>
                                {% else %}
                                    <input type="checkbox" name="updatesupplierprices" value="1"
                                           id="cbUpdateSupplierPrices" class="form-check-input"/>
                                {% endif %}
                                <label for="cbUpdateSupplierPrices">{{ trans('update-supplier-prices') }}</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="card-footer text-end">
                    <button type="submit" class="btn btn-primary" id="btnWizard">
                        <i class="fa-solid fa-arrow-right fa-beat me-1"></i> {{ trans('continue') }}
                    </button>
                </div>
            </div>
        </form>
        <br/>
    </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="fa-solid fa-circle-notch fa-spin"></i>');
            });
        });
    </script>
{% endblock %}