<!--
 SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
 SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
    {{( pgettext "Tax Details" "title" )}}
{{- end }}

{{ define "content" -}}
    {{- /*gotype: dev.tandem.ws/tandem/camper/pkg/company.taxDetailsForm*/ -}}
    <form data-hx-put="/admin/company">
        <h2>{{( pgettext "Tax Details" "title" )}}</h2>
        {{ CSRFInput }}
        <fieldset>
            {{ with .BusinessName -}}
                <label>
                    {{( pgettext "Business Name" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required autocomplete="organization" minlength="2"
                            {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .VATIN -}}
                <label>
                    {{( pgettext "VAT Number" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .TradeName -}}
                <label>
                    {{( pgettext "Trade Name" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                            {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Phone -}}
                <label>
                    {{( pgettext "Phone" "input")}}<br>
                    <input type="tel" name="{{ .Name }}" value="{{ .Val }}"
                           required autocomplete="tel" {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Email -}}
                <label>
                    {{( pgettext "Email" "input")}}<br>
                    <input type="email" name="{{ .Name }}" value="{{ .Val }}"
                           required autocomplete="email" {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Web -}}
                <label>
                    {{( pgettext "Business Name" "input")}}<br>
                    <input type="url" name="{{ .Name }}" value="{{ .Val }}"
                           autocomplete="url" {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Address -}}
                <label>
                    {{( pgettext "Address" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required autocomplete="address-line1" {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .City -}}
                <label>
                    {{( pgettext "City" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Province -}}
                <label>
                    {{( pgettext "Province" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .PostalCode -}}
                <label>
                    {{( pgettext "Postcode" "input")}}<br>
                    <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                           required autocomplete="postal-code" {{ template "error-attrs" . }}><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Country -}}
                <label>
                    {{( pgettext "Country" "input")}}<br>
                    <select name="{{ .Name }}"
                            required autocomplete="country"
                            {{ template "error-attrs" . }}>{{ template "list-options" . }}
                    </select><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .Currency -}}
                <label>
                    {{( pgettext "Currency" "input")}}<br>
                    <select name="{{ .Name }}"
                            required
                            {{ template "error-attrs" . }}>{{ template "list-options" . }}
                    </select><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            {{ with .DefaultLanguage -}}
                <label>
                    {{( pgettext "Default Language" "input")}}<br>
                    <select name="{{ .Name }}"
                            required
                            {{ template "error-attrs" . }}>{{ template "list-options" . }}
                    </select><br>
                </label>
                {{ template "error-message" . }}
            {{- end }}
            <fieldset>
                <legend>{{( pgettext "Tourism" "title" )}}</legend>
                {{ with .RTCNumber -}}
                    <label>
                        {{( pgettext "RTC number" "input")}}<br>
                        <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                               required {{ template "error-attrs" . }}><br>
                    </label>
                    {{ template "error-message" . }}
                {{- end }}
                {{ with .TouristTax -}}
                    <label>
                        {{( pgettext "Tourist Tax" "input")}}<br>
                        <input type="number" name="{{ .Name }}" value="{{ .Val }}"
                               min="0" step="0.01"
                               required {{ template "error-attrs" . }}><br>
                    </label>
                    {{ template "error-message" . }}
                {{- end }}
            </fieldset>
            <fieldset>
                <legend>{{( pgettext "Invoicing" "title" )}}</legend>
                {{ with .InvoiceNumberFormat -}}
                    <label>
                        {{( pgettext "Invoice Number Format" "input")}}<br>
                        <input type="text" name="{{ .Name }}" value="{{ .Val }}"
                               required {{ template "error-attrs" . }}><br>
                    </label>
                    {{ template "error-message" . }}
                {{- end }}
                {{ with .LegalDisclaimer -}}
                    <label>
                        {{( pgettext "Legal Disclaimer" "input")}}<br>
                        <textarea name="{{ .Name }}"
                            {{ template "error-attrs" . }}>{{ .Val }}</textarea><br>
                    </label>
                    {{ template "error-message" . }}
                {{- end }}
            </fieldset>
        </fieldset>
        <footer>
            <button type="submit">{{( pgettext "Save changes" "action" )}}</button>
        </footer>
    </form>
{{- end }}
