diff --git a/app/Http/Controllers/API/Penjual/PenjualApiController.php b/app/Http/Controllers/API/Penjual/PenjualApiController.php index 19c7a7e..4b7340b 100644 --- a/app/Http/Controllers/API/Penjual/PenjualApiController.php +++ b/app/Http/Controllers/API/Penjual/PenjualApiController.php @@ -340,7 +340,38 @@ class PenjualApiController extends Controller } public function acceptResult(Request $request){ + try{ + DB::beginTransaction(); + Transaction::where('id', $request->input('id'))->update([ + 'status_transaction' => 'done' + ]); + + TransactionDescription::create([ + 'transaction_id' => $request->input('id'), + 'status' => 'sent', + 'background' => 'bg-seller', + 'user' => auth()->user()->email, + 'judul' => 'fas fa-money-bill', + 'deskripsi' => auth()->user()->nama_depan.' telah menerima uang.', + ]); + + DB::commit(); + + return response()->json([ + 'status' => true, + 'message' => 'Uang akan dikirim ke bank anda. Terima kasih telah menggunakan Rekber.' + ]); + }catch(Throwable $e){ + DB::rollBack(); + + Log::error($e->getMessage()); + + return response()->json([ + 'status' => false, + 'message' => 'Gagal update status karena kesalahan server.', + ]); + } } } diff --git a/app/Http/Controllers/Admin/Notification/AdminNotification.php b/app/Http/Controllers/Admin/Notification/AdminNotification.php new file mode 100644 index 0000000..c5a8983 --- /dev/null +++ b/app/Http/Controllers/Admin/Notification/AdminNotification.php @@ -0,0 +1,325 @@ +id)->first(); + return view('admin.notification.show', compact('notification')); + } + + public function selectAllUser() + { + $users = User::where('role', 'User') + ->where('status', 'Finished') + ->pluck('email') + ->toArray(); + return response()->json([ + 'users' => $users, + ]); + } + + public function listNotification(Request $request) + { + try { + $subQuery = Notification::latest()->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notifications.created_at'); + + if ($request->has('search') && !empty($request->search['value'])) { + $searchNotif = $request->search['value']; + $subQuery->where(function ($a) use ($searchNotif) { + $a->whereRaw('LOWER(notifications.title) LIKE ?', ['%' . strtolower($searchNotif) . '%']) + ->orWhereRaw('LOWER(notifications.teaser) LIKE ?', ['%' . strtolower($searchNotif) . '%']); + }); + } + + $queryNotif = Notification::from(DB::raw("({$subQuery->toSql()}) as tmp")) + ->mergeBindings($subQuery->getQuery()) + ->select('*') + ->get(); + + if ($request->ajax()) { + return DataTables::of($queryNotif) + ->addIndexColumn() + ->addColumn('action', function ($row) { + $detail = route('admin-notification.show', ['id' => $row->id]); + $edit = route('admin-notification.edit', ['id' => $row->id]); + $html_code = + ' +
+ # + | ++ Judul + | ++ Teaser + | ++ Dibuat pada + | ++ Diperbarui pada + | ++ Aksi + | +
---|
+ # + | ++ Nama Lengkap + | ++ Email + | ++ Tanggal Kirim + | ++ Tanggal Terima + | +
---|
+ # + | ++ Judul + | ++ Teaser + | ++ Tanggal Dibuat + | ++ Aksi + | +
---|
+ |
Pembeli : |
- + |
Penjual : |
Takapedia Top Up |
+ |
Email : |
||
darwin@gmail.com | +darwin@gmail.com | ||
+ |
Alamat : |
||
Pondok ponogoro jl.raya bogor no.26 rt 2/2Pondok ponogoro jl.raya bogor no.26 - rt 2/2 | +Pondok ponogoro jl.raya bogor no.26 rt 2/2Pondok ponogoro jl.raya bogor no.26 rt + 2/2 | ||
+ |
no. HP : |
- Rincian Pesanan+ |
+ Rincian Pesanan |
- ||
Semua pesanan yang di daftarkan dalam transaksi | +Semua pesanan yang di daftarkan dalam transaksi | +
[ini kosongggggggggggggggggggg] | -+ | [ini kosong] | +||
[kosong] | -+ |
Rp.35.989.184,00 |
||
[kosong] | -+ | |||
[kosong] | -+ |
Rp.30.000,00 |
||
[kosong] | -+ |
|
||
[kosong] | -+ | |||
[kosong] | -+ |
Rp.30.000,00 |