better setups for some view variants

This commit is contained in:
2024-03-10 03:59:52 +00:00
parent 29aeb93415
commit 01f25d4f71
7 changed files with 123 additions and 89 deletions

View File

@@ -49,7 +49,7 @@
<td class="whitespace-nowrap px-1 py-1">
<a
hx-put="/items/{{.ID}}"
hx-put="/items/save/{{.ID}}"
hx-target="#datarow-{{.ID}}"
hx-swap="outerHTML"
hx-indicator="#processing"
@@ -61,7 +61,7 @@
</td>
<td class="whitespace-nowrap px-1 py-1">
<a
hx-get="/company/{{.ID}}"
hx-get="/items/{{.ID}}"
hx-target="#datarow-{{.ID}}"
hx-swap="outerHTML"
hx-indicator="#processing"

View File

@@ -1,8 +1,10 @@
<tr id="datarow-{{.ID}}" class="border-b dark:border-neutral-500">
<tr id="datarow-{{.ID}}" class="border-b dark:border-neutral-500 hover:bg-slate-300 hover:bg-opacity-20">
<td class="whitespace-nowrap px-6 py-4">{{.ID}}</td>
<td class="whitespace-nowrap px-6 py-4">{{.Name}}</td>
<td class="whitespace-nowrap px-6 py-4">{{.Stage}}</td>
<td class="whitespace-nowrap px-6 py-4">{{.Category}}</td>
{{ template "parsed-category.html" .Category }}
{{ if .Description }}
<td class="whitespace-nowrap px-6 py-4">{{.Description}}</td>
@@ -18,10 +20,10 @@
<td class="whitespace-nowrap px-6 py-4">
<button
hx-get="/items/edit/{{.ID}}"
hx-target="#datarow-{{.ID}}"
hx-get="/items/edit/{{ .ID }}"
hx-target="#datarow-{{ .ID }}"
hx-swap="outerHTML"
class="inline-flex items-center h-8 px-4 m-2 text-sm text-blue-100 transition-colors duration-150 bg-blue-700 rounded-lg focus:shadow-outline hover:bg-blue-800"
class="inline-flex items-center h-8 px-4 m-2 text-sm text-blue-100 transition-colors duration-150 bg-yellow-700 rounded-lg focus:shadow-outline hover:bg-blue-800"
>
Edit
</button>

View File

@@ -0,0 +1,27 @@
<td class="whitespace-nowrap px-6 py-4">
{{ if eq . 0 }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">
Bedroom
</span>
{{ else if eq . 1 }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-cyan-100 text-cyan-800">
Bathroom
</span>
{{ else if eq . 2 }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-orange-100 text-orange-800">
Kitchen
</span>
{{ else if eq . 3 }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-rose-100 text-rose-800">
Office
</span>
{{ else if eq . 4 }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-indigo-100 text-indigo-800">
Living Room
</span>
{{ else }}
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">
Other
</span>
{{ end }}
</td>