From b1de98f05d72fcc9d5a5e24f8b05719639a775c2 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 9 Sep 2025 19:18:29 -0400 Subject: [PATCH 1/7] first front end --- resources/views/reports/custom.blade.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 01eb13ad8f..c51caf90f9 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -426,7 +426,25 @@ - + +
+ +
+ + {{ strtolower(trans('general.to')) }} + +
+ + @if ($errors->has('purchase_price_start') || $errors->has('purchase_price_end')) +
+ {!! $errors->first('purchase_price_start', '') !!} + {!! $errors->first('purchase_price_end', '') !!} +
+ @endif + +
+ +
From 50e210b2db008020d52b57ad293fe6f0b9fa57a8 Mon Sep 17 00:00:00 2001 From: akemidx Date: Wed, 10 Sep 2025 17:35:09 -0400 Subject: [PATCH 2/7] fixing naming convention to match --- resources/views/reports/custom.blade.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index c51caf90f9..d620af4a15 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -426,19 +426,19 @@
- -
- + +
+
- + {{ strtolower(trans('general.to')) }} - +
- @if ($errors->has('purchase_price_start') || $errors->has('purchase_price_end')) + @if ($errors->has('purchase_cost_start') || $errors->has('purchase_cost_end'))
- {!! $errors->first('purchase_price_start', '') !!} - {!! $errors->first('purchase_price_end', '') !!} + {!! $errors->first('purchase_cost_start', '') !!} + {!! $errors->first('purchase_cost_end', '') !!}
@endif From 6ce0fd20ce5897633a790dbd9e62d78c41dc8f31 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 16 Sep 2025 08:11:42 -0400 Subject: [PATCH 3/7] works, needs error handling --- app/Http/Controllers/ReportsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 1eccf4886f..afa9191b9a 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -685,6 +685,10 @@ class ReportsController extends Controller $assets->whereBetween('assets.purchase_date', [$request->input('purchase_start'), $request->input('purchase_end')]); } + if (($request->filled('purchase_cost_start')) && ($request->filled('purchase_cost_end'))) { + $assets->whereBetween('assets.purchase_cost', [$request->input('purchase_cost_start'), $request->input('purchase_cost_end')]); + } + if (($request->filled('created_start')) && ($request->filled('created_end'))) { $created_start = Carbon::parse($request->input('created_start'))->startOfDay(); $created_end = Carbon::parse($request->input('created_end'))->endOfDay(); From cb63c12d2f7bd11ac4067c108bd8635f76f71d83 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 16 Sep 2025 08:24:22 -0400 Subject: [PATCH 4/7] i think this is gonna need livewire to validate lol --- resources/views/reports/custom.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index d620af4a15..87810ac5cc 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -430,7 +430,7 @@
- + {{ strtolower(trans('general.to')) }}
From 99acf018f13d5dade8db216ede9597aca41ab01c Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 16 Sep 2025 15:17:59 -0400 Subject: [PATCH 5/7] validation rule & query --- app/Http/Controllers/ReportsController.php | 8 ++++++-- app/Http/Requests/CustomAssetReportRequest.php | 1 + resources/views/reports/custom.blade.php | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index afa9191b9a..d1a649a14e 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -685,8 +685,12 @@ class ReportsController extends Controller $assets->whereBetween('assets.purchase_date', [$request->input('purchase_start'), $request->input('purchase_end')]); } - if (($request->filled('purchase_cost_start')) && ($request->filled('purchase_cost_end'))) { - $assets->whereBetween('assets.purchase_cost', [$request->input('purchase_cost_start'), $request->input('purchase_cost_end')]); + if ($request->filled('purchase_cost_start')) { + if ($request->filled('purchase_cost_end')) { + $assets->whereBetween('assets.purchase_cost', [$request->input('purchase_cost_start'), $request->input('purchase_cost_end')]); + } else { + $assets->where('assets.purchase_cost', ">", $request->input('purchase_cost_start')); + } } if (($request->filled('created_start')) && ($request->filled('created_end'))) { diff --git a/app/Http/Requests/CustomAssetReportRequest.php b/app/Http/Requests/CustomAssetReportRequest.php index 2a8fbe7fab..16bbe1006f 100644 --- a/app/Http/Requests/CustomAssetReportRequest.php +++ b/app/Http/Requests/CustomAssetReportRequest.php @@ -24,6 +24,7 @@ class CustomAssetReportRequest extends Request return [ 'purchase_start' => 'date|date_format:Y-m-d|nullable', 'purchase_end' => 'date|date_format:Y-m-d|nullable', + 'purchase_cost_end' => 'numeric|nullable|gte:purchase_cost_start', 'created_start' => 'date|date_format:Y-m-d|nullable', 'created_end' => 'date|date_format:Y-m-d|nullable', 'checkout_date_start' => 'date|date_format:Y-m-d|nullable', diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 87810ac5cc..a3693f6f72 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -430,9 +430,9 @@
- + {{ strtolower(trans('general.to')) }} - +
@if ($errors->has('purchase_cost_start') || $errors->has('purchase_cost_end')) From cf1bccfd6527cdb8c1412d0338d297bced379683 Mon Sep 17 00:00:00 2001 From: akemidx Date: Tue, 16 Sep 2025 15:24:44 -0400 Subject: [PATCH 6/7] prep for val --- app/Http/Requests/CustomAssetReportRequest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Http/Requests/CustomAssetReportRequest.php b/app/Http/Requests/CustomAssetReportRequest.php index 16bbe1006f..074db091a5 100644 --- a/app/Http/Requests/CustomAssetReportRequest.php +++ b/app/Http/Requests/CustomAssetReportRequest.php @@ -14,6 +14,15 @@ class CustomAssetReportRequest extends Request return true; } + + public function prepareForValidation() + { + if($this->filled('purchase_cost_end') && !$this->filled('purchase_cost_start')){ + $this->merge(['purchase_cost_start' => 0 ]); + } + } + + /** * Get the validation rules that apply to the request. * From 69c5dbfc23e2c1256ae66ec78a113f0be28c3494 Mon Sep 17 00:00:00 2001 From: akemidx Date: Wed, 17 Sep 2025 05:39:45 -0400 Subject: [PATCH 7/7] formatting --- resources/views/reports/custom.blade.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index a3693f6f72..593b9268aa 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -427,7 +427,7 @@
-
+
@@ -442,9 +442,9 @@
@endif -
+
- +