renew and other crud functionality
This commit is contained in:
@@ -13,7 +13,15 @@
|
||||
Add Subunit
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl p-4 border border-slate-200">
|
||||
<input
|
||||
v-model="search"
|
||||
@input="filterResults"
|
||||
type="text"
|
||||
placeholder="Search by building..."
|
||||
class="w-full px-4 py-2 border border-slate-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#137fec]"
|
||||
/>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl border border-slate-200 overflow-hidden">
|
||||
<table class="w-full">
|
||||
<thead class="bg-slate-50">
|
||||
@@ -35,10 +43,12 @@
|
||||
<td class="px-6 py-4 text-sm text-slate-900">{{ subunit.subunit_type }}</td>
|
||||
<td class="px-6 py-4 text-sm text-slate-900">{{ subunit.area_sqft }}</td>
|
||||
<td class="px-6 py-4"><span class="px-2 py-1 text-xs font-bold rounded-md bg-green-50 text-green-700">{{ subunit.status }}</span></td>
|
||||
<td class="px-6 py-4 text-sm space-x-2">
|
||||
<Link :href="route('subunits.edit', subunit.id)" class="text-[#137fec] hover:underline">Edit</Link>
|
||||
<button @click="destroy(subunit.id)" class="text-red-600 hover:underline">Delete</button>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm">
|
||||
<div class="flex items-center gap-3">
|
||||
<Link :href="route('subunits.edit', subunit.id)" class="text-[#137fec] hover:underline">Edit</Link>
|
||||
<button @click="destroy(subunit.id)" class="text-red-600 hover:underline">Delete</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -58,4 +68,10 @@ const destroy = (id) => {
|
||||
router.delete(route('subunits.destroy', id))
|
||||
}
|
||||
}
|
||||
|
||||
const search = ref('')
|
||||
|
||||
const filterResults = () => {
|
||||
router.get(route('subunits.index'), { search: search.value }, { preserveState: true })
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user