feat: Reorganizing views
This commit is contained in:
35
Resources/Views/vendors/form.leaf
vendored
Normal file
35
Resources/Views/vendors/form.leaf
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
#extend("htmx-form", htmxForm):
|
||||
#export("formBody"):
|
||||
<input type="hidden"
|
||||
id="vendorId"
|
||||
name="id"
|
||||
#if(context.vendor.id):
|
||||
value="#(context.vendor.id)"
|
||||
#endif
|
||||
>
|
||||
|
||||
<input type="text"
|
||||
id="name"
|
||||
name="name"
|
||||
placeholder="Vendor Name"
|
||||
autofocus
|
||||
required
|
||||
#if(context.vendor.name):
|
||||
value="#(context.vendor.name)"
|
||||
#endif
|
||||
>
|
||||
<br>
|
||||
<input type="text"
|
||||
id="branches"
|
||||
name="branches"
|
||||
#if(context.branches):
|
||||
value="#(context.branches)"
|
||||
#endif
|
||||
placeholder="Monroe, Dayton..."
|
||||
>
|
||||
<br>
|
||||
<input type="submit" value="#(context.buttonLabel)">
|
||||
<br>
|
||||
<p><small>Mutliple branches can be specified separated by a comma.</small></p>
|
||||
#endexport
|
||||
#endextend
|
||||
14
Resources/Views/vendors/index.leaf
vendored
Normal file
14
Resources/Views/vendors/index.leaf
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
#extend("home"):
|
||||
#export("homeContent"):
|
||||
<div id="home-content" class="container">
|
||||
<div class="container">
|
||||
<h1>Vendors</h1>
|
||||
<br>
|
||||
<p>Vendors are who purchase orders can be issued for, they consist of multiple branches / locations.</p>
|
||||
<br>
|
||||
#extend("vendors/form", form)
|
||||
#extend("vendors/table")
|
||||
</div>
|
||||
</div>
|
||||
#endexport
|
||||
#endextend
|
||||
34
Resources/Views/vendors/table.leaf
vendored
Normal file
34
Resources/Views/vendors/table.leaf
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<table id="vendor-table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Branches</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tbody id="vendor-table-body">
|
||||
#for(vendor in vendors):
|
||||
<tr id="vendor_#(vendor.id)">
|
||||
<td>#capitalized(vendor.name)</td>
|
||||
<td>
|
||||
#if(vendor.branches):
|
||||
<ul>
|
||||
#for(branch in vendor.branches):
|
||||
<li>#capitalized(branch.name)</li>
|
||||
#endfor
|
||||
</ul>
|
||||
#endif
|
||||
</td>
|
||||
<!-- TODO: Add edit button -->
|
||||
<td>
|
||||
<a class="btn btn-delete"
|
||||
hx-delete="/vendors/#(vendor.id)"
|
||||
hx-target="closest tr"
|
||||
hx-swap="outerHTML swap:0.5s"
|
||||
hx-confirm="Are you sure you want to delete this vendor?"
|
||||
>
|
||||
#extend("img/trash-can")
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
#endfor
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user