diff --git a/Modules/HospitalPortal/Http/Controllers/ApotekController.php b/Modules/HospitalPortal/Http/Controllers/ApotekController.php index 2e732ab0..3322e795 100644 --- a/Modules/HospitalPortal/Http/Controllers/ApotekController.php +++ b/Modules/HospitalPortal/Http/Controllers/ApotekController.php @@ -51,10 +51,13 @@ class ApotekController extends Controller $query->where('tx_prescriptions.dTanggalresep', '<', $start_date); }); }) - ->when($request->input('status') && $request->input('status') != 'all', function ($query, $status) { - $query->where(function ($query) use ($status) { - $query->where('tx_prescription_orders.sStatus', '=', $status); - }); + ->when($request->input('status'), function ($query, $status) { + // Apply the filter if 'status' has a value + if ($status !== 'all') { + $query->where(function ($query) use ($status) { + $query->where('tx_prescription_orders.sStatus', '=', $status); + }); + } }) ->select( 'tx_prescriptions.nID as id',