Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into tender
This commit is contained in:
@@ -36,6 +36,16 @@
|
||||
]);
|
||||
}
|
||||
|
||||
// Apply status filter if provided
|
||||
if ($this->request->has('status') && !empty($this->request->status)) {
|
||||
$query->where('status', $this->request->status);
|
||||
}
|
||||
|
||||
// Apply branch filter if provided
|
||||
if ($this->request->has('branch_id') && !empty($this->request->branch_id)) {
|
||||
$query->where('branch_id', $this->request->branch_id);
|
||||
}
|
||||
|
||||
// Apply search filter if provided
|
||||
if ($this->request->has('search') && !empty($this->request->search)) {
|
||||
$search = $this->request->search;
|
||||
|
||||
@@ -50,6 +50,16 @@
|
||||
]);
|
||||
}
|
||||
|
||||
// Filter by status if provided
|
||||
if (isset($search->status) && !empty($search->status)) {
|
||||
$query->where('status', $search->status);
|
||||
}
|
||||
|
||||
// Filter by branch if provided
|
||||
if (isset($search->branch_id) && !empty($search->branch_id)) {
|
||||
$query->where('branch_id', $search->branch_id);
|
||||
}
|
||||
|
||||
if(isset($search->search)) {
|
||||
|
||||
$query->where(function ($q) use ($search) {
|
||||
|
||||
@@ -22,6 +22,23 @@
|
||||
<input placeholder="Tanggal Akhir" id="end_date" type="date">
|
||||
</label>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<select class="select select-sm" id="branch_filter">
|
||||
<option value="">Semua Cabang</option>
|
||||
@foreach(\Modules\Basicdata\Models\Branch::where('status', 1)->get() as $branch)
|
||||
<option value="{{ $branch->id }}">{{ $branch->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<select class="select select-sm" id="status_filter">
|
||||
<option value="">Semua Status</option>
|
||||
@foreach(\Modules\Lpj\Models\StatusPermohonan::where('status', 1)->get() as $status)
|
||||
<option value="{{ $status->slug }}">{{ $status->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<button class="btn btn-sm btn-primary" id="filter_tanggal">Filter</button>
|
||||
</div>
|
||||
@@ -104,6 +121,8 @@
|
||||
const searchInput = document.getElementById('search');
|
||||
const startDateInput = document.getElementById('start_date');
|
||||
const endDateInput = document.getElementById('end_date');
|
||||
const statusFilter = document.getElementById('status_filter');
|
||||
const branchFilter = document.getElementById('branch_filter');
|
||||
const filterTanggalButton = document.getElementById('filter_tanggal');
|
||||
const exportBtn = document.getElementById('export-btn');
|
||||
|
||||
@@ -199,6 +218,8 @@
|
||||
let filters = {};
|
||||
const startDate = startDateInput.value;
|
||||
const endDate = endDateInput.value;
|
||||
const status = statusFilter.value;
|
||||
const branch = branchFilter.value;
|
||||
|
||||
if (searchInput.value) {
|
||||
filters.search = searchInput.value;
|
||||
@@ -212,6 +233,14 @@
|
||||
filters.end_date = endDate;
|
||||
}
|
||||
|
||||
if (status) {
|
||||
filters.status = status;
|
||||
}
|
||||
|
||||
if (branch) {
|
||||
filters.branch_id = branch;
|
||||
}
|
||||
|
||||
dataTable.search(filters);
|
||||
}
|
||||
|
||||
@@ -231,6 +260,18 @@
|
||||
url.searchParams.delete('end_date');
|
||||
}
|
||||
|
||||
if (statusFilter.value) {
|
||||
url.searchParams.set('status', statusFilter.value);
|
||||
} else {
|
||||
url.searchParams.delete('status');
|
||||
}
|
||||
|
||||
if (branchFilter.value) {
|
||||
url.searchParams.set('branch_id', branchFilter.value);
|
||||
} else {
|
||||
url.searchParams.delete('branch_id');
|
||||
}
|
||||
|
||||
if (searchInput.value) {
|
||||
url.searchParams.set('search', searchInput.value);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user