enabled more crud operations

This commit is contained in:
2024-03-10 05:48:26 +00:00
parent 95171706da
commit 1ce9a659ed
5 changed files with 128 additions and 10 deletions

58
templates/entity-add.html Normal file
View File

@@ -0,0 +1,58 @@
<tr id="datarow-NEW_ITEM_ROW" class="datarow border-b dark:border-neutral-500">
<td class="whitespace-nowrap px-6 py-4">
<!-- <input hidden disabled type="text" name="id" value="NEW_ITEM_ROW" data-include-edit="NEW_ITEM_ROW" />
<span>NEW_ITEM_ROW</span> -->
</td>
<td class="whitespace-nowrap px-6 py-4">
<input
type="text"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
data-include-edit="NEW_ITEM_ROW"
name="name"
/>
</td>
<td class="whitespace-nowrap px-6 py-4">
<input
type="text"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
data-include-edit="NEW_ITEM_ROW"
name="stage"
/>
</td>
<td class="whitespace-nowrap px-6 py-4">
<input
type="text"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
data-include-edit="NEW_ITEM_ROW"
name="category"
/>
</td>
<td class="whitespace-nowrap px-6 py-4">
<input
type="text"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
data-include-edit="NEW_ITEM_ROW"
name="description"
/>
</td>
<td class="whitespace-nowrap px-6 py-4">
<input
type="text"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
data-include-edit="NEW_ITEM_ROW"
name="notes"
/>
<td class="whitespace-nowrap px-1 py-1">
<a
hx-post="/items/add"
hx-target="#datarow-NEW_ITEM_ROW"
hx-swap="outerHTML"
hx-indicator="#processing"
hx-include="input[data-include-edit='NEW_ITEM_ROW']"
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"
href=""
>Add</a
>
</td>
</tr>

View File

@@ -48,8 +48,6 @@
value="{{.Notes}}"
/>
<td class="whitespace-nowrap px-1 py-1">
<a
hx-put="/items/save/{{.ID}}"

View File

@@ -6,9 +6,9 @@
<div class="overflow-hidden">
<!-- <div class="flex justify-end">
<button
hx-get="/company/add"
hx-get="/item/add"
hx-target="#table-body"
hx-swap="outerHTML"
hx-swap="beforeend"
hx-indicator="#processing"
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"
href=""
@@ -30,8 +30,10 @@
</thead>
<tbody id="table-body">
{{range .}}
{{ template "entity-row.html". }}
{{ template "entity-row.html" . }}
{{end}}
{{ template "entity-add.html" . }}
</tbody>
</table>
</div>