Notifikasi
This commit is contained in:
parent
85dec7d3c0
commit
d501cefc46
@ -340,7 +340,38 @@ class PenjualApiController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function acceptResult(Request $request){
|
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.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
325
app/Http/Controllers/Admin/Notification/AdminNotification.php
Normal file
325
app/Http/Controllers/Admin/Notification/AdminNotification.php
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin\Notification;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Notification;
|
||||||
|
use App\Models\NotificationReceiver;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Throwable;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Pusher\Pusher;
|
||||||
|
|
||||||
|
class AdminNotification extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('admin.notification.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.notification.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request)
|
||||||
|
{
|
||||||
|
$notification = Notification::where('id', $request->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 =
|
||||||
|
'
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle"
|
||||||
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
....
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="' .
|
||||||
|
$detail .
|
||||||
|
'">Detail</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="' .
|
||||||
|
$edit .
|
||||||
|
'">Edit</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" id="deleteNotif" data-id="' .
|
||||||
|
$row->id .
|
||||||
|
'">Hapus</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
return $html_code;
|
||||||
|
})
|
||||||
|
->rawColumns(['action'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listUserForShow(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$subQuery = NotificationReceiver::join('users', 'notification_receivers.receiver', '=', 'users.email')
|
||||||
|
->join('notifications', 'notification_receivers.notification_id', '=', 'notifications.id')
|
||||||
|
->where('notification_receivers.notification_id', $request->id)
|
||||||
|
->latest()
|
||||||
|
->select(DB::raw("CONCAT(users.nama_depan,' ', users.nama_belakang) as nama_lengkap"), 'notification_receivers.created_at', 'notification_receivers.updated_at', 'notification_receivers.receiver');
|
||||||
|
|
||||||
|
if ($request->has('search') && !empty($request->search['value'])) {
|
||||||
|
$searchNotif = $request->search['value'];
|
||||||
|
if (!is_numeric($searchNotif)) {
|
||||||
|
$subQuery->where(function ($a) use ($searchNotif) {
|
||||||
|
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?", ['%' . strtolower($searchNotif) . '%']);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$queryNotif = NotificationReceiver::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
||||||
|
->mergeBindings($subQuery->getQuery())
|
||||||
|
->select('*')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return DataTables::of($queryNotif)
|
||||||
|
->addIndexColumn()
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listUserForCreateEdit(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$subQuery = User::latest()
|
||||||
|
->where('users.status', '=', 'Finished')
|
||||||
|
->where('users.role', '=', 'User')
|
||||||
|
->select(DB::raw("CONCAT(users.nama_depan,' ', users.nama_belakang) as nama_lengkap"), 'users.email');
|
||||||
|
|
||||||
|
if ($request->has('search') && !empty($request->search['value'])) {
|
||||||
|
$searchUser = $request->search['value'];
|
||||||
|
$subQuery->where(function ($a) use ($searchUser) {
|
||||||
|
$a->whereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?", ['%' . strtolower($searchUser) . '%'])->orWhereRaw('LOWER(users.email) LIKE ?', ['%' . strtolower($searchUser) . '%']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$queryUser = User::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
||||||
|
->mergeBindings($subQuery->getQuery())
|
||||||
|
->select('*')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return DataTables::of($queryUser)
|
||||||
|
->addIndexColumn()
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$notif = Notification::create([
|
||||||
|
'title' => $request->title,
|
||||||
|
'content' => $request->content,
|
||||||
|
'teaser' => Str::limit($request->content, 20, '...'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
foreach ($request->receivers as $receiver) {
|
||||||
|
NotificationReceiver::create([
|
||||||
|
'receiver' => $receiver,
|
||||||
|
'notification_id' => $notif->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil membuat notifikasi dan akan dikirim ke pengguna.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Notification::destroy($request->id);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil menghapus notifikasi.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteAll()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Notification::truncate();
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil menghapus semua notifikasi.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(Request $request)
|
||||||
|
{
|
||||||
|
$notification = Notification::where('id', $request->id)->first();
|
||||||
|
$email = NotificationReceiver::where('notification_id', $request->id)
|
||||||
|
->pluck('receiver')
|
||||||
|
->toArray();
|
||||||
|
return view('admin.notification.edit', compact('notification', 'email'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Notification::where('id', $request->id)->update([
|
||||||
|
'title' => $request->title,
|
||||||
|
'content' => $request->content,
|
||||||
|
'teaser' => Str::limit($request->content, 20, '...'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
NotificationReceiver::where('notification_id', $request->id)->delete();
|
||||||
|
|
||||||
|
foreach ($request->receivers as $receiver) {
|
||||||
|
NotificationReceiver::create([
|
||||||
|
'receiver' => $receiver,
|
||||||
|
'notification_id' => $request->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil update notifikasi dan akan dikirim ke pengguna.',
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Terjadi kesalahan di server.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateNewNotification(Request $request)
|
||||||
|
{
|
||||||
|
$options = [
|
||||||
|
'cluster' => 'ap1',
|
||||||
|
'useTLS' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
$pusher = new Pusher('3e5bdc20dddd7fbc655e', 'f2274c37c616d29ff590', '1659859', $options);
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'receivers' => $request->receivers,
|
||||||
|
];
|
||||||
|
|
||||||
|
$pusher->trigger('chanel-update-notifikasi', 'event-update-notifikasi', $payload);
|
||||||
|
}
|
||||||
|
}
|
@ -35,16 +35,23 @@ class AdminUserController extends Controller
|
|||||||
public function destroy(Request $request)
|
public function destroy(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$result = User::destroy($request->id);
|
DB::beginTransaction();
|
||||||
if ($result) {
|
|
||||||
return response()->json([
|
User::destroy($request->id);
|
||||||
'message' => 'Berhasil hapus data',
|
|
||||||
'status' => true,
|
DB::commit();
|
||||||
]);
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Gagal hapus data, karena ' . $e,
|
'message' => 'Berhasil hapus data',
|
||||||
|
'status' => true,
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Terjadi kesalahan di server',
|
||||||
'status' => false,
|
'status' => false,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -52,11 +59,11 @@ class AdminUserController extends Controller
|
|||||||
|
|
||||||
public function approveUser(Request $request)
|
public function approveUser(Request $request)
|
||||||
{
|
{
|
||||||
try{
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
User::where('id', $request->id)->update([
|
User::where('id', $request->id)->update([
|
||||||
'status' => 'Finished'
|
'status' => 'Finished',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
@ -65,7 +72,7 @@ class AdminUserController extends Controller
|
|||||||
'message' => 'Akun telah disetujui dan dapat digunakan',
|
'message' => 'Akun telah disetujui dan dapat digunakan',
|
||||||
'status' => true,
|
'status' => true,
|
||||||
]);
|
]);
|
||||||
}catch(Throwable $e){
|
} catch (Throwable $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
@ -74,12 +81,12 @@ class AdminUserController extends Controller
|
|||||||
|
|
||||||
public function denyUser(Request $request)
|
public function denyUser(Request $request)
|
||||||
{
|
{
|
||||||
try{
|
try {
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
User::where('id', $request->id)->update([
|
User::where('id', $request->id)->update([
|
||||||
'status' => 'Rejected',
|
'status' => 'Rejected',
|
||||||
'keterangan' => $request->keterangan
|
'keterangan' => $request->keterangan,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
@ -88,8 +95,7 @@ class AdminUserController extends Controller
|
|||||||
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
|
'message' => 'Akun telah ditolak dan tidak dapat digunakan',
|
||||||
'status' => true,
|
'status' => true,
|
||||||
]);
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
}catch(Throwable $e){
|
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
@ -106,16 +112,14 @@ class AdminUserController extends Controller
|
|||||||
|
|
||||||
if ($request->has('search') && !empty($request->search['value'])) {
|
if ($request->has('search') && !empty($request->search['value'])) {
|
||||||
$searchUser = $request->search['value'];
|
$searchUser = $request->search['value'];
|
||||||
if(!is_numeric($searchUser)){
|
if (!is_numeric($searchUser)) {
|
||||||
$subQuery->where(function ($a) use ($searchUser) {
|
$subQuery->where(function ($a) use ($searchUser) {
|
||||||
$a->whereRaw('LOWER(email) LIKE ?', ['%' . strtolower($searchUser) . '%'])
|
$a->whereRaw('LOWER(email) LIKE ?', ['%' . strtolower($searchUser) . '%'])
|
||||||
->orWhereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?", ['%' . strtolower($searchUser) . '%'])
|
->orWhereRaw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?", ['%' . strtolower($searchUser) . '%'])
|
||||||
->orWhereRaw('LOWER(status) LIKE ?',['%'.strtolower($searchUser).'%']);
|
->orWhereRaw('LOWER(status) LIKE ?', ['%' . strtolower($searchUser) . '%']);
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$queryUser = User::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
$queryUser = User::from(DB::raw("({$subQuery->toSql()}) as tmp"))
|
||||||
@ -128,7 +132,8 @@ class AdminUserController extends Controller
|
|||||||
->addIndexColumn()
|
->addIndexColumn()
|
||||||
->addColumn('action', function ($row) {
|
->addColumn('action', function ($row) {
|
||||||
$url = route('admin-user.show', ['id' => $row->id]);
|
$url = route('admin-user.show', ['id' => $row->id]);
|
||||||
$html_code = '
|
$html_code =
|
||||||
|
'
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle"
|
<button type="button" class="btn btn-primary dropdown-toggle"
|
||||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
@ -137,7 +142,9 @@ class AdminUserController extends Controller
|
|||||||
|
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item"
|
<li><a class="dropdown-item"
|
||||||
href="'.$url.'">Detail</a>
|
href="' .
|
||||||
|
$url .
|
||||||
|
'">Detail</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>';
|
</div>';
|
||||||
|
@ -20,7 +20,7 @@ class InvoiceController extends Controller
|
|||||||
{
|
{
|
||||||
$transaction = Transaction::findOrFail($request->id);
|
$transaction = Transaction::findOrFail($request->id);
|
||||||
$pdf = Pdf::loadView('invoice.export-invoice',compact('transaction'))->setPaper('A4','Portrait');
|
$pdf = Pdf::loadView('invoice.export-invoice',compact('transaction'))->setPaper('A4','Portrait');
|
||||||
return $pdf->download("invoice-$request->id.pdf");
|
return $pdf->download("invoice-".uniqid().".pdf");
|
||||||
// return view('invoice.export-invoice', [
|
// return view('invoice.export-invoice', [
|
||||||
// 'transaction' => Transaction::findOrFail($request->id),
|
// 'transaction' => Transaction::findOrFail($request->id),
|
||||||
// ]);
|
// ]);
|
||||||
|
@ -421,6 +421,6 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
// $transaction = Transaction::findOrFail('80d9b19b-ba17-4aea-8cad-c3b4661d33bc');
|
// $transaction = Transaction::findOrFail('80d9b19b-ba17-4aea-8cad-c3b4661d33bc');
|
||||||
$pdf = Pdf::loadView('invoice.export-invoice')->setPaper('A4','portrait');
|
$pdf = Pdf::loadView('invoice.export-invoice')->setPaper('A4','portrait');
|
||||||
return $pdf->download("invoice-80d9b19b-ba17-4aea-8cad-c3b4661d33b-".uniqid().".pdf");
|
return $pdf->download("invoice-".uniqid().".pdf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
126
app/Http/Controllers/User/Notification/UserNotification.php
Normal file
126
app/Http/Controllers/User/Notification/UserNotification.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\User\Notification;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Notification;
|
||||||
|
use App\Models\NotificationReceiver;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Throwable;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
|
||||||
|
class UserNotification extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('user.notification.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ListNotification(Request $request)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$subQuery = Notification::join('notification_receivers','notifications.id','=','notification_receivers.notification_id')
|
||||||
|
->where('notification_receivers.receiver','=',auth()->user()->email)
|
||||||
|
->latest()
|
||||||
|
->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notification_receivers.created_at', 'notification_receivers.status');
|
||||||
|
|
||||||
|
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('user-notifiaction.detail-notification', ['id' => $row->id]);
|
||||||
|
$html_code =
|
||||||
|
'
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-primary dropdown-toggle"
|
||||||
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
....
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" href="' .
|
||||||
|
$detail .
|
||||||
|
'">Detail</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
return $html_code;
|
||||||
|
})
|
||||||
|
->rawColumns(['action'])
|
||||||
|
->make(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json(['success' => false, 'message' => 'Terjadi Kesalahan pada sisi server']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
$notification = Notification::where('id', $id)->first();
|
||||||
|
|
||||||
|
NotificationReceiver::where('notification_id', $id)
|
||||||
|
->where('receiver', auth()->user()->email)
|
||||||
|
->update([
|
||||||
|
'status' => 'read',
|
||||||
|
]);
|
||||||
|
|
||||||
|
DB::commit();
|
||||||
|
|
||||||
|
return view('user.notification.detail-notification', compact('notification'));
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function latestNotification()
|
||||||
|
{
|
||||||
|
$notifications = NotificationReceiver::join('notifications', 'notification_receivers.notification_id', '=', 'notifications.id')
|
||||||
|
->where('receiver', auth()->user()->email)
|
||||||
|
->where('status', 'unread')
|
||||||
|
->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notifications.updated_at')
|
||||||
|
->latest('notifications.updated_at')
|
||||||
|
->limit(4)
|
||||||
|
->get();
|
||||||
|
return response()->json([
|
||||||
|
'notifications' => $notifications,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAllAsRead()
|
||||||
|
{
|
||||||
|
NotificationReceiver::where('receiver', auth()->user()->email)->update([
|
||||||
|
'status' => 'read',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Berhasil',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -228,14 +228,14 @@ class PembeliController extends Controller
|
|||||||
'background' => 'bg-buyer',
|
'background' => 'bg-buyer',
|
||||||
'user' => auth()->user()->email,
|
'user' => auth()->user()->email,
|
||||||
'judul' => 'fas fa-check',
|
'judul' => 'fas fa-check',
|
||||||
'deskripsi' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
'deskripsi' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '. Uang akan dikirim ke penjual.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'message' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '.',
|
'message' => 'Pesanan anda selesai dan uang akan dikirim ke penjual. Terima kasih telah menggunakan Rekber.',
|
||||||
]);
|
]);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
@ -319,7 +319,7 @@ class PembeliController extends Controller
|
|||||||
'status' => 'challenge',
|
'status' => 'challenge',
|
||||||
'background' => 'bg-primary',
|
'background' => 'bg-primary',
|
||||||
'judul' => 'fas fa-clock',
|
'judul' => 'fas fa-clock',
|
||||||
'deskripsi' => 'Transaksi ' . auth()->user()->email . ' terindikasi masalah, tunggu sesaat hingga admin menyetujui pembayaran.',
|
'deskripsi' => 'Transaksi ' . auth()->user()->email . ' terindikasi masalah/penipuan, tunggu sesaat hingga admin menyetujui pembayaran.',
|
||||||
'user' => 'admin@example.net',
|
'user' => 'admin@example.net',
|
||||||
'keterangan' => $result['status_message'],
|
'keterangan' => $result['status_message'],
|
||||||
]);
|
]);
|
||||||
@ -537,11 +537,6 @@ class PembeliController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function complaintTransaction($id)
|
|
||||||
{
|
|
||||||
return view('user.refund.new-refund', compact('id'));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onErrorTransaction(Request $request)
|
public function onErrorTransaction(Request $request)
|
||||||
{
|
{
|
||||||
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
|
||||||
|
@ -353,7 +353,27 @@ class PenjualController extends Controller
|
|||||||
public function acceptResult(Request $request)
|
public function acceptResult(Request $request)
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
|
Transaction::where('id', $request->id)->update([
|
||||||
|
'status_transaction' => 'done'
|
||||||
|
]);
|
||||||
|
|
||||||
|
TransactionDescription::create([
|
||||||
|
'transaction_id' => $request->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){
|
}catch(Throwable $e){
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
|
||||||
|
27
app/Models/Notification.php
Normal file
27
app/Models/Notification.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Notification extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'teaser',
|
||||||
|
'content',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'id' => 'string',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relasi
|
||||||
|
public function notifications(){
|
||||||
|
return $this->hasMany(NotificationReceiver::class, 'id', 'notification_id');
|
||||||
|
}
|
||||||
|
// Relasi
|
||||||
|
}
|
30
app/Models/NotificationReceiver.php
Normal file
30
app/Models/NotificationReceiver.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class NotificationReceiver extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'notification_id',
|
||||||
|
'receiver',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'id' => 'string',
|
||||||
|
];
|
||||||
|
|
||||||
|
//Relasi
|
||||||
|
public function data_receiver(){
|
||||||
|
return $this->belongsTo(User::class, 'receiver', 'email');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notifications(){
|
||||||
|
return $this->belongsTo(Notification::class, 'notification_id', 'id');
|
||||||
|
}
|
||||||
|
//Relasi
|
||||||
|
}
|
@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class RefundUser
|
|
||||||
{
|
|
||||||
// use HasFactory;
|
|
||||||
|
|
||||||
private static $history_refundUser=[
|
|
||||||
[
|
|
||||||
"orderId" => "INV-1234",
|
|
||||||
"Customer" => "npannisa",
|
|
||||||
"seller" => "rayhan",
|
|
||||||
"Total" => " 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",
|
|
||||||
"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"
|
|
||||||
],
|
|
||||||
];
|
|
||||||
public static function HistoryRefundUser(){
|
|
||||||
return self::$history_refundUser;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
// class Refund extends Model{
|
|
||||||
// protected $table = 'refund';
|
|
||||||
// use HasFactory;
|
|
||||||
// }
|
|
||||||
class Refunds
|
|
||||||
{
|
|
||||||
private static $history_refund=[
|
|
||||||
[
|
|
||||||
"no"=>"1",
|
|
||||||
"orderId" => "INV-1234",
|
|
||||||
"customer" => "Okta",
|
|
||||||
"seller" => "dodo",
|
|
||||||
"total" => "Rp. 15000",
|
|
||||||
"date" => "July 19, 2023 ",
|
|
||||||
"status"=>"Process Refund"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no"=>"2",
|
|
||||||
"orderId" => "INV-0000",
|
|
||||||
"customer" => "Selvi",
|
|
||||||
"seller" => "dedo",
|
|
||||||
"total" => "Rp. 11000",
|
|
||||||
"date" => "August 19, 2023 ",
|
|
||||||
"status"=>"Refund Success"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no"=>"3",
|
|
||||||
"orderId" => "INV-2313",
|
|
||||||
"customer" => "Septa",
|
|
||||||
"seller" => "dido",
|
|
||||||
"total" => "Rp. 15000",
|
|
||||||
"date" => "July 29, 2023 ",
|
|
||||||
"status"=>"Process Refund"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no"=>"4",
|
|
||||||
"orderId" => "INV-5664",
|
|
||||||
"customer" => "Padia",
|
|
||||||
"seller" => "dedo",
|
|
||||||
"total" => "Rp. 14000",
|
|
||||||
"date" => "July 18, 2023 ",
|
|
||||||
"status"=>"Refunds Refused"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no"=>"5",
|
|
||||||
"orderId" => "INV-9090",
|
|
||||||
"customer" => "hantu",
|
|
||||||
"seller" => "dado",
|
|
||||||
"total" => "Rp. 45000",
|
|
||||||
"date" => "2023-08-14 ",
|
|
||||||
"status"=>"Refunds Refused"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
public static $detail_refund=[
|
|
||||||
[
|
|
||||||
"orderId" => "INV-9090",
|
|
||||||
"customer" => "hantu",
|
|
||||||
"seller" => "dado",
|
|
||||||
"total" => "Rp. 45000",
|
|
||||||
"date" => "2023-08-14 ",
|
|
||||||
"complaint" =>" Lorem ipsum dolor sit, amet consectetur adipisicing elit. Aliquam inventore, sit enim iure itaque fuga voluptates alias, eveniet quos ex reiciendis! Dolore mollitia ea inventore, excepturi hic fugiat id, magnam molestias sint ut enim repellendus, cum dolorum dolores sapiente adipisci tempora nihil omnis! Accusantium, non perspiciatis? Molestias modi debitis perferendis reprehenderit excepturi voluptates? Sit incidunt consequuntur iusto odit sapiente inventore nemo commodi, quam vero magnam temporibus ducimus praesentium assumenda blanditiis possimus perferendis totam placeat maiores. Quae ut id libero atque pariatur veritatis rerum culpa tempore consequatur quod corrupti corporis nobis quia repellendus iste quidem illum, voluptates aspernatur cumque officia. Tenetur.",
|
|
||||||
"image"=>"assets/images/dashboard/img_2.jpg"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
public static function HistoryRefund(){
|
|
||||||
return self::$history_refund;
|
|
||||||
|
|
||||||
}
|
|
||||||
public static function DetailRefund(){
|
|
||||||
return self::$detail_refund;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Settings
|
|
||||||
{
|
|
||||||
static $History_Setting=[
|
|
||||||
[
|
|
||||||
"no" => "1",
|
|
||||||
"month" => "January",
|
|
||||||
"year" =>"2021",
|
|
||||||
"persentase" =>"50%",
|
|
||||||
"status" =>"Active"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no" => "2",
|
|
||||||
"month" => "February",
|
|
||||||
"year" =>"2022",
|
|
||||||
"persentase" =>"40%",
|
|
||||||
"status" =>"Non Active"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no" => "3",
|
|
||||||
"month" => "March",
|
|
||||||
"year" =>"2023",
|
|
||||||
"persentase" =>"30%",
|
|
||||||
"status" =>"Non Active"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no" => "4",
|
|
||||||
"month" => "April",
|
|
||||||
"year" =>"2021",
|
|
||||||
"persentase" =>"60%",
|
|
||||||
"status" =>"Non Active"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"no" => "5",
|
|
||||||
"month" => "May",
|
|
||||||
"year" =>"2023",
|
|
||||||
"persentase" =>"20%",
|
|
||||||
"status" =>"Non Active"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
public static function HistorySetting(){
|
|
||||||
return self::$History_Setting;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
|
|
||||||
|
|
||||||
class TransactionUser
|
|
||||||
{
|
|
||||||
private static $history_transaction=[
|
|
||||||
[
|
|
||||||
"userId" => "NPA-9876",
|
|
||||||
"orderId" => "INV-1234",
|
|
||||||
"Customer" => "Nurul Prima",
|
|
||||||
"seller" => "Jilhan",
|
|
||||||
"total" => "Rp.500.000",
|
|
||||||
"dueDate"=>"29 juni 2023",
|
|
||||||
"status"=>"OnProgress",
|
|
||||||
"action" => ""
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"userId" => "NPA-9879",
|
|
||||||
"orderId" => "INV-1234",
|
|
||||||
"Customer" => "Nurul Prima Annisa",
|
|
||||||
"seller" => "Raihan",
|
|
||||||
"total" => "Rp.500.000",
|
|
||||||
"dueDate"=>"29 juni 2025",
|
|
||||||
"status"=>"Diterima",
|
|
||||||
"action" => ""
|
|
||||||
],
|
|
||||||
|
|
||||||
// [
|
|
||||||
// "userId" => "NPA-9877",
|
|
||||||
// "orderId" => "INV-1235",
|
|
||||||
// "Customer" => "Nurul Annisa",
|
|
||||||
// "seller" => "Rayhan",
|
|
||||||
// "total" => "Rp.900.000",
|
|
||||||
// "dueDate"=>"29 Juli 2023",
|
|
||||||
// "status"=>"Pembeli",
|
|
||||||
// "action" => ""
|
|
||||||
// ],
|
|
||||||
|
|
||||||
// [
|
|
||||||
// "userId" => "NPA-9878",
|
|
||||||
// "orderId" => "INV-1236",
|
|
||||||
// "Customer" => "Nurul Prima Annisa",
|
|
||||||
// "seller" => "Rayhan",
|
|
||||||
// "total" => "Rp.900.000",
|
|
||||||
// "dueDate"=>"29 Juli 2023",
|
|
||||||
// "status"=>"Pembeli",
|
|
||||||
// "action" => ""
|
|
||||||
// ],
|
|
||||||
];
|
|
||||||
public static function HistoryTransaction(){
|
|
||||||
return self::$history_transaction;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class Transactions
|
|
||||||
{
|
|
||||||
private static $list_transaction = [
|
|
||||||
[
|
|
||||||
'no' => '1',
|
|
||||||
'orderId' => 'INV-1234',
|
|
||||||
'customer' => 'Jilhan',
|
|
||||||
'seller' => 'dodo',
|
|
||||||
'total' => 'Rp. 15000',
|
|
||||||
'date' => 'July 19, 2023 ',
|
|
||||||
'status' => 'paid',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'no' => '2',
|
|
||||||
'orderId' => 'INV-0000',
|
|
||||||
'customer' => 'hmmm',
|
|
||||||
'seller' => 'dodo',
|
|
||||||
'total' => 'Rp. 11000',
|
|
||||||
'date' => 'August 19, 2023 ',
|
|
||||||
'status' => 'pending',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'no' => '3',
|
|
||||||
'orderId' => 'INV-2313',
|
|
||||||
'customer' => 'nurul',
|
|
||||||
'seller' => 'dido',
|
|
||||||
'total' => 'Rp. 15000',
|
|
||||||
'date' => 'July 29, 2023 ',
|
|
||||||
'status' => 'unpaid',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'no' => '4',
|
|
||||||
'orderId' => 'INV-5664',
|
|
||||||
'customer' => 'raihan',
|
|
||||||
'seller' => 'dedo',
|
|
||||||
'total' => 'Rp. 14000',
|
|
||||||
'date' => 'July 18, 2023 ',
|
|
||||||
'status' => 'pending',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'no' => '5',
|
|
||||||
'orderId' => 'INV-9090',
|
|
||||||
'customer' => 'testing',
|
|
||||||
'seller' => 'dado',
|
|
||||||
'total' => 'Rp. 45000',
|
|
||||||
'date' => 'June 19, 2023 ',
|
|
||||||
'status' => 'paid',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
private static $detail_transaction = [
|
|
||||||
[
|
|
||||||
'idTransaction' => 'INV-76899',
|
|
||||||
'side' => 'SELL',
|
|
||||||
'marketPair' => 'IDR',
|
|
||||||
'email' => 'JilhanHaura07@gmail.com',
|
|
||||||
'amountTransaction' => 'Rp. 900000',
|
|
||||||
'feeTransaction' => '10%',
|
|
||||||
'total' => '68,00989.00 IDR',
|
|
||||||
'paymentDetail' => 'Bank',
|
|
||||||
'bankName' => 'BNI',
|
|
||||||
'accountNumber' => '123',
|
|
||||||
'statusTransaction' => 'Success',
|
|
||||||
|
|
||||||
// "tracking_number" => "09102919209",
|
|
||||||
// "orderId" => "INV-9090",
|
|
||||||
// "status"=>"Pending",
|
|
||||||
// "estimated" => "June 20, 2023",
|
|
||||||
// "tracking_detail1"=> "August 10: processed payment",
|
|
||||||
// "tracking_detail2"=> "August 12: payment in system",
|
|
||||||
// "tracking_detail3"=> "August 14: payment has been received by the seller",
|
|
||||||
],
|
|
||||||
];
|
|
||||||
public static function allTransactions()
|
|
||||||
{
|
|
||||||
return self::$list_transaction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function allDetailTransactions()
|
|
||||||
{
|
|
||||||
return self::$detail_transaction;
|
|
||||||
}
|
|
||||||
}
|
|
@ -57,11 +57,11 @@ class Transaction extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function refunds(){
|
public function refunds(){
|
||||||
return $this->hasMany(Refund::class, 'transaction_id', 'id');
|
return $this->hasMany(Refund::class, 'id', 'transaction_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function transactionDescription(){
|
public function transactionDescription(){
|
||||||
return $this->hasMany(TransactionDescription::class, 'transaction_id', 'id');
|
return $this->hasMany(TransactionDescription::class, 'id', 'transaction_id');
|
||||||
}
|
}
|
||||||
//Relasi
|
//Relasi
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ return new class extends Migration
|
|||||||
$table->timestamp('tanggal_transaksi')->nullable();
|
$table->timestamp('tanggal_transaksi')->nullable();
|
||||||
$table->string('nama_bank_penjual');
|
$table->string('nama_bank_penjual');
|
||||||
$table->string('no_rek_penjual');
|
$table->string('no_rek_penjual');
|
||||||
|
$table->string('keterangan')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('pembeli')->on('users')->references('email');
|
$table->foreign('pembeli')->on('users')->references('email');
|
||||||
|
@ -20,6 +20,7 @@ return new class extends Migration
|
|||||||
$table->enum('status',['refund','deny','pending'])->default('pending');
|
$table->enum('status',['refund','deny','pending'])->default('pending');
|
||||||
$table->text('complaint');
|
$table->text('complaint');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('transaction_id')->on('transactions')->references('id');
|
$table->foreign('transaction_id')->on('transactions')->references('id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('notifications', function (Blueprint $table) {
|
||||||
|
$table->uuid('id')->default(DB::raw('uuid_generate_v4()'))->primary();
|
||||||
|
$table->string('title'); // judul notifikasi
|
||||||
|
$table->string('teaser'); // cuplikan dari isi notifikasi
|
||||||
|
$table->string('content'); // isi notifikasi
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('notifications');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('notification_receivers', function (Blueprint $table) {
|
||||||
|
$table->uuid('id')->default(DB::raw('uuid_generate_v4()'))->primary();
|
||||||
|
$table->foreignUuid('notification_id');
|
||||||
|
$table->string('receiver');
|
||||||
|
$table->enum('status',['unread', 'read'])->default('unread');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('receiver')->on('users')->references('email');
|
||||||
|
$table->foreign('notification_id')->on('notifications')->references('id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('notification_receivers');
|
||||||
|
}
|
||||||
|
};
|
@ -5,6 +5,8 @@ namespace Database\Seeders;
|
|||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
|
use App\Models\Notification;
|
||||||
|
use App\Models\NotificationReceiver;
|
||||||
use App\Models\Refund;
|
use App\Models\Refund;
|
||||||
use App\Models\RefundDescription;
|
use App\Models\RefundDescription;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
@ -190,6 +192,22 @@ class DatabaseSeeder extends Seeder
|
|||||||
'relasi_kontak' => $user1->email
|
'relasi_kontak' => $user1->email
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$notification1 = Notification::create([
|
||||||
|
'title' => 'Selamat Datang di Rekber',
|
||||||
|
'content' => 'Hai, selamat datang di Rekber. Anda dapat menikmati bertransaksi disini',
|
||||||
|
'teaser' => 'Hai, selamat datang di Rekber. ...'
|
||||||
|
]);
|
||||||
|
|
||||||
|
NotificationReceiver::create([
|
||||||
|
'notification_id' => $notification1->id,
|
||||||
|
'receiver' => $user1->email
|
||||||
|
]);
|
||||||
|
|
||||||
|
NotificationReceiver::create([
|
||||||
|
'notification_id' => $notification1->id,
|
||||||
|
'receiver' => $user2->email
|
||||||
|
]);
|
||||||
|
|
||||||
$this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]);
|
$this->call([ProvincesSeeder::class, CitiesSeeder::class, DistrictsSeeder::class, VillagesSeeder::class]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,54 +1,53 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------
|
/*--------------------------------------------------------------
|
||||||
# Profie Page
|
# Profie Page
|
||||||
--------------------------------------------------------------*/
|
--------------------------------------------------------------*/
|
||||||
.profile .profile-card img {
|
.profile .profile-card img {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-card h2 {
|
.profile .profile-card h2 {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #2c384e;
|
color: #2c384e;
|
||||||
margin: 10px 0 0 0;
|
margin: 10px 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-card h3 {
|
.profile .profile-card h3 {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-card .social-links a {
|
.profile .profile-card .social-links a {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
color: rgba(1, 41, 112, 0.5);
|
color: rgba(1, 41, 112, 0.5);
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-card .social-links a:hover {
|
.profile .profile-card .social-links a:hover {
|
||||||
color: #012970;
|
color: #012970;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-overview .row {
|
.profile .profile-overview .row {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-overview .card-title {
|
.profile .profile-overview .card-title {
|
||||||
color: #012970;
|
color: #012970;
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-overview .label {
|
.profile .profile-overview .label {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: rgba(1, 41, 112, 0.6);
|
color: rgba(1, 41, 112, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-edit label {
|
.profile .profile-edit label {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: rgba(1, 41, 112, 0.6);
|
color: rgba(1, 41, 112, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.profile .profile-edit img {
|
.profile .profile-edit img {
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
}
|
}
|
||||||
|
@ -1776,7 +1776,7 @@ h6 .badge {
|
|||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 12px;
|
font-size: 18px;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
padding: 0.3rem 0.8rem;
|
padding: 0.3rem 0.8rem;
|
||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
@ -3090,7 +3090,7 @@ a.dropdown-item.active {
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #fafdfb;
|
background-color: #fafdfb;
|
||||||
font-size: 14px;
|
font-size: 18px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-family: "Nunito", "Segoe UI", arial;
|
font-family: "Nunito", "Segoe UI", arial;
|
||||||
color: #6c757d;
|
color: #6c757d;
|
||||||
|
214
resources/views/Admin/notification/create.blade.php
Normal file
214
resources/views/Admin/notification/create.blade.php
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
let selected = [];
|
||||||
|
|
||||||
|
let listUser = $('#table-user').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: "{{ route('admin-notification.list-user-for-create-edit') }}",
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
name: 'DT_RowIndex',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'nama_lengkap',
|
||||||
|
name: 'nama_lengkap',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'email',
|
||||||
|
name: 'email',
|
||||||
|
className: 'text-center'
|
||||||
|
}],
|
||||||
|
rowId: 'DT_RowIndex',
|
||||||
|
rowCallback: function(row, data) {
|
||||||
|
selected.forEach(element => {
|
||||||
|
if (element == data.email) {
|
||||||
|
$(row).addClass('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
createdRow: function(row, data, dataIndex) {
|
||||||
|
$(row).attr('data-email', data.email);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#table-user tbody').on('click', 'tr', function() {
|
||||||
|
var email = $(this).data('email');
|
||||||
|
var index = $.inArray(email, selected);
|
||||||
|
|
||||||
|
if (index === -1) {
|
||||||
|
selected.push(email);
|
||||||
|
} else {
|
||||||
|
selected.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).toggleClass('selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selectAll').on('click', function() {
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('admin-notification.select-all-user') }}",
|
||||||
|
type: 'GET',
|
||||||
|
success: function(result) {
|
||||||
|
selected = result.users;
|
||||||
|
listUser.ajax.reload();
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan di server',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#deselectAll').on('click', function() {
|
||||||
|
listUser.rows().deselect();
|
||||||
|
selected = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#formNotif').on('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
|
||||||
|
let form = this;
|
||||||
|
|
||||||
|
if (!form.checkValidity()) {
|
||||||
|
form.reportValidity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let formData = new FormData(this);
|
||||||
|
|
||||||
|
if (selected.length > 0) {
|
||||||
|
selected.forEach(element => {
|
||||||
|
formData.append('receivers[]', element);
|
||||||
|
});
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
|
||||||
|
allowEscapeKey: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
didOpen: () => {
|
||||||
|
Swal.showLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('admin-notification.store') }}",
|
||||||
|
type: 'POST',
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
data: formData,
|
||||||
|
success: function(result) {
|
||||||
|
Swal.fire({
|
||||||
|
title: result.status ? 'Berhasil' : 'Gagal',
|
||||||
|
text: result.message,
|
||||||
|
icon: result.status ? 'success' : 'error'
|
||||||
|
}).then(function() {
|
||||||
|
if (result.status) {
|
||||||
|
location.href =
|
||||||
|
"{{ route('admin-notification.index') }}";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan di server',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Tambah Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin-notification.index') }}"></a>Notifikasi</div>
|
||||||
|
<div class="breadcrumb-item">Tambah Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="javascript:void(0)" id="formNotif" enctype="multipart/form-data" method="POST">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="inputTitle">
|
||||||
|
<h5>Judul</h5>
|
||||||
|
</label>
|
||||||
|
<input type="text" class="form-control font-weight-bold" name="title" id="inputTitle"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
<div class="form-row mt-4">
|
||||||
|
<label for="inputContent">
|
||||||
|
<h5>Isi/Konten</h5>
|
||||||
|
</label>
|
||||||
|
<textarea class="form-control" name="content" id="inputContent" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-center mt-5 mb-3">
|
||||||
|
Daftar akun akan yang mendapatkan notifikasi
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="table-user" style="font-size: 16px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
Nama Lengkap
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
Email
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn btn-success btn-icon icon-left" id="kirimData">
|
||||||
|
<i class="fa fa-pencil-alt m-2"></i>Buat
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
240
resources/views/Admin/notification/edit.blade.php
Normal file
240
resources/views/Admin/notification/edit.blade.php
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
let selected = {!! json_encode($email) !!};
|
||||||
|
|
||||||
|
let listUser = $('#table-user').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('admin-notification.list-user-for-create-edit') }}",
|
||||||
|
data: {
|
||||||
|
id: "{{ $notification->id }}",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
name: 'DT_RowIndex',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'nama_lengkap',
|
||||||
|
name: 'nama_lengkap',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'email',
|
||||||
|
name: 'email',
|
||||||
|
className: 'text-center'
|
||||||
|
}],
|
||||||
|
rowId: 'DT_RowIndex',
|
||||||
|
rowCallback: function(row, data) {
|
||||||
|
selected.forEach(element => {
|
||||||
|
if (element == data.email) {
|
||||||
|
$(row).addClass('selected');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
createdRow: function(row, data, dataIndex) {
|
||||||
|
$(row).attr('data-email', data.email);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#table-user tbody').on('click', 'tr', function() {
|
||||||
|
var email = $(this).data('email');
|
||||||
|
var index = $.inArray(email, selected);
|
||||||
|
|
||||||
|
if (index === -1) {
|
||||||
|
selected.push(email);
|
||||||
|
console.log(index);
|
||||||
|
} else {
|
||||||
|
selected.splice(index, 1);
|
||||||
|
console.log(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).toggleClass('selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#selectAll').on('click', function() {
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('admin-notification.select-all-user') }}",
|
||||||
|
type: 'GET',
|
||||||
|
success: function(result) {
|
||||||
|
selected = result.users;
|
||||||
|
listUser.ajax.reload();
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan di server',
|
||||||
|
icon: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#deselectAll').on('click', function() {
|
||||||
|
listUser.rows().deselect();
|
||||||
|
selected = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#formNotif').on('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
|
||||||
|
let form = this;
|
||||||
|
|
||||||
|
if (!form.checkValidity()) {
|
||||||
|
form.reportValidity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let formData = new FormData(this);
|
||||||
|
|
||||||
|
console.log(selected);
|
||||||
|
|
||||||
|
if (selected.length > 0) {
|
||||||
|
selected.forEach(element => {
|
||||||
|
formData.append('receivers[]', element);
|
||||||
|
});
|
||||||
|
formData.append('id', "{{ $notification->id }}");
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
html: '<div class="mt-3"><lord-icon src="https://cdn.lordicon.com/etwtznjn.json" trigger="loop" colors="primary:#0ab39c,secondary:#405189" style="width:120px;height:120px"></lord-icon><div class="mt-4 pt-2 fs-15"><h4>Form Anda sedang diproses!</h4><p class="text-muted mx-4 mb-0">Mohon tunggu...</p></div></div>',
|
||||||
|
allowEscapeKey: false,
|
||||||
|
allowOutsideClick: false,
|
||||||
|
didOpen: () => {
|
||||||
|
Swal.showLoading();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('admin-notification.update') }}",
|
||||||
|
type: 'POST',
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
data: formData,
|
||||||
|
success: function(result) {
|
||||||
|
Swal.close();
|
||||||
|
Swal.fire({
|
||||||
|
title: result.status ? 'Berhasil' : 'Gagal',
|
||||||
|
text: result.message,
|
||||||
|
icon: result.status ? 'success' : 'error'
|
||||||
|
}).then(function() {
|
||||||
|
if (result.status) {
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('admin-notification.update-new-notification') }}",
|
||||||
|
data: formData,
|
||||||
|
type: 'POST',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
});
|
||||||
|
// location.href =
|
||||||
|
// "{{ route('admin-notification.index') }}";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Swal.fire({
|
||||||
|
title: 'Gagal',
|
||||||
|
text: 'Terjadi kesalahan di server',
|
||||||
|
icon: 'error',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Edit Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin-notification.index') }}"></a>Notifikasi</div>
|
||||||
|
<div class="breadcrumb-item">Edit Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form action="javascript:void(0)" id="formNotif" enctype="multipart/form-data" method="POST">
|
||||||
|
<div class="form-row mb-4">
|
||||||
|
<label for="inputTitle">
|
||||||
|
<h5>Judul</h5>
|
||||||
|
</label>
|
||||||
|
<input type="text" class="form-control font-weight-bold" name="title" id="inputTitle"
|
||||||
|
value="{{ $notification->title }}" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-row mb-4">
|
||||||
|
<label for="inputContent">
|
||||||
|
<h5>Isi/Konten</h5>
|
||||||
|
</label>
|
||||||
|
<textarea class="form-control" name="content" id="inputContent" required>{{ $notification->content }}</textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-center mt-5 mb-3">
|
||||||
|
Daftar akun akan yang mendapatkan notifikasi
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<div class="mb-2">
|
||||||
|
<button class="btn btn-primary" id="selectAll">Pilih Semua</button>
|
||||||
|
<button class="btn btn-danger" id="deselectAll">Hapus Semua</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="table table-striped" id="table-user" style="font-size: 16px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
Nama Lengkap
|
||||||
|
</th>
|
||||||
|
<th class="text-center">
|
||||||
|
Email
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn btn-success btn-icon icon-left" id="kirimData">
|
||||||
|
<i class="fa fa-pencil-alt m-2"></i>Update
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
120
resources/views/Admin/notification/index.blade.php
Normal file
120
resources/views/Admin/notification/index.blade.php
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
let listNotifikasi = $('#table-notifikasi').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: "{{ route('admin-notification.list-notification') }}",
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
name: 'DT_RowIndex',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'title',
|
||||||
|
name: 'title',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'teaser',
|
||||||
|
name: 'teaser',
|
||||||
|
orderable: false
|
||||||
|
|
||||||
|
}, {
|
||||||
|
data: 'created_at',
|
||||||
|
name: 'created_at',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var date = new Date(data);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year;
|
||||||
|
return formattedDate;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'updated_at',
|
||||||
|
name: 'updated_at',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var date = new Date(data);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year;
|
||||||
|
return formattedDate;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'action',
|
||||||
|
name: 'action',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item">Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-end mb-3">
|
||||||
|
<a class="btn btn-success active" href="{{ route('admin-notification.create') }}">Tambah
|
||||||
|
Notifikasi</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="table-notifikasi" style="font-size: 16px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Judul
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Teaser
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Dibuat pada
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Diperbarui pada
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Aksi
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
130
resources/views/Admin/notification/show.blade.php
Normal file
130
resources/views/Admin/notification/show.blade.php
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
let listUser = $('#table-user').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('admin-notification.list-user-for-show') }}",
|
||||||
|
data: {
|
||||||
|
id: "{{ $notification->id }}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
name: 'DT_RowIndex',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'nama_lengkap',
|
||||||
|
name: 'nama_lengkap',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'receiver',
|
||||||
|
name: 'receiver',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'created_at',
|
||||||
|
name: 'created_at',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var date = new Date(data);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year;
|
||||||
|
return formattedDate;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'updated_at',
|
||||||
|
name: 'updated_at',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var date = new Date(data);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year;
|
||||||
|
return formattedDate;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
className: 'text-center'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Detail Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('admin-notification.index') }}">Notifikasi</a></div>
|
||||||
|
<div class="breadcrumb-item">Detail Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-start mb-3">
|
||||||
|
<h2>{{ $notification->title }}</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-start mb-3">
|
||||||
|
{{ $notification->content }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mt-5 mb-3">
|
||||||
|
Daftar akun yang mendapatkan notifikasi
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="table-user" style="font-size: 16px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Nama Lengkap
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Email
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Tanggal Kirim
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Tanggal Terima
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<a href="{{ route('admin-notification.edit', ['id' => $notification->id]) }}"
|
||||||
|
class="btn btn-success btn-icon icon-left">
|
||||||
|
<i class="fa fa-pencil-alt m-2"></i>Edit
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
@ -196,7 +196,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-end mb-3">
|
<div class="d-flex justify-content-end mb-3">
|
||||||
<a class="btn btn-success active" href="#" id="tambahModal">Tambah Data Kebijakan</a>
|
<a class="btn btn-success active" href="#" id="tambahModal">Tambah Kebijakan</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped" id="table-setting" style="font-size: 16px;">
|
<table class="table table-striped" id="table-setting" style="font-size: 16px;">
|
||||||
|
@ -97,6 +97,64 @@
|
|||||||
</address>
|
</address>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{-- batas pembayaran dan pengiriman --}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<address>
|
||||||
|
<strong>Batas Pembayaran:</strong><br>
|
||||||
|
{{ date('d F Y', strtotime($transaction->batas_pembayaran)) }}<br>
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-md-right">
|
||||||
|
<address>
|
||||||
|
<strong>Estimasi Pengiriman:</strong><br>
|
||||||
|
{{ date('Y', strtotime($transaction->batas_pengiriman_barang_awal)) ==
|
||||||
|
date('Y', strtotime($transaction->batas_pengiriman_barang_akhir))
|
||||||
|
? (date('F', strtotime($transaction->batas_pengiriman_barang_awal)) ==
|
||||||
|
date('F', strtotime($transaction->batas_pengiriman_barang_akhir))
|
||||||
|
? date('d', strtotime($transaction->batas_pengiriman_barang_awal)) .
|
||||||
|
'-' .
|
||||||
|
date('d F Y', strtotime($transaction->batas_pengiriman_barang_akhir))
|
||||||
|
: date('F', strtotime($transaction->batas_pengiriman_barang_awal)) .
|
||||||
|
'-' .
|
||||||
|
date('d F Y', strtotime($transaction->batas_pengiriman_barang_akhir)))
|
||||||
|
: date('d F', strtotime($transaction->batas_pengiriman_barang_awal)) .
|
||||||
|
'-' .
|
||||||
|
date('d F Y', strtotime($transaction->batas_pengiriman_barang_akhir)) }}<br>
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{-- Keterangan Pembayaran --}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<address>
|
||||||
|
<strong>Status Transaksi:</strong><br>
|
||||||
|
{{ ucwords($transaction->status_transaksi) }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-md-right">
|
||||||
|
<address>
|
||||||
|
<strong>Status Pembayaran:</strong><br>
|
||||||
|
{{ ucwords($transaction->status_pembayaran) }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Keterangan --}}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<address>
|
||||||
|
<strong>Status Indikasi Penipuan:</strong><br>
|
||||||
|
{{ $transaction->fraud_status == null ? 'Tidak ada' : 'Ada' }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 text-md-right">
|
||||||
|
<address>
|
||||||
|
<strong>Keterangan:</strong><br>
|
||||||
|
{{ $transaction->keterangan }}
|
||||||
|
</address>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -161,18 +219,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
@if ($transaction->status_transaksi == 'challenge')
|
@if ($transaction->status_transaksi == 'challenge')
|
||||||
<hr>
|
|
||||||
<div class="text-md-center">
|
<div class="text-md-center">
|
||||||
<p>Pada transaksi ini terjadi penipuan. Apakah anda ini menerima transaksi ini?</p>
|
<p>Pada transaksi ini terjadi penipuan. Apakah anda ini menerima transaksi ini?</p>
|
||||||
<button class="btn btn-primary btn-icon icon-left" data-id="{{ $transaction->id }}"
|
<button class="btn btn-primary btn-icon icon-left" data-id="{{ $transaction->id }}"
|
||||||
id="acceptTransaction"><i class="fas fa-credit-card" id="payment"></i>Terima
|
id="acceptTransaction"><i class="fa fa-credit-card fa-lg m-2"
|
||||||
|
id="payment"></i>Terima
|
||||||
Transaksi</button>
|
Transaksi</button>
|
||||||
<button class="btn btn-danger btn-icon icon-left" data-id="{{ $transaction->id }}"
|
<button class="btn btn-danger btn-icon icon-left" data-id="{{ $transaction->id }}"
|
||||||
id="denyTransaction"><i class="fas fa-times"></i>
|
id="denyTransaction"><i class="fa fa-times fa-lg m-2"></i>
|
||||||
Tolak Transaksi</button>
|
Tolak Transaksi</button>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
@endif
|
@endif
|
||||||
|
<div class="text-md-right">
|
||||||
|
<button class="btn btn-warning btn-icon icon-left" id="btnPDF"
|
||||||
|
data-id="{{ $transaction->id }}"><i
|
||||||
|
class="fa fa-print fa-lg m-2"></i>Print</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -334,6 +399,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#btnPDF').on('click', function() {
|
||||||
|
const id = $(this).data('id');
|
||||||
|
location.href = "{{ route('invoice.get', ':id') }}".replace(':id', id);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<section class="section">
|
<section class="section">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 col-md-12 col-sm-12">
|
<div class="col-lg-4 col-md-4 col-sm-12">
|
||||||
<div class="card card-statistic-2">
|
<div class="card card-statistic-2">
|
||||||
<div class="card-stats">
|
<div class="card-stats">
|
||||||
<div class="card-stats-title">List Transaction -
|
<div class="card-stats-title">List Transaction -
|
||||||
@ -44,10 +44,11 @@
|
|||||||
Sebagai -
|
Sebagai -
|
||||||
<div class="dropdown d-inline">
|
<div class="dropdown d-inline">
|
||||||
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
|
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
|
||||||
id="orders-role">Pembeli</a>
|
id="orders-role">Semua</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-sm" aria-labelledby="orders-role"
|
<ul class="dropdown-menu dropdown-menu-sm" aria-labelledby="orders-role"
|
||||||
id="dropdownMenu3">
|
id="dropdownMenu3">
|
||||||
<li class="dropdown-title">Pilih Peran</li>
|
<li class="dropdown-title">Pilih Peran</li>
|
||||||
|
<li><a href="#" class="dropdown-item">Semua</a></li>
|
||||||
<li><a href="#" class="dropdown-item">Pembeli</a></li>
|
<li><a href="#" class="dropdown-item">Pembeli</a></li>
|
||||||
<li><a href="#" class="dropdown-item">Penjual</a></li>
|
<li><a href="#" class="dropdown-item">Penjual</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -66,6 +67,14 @@
|
|||||||
<div class="card-stats-item-count">23</div>
|
<div class="card-stats-item-count">23</div>
|
||||||
<div class="card-stats-item-label">Gagal</div>
|
<div class="card-stats-item-label">Gagal</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-stats-item">
|
||||||
|
<div class="card-stats-item-count">23</div>
|
||||||
|
<div class="card-stats-item-label">Gagal</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-stats-item">
|
||||||
|
<div class="card-stats-item-count">23</div>
|
||||||
|
<div class="card-stats-item-label">Gagal</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-icon shadow-primary bg-primary">
|
<div class="card-icon shadow-primary bg-primary">
|
||||||
@ -81,7 +90,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{-- <div class="col-lg-4 col-md-4 col-sm-12">
|
<div class="col-lg-4 col-md-4 col-sm-12">
|
||||||
<div class="card card-statistic-2">
|
<div class="card card-statistic-2">
|
||||||
<div class="card-chart">
|
<div class="card-chart">
|
||||||
<canvas id="balance-chart" height="80"></canvas>
|
<canvas id="balance-chart" height="80"></canvas>
|
||||||
@ -91,10 +100,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-wrap">
|
<div class="card-wrap">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4>Jumlah Refund</h4>
|
<h4>Pemasukan</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
190 Bulan ini
|
Rp. 35.000.000,00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -109,13 +118,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-wrap">
|
<div class="card-wrap">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h4>Total Transaction </h4>
|
<h4>Pengeluaran</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">Rp. 35.000.000,00</div>
|
||||||
109 Bulan ini</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> --}}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -168,7 +176,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Refund',
|
label: 'Refund',
|
||||||
data: [2207, 3403, 220000, 5025, 2302, 4208, 3880, 4880, 5000],
|
data: [2207, 3403, 2200, 5025, 2302, 4208, 3880, 4880, 5000],
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
backgroundColor: 'rgba(254,86,83,.7)',
|
backgroundColor: 'rgba(254,86,83,.7)',
|
||||||
borderWidth: 0,
|
borderWidth: 0,
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Detail Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('user.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('user-notification.index') }}">Notifikasi</a></div>
|
||||||
|
<div class="breadcrumb-item">Detail Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-start mb-3">
|
||||||
|
<h2>{{ $notification->title }}</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-start mb-3">
|
||||||
|
{{ $notification->content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
108
resources/views/User/notification/index.blade.php
Normal file
108
resources/views/User/notification/index.blade.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
@extends('layouts.main')
|
||||||
|
@section('content')
|
||||||
|
<style>
|
||||||
|
.unread {
|
||||||
|
background-color: #a3194e;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
let listUser = $('#table-notifikasi').DataTable({
|
||||||
|
processing: true,
|
||||||
|
serverSide: true,
|
||||||
|
ajax: {
|
||||||
|
url: "{{ route('user-notification.list-notification') }}",
|
||||||
|
},
|
||||||
|
columns: [{
|
||||||
|
data: 'DT_RowIndex',
|
||||||
|
name: 'DT_RowIndex',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'title',
|
||||||
|
name: 'title',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'teaser',
|
||||||
|
name: 'teaser',
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'created_at',
|
||||||
|
name: 'created_at',
|
||||||
|
render: function(data, type, row) {
|
||||||
|
if (type === 'display') {
|
||||||
|
var date = new Date(data);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year;
|
||||||
|
return formattedDate;
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
className: 'text-center'
|
||||||
|
}, {
|
||||||
|
data: 'action',
|
||||||
|
name: 'action',
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
className: 'text-center'
|
||||||
|
}],
|
||||||
|
rowCallback: function(row, data) {
|
||||||
|
if (data.status == 'unread') {
|
||||||
|
$(row).addClass('unread');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="main-content">
|
||||||
|
<section class="section">
|
||||||
|
<div class="section-header">
|
||||||
|
<h1>Notifikasi</h1>
|
||||||
|
<div class="section-header-breadcrumb">
|
||||||
|
<div class="breadcrumb-item active"><a href="{{ route('user.index') }}">Dashboard</a></div>
|
||||||
|
<div class="breadcrumb-item">Notifikasi</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped" id="table-notifikasi" style="font-size: 16px;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">
|
||||||
|
#
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Judul
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Teaser
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Tanggal Dibuat
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Aksi
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
@endsection
|
@ -28,9 +28,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.info-user,
|
.info-user,
|
||||||
|
.data-pesanan,
|
||||||
.rincian-pesanan,
|
.rincian-pesanan,
|
||||||
.info-pembayaran,
|
.info-pembayaran,
|
||||||
.data-pesanan {
|
.judul-rincian {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@ -42,9 +43,10 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
table h3 {
|
h3 {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
color: #191919;
|
color: #191919;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
table span {
|
table span {
|
||||||
@ -58,8 +60,8 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.py-2 {
|
table hr {
|
||||||
padding: 20px 0;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pt-0 {
|
.pt-0 {
|
||||||
@ -70,20 +72,17 @@
|
|||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pt-4 {
|
.pb-2 {
|
||||||
padding-top: 40px;
|
padding-bottom: 20px;
|
||||||
}
|
|
||||||
|
|
||||||
.pb-1 {
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pr-1 {
|
.pr-1 {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pl-1 {
|
.info-user td,
|
||||||
padding-left: 10px;
|
.judul-rincian td {
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-user td:first-child {
|
.info-user td:first-child {
|
||||||
@ -104,12 +103,13 @@
|
|||||||
|
|
||||||
.info-pembayaran td:first-child {
|
.info-pembayaran td:first-child {
|
||||||
opacity: 1%;
|
opacity: 1%;
|
||||||
|
width: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-pembayaran td:last-child {
|
.info-pembayaran td:last-child {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
background: whitesmoke;
|
background: whitesmoke;
|
||||||
width: 60%;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-pesanan {
|
.data-pesanan {
|
||||||
@ -117,11 +117,10 @@
|
|||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-pesanan thead {
|
.data-pesanan th {
|
||||||
height: 40px;
|
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
padding: 20px 25px;
|
padding: 15px 30px 5px 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-pesanan td {
|
.data-pesanan td {
|
||||||
@ -176,13 +175,13 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3 style="text-align: center;">Nota Pesanan</h3>
|
<h3>Nota Pesanan</h3>
|
||||||
<table class="info-user">
|
<table class="info-user">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-2">
|
<td class="pt-0">
|
||||||
<p>Pembeli :</p>
|
<p>Pembeli :</p>
|
||||||
</td>
|
</td>
|
||||||
<td class="pt-2">
|
<td class="pt-0">
|
||||||
<p>Penjual :</p>
|
<p>Penjual :</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -191,24 +190,24 @@
|
|||||||
<td><span>Takapedia Top Up</span></td>
|
<td><span>Takapedia Top Up</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-0">
|
<td>
|
||||||
<p>Email :</p>
|
<p>Email :</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-0"><span>darwin@gmail.com</span></td>
|
<td><span>darwin@gmail.com</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-0">
|
<td>
|
||||||
<p>Alamat :</p>
|
<p>Alamat :</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pr-1"><span>Pondok ponogoro jl.raya bogor no.26 rt 2/2Pondok ponogoro jl.raya bogor no.26
|
<td class="pr-1"><span>Pondok ponogoro jl.raya bogor no.26 rt 2/2Pondok ponogoro jl.raya bogor no.26 rt
|
||||||
rt 2/2</span></td>
|
2/2</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-0" colspan="2">
|
<td colspan="2">
|
||||||
<p>no. HP :</p>
|
<p>no. HP :</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -230,15 +229,15 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table class="pb-1">
|
<table class="judul-rincian">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pt-0">
|
<td>
|
||||||
<h4>Rincian Pesanan</h4>
|
<p>Rincian Pesanan</p>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="start" colspan="2"><span>Semua pesanan yang di daftarkan dalam transaksi</span></td>
|
<td><span>Semua pesanan yang di daftarkan dalam transaksi</span></td>
|
||||||
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table class="rincian-pesanan">
|
<table class="rincian-pesanan">
|
||||||
@ -259,40 +258,40 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<table class="info-pembayaran pt-4">
|
<table class="info-pembayaran">
|
||||||
<tr>
|
<tr>
|
||||||
<td>[ini kosongggggggggggggggggggg]</td>
|
<td>[ini kosong]</td>
|
||||||
<td><label>subtotal :</label></td>
|
<td style="width: 45%;" class="pt-2"><label>subtotal :</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td colspan="2">
|
<td style="width: 45%;" colspan="2">
|
||||||
<p>Rp.35.989.184,00</p>
|
<p>Rp.35.989.184,00</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td colspan="2" class="pt-1"><label>biaya admin</label></td>
|
<td style="width: 45%;" colspan="2"><label>biaya admin</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td colspan="2">
|
<td style="width: 45%;" colspan="2">
|
||||||
<p>Rp.30.000,00</p>
|
<p>Rp.30.000,00</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td class="py-2">
|
<td style="width: 45%;">
|
||||||
<hr>
|
<hr>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td colspan="2"><label>total</label></td>
|
<td style="width: 45%;" colspan="2"><label>total</label></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[kosong]</td>
|
<td>[kosong]</td>
|
||||||
<td colspan="2">
|
<td style="width: 45%;" class="pb-2" colspan="2">
|
||||||
<p>Rp.30.000,00</p>
|
<p>Rp.30.000,00</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<div class="text-md-right">
|
<div class="text-md-right">
|
||||||
<button class="btn btn-warning btn-icon icon-left" id="btnPDF"
|
<button class="btn btn-warning btn-icon icon-left" id="btnPDF"
|
||||||
data-id="{{ $transaction->id }}"><i class="fas fa-print"></i>Print</button>
|
data-id="{{ $transaction->id }}"><i class="fa fa-print m-2"></i>Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
use App\Models\NotificationReceiver;
|
||||||
|
|
||||||
|
$new = NotificationReceiver::where('receiver', auth()->user()->email)
|
||||||
|
->where('status', 'unread')
|
||||||
|
->count();
|
||||||
|
?>
|
||||||
<div class="navbar-bg"></div>
|
<div class="navbar-bg"></div>
|
||||||
<nav class="navbar navbar-expand-lg main-navbar">
|
<nav class="navbar navbar-expand-lg main-navbar">
|
||||||
<form class="form-inline mr-auto">
|
<form class="form-inline mr-auto">
|
||||||
@ -8,138 +15,26 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
<ul class="navbar-nav navbar-right">
|
<ul class="navbar-nav navbar-right">
|
||||||
<li class="dropdown dropdown-list-toggle"><a href="#" data-toggle="dropdown"
|
@if (auth()->user()->role != 'Admin')
|
||||||
class="nav-link nav-link-lg message-toggle beep"><i class="far fa-envelope"></i></a>
|
<li class="dropdown dropdown-list-toggle"><a href="#" data-toggle="dropdown"
|
||||||
<div class="dropdown-menu dropdown-list dropdown-menu-right">
|
class="nav-link notification-toggle nav-link-lg {{ $new > 0 ? 'beep' : '' }}" id="notifBtn"><i
|
||||||
<div class="dropdown-header">Messages
|
class="far fa-bell"></i></a>
|
||||||
<div class="float-right">
|
<div class="dropdown-menu dropdown-list dropdown-menu-right">
|
||||||
<a href="#">Mark All As Read</a>
|
<div class="dropdown-header">Notifikasi
|
||||||
|
<div class="float-right">
|
||||||
|
<a href="javascript: void(0);" id="markAllAsRead">Mark All As Read</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-list-content dropdown-list-icons" id="notifContent">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-footer text-center">
|
||||||
|
<a href="{{ route('user-notification.index') }}">View All <i
|
||||||
|
class="fas fa-chevron-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-list-content dropdown-list-message">
|
</li>
|
||||||
<a href="#" class="dropdown-item dropdown-item-unread">
|
@endif
|
||||||
<div class="dropdown-item-avatar">
|
|
||||||
<img alt="image" src="{{ asset('assets/img/avatar/avatar-1.png') }}"
|
|
||||||
class="rounded-circle">
|
|
||||||
<div class="is-online"></div>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Kusnaedi</b>
|
|
||||||
<p>Hello, Bro!</p>
|
|
||||||
<div class="time">10 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item dropdown-item-unread">
|
|
||||||
<div class="dropdown-item-avatar">
|
|
||||||
<img alt="image" src="{{ asset('assets/img/avatar/avatar-2.png') }}"
|
|
||||||
class="rounded-circle">
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Dedik Sugiharto</b>
|
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit</p>
|
|
||||||
<div class="time">12 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item dropdown-item-unread">
|
|
||||||
<div class="dropdown-item-avatar">
|
|
||||||
<img alt="image" src="{{ asset('assets/img/avatar/avatar-3.png') }}"
|
|
||||||
class="rounded-circle">
|
|
||||||
<div class="is-online"></div>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Agung Ardiansyah</b>
|
|
||||||
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
||||||
<div class="time">12 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-avatar">
|
|
||||||
<img alt="image" src="{{ asset('assets/img/avatar/avatar-4.png') }}"
|
|
||||||
class="rounded-circle">
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Ardian Rahardiansyah</b>
|
|
||||||
<p>Duis aute irure dolor in reprehenderit in voluptate velit ess</p>
|
|
||||||
<div class="time">16 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-avatar">
|
|
||||||
<img alt="image" src="{{ asset('assets/img/avatar/avatar-5.png') }}"
|
|
||||||
class="rounded-circle">
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Alfa Zulkarnain</b>
|
|
||||||
<p>Exercitation ullamco laboris nisi ut aliquip ex ea commodo</p>
|
|
||||||
<div class="time">Yesterday</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-footer text-center">
|
|
||||||
<a href="#">View All <i class="fas fa-chevron-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown dropdown-list-toggle"><a href="#" data-toggle="dropdown"
|
|
||||||
class="nav-link notification-toggle nav-link-lg beep"><i class="far fa-bell"></i></a>
|
|
||||||
<div class="dropdown-menu dropdown-list dropdown-menu-right">
|
|
||||||
<div class="dropdown-header">Notifications
|
|
||||||
<div class="float-right">
|
|
||||||
<a href="#">Mark All As Read</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-list-content dropdown-list-icons">
|
|
||||||
<a href="#" class="dropdown-item dropdown-item-unread">
|
|
||||||
<div class="dropdown-item-icon bg-primary text-white">
|
|
||||||
<i class="fas fa-code"></i>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
Template update is available now!
|
|
||||||
<div class="time text-primary">2 Min Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-icon bg-info text-white">
|
|
||||||
<i class="far fa-user"></i>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>You</b> and <b>Dedik Sugiharto</b> are now friends
|
|
||||||
<div class="time">10 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-icon bg-success text-white">
|
|
||||||
<i class="fas fa-check"></i>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
<b>Kusnaedi</b> has moved task <b>Fix bug header</b> to <b>Done</b>
|
|
||||||
<div class="time">12 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-icon bg-danger text-white">
|
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
Low disk space. Let's clean it!
|
|
||||||
<div class="time">17 Hours Ago</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="dropdown-item">
|
|
||||||
<div class="dropdown-item-icon bg-info text-white">
|
|
||||||
<i class="fas fa-bell"></i>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-item-desc">
|
|
||||||
Welcome to Stisla template!
|
|
||||||
<div class="time">Yesterday</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="dropdown-footer text-center">
|
|
||||||
<a href="#">View All <i class="fas fa-chevron-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown"><a href="#" data-toggle="dropdown"
|
<li class="dropdown"><a href="#" data-toggle="dropdown"
|
||||||
class="nav-link dropdown-toggle nav-link-lg nav-link-user">
|
class="nav-link dropdown-toggle nav-link-lg nav-link-user">
|
||||||
<img alt="image"
|
<img alt="image"
|
||||||
@ -160,3 +55,125 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var notifBtn = $('#notifBtn');
|
||||||
|
|
||||||
|
function updateNotif() {
|
||||||
|
notifBtn.toggleClass("beep");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#notifBtn').on('click', function() {
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
var notifContent = $('#notifContent');
|
||||||
|
var activitiesHtml = '';
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('user-notification.latest-notification') }}",
|
||||||
|
type: 'GET',
|
||||||
|
success: function(response) {
|
||||||
|
var notifications = response.notifications;
|
||||||
|
if (notifications.length > 0) {
|
||||||
|
notifications.forEach(element => {
|
||||||
|
var url =
|
||||||
|
"{{ route('user-notifiaction.detail-notification', ':id') }}"
|
||||||
|
.replace(':id', element.id);
|
||||||
|
|
||||||
|
var date = new Date(element.updated_at);
|
||||||
|
var day = date.getDate();
|
||||||
|
var month = date.toLocaleString('id-ID', {
|
||||||
|
month: 'short'
|
||||||
|
});
|
||||||
|
var year = date.getFullYear();
|
||||||
|
var hours = date.getHours();
|
||||||
|
var minutes = date.getMinutes();
|
||||||
|
|
||||||
|
var formattedDate = day + ' ' + month + ' ' + year +
|
||||||
|
" | " + hours + ":" + +(minutes < 10 ? '0' : '') +
|
||||||
|
minutes;
|
||||||
|
|
||||||
|
activitiesHtml += `
|
||||||
|
<a href="${url}" class="dropdown-item dropdown-item-unread">
|
||||||
|
<div class="dropdown-item-icon bg-primary text-white">
|
||||||
|
<i class="fas fa-code"></i>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item-desc">
|
||||||
|
<h6>${element.title}</h6>
|
||||||
|
${element.teaser}
|
||||||
|
<div class="time text-primary">${formattedDate}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
activitiesHtml += `
|
||||||
|
<a class="dropdown-item dropdown-item-unread">
|
||||||
|
<div class="dropdown-item-icon bg-primary text-white">
|
||||||
|
<i class="fas fa-code"></i>
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-item-desc">
|
||||||
|
Tidak ada notifikasi baru
|
||||||
|
<div class="time text-primary">--:--</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
notifContent.html(activitiesHtml);
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#markAllAsRead').on('click', function() {
|
||||||
|
const csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||||
|
console.log("Berhasil");
|
||||||
|
|
||||||
|
$.ajaxSetup({
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': csrfToken
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ route('user.notification.mark-all-as-read') }}",
|
||||||
|
type: 'GET',
|
||||||
|
success: function(response) {
|
||||||
|
if (response.status) {
|
||||||
|
updateNotif();
|
||||||
|
console.log(response);
|
||||||
|
} else {
|
||||||
|
console.log(response);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Pusher.logToConsole = true;
|
||||||
|
var pusher = new Pusher('3e5bdc20dddd7fbc655e', {
|
||||||
|
cluster: 'ap1'
|
||||||
|
});
|
||||||
|
|
||||||
|
var channel = pusher.subscribe('chanel-update-notifikasi');
|
||||||
|
|
||||||
|
channel.bind('event-update-notifikasi', function(data) {
|
||||||
|
let receivers = data.receivers;
|
||||||
|
let userEmail = "{{ auth()->user()->email }}";
|
||||||
|
receivers.forEach(email => {
|
||||||
|
if (email == userEmail) {
|
||||||
|
updateNotif();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<script src="{{ asset('assets/modules/popper.js') }}"></script>
|
<script src="{{ asset('assets/modules/popper.js') }}"></script>
|
||||||
<script src="{{ asset('assets/modules/bootstrap/js/bootstrap.min.js') }}"></script>
|
<script src="{{ asset('assets/modules/bootstrap/js/bootstrap.min.js') }}"></script>
|
||||||
|
|
||||||
|
<script src="https://js.pusher.com/7.2/pusher.min.js"></script>
|
||||||
|
|
||||||
<!-- dashboard -->
|
<!-- dashboard -->
|
||||||
<script src="{{ asset('assets/modules/chart.min.js') }}"></script>
|
<script src="{{ asset('assets/modules/chart.min.js') }}"></script>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
href="{{ route(Auth::user()->role == 'Admin' ? 'admin.index' : 'user.index') }}"><i
|
href="{{ route(Auth::user()->role == 'Admin' ? 'admin.index' : 'user.index') }}"><i
|
||||||
class="fas fa-fire"></i> <span>Dashboard</span></a></li>
|
class="fas fa-fire"></i> <span>Dashboard</span></a></li>
|
||||||
|
|
||||||
<li class="menu-header">Starter</li>
|
<li class="menu-header">Menu</li>
|
||||||
|
|
||||||
@if (Auth::user()->role == 'Admin')
|
@if (Auth::user()->role == 'Admin')
|
||||||
<li><a class="nav-link {{ request()->routeIs('admin-user.index') ? 'active' : '' }}"
|
<li><a class="nav-link {{ request()->routeIs('admin-user.index') ? 'active' : '' }}"
|
||||||
@ -29,6 +29,9 @@
|
|||||||
<li><a class="nav-link {{ request()->routeIs('admin-setting.index') ? 'active' : '' }}"
|
<li><a class="nav-link {{ request()->routeIs('admin-setting.index') ? 'active' : '' }}"
|
||||||
href="{{ route('admin-setting.index') }}"><i class="fas fa-cog"></i>
|
href="{{ route('admin-setting.index') }}"><i class="fas fa-cog"></i>
|
||||||
<span>Setting</span></a></li>
|
<span>Setting</span></a></li>
|
||||||
|
<li><a class="nav-link {{ request()->routeIs('admin-notification.index') ? 'active' : '' }}"
|
||||||
|
href="{{ route('admin-notification.index') }}"><i class="fas fa-bell"></i>
|
||||||
|
<span>Notifikasi</span></a></li>
|
||||||
@else
|
@else
|
||||||
<li class="drop-down ">
|
<li class="drop-down ">
|
||||||
<a class="nav-link {{ request()->routeIs('user-pembeli.index') || request()->routeIs('user-penjual.index') ? 'active' : '' }}"
|
<a class="nav-link {{ request()->routeIs('user-pembeli.index') || request()->routeIs('user-penjual.index') ? 'active' : '' }}"
|
||||||
|
@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
|
|||||||
use App\Http\Controllers\Admin\User\AdminUserController;
|
use App\Http\Controllers\Admin\User\AdminUserController;
|
||||||
use App\Http\Controllers\Admin\Setting\AdminSettingController;
|
use App\Http\Controllers\Admin\Setting\AdminSettingController;
|
||||||
use App\Http\Controllers\Admin\Dashboard\AdminDashboardController;
|
use App\Http\Controllers\Admin\Dashboard\AdminDashboardController;
|
||||||
|
use App\Http\Controllers\Admin\Notification\AdminNotification;
|
||||||
use App\Http\Controllers\Admin\Transaction\AdminTransactionController;
|
use App\Http\Controllers\Admin\Transaction\AdminTransactionController;
|
||||||
use App\Http\Controllers\Admin\Refund\AdminRefundController;
|
use App\Http\Controllers\Admin\Refund\AdminRefundController;
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ use App\Http\Controllers\Profile\ProfileController;
|
|||||||
|
|
||||||
//Invoice
|
//Invoice
|
||||||
use App\Http\Controllers\Invoice\InvoiceController;
|
use App\Http\Controllers\Invoice\InvoiceController;
|
||||||
|
use App\Http\Controllers\User\Notification\UserNotification;
|
||||||
|
|
||||||
// use Illuminate\Foundation\Auth\User;
|
// use Illuminate\Foundation\Auth\User;
|
||||||
|
|
||||||
@ -125,6 +127,22 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
Route::post('admin-setting/store','store')->name('admin-setting.store');
|
Route::post('admin-setting/store','store')->name('admin-setting.store');
|
||||||
Route::put('admin-setting/active/','activeSetting')->name('admin-setting.active-setting');
|
Route::put('admin-setting/active/','activeSetting')->name('admin-setting.active-setting');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::controller(AdminNotification::class)->group(function(){
|
||||||
|
Route::get('admin-notification','index')->name('admin-notification.index');
|
||||||
|
Route::get('admin-notification/show/{id}','show')->name('admin-notification.show');
|
||||||
|
Route::get('admin-notification/create','create')->name('admin-notification.create');
|
||||||
|
Route::get('admin-notification/list-notification','listNotification')->name('admin-notification.list-notification');
|
||||||
|
Route::get('admin-notification/list-user-for-show','listUserForShow')->name('admin-notification.list-user-for-show');
|
||||||
|
Route::get('admin-notification/list-user-for-create-edit','listUserForCreateEdit')->name('admin-notification.list-user-for-create-edit');
|
||||||
|
Route::get('admin-notification/select-all-user','selectAllUser')->name('admin-notification.select-all-user');
|
||||||
|
Route::get('admin-notification/edit','edit')->name('admin-notification.edit');
|
||||||
|
Route::post('admin-notification/update-new-notification','updateNewNotification')->name('admin-notification.update-new-notification');
|
||||||
|
Route::post('admin-notification/store','store')->name('admin-notification.store');
|
||||||
|
Route::post('admin-notification/update','update')->name('admin-notification.update');
|
||||||
|
Route::delete('admin-notification/delete','delete')->name('admin-notification.delete');
|
||||||
|
Route::delete('admin-notification/delete-all','deleteAll')->name('admin-notification.delete-all');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,10 +201,18 @@ Route::middleware(['auth'])->group(function(){
|
|||||||
Route::controller(UserRefundController::class)->group(function(){
|
Route::controller(UserRefundController::class)->group(function(){
|
||||||
Route::get('user-refund','index')->name('user-refund.index');
|
Route::get('user-refund','index')->name('user-refund.index');
|
||||||
Route::get('user-refund/list-refund','listRefund')->name('user-refund.list-refund');
|
Route::get('user-refund/list-refund','listRefund')->name('user-refund.list-refund');
|
||||||
Route::get('user-refund/ajukan-komplain/{id}','create')->name('user-refund.create');
|
Route::get('user-refund/ajukan-komplain','create')->name('user-refund.create');
|
||||||
Route::get('user-refund/detail-refund/{id}','show')->name('user-refund.show');
|
Route::get('user-refund/detail-refund/{id}','show')->name('user-refund.show');
|
||||||
Route::post('user-refund','store')->name('user-refund.store');
|
Route::post('user-refund','store')->name('user-refund.store');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::controller(UserNotification::class)->group(function(){
|
||||||
|
Route::get('user-notification','index')->name('user-notification.index');
|
||||||
|
Route::get('user-notification/list-notification','listNotification')->name('user-notification.list-notification'); // untuk di index
|
||||||
|
Route::get('user-notification/detail-notification/{id}','show')->name('user-notifiaction.detail-notification');
|
||||||
|
Route::get('user-notification/latest-notification','latestNotification')->name('user-notification.latest-notification');
|
||||||
|
Route::get('user-notification/mark-all-as-read','markAllAsRead')->name('user.notification.mark-all-as-read');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user