Feature #6 : Update

- Add Get Village by District Code
- Add Get Postal Code by Village Code
- Update Filter on Villages, District, and City, add dropdown to select province, city, district before filter for faster filter
This commit is contained in:
Daeng Deni Mardaeni
2024-08-13 10:42:03 +07:00
parent b75db02f27
commit 4987002a9d
8 changed files with 469 additions and 293 deletions

View File

@@ -16,70 +16,69 @@
@endpush
@section('content')
<div class="container-fluid">
<div class="grid">
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="cities-table" data-api-url="{{ route('locations.cities.datatables') }}">
<div class="card-header py-5 flex-wrap">
<h3 class="card-title">
List of Cities
</h3>
<div class="flex flex-wrap gap-2 lg:gap-5">
<div class="flex flex-wrap gap-2.5">
<select id="province_code" name="province_code" class="select select-sm w-[150px]">
<option value="">Select Province</option>
@foreach($provinces as $province)
<option value="{{ $province->code }}">
{{ $province->name }}
</option>
@endforeach
</select>
<div class="grid">
<div class="card card-grid min-w-full" data-datatable="false" data-datatable-page-size="5" data-datatable-state-save="false" id="cities-table" data-api-url="{{ route('locations.cities.datatables') }}">
<div class="card-header py-5 flex-wrap">
<h3 class="card-title">
List of Cities
</h3>
<div class="flex flex-wrap gap-2 lg:gap-5">
<div class="flex flex-wrap gap-2.5">
<select id="province_code" name="province_code" class="select select-sm w-[150px]">
<option value="">Select Province</option>
@foreach($provinces as $province)
<option value="{{ $province->code }}">
{{ $province->name }}
</option>
@endforeach
</select>
<label class="input input-sm w-[150px]"> <i class="ki-filled ki-magnifier"> </i>
<input placeholder="Search Cities" id="search" type="text" value="">
</label>
<button class="search btn btn-sm btn-outline btn-primary">
<i class="ki-filled ki-setting-4"> </i> <Filters></Filters>
</button>
<div class="h-[24px] border border-r-gray-200"> </div>
<a class="btn btn-sm btn-light" href="{{ route('locations.cities.export') }}"> Export to Excel </a>
<a class="btn btn-sm btn-primary" href="{{ route('locations.cities.create') }}"> Add City </a>
</div>
<label class="input input-sm w-[150px]"> <i class="ki-filled ki-magnifier"> </i>
<input placeholder="Search Cities" id="search" type="text" value="">
</label>
<button class="search btn btn-sm btn-outline btn-primary">
<i class="ki-filled ki-setting-4"> </i>
<Filters></Filters>
</button>
<div class="h-[24px] border border-r-gray-200"></div>
<a class="btn btn-sm btn-light" href="{{ route('locations.cities.export') }}"> Export to Excel </a>
<a class="btn btn-sm btn-primary" href="{{ route('locations.cities.create') }}"> Add City </a>
</div>
</div>
<div class="card-body">
<div class="scrollable-x-auto">
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
<thead>
<tr>
<th class="w-14">
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
</th>
<th class="min-w-[250px]" data-datatable-column="code">
<span class="sort"> <span class="sort-label"> Code </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="name">
<span class="sort"> <span class="sort-label"> City </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="province">
<span class="sort"> <span class="sort-label"> Province </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
</thead>
</table>
</div>
<div class="card-body">
<div class="scrollable-x-auto">
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
<thead>
<tr>
<th class="w-14">
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
</th>
<th class="min-w-[250px]" data-datatable-column="code">
<span class="sort"> <span class="sort-label"> Code </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="name">
<span class="sort"> <span class="sort-label"> City </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="province">
<span class="sort"> <span class="sort-label"> Province </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
</thead>
</table>
</div>
<div class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
<div class="flex items-center gap-2">
Show
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per page
</div>
<div class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
<div class="flex items-center gap-2">
Show
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per page
</div>
<div class="flex items-center gap-4">
<span data-datatable-info="true"> </span>
<div class="pagination" data-datatable-pagination="true">
</div>
<div class="flex items-center gap-4">
<span data-datatable-info="true"> </span>
<div class="pagination" data-datatable-pagination="true">
</div>
</div>
</div>
@@ -94,7 +93,7 @@
function deleteData(data) {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!" ,
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
@@ -111,7 +110,7 @@
$.ajax(`locations/cities/${data}`, {
type: 'DELETE'
}).then((response) => {
swal.fire('Deleted!', 'User has been deleted.','success').then(() => {
swal.fire('Deleted!', 'User has been deleted.', 'success').then(() => {
window.location.reload();
});
}).catch((error) => {