diff --git a/app/Http/Controllers/RefundController.php b/app/Http/Controllers/RefundController.php new file mode 100644 index 00000000..a2fb165f --- /dev/null +++ b/app/Http/Controllers/RefundController.php @@ -0,0 +1,58 @@ +validate([ + 'reason_complaint' => 'required|string', + 'transfer_proof' => 'required|image', + ]); + + // Ambil data tambahan dari database berdasarkan order_id atau informasi lain + $order = Order::where('order_id', $request->input('order_id'))->first(); + + // Buat objek RefundUser + $refund = new RefundUser(); + $refund->order_id = $order->order_id; // Ambil data dari order + $refund->customer = $order->customer; + $refund->seller = $order->seller; + $refund->total = $order->total; + $refund->dueDate = $order->dueDate; + $refund->status = $order->status; + $refund->reason_complaint = $request->input('reason_complaint'); + + if ($request->hasFile('transfer_proof')) { + $image = $request->file('transfer_proof'); + $imageName = time() . '.' . $image->getClientOriginalExtension(); + $image->move(public_path('uploads'), $imageName); + $refund->transfer_proof = $imageName; + } + + // Simpan data ke dalam database + $refund->save(); + + return redirect('/refund')->with('success', 'Pengembalian Berhasil Diajukan'); + } + + // detail pengajuan berdasarkan id + public function show($id) + { + $refund = Refund::findOrFail($id); + return view('refund.show', ['refund' => $refund]); + } + + // menghapus pengajuan refund berdasarkan id + public function destroy($id) // Perbaikan pada penulisan "destroy" + { + $refund = Refund::findOrFail($id); + $refund->delete(); + + return redirect('/refund')->with('success', 'Pengembalian Berhasil Dihapus'); + } +} diff --git a/app/Http/Controllers/RefundUserController.php b/app/Http/Controllers/RefundUserController.php deleted file mode 100644 index ea3808fd..00000000 --- a/app/Http/Controllers/RefundUserController.php +++ /dev/null @@ -1,66 +0,0 @@ - " Rp.200.000", "dueDate"=>"29 juni 2023", "status"=>"diterima", - "uploadBukti" => "5.jpg" + ], [ - "orderId" => "INV-1234", - "Customer" => "hantu", - "seller" => "rayhan", - "Total" => " Rp.200.000", - "dueDate"=>"29 juni 2023", + "orderId" => "INV-1235", + "Customer" => "jilhan haura", + "seller" => "kevin", + "Total" => " Rp.500.000", + "dueDate"=>"29 Januari 2023", + "status"=>"diproses", + + ], + [ + "orderId" => "INV-1236", + "Customer" => "Raihan Surya", + "seller" => "Salsa", + "Total" => " Rp.400.000", + "dueDate"=>"20 Agustus 2023", "status"=>"ditolak", - "uploadBukti" => "5.jpg" + ], [ - "orderId" => "INV-1234", - "Customer" => "pocong", - "seller" => "rayhan", - "Total" => " Rp.200.000", - "dueDate"=>"29 juni 2023", - "status"=>"diterima", - "uploadBukti" => "5.jpg" + "orderId" => "INV-1237", + "Customer" => "Fatur Rahman", + "seller" => "Satria ", + "Total" => " Rp.100.000", + "dueDate"=>"2 Agustus 2023", + "status"=>"ditolak", + ], ]; public static function HistoryRefundUser(){ diff --git a/app/Models/TransactionPembeli.php b/app/Models/TransactionPembeli.php index d8b19678..68be2e7b 100644 --- a/app/Models/TransactionPembeli.php +++ b/app/Models/TransactionPembeli.php @@ -9,12 +9,39 @@ class TransactionPembeli { private static $history_transactionPembeli=[ [ + "userId" => "NPA-9876", "orderId" => "INV-1234", - "Customer" => "Nurul Prima", - "seller" => "Jilhan", + "seller" => "Jilhan Haura", "total" => "Rp.500.000", "dueDate"=>"29 juni 2023", - "status"=>"pending", + "status"=>"OnProgress", + "action" => "" + ], + [ + "userId" => "NPA-9877", + "orderId" => "INV-12345", + "seller" => "Rayhan Surya", + "total" => "Rp.900.000", + "dueDate"=>"30 juni 2023", + "status"=>"Failed", + "action" => "" + ], + [ + "userId" => "NPA-9878", + "orderId" => "INV-12346", + "seller" => "Satria Hikmaladi", + "total" => "Rp.900.000", + "dueDate"=>"31 juni 2023", + "status"=>"Success", + "action" => "" + ], + [ + "userId" => "NPA-9871", + "orderId" => "INV-12340", + "seller" => "Aliffian Septi", + "total" => "Rp.1.000.000", + "dueDate"=>"13 Maret 2023", + "status"=>"Failed", "action" => "" ], ]; diff --git a/app/Models/TransactionPenjual.php b/app/Models/TransactionPenjual.php index dbca18ef..8d22474a 100644 --- a/app/Models/TransactionPenjual.php +++ b/app/Models/TransactionPenjual.php @@ -9,24 +9,42 @@ class TransactionPenjual { private static $history_transactionPenjual=[ [ - "orderId" => "INV-1234", - "Customer" => "Nurul Prima", - "seller" => "Jilhan", + "userId" => "NPA-9876", + "orderId" => "INV-1235", + "customer" => "Viona Denopta", "total" => "Rp.500.000", "dueDate"=>"29 juni 2023", - "status"=>"pending", + "status"=>"OnProgress", "action" => "" ], - [ - "orderId" => "INV-1235", - "Customer" => "Nurul Annisa", - "seller" => "Rayhan", - "total" => "Rp.900.000", - "dueDate"=>"29 Juli 2023", - "status"=>"proses", + "userId" => "NPA-9877", + "orderId" => "INV-1236", + "customer" => "Intan Saudina Fitri", + "total" => "Rp.1.500.000", + "dueDate"=>"29 September 2023", + "status"=>"Success", "action" => "" ], + [ + "userId" => "NPA-9879", + "orderId" => "INV-1238", + "customer" => "Cindy Zahra", + "total" => "Rp.5.000.000", + "dueDate"=>"09 juni 2023", + "status"=>"Failed", + "action" => "" + ], + [ + "userId" => "NPA-9872", + "orderId" => "INV-1232", + "customer" => "Naufal Hady", + "total" => "Rp.500.000", + "dueDate"=>"05 Desember 2023", + "status"=>"Failed", + "action" => "" + ], + ]; public static function HistoryTransactionPenjual(){ return self::$history_transactionPenjual; diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index e5c70b5c..bf593251 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -93,7 +93,7 @@
Order ID | -Customer | -Seller | -Total | -Due Date | -Status | -Image | -|
---|---|---|---|---|---|---|---|
- {{ $HistoryRefundUser['orderId'] }} | -- {{ $HistoryRefundUser['Customer'] }} | -- {{ $HistoryRefundUser['seller'] }} | -- {{ $HistoryRefundUser['Total'] }} | -{{ $HistoryRefundUser['dueDate'] }} | -
- Diterima
- |
- - {{ $HistoryRefundUser['uploadBukti'] }} | -- - |
User ID | +Order ID | +Seller | +Total | +Due Date | +Status | +
---|---|---|---|---|---|
{{ $HistoryTransactionPembeli['userId'] }} | +{{ $HistoryTransactionPembeli['orderId'] }} | +{{ $HistoryTransactionPembeli['seller'] }} | +{{ $HistoryTransactionPembeli['total'] }} | +{{ $HistoryTransactionPembeli['dueDate'] }} | +
+ @php
+ $statusClass="";
+ if ($HistoryTransactionPembeli['status'] === 'OnProgress'){
+ $statusClass = 'badge-warning';
+ }elseif ($HistoryTransactionPembeli['status'] === 'Success'){
+ $statusClass ='btn btn-info';
+ }elseif ($HistoryTransactionPembeli['status'] === 'Failed'){
+ $statusClass ='badge badge-danger';
+ }
+ @endphp
+ {{ $HistoryTransactionPembeli['status'] }} |
+