2023-01-31 12:07:17 +00:00
|
|
|
{{ define "title" -}}
|
2023-02-01 13:15:02 +00:00
|
|
|
{{( pgettext "Tax Details" "title" )}}
|
2023-01-31 12:07:17 +00:00
|
|
|
{{- end }}
|
|
|
|
|
2023-03-20 12:09:52 +00:00
|
|
|
{{ define "breadcrumbs" -}}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxDetailsPage*/ -}}
|
2023-04-02 14:10:13 +00:00
|
|
|
<nav data-hx-target="main" data-hx-boost="true">
|
2023-02-03 12:58:10 +00:00
|
|
|
<p>
|
|
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
|
|
<a>{{( pgettext "Tax Details" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
</nav>
|
2023-03-20 12:09:52 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{ define "content" }}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.TaxDetailsPage*/ -}}
|
2023-03-21 10:58:54 +00:00
|
|
|
<section class="dialog-content" id="tax-details-dialog-content" data-hx-target="this">
|
2023-02-01 13:15:02 +00:00
|
|
|
<h2>{{(pgettext "Tax Details" "title")}}</h2>
|
|
|
|
{{ with .DetailsForm }}
|
2023-03-21 10:58:54 +00:00
|
|
|
<form id="details" method="POST" action="{{ companyURI "/tax-details" }}" data-hx-boost="true" data-hx-select="#tax-details-dialog-content">
|
2023-02-02 10:39:34 +00:00
|
|
|
{{ csrfToken }}
|
2023-02-01 13:15:02 +00:00
|
|
|
{{ template "input-field" .BusinessName }}
|
|
|
|
{{ template "input-field" .VATIN }}
|
|
|
|
{{ template "input-field" .TradeName }}
|
|
|
|
{{ template "input-field" .Phone }}
|
|
|
|
{{ template "input-field" .Email }}
|
|
|
|
{{ template "input-field" .Web }}
|
|
|
|
{{ template "input-field" .Address | addInputAttr `class="width-2x"` }}
|
|
|
|
{{ template "input-field" .City }}
|
|
|
|
{{ template "input-field" .Province }}
|
|
|
|
{{ template "input-field" .PostalCode }}
|
|
|
|
{{ template "select-field" .Country | addSelectAttr `class="width-fixed"` }}
|
2023-01-27 20:30:14 +00:00
|
|
|
|
2023-02-01 13:15:02 +00:00
|
|
|
<fieldset>
|
|
|
|
<legend id="currency-legend">{{( pgettext "Currency" "title" )}}</legend>
|
2023-01-27 20:30:14 +00:00
|
|
|
|
2023-02-01 13:15:02 +00:00
|
|
|
{{ template "select-field" .Currency }}
|
|
|
|
</fieldset>
|
2023-03-20 12:09:52 +00:00
|
|
|
|
2023-05-31 18:01:00 +00:00
|
|
|
<fieldset id="invoicing">
|
2023-03-02 09:24:44 +00:00
|
|
|
<legend>{{( pgettext "Invoicing" "title" )}}</legend>
|
2023-03-20 12:09:52 +00:00
|
|
|
|
2023-03-02 09:24:44 +00:00
|
|
|
{{ template "input-field" .InvoiceNumberFormat }}
|
2023-05-31 18:01:00 +00:00
|
|
|
{{ template "input-field" .NextInvoiceNumber }}
|
2023-03-02 09:24:44 +00:00
|
|
|
{{ template "input-field" .LegalDisclaimer }}
|
|
|
|
</fieldset>
|
2023-02-01 13:15:02 +00:00
|
|
|
</form>
|
|
|
|
{{ end }}
|
2023-01-28 11:24:52 +00:00
|
|
|
|
2023-03-21 10:58:54 +00:00
|
|
|
<form id="newtax" method="POST" action="{{ companyURI "/tax" }}" data-hx-boost="true" data-hx-select="#tax-details-dialog-content">
|
2023-02-02 10:39:34 +00:00
|
|
|
{{ csrfToken }}
|
2023-02-01 13:15:02 +00:00
|
|
|
</form>
|
2023-01-28 13:18:58 +00:00
|
|
|
|
2023-03-21 10:58:54 +00:00
|
|
|
{{ $confirm := ( gettext "Are you sure?" )}}
|
2023-02-01 13:15:02 +00:00
|
|
|
<fieldset>
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="50%"></th>
|
|
|
|
<th>{{( pgettext "Tax Name" "title" )}}</th>
|
|
|
|
<th>{{( pgettext "Rate (%)" "title" )}}</th>
|
2023-02-28 11:02:27 +00:00
|
|
|
<th>{{( pgettext "Class" "title" )}}</th>
|
2023-02-01 13:15:02 +00:00
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-03-21 10:58:54 +00:00
|
|
|
<tbody data-hx-confirm="{{ $confirm }}" data-hx-target="closest tr" data-hx-swap="outerHTML swap:1s">
|
2023-02-01 13:15:02 +00:00
|
|
|
{{ with .Taxes }}
|
|
|
|
{{- range $tax := . }}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td>{{ .Name }}</td>
|
|
|
|
<td>{{ .Rate }}</td>
|
2023-02-28 11:02:27 +00:00
|
|
|
<td>{{ .Class }}</td>
|
2023-02-01 13:15:02 +00:00
|
|
|
<td>
|
2023-03-21 10:58:54 +00:00
|
|
|
<form method="POST" action="{{ companyURI "/tax"}}/{{ .Id }}" data-hx-boost="true">
|
2023-02-02 10:39:34 +00:00
|
|
|
{{ csrfToken }}
|
2023-02-03 12:29:10 +00:00
|
|
|
{{ deleteMethod }}
|
2023-02-01 13:15:02 +00:00
|
|
|
<button class="icon" aria-label="{{( gettext "Delete tax" )}}" type="submit"><i
|
|
|
|
class="ri-delete-back-2-line"></i></button>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{- end }}
|
|
|
|
{{ else }}
|
|
|
|
<tr>
|
|
|
|
<td colspan="4">{{( gettext "No taxes added yet." )}}</td>
|
|
|
|
</tr>
|
|
|
|
{{ end }}
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<th scope="row">{{( pgettext "New Line" "title")}}</th>
|
|
|
|
<td>
|
|
|
|
{{ template "input-field" .NewTaxForm.Name | addInputAttr `form="newtax"` }}
|
|
|
|
</td>
|
2023-02-28 11:02:27 +00:00
|
|
|
<td>
|
2023-02-01 13:15:02 +00:00
|
|
|
{{ template "input-field" .NewTaxForm.Rate | addInputAttr `form="newtax"` }}
|
|
|
|
</td>
|
2023-02-28 11:02:27 +00:00
|
|
|
<td>
|
|
|
|
{{ template "select-field" .NewTaxForm.Class | addSelectAttr `form="newtax"` }}
|
|
|
|
</td>
|
2023-02-01 13:15:02 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td colspan="2">
|
|
|
|
<button form="newtax" type="submit">{{( pgettext "Add new tax" "action" )}}</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
2023-01-28 13:18:58 +00:00
|
|
|
|
2023-03-21 10:58:54 +00:00
|
|
|
<form id="new-payment-method" method="POST" action="{{ companyURI "/payment-method" }}" data-hx-boost="true" data-hx-select="#tax-details-dialog-content">
|
2023-03-03 15:49:06 +00:00
|
|
|
{{ csrfToken }}
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="50%"></th>
|
|
|
|
<th>{{( pgettext "Payment Method" "title" )}}</th>
|
|
|
|
<th>{{( pgettext "Instructions" "title" )}}</th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-03-21 10:58:54 +00:00
|
|
|
<tbody data-hx-confirm="{{ $confirm }}" data-hx-target="closest tr" data-hx-swap="outerHTML swap:1s">
|
2023-03-03 15:49:06 +00:00
|
|
|
{{ with .PaymentMethods }}
|
|
|
|
{{- range $method := . }}
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
|
|
|
<td>{{ .Name }}</td>
|
|
|
|
<td>{{ .Instructions }}</td>
|
|
|
|
<td>
|
2023-03-21 10:58:54 +00:00
|
|
|
<form method="POST" action="{{ companyURI "/payment-method"}}/{{ .Id }}" data-hx-boost="true">
|
2023-03-03 15:49:06 +00:00
|
|
|
{{ csrfToken }}
|
|
|
|
{{ deleteMethod }}
|
2023-03-20 12:09:52 +00:00
|
|
|
<button class="icon" aria-label="{{( gettext "Delete payment method" )}}"
|
|
|
|
type="submit"><i
|
2023-03-03 15:49:06 +00:00
|
|
|
class="ri-delete-back-2-line"></i></button>
|
|
|
|
</form>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{{- end }}
|
|
|
|
{{ else }}
|
|
|
|
<tr>
|
|
|
|
<td colspan="4">{{( gettext "No payment methods added yet." )}}</td>
|
|
|
|
</tr>
|
|
|
|
{{ end }}
|
|
|
|
</tbody>
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<th scope="row">{{( pgettext "New Line" "title")}}</th>
|
|
|
|
<td>
|
|
|
|
{{ template "input-field" .NewPaymentMethodForm.Name | addInputAttr `form="new-payment-method"` }}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{{ template "input-field" .NewPaymentMethodForm.Instructions | addInputAttr `form="new-payment-method"` }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"></td>
|
|
|
|
<td colspan="2">
|
2023-03-20 12:09:52 +00:00
|
|
|
<button form="new-payment-method"
|
|
|
|
type="submit">{{( pgettext "Add new payment method" "action" )}}</button>
|
2023-03-03 15:49:06 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
|
2023-02-01 13:15:02 +00:00
|
|
|
<fieldset>
|
|
|
|
<button form="details" type="submit">{{( pgettext "Save changes" "action" )}}</button>
|
|
|
|
</fieldset>
|
|
|
|
</section>
|
Add the company relation and read-only form to edit
I do not have more time to update the update to the company today, but i
believe this is already a good amount of work for a commit.
The company is going to be used for row level security, as users will
only have access to the data from companies they are granted access, by
virtue of being in the company_user relation.
I did not know how add a row level security policy to the company_user
because i needed the to select on the same relation and this is not
allowed, because it would create an infinite loop.
Had to add the vat, pg_libphonenumber, and uri extensions in order to
validate VAT identification numbers, phone numbers, and URIs,
repectively. These libraries are not in Debian, but i created packages
for them all in https://dev.tandem.ws/tandem.
2023-01-24 20:46:07 +00:00
|
|
|
{{- end }}
|