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-04-25 13:28:55 +00:00
|
|
|
<nav data-hx-boost="true" data-hx-target="main">
|
|
|
|
<p>
|
2023-02-03 12:58:10 +00:00
|
|
|
<a href="{{ companyURI "/" }}">{{( pgettext "Home" "title" )}}</a> /
|
|
|
|
<a>{{( pgettext "Contacts" "title" )}}</a>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="primary button"
|
|
|
|
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-05-10 16:56:07 +00:00
|
|
|
<div aria-label="{{( pgettext "Filters" "title" )}}">
|
2023-05-23 12:50:46 +00:00
|
|
|
<form class="filters" method="GET" action="{{ companyURI "/contacts"}}"
|
2023-05-10 16:56:07 +00:00
|
|
|
data-hx-target="main"
|
|
|
|
data-hx-boost="true"
|
|
|
|
data-hx-trigger="change,search,submit"
|
|
|
|
>
|
|
|
|
{{ with .Filters }}
|
|
|
|
{{ template "input-field" .Name }}
|
|
|
|
{{ template "tags-field" .Tags | addTagsAttr (print `data-conditions="` .TagsCondition.Name `-field"`) }}
|
|
|
|
{{ template "toggle-field" .TagsCondition }}
|
|
|
|
{{ end }}
|
2023-05-23 12:34:46 +00:00
|
|
|
<noscript>
|
|
|
|
<button type="submit">{{( pgettext "Filter" "action" )}}</button>
|
|
|
|
</noscript>
|
2023-05-10 16:56:07 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
2023-02-03 12:58:10 +00:00
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<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-05-11 21:32:21 +00:00
|
|
|
<th>{{( pgettext "Actions" "title" )}}</th>
|
2023-02-03 12:58:10 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-03-27 07:40:24 +00:00
|
|
|
<tbody>
|
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>
|
2023-05-23 12:34:46 +00:00
|
|
|
<td><a href="{{ companyURI "/contacts/"}}{{ .Slug }}" data-hx-target="main"
|
|
|
|
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>
|
2023-05-12 09:32:39 +00:00
|
|
|
<td
|
|
|
|
data-hx-get="{{companyURI "/contacts/"}}{{ .Slug }}/tags/edit"
|
|
|
|
data-hx-target="this"
|
|
|
|
data-hx-swap="outerHTML"
|
|
|
|
>
|
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
|
|
|
{{- range $index, $tag := .Tags }}
|
|
|
|
{{- if gt $index 0 }}, {{ end -}}
|
2023-05-12 09:32:39 +00:00
|
|
|
{{ . }}
|
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
|
|
|
{{- end }}
|
|
|
|
</td>
|
2023-05-11 21:32:21 +00:00
|
|
|
<td class="actions">
|
|
|
|
<details class="menu">
|
|
|
|
<summary><i class="ri-more-line"></i></summary>
|
|
|
|
<ul role="menu" class="action-menu">
|
|
|
|
<li role="presentation">
|
|
|
|
<a role="menuitem" href="{{ companyURI "/contacts"}}/{{ .Slug }}"
|
|
|
|
data-hx-target="main" data-hx-boost="true"
|
|
|
|
>
|
|
|
|
<i class="ri-edit-line"></i>
|
|
|
|
{{( pgettext "Edit" "action" )}}
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</details>
|
|
|
|
</td>
|
2023-02-03 12:58:10 +00:00
|
|
|
</tr>
|
|
|
|
{{- end }}
|
|
|
|
{{ else }}
|
|
|
|
<tr>
|
2023-05-23 12:21:04 +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 }}
|