2023-01-31 12:07:17 +00:00
|
|
|
{{ define "title" -}}
|
2023-02-01 13:34:40 +00:00
|
|
|
{{( pgettext "New Contact" "title" )}}
|
2023-01-31 12:07:17 +00:00
|
|
|
{{- end }}
|
|
|
|
|
2023-03-20 12:09:52 +00:00
|
|
|
{{ define "breadcrumbs" -}}
|
2023-02-02 10:39:34 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.contactForm*/ -}}
|
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 href="{{ companyURI "/contacts"}}">{{( pgettext "Contacts" "title" )}}</a> /
|
|
|
|
<a>{{( pgettext "New Contact" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
</nav>
|
2023-03-20 12:09:52 +00:00
|
|
|
{{- end }}
|
|
|
|
|
|
|
|
{{ define "content" }}
|
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.contactForm*/ -}}
|
2023-03-22 13:59:54 +00:00
|
|
|
<section class="dialog-content" id="new-contact-dialog-content" data-hx-target="this">
|
2023-02-01 13:34:40 +00:00
|
|
|
<h2>{{(pgettext "New Contact" "title")}}</h2>
|
2023-03-22 13:59:54 +00:00
|
|
|
<form method="POST" action="{{ companyURI "/contacts" }}" data-hx-boost="true" data-hx-select="#new-contact-dialog-content">
|
2023-02-02 10:39:34 +00:00
|
|
|
{{ csrfToken }}
|
2023-02-01 13:34:40 +00:00
|
|
|
{{ template "input-field" .BusinessName | addInputAttr "autofocus" }}
|
|
|
|
{{ 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"` }}
|
Add tags for contacts too
With Oriol we agreed that contacts should have tags, too, and that the
“tag pool”, as it were, should be shared with the one for invoices (and
all future tags we might add).
I added the contact_tag relation and tag_contact function, just like
with invoices, and then realized that the SQL queries that Go had to
execute were becoming “complex” enough: i had to get not only the slug,
but the contact id to call tag_contact, and all inside a transaction.
Therefore, i opted to create the add_contact and edit_contact functions,
that mirror those for invoice and products, so now each “major” section
has these functions. They also simplified a bit the handling of the
VATIN and phone numbers, because it is now encapsuled inside the
PL/pgSQL function and Go does not know how to assemble the parts.
2023-03-26 00:32:53 +00:00
|
|
|
{{ template "tags-field" .Tags }}
|
2023-01-29 14:14:31 +00:00
|
|
|
|
2023-02-01 13:34:40 +00:00
|
|
|
<fieldset>
|
2023-02-03 12:58:10 +00:00
|
|
|
<button class="primary" type="submit">{{( pgettext "New contact" "action" )}}</button>
|
2023-02-01 13:34:40 +00:00
|
|
|
</fieldset>
|
2023-01-29 14:14:31 +00:00
|
|
|
|
2023-02-01 13:34:40 +00:00
|
|
|
</form>
|
|
|
|
</section>
|
2023-01-29 14:14:31 +00:00
|
|
|
{{- end }}
|