diff --git a/app/Http/Controllers/Kasir/History.php b/app/Http/Controllers/Kasir/History.php index 101b1fc..f673b86 100644 --- a/app/Http/Controllers/Kasir/History.php +++ b/app/Http/Controllers/Kasir/History.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Kasir; use App\Http\Controllers\Controller; use App\Models\DetailPesanan; use App\Models\Pesanan; +use Carbon\Carbon; use Illuminate\Http\Request; class History extends Controller @@ -14,12 +15,25 @@ class History extends Controller return view('pages.History.index'); } - public function getDataHistory() + public function getDataHistory(Request $request) { - $data = Pesanan::with(['detailPesanan', 'user'])->orderBy('created_at', 'desc')->get(); $nomor = 1; + $filter_tanggal_1 = $request->filter_tanggal_1; + $filter_tanggal_2 = $request->filter_tanggal_2; + $data = Pesanan::with(['detailPesanan', 'user']) + ->when($filter_tanggal_1, function ($query) use ($filter_tanggal_1) { + return $query->whereDate('created_at', '>=', $filter_tanggal_1); + }) + ->when($filter_tanggal_2, function ($query) use ($filter_tanggal_2) { + return $query->whereDate('created_at', '<=', $filter_tanggal_2); + }) + ->when(!$filter_tanggal_1 && !$filter_tanggal_2, function ($query) { + return $query->whereDate('created_at', Carbon::today()); + }) + ->orderBy('created_at', 'desc') + ->get(); - return $datatables = datatables() + return datatables() ->of($data) ->addColumn('nomor', function ($data) use (&$nomor) { return $nomor++; @@ -42,6 +56,7 @@ class History extends Controller }) ->addColumn('ubah', function ($data) { return '
+
'; }) ->rawColumns(['nomor', 'nama_user', 'created_at', 'grand_total', 'ubah']) @@ -54,4 +69,10 @@ class History extends Controller return view('pages.Kasir.print_dapur', compact('pesanan')); } + + public function getDataDetailHistory(Request $request){ + $data = DetailPesanan::with('pesanan')->where('pesanan_id', $request->id_pesanan)->get(); + + return response()->json(['status' => true, 'data' => $data]); + } } diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index 01403c1..3cddfd8 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -8,6 +8,7 @@ scratch. This page gets rid of all links and provides the needed markup only. + Sepiring Telur Keriting diff --git a/resources/views/pages/History/index.blade.php b/resources/views/pages/History/index.blade.php index 71e0547..9c5a406 100644 --- a/resources/views/pages/History/index.blade.php +++ b/resources/views/pages/History/index.blade.php @@ -25,179 +25,58 @@
- {{--
Form List Data
--}} -
- - - - - - - - - - - - - - - - - - - - - - - - - -
NoKode PesananPemesanNomor MejaTanggal & JamTotal PesananSub TotalDiskon(%)Grand Total
Total
+
+ +
+
+ +
+

s/d

+
+ +
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
NoKode PesananPemesanNomor MejaTanggal & JamTotal PesananSub TotalDiskon(%)Grand Total
Total
+
+ @include('pages.History.modal') @endsection -@push('styles') - - - - -@endpush - -@push('scripts') - - - -@endpush diff --git a/resources/views/pages/History/js.blade.php b/resources/views/pages/History/js.blade.php new file mode 100644 index 0000000..3fe31f2 --- /dev/null +++ b/resources/views/pages/History/js.blade.php @@ -0,0 +1,202 @@ +@push('scripts') + + + + + {{-- --}} + +@endpush \ No newline at end of file diff --git a/resources/views/pages/History/modal.blade.php b/resources/views/pages/History/modal.blade.php new file mode 100644 index 0000000..e906173 --- /dev/null +++ b/resources/views/pages/History/modal.blade.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/resources/views/pages/History/style.blade.php b/resources/views/pages/History/style.blade.php new file mode 100644 index 0000000..63bfc92 --- /dev/null +++ b/resources/views/pages/History/style.blade.php @@ -0,0 +1,18 @@ +@push('styles') + + + + +@endpush \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 45e71a8..1967edf 100644 --- a/routes/web.php +++ b/routes/web.php @@ -34,6 +34,7 @@ Route::group(['prefix' => 'history'], function () { Route::get('/', [History::class, 'index'])->name('history.index'); Route::get('/getDataHistory', [History::class, 'getDataHistory'])->name('history.getDataHistory'); Route::get('/print/{id}', [History::class, 'print'])->name('history.print'); + Route::post('/getDataDetailHistory', [History::class, 'getDataDetailHistory'])->name('history.getDataDetailHistory'); }); Route::group(['prefix' => 'menu'], function () {