2023-01-31 12:07:17 +00:00
|
|
|
{{ define "title" -}}
|
2023-02-03 12:58:10 +00:00
|
|
|
{{( pgettext "Contacts" "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.ContactsIndexPage*/ -}}
|
2023-02-03 12:58:10 +00:00
|
|
|
<nav>
|
|
|
|
<p>
|
|
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
|
|
<a>{{( pgettext "Contacts" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="primary button"
|
2023-03-22 13:59:54 +00:00
|
|
|
data-hx-push-url="false" data-hx-swap="beforeend" data-hx-boost="true"
|
2023-02-03 12:58:10 +00:00
|
|
|
href="{{ companyURI "/contacts/new" }}">{{( pgettext "New contact" "action" )}}</a>
|
|
|
|
</p>
|
|
|
|
</nav>
|
2023-03-20 12:09:52 +00:00
|
|
|
{{- end }}
|
2023-01-29 14:14:31 +00:00
|
|
|
|
2023-03-20 12:09:52 +00:00
|
|
|
{{ define "content" }}
|
2023-02-04 10:32:39 +00:00
|
|
|
{{- /*gotype: dev.tandem.ws/tandem/numerus/pkg.ContactsIndexPage*/ -}}
|
2023-02-03 12:58:10 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{{( pgettext "All" "contact" )}}</th>
|
|
|
|
<th>{{( pgettext "Customer" "title" )}}</th>
|
|
|
|
<th>{{( pgettext "Email" "title" )}}</th>
|
|
|
|
<th>{{( pgettext "Phone" "title" )}}</th>
|
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
|
|
|
<th>{{( pgettext "Tags" "title" )}}</th>
|
2023-02-03 12:58:10 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-03-23 09:46:14 +00:00
|
|
|
<tbody data-hx-push-url="false" data-hx-swap="beforeend">
|
2023-02-03 12:58:10 +00:00
|
|
|
{{ with .Contacts }}
|
2023-02-04 10:32:39 +00:00
|
|
|
{{- range $contact := . }}
|
2023-02-03 12:58:10 +00:00
|
|
|
<tr>
|
|
|
|
<td></td>
|
2023-03-23 09:46:14 +00:00
|
|
|
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-boost="true">{{ .Name }}</a></td>
|
2023-02-03 12:58:10 +00:00
|
|
|
<td><a href="mailto:{{ .Email }}">{{ .Email }}</a></td>
|
|
|
|
<td><a href="tel:{{ .Phone }}">{{ .Phone }}</a></td>
|
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
|
|
|
<td>
|
|
|
|
{{- range $index, $tag := .Tags }}
|
|
|
|
{{- if gt $index 0 }}, {{ end -}}
|
|
|
|
<a href="?tag={{ . }}">{{ . }}</a>
|
|
|
|
{{- end }}
|
|
|
|
</td>
|
2023-02-03 12:58:10 +00:00
|
|
|
</tr>
|
|
|
|
{{- end }}
|
|
|
|
{{ else }}
|
|
|
|
<tr>
|
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
|
|
|
<td colspan="5">{{( gettext "No contacts added yet." )}}</td>
|
2023-02-03 12:58:10 +00:00
|
|
|
</tr>
|
|
|
|
{{ end }}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2023-01-29 14:14:31 +00:00
|
|
|
{{- end }}
|