diff --git a/app/Http/Controllers/Customer/DepositController.php b/app/Http/Controllers/Customer/DepositController.php
index cda863e..ae6d610 100644
--- a/app/Http/Controllers/Customer/DepositController.php
+++ b/app/Http/Controllers/Customer/DepositController.php
@@ -11,21 +11,33 @@ use App\Models\Setting;
use App\Services\GeneralService;
use App\Services\MidtransService;
use Illuminate\Http\Request;
+use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
class DepositController extends Controller
{
- public function index()
+ public function index(Request $request)
{
$histories = DepositHistory::where('customer_id', auth()->id())
->orderBy('updated_at', 'desc')
->orderBy('is_valid', 'desc')
->where('type', DepositHistory::TYPE_DEPOSIT);
+ $start_date = now()->startOfMonth();
+ $end_date = now()->endOfMonth();
+ if ($request->startDate != '' && $request->endDate != '') {
+ $start_date = Carbon::parse($request->startDate);
+ $end_date = Carbon::parse($request->endDate);
+ }
+
+ $histories->whereBetween('created_at', [$start_date, $end_date]);
+
return inertia('Deposit/Index', [
'histories' => $histories->paginate(20),
+ '_start_date' => $start_date->format('m/d/Y'),
+ '_end_date' => $end_date->format('m/d/Y')
]);
}
diff --git a/app/Http/Controllers/Customer/PoinController.php b/app/Http/Controllers/Customer/PoinController.php
index f0a4820..62ede3f 100644
--- a/app/Http/Controllers/Customer/PoinController.php
+++ b/app/Http/Controllers/Customer/PoinController.php
@@ -4,16 +4,29 @@ namespace App\Http\Controllers\Customer;
use App\Http\Controllers\Controller;
use App\Models\PoinHistory;
+use Illuminate\Http\Request;
+use Illuminate\Support\Carbon;
class PoinController extends Controller
{
- public function index()
+ public function index(Request $request)
{
$poins = PoinHistory::where('customer_id', auth()->id())
->orderBy('updated_at', 'desc');
+ $start_date = now()->startOfMonth();
+ $end_date = now()->endOfMonth();
+ if ($request->startDate != '' && $request->endDate != '') {
+ $start_date = Carbon::parse($request->startDate);
+ $end_date = Carbon::parse($request->endDate);
+ }
+
+ $poins->whereBetween('created_at', [$start_date, $end_date]);
+
return inertia('Poin/Index', [
'poins' => $poins->paginate(20),
+ '_start_date' => $start_date->format('m/d/Y'),
+ '_end_date' => $end_date->format('m/d/Y')
]);
}
diff --git a/app/Http/Controllers/Customer/TransactionController.php b/app/Http/Controllers/Customer/TransactionController.php
index 49acbb8..4b8b8bd 100644
--- a/app/Http/Controllers/Customer/TransactionController.php
+++ b/app/Http/Controllers/Customer/TransactionController.php
@@ -4,16 +4,29 @@ namespace App\Http\Controllers\Customer;
use App\Http\Controllers\Controller;
use App\Models\Sale;
+use Illuminate\Http\Request;
+use Illuminate\Support\Carbon;
class TransactionController extends Controller
{
- public function index()
+ public function index(Request $request)
{
$query = Sale::where('customer_id', auth()->id())
->orderBy('created_at', 'desc');
+ $start_date = now()->startOfMonth();
+ $end_date = now()->endOfMonth();
+ if ($request->startDate != '' && $request->endDate != '') {
+ $start_date = Carbon::parse($request->startDate);
+ $end_date = Carbon::parse($request->endDate);
+ }
+
+ $query->whereBetween('created_at', [$start_date, $end_date]);
+
return inertia('Trx/Index', [
- 'query' => $query->paginate(),
+ 'query' => $query->paginate(20),
+ '_start_date' => $start_date->format('m/d/Y'),
+ '_end_date' => $end_date->format('m/d/Y')
]);
}
diff --git a/resources/js/Customer/Components/HeaderTrx.jsx b/resources/js/Customer/Components/HeaderTrx.jsx
index 7612c91..ada1ce6 100644
--- a/resources/js/Customer/Components/HeaderTrx.jsx
+++ b/resources/js/Customer/Components/HeaderTrx.jsx
@@ -1,15 +1,49 @@
+import React, { useState, useEffect } from 'react'
import { usePage, router, Link } from '@inertiajs/react'
-import { useState } from 'react'
+import { usePrevious } from 'react-use'
+import { HiOutlineFilter } from 'react-icons/hi'
import { HiOutlineQuestionMarkCircle } from 'react-icons/hi2'
-export default function HeaderTrx({ enable = 'deposit' }) {
+import { useModalState } from '@/hooks'
+import BottomSheet from './BottomSheet'
+import FormInputDateRanger from '@/Components/FormInputDateRange'
+
+const FilterSheet = ({ state, dates, setDates, setApply }) => {
+ const apply = () => {
+ setApply(true)
+ state.toggle()
+ }
+
+ return (
+