Notifikasi, email dan dashboard

This commit is contained in:
Muhammad Raihan Surya 2023-12-06 11:40:38 +07:00
parent d501cefc46
commit fc7db3e110
55 changed files with 3240 additions and 976 deletions

View File

@ -17,8 +17,6 @@ class ContactApiController extends Controller
{
public function getListContact(Request $request)
{
// $token = JWTAuth::getToken();
// $user = JWTAuth::user($token);
$data = DB::table('contacts')
->join('users', 'contacts.relasi_kontak', '=', 'users.email')

View File

@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\API\Notification;
use App\Http\Controllers\Controller;
use App\Models\Notification;
use App\Models\NotificationReceiver;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class NotificationApiController extends Controller
{
public function listNotification(Request $request){
}
public function getDetailNotification(Request $request){
$notification = Notification::where('id', $request->input('id'))->get();
return response()->json([
'data' => $notification
]);
}
public function markAllAsRead(){
$result = NotificationReceiver::where('receiver', auth()->user()->email)->update([
'status' => 'read'
]);
if($result){
return response()->json([
'status' => true,
'message' => 'Berhasil'
]);
}else{
return response()->json([
'status' => false,
'message' => 'Gagal'
]);
Log::error($result);
}
}
}

View File

@ -8,76 +8,369 @@ use Carbon\Carbon;
use App\Models\Transaction;
use App\Models\Refund;
use App\Models\User;
use DateInterval;
use DateTime;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class AdminDashboardController extends Controller
{
public function index()
{
$currentMonth = Carbon::now()->month;
$currentYear = Carbon::now()->year;
$today = new DateTime();
$todayDate = $today->format('Y-m-d');
$pickDate = new DateTime();
$interval = new DateInterval('P29D');
$start = $pickDate->sub($interval);
$startDate = $start->format('Y-m-d');
$countSuccess = Transaction::where('status_pembayaran', 'settlement')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
$intervalBefore = new DateInterval('P1D');
$intervalBeforeStart = new DateInterval('P29D');
$endBefore = $pickDate->sub($intervalBefore);
$endBeforeDate = $endBefore->format('Y-m-d');
$startBefore = $pickDate->sub($intervalBeforeStart);
$startBeforeDate = $startBefore->format('Y-m-d');
$countSuccess = Transaction::whereIn('status_transaksi', ['done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // selesai
$countProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent', 'success', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // diproses
$countCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); //gagal
$countIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // terindikasi
$countWaiting = Transaction::where('status_transaksi', 'created_at')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // terindikasi
$totalTransaction = Transaction::whereNotIn('status_transaksi', ['refund'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // transaksi
$totalTransactionSebelum = Transaction::whereNotIn('status_transaksi', ['refund', 'created'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count(); // transaksi sebelum
$rateTransaction = floatval((floatval($totalTransaction)-floatval($totalTransactionSebelum))*100)/ ($totalTransactionSebelum == 0 ? 1 : floatval($totalTransactionSebelum));
$countPending = Refund::where('status', 'pending')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); //ajuan
$countApprove = Refund::where('status', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // disetujui
$countDeny = Refund::where('status', 'deny')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // ditolak
$totalRefund = Refund::whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count(); // refund
$totalRefundSebelum = Refund::whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count(); // refund sebelum
$rateRefund = floatval((floatval($totalRefund)-floatval($totalRefundSebelum))*100)/ ($totalRefundSebelum == 0 ? 1 : floatval($totalRefundSebelum));
$totalUser = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->count();
$countPending = Transaction::where('status_pembayaran', 'pending')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
$totalUserSebelum = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count();
$countCancelled = Transaction::where('status_pembayaran', 'cancel')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
->count();
$rateUser = floatval((floatval($totalUser)-floatval($totalUserSebelum))*100)/ ($totalUserSebelum == 0 ? 1 : floatval($totalUserSebelum));
$countRefund = Transaction::where('status_pembayaran', 'refund')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
->count();
$totalProfit = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->sum('total_keuntungan');
$totalTransaction = Transaction::whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
->count();
$totalProfitSebelum = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->sum('total_keuntungan');
$rateProfit = floatval((floatval($totalProfit)-floatval($totalProfitSebelum))*100)/ ($totalProfitSebelum == 0 ? 1 : floatval($totalProfitSebelum));
$dataChartTransaction = [];
$dataChartRefund = [];
$dataChartUser = [];
$dataLabel = [];
$totalRefund = Transaction::where('status_pembayaran', 'refund')->count();
$dataChartTotalRefund = [];
$startDate = $start;
$intervalDate = new DateInterval('P1D');
$todayDate = $today;
$endDate = $todayDate->add($intervalDate);
$totalUser = User::where('status', 'Finished')->count();
$dataChartTotalUser = [];
for ($date = clone $startDate; $date <= $endDate; $date->modify('+1 day')) {
$transaction = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_keuntungan');
for ($bulan = 1; $bulan <= 12; $bulan++) {
$transaction = Transaction::whereMonth('updated_at', $bulan)
->whereYear('updated_at', $currentYear)
->where('status_pembayaran', 'settlement')
->sum('total_bayar')/100;
$refund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_keuntungan');
$refund = Transaction::whereMonth('updated_at', $bulan)
->whereYear('updated_at', $currentYear)
->where('status_pembayaran', 'refund')
->sum('total_harga')/100;
$user = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', $date->format('Y-m-d'))
->count();
$dataChartTransaction[] = intval($transaction);
$dataChartRefund[] = intval($refund);
$dataChartTransaction[] = floatval($transaction) / 1000;
$dataChartRefund[] = floatval($refund) / 1000;
$dataChartUser[] = intval($user);
$dataLabel[] = $date->format('d/m/Y');
}
$transactions = Transaction::latest()
$dataTopUsers = Transaction::selectRaw(
"
CONCAT(users.nama_depan,' ',users.nama_belakang) AS nama_lengkap,
COUNT(CASE WHEN transactions.status_transaksi = 'done' OR refunds.status = 'refund' THEN 1 ELSE NULL END) AS jumlah_transaksi,
COUNT(CASE WHEN transactions.status_transaksi = 'done' THEN 1 ELSE NULL END) AS jumlah_transaksi_berhasil,
COUNT(CASE WHEN refunds.status = 'refund' THEN 1 ELSE NULL END) AS jumlah_refund_berhasil,
SUM(CASE WHEN refunds.status = 'refund' THEN refunds.total ELSE 0 END) AS total_refund_berhasil,
SUM(CASE WHEN transactions.status_transaksi = 'done' THEN transactions.total_harga ELSE 0 END) AS total_transaksi_berhasil,
users.foto_profile
",
)
->leftJoin('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->leftJoin('users', 'users.email', '=', 'transactions.pembeli')
->groupBy('nama_lengkap', 'users.foto_profile')
->orderBy('total_transaksi_berhasil', 'DESC')
->orderBy('total_refund_berhasil', 'ASC')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->limit(5)
->get();
return view('admin.index', compact('transactions', 'countSuccess', 'countPending', 'countCancelled', 'countRefund', 'totalRefund', 'totalUser', 'totalTransaction', 'dataChartTransaction', 'dataChartRefund', 'dataChartTotalUser', 'dataChartTotalRefund', 'transactions'));
return view('admin.index', compact(
'countSuccess',
'countProcessed',
'countCancelled',
'countIndicated',
'countWaiting',
'totalTransaction',
'rateTransaction',
'countPending',
'countApprove',
'countDeny',
'totalRefund',
'rateRefund',
'totalUser',
'rateUser',
'rateProfit',
'dataChartTransaction',
'dataChartRefund',
'dataChartUser',
'dataLabel',
'dataTopUsers'
));
}
public function getSelectedChart()
public function getDataBySearch(Request $request)
{
$dataChartLaporan = [];
$tahun = Carbon::now()->year;
$startDate = $request->startDate; // 0
$endDate = $request->endDate; // 29
$pickDate = new DateTime($request->startDate);
$startDateTime = new DateTime($request->startDate);
$endDateTime = new DateTime($request->endDate);
$interval = $startDateTime->diff($endDateTime);
$intervalBefore = new DateInterval('P1D');
$intervalBeforeStart = new DateInterval('P'.$interval->format('%a').'D');
$endBefore = $pickDate->sub($intervalBefore);
$endBeforeDate = $endBefore->format('Y-m-d'); // -1
$startBefore = $pickDate->sub($intervalBeforeStart);
$startBeforeDate = $startBefore->format('Y-m-d'); // -29
$countSuccess = Transaction::whereIn('status_transaksi', ['done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // selesai
$countProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent', 'success', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // diproses
$countCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); //gagal
$countIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // terindikasi
$countWaiting = Transaction::where('status_transaksi', 'created')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // terindikasi
$totalTransaction = Transaction::whereNotIn('status_transaksi', ['refund'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // transaksi
$totalTransactionSebelum = Transaction::whereNotIn('status_transaksi', ['refund'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count(); // transaksi
$rateTransaction = floatval((floatval($totalTransaction)-floatval($totalTransactionSebelum))*100)/ ($totalTransactionSebelum == 0 ? 1 : floatval($totalTransactionSebelum));
$countPending = Refund::where('status', 'pending')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); //ajuan
$countApprove = Refund::where('status', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // disetujui
$countDeny = Refund::where('status', 'deny')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // ditolak
$totalRefund = Refund::whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count(); // refund
$totalRefundSebelum = Refund::whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count();
$rateRefund = floatval((floatval($totalRefund)-floatval($totalRefundSebelum))*100)/ ($totalRefundSebelum == 0 ? 1 : floatval($totalRefundSebelum));
$totalUser = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->count();
$totalUserSebelum = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->count();
$rateUser = floatval((floatval($totalUser)-floatval($totalUserSebelum))*100)/ ($totalUserSebelum == 0 ? 1 : floatval($totalUserSebelum));
$totalProfit = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $endDate)
->sum('total_keuntungan');
$totalProfitSebelum = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->sum('total_keuntungan');
$rateProfit = floatval((floatval($totalProfit)-floatval($totalProfitSebelum))*100)/ ($totalProfitSebelum == 0 ? 1 : floatval($totalProfitSebelum));
$dataChartTransaction = [];
$dataChartRefund = [];
$dataChartUser = [];
$dataLabel = [];
$first = $startDateTime;
$intervalDate = new DateInterval('P1D');
$endPlus1 = $endDateTime;
$last = $endPlus1->add($intervalDate);
for ($date = clone $first; $date <= $last; $date->modify('+1 day')) {
$transaction = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_keuntungan');
$refund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_keuntungan');
$user = User::where('role', 'User')
->where('status', 'Finished')
->whereDate('created_at', $date->format('Y-m-d'))
->count();
$dataChartTransaction[] = floatval($transaction);
$dataChartRefund[] = floatval($refund);
$dataChartUser[] = intval($user);
$dataLabel[] = $date->format('d/m/Y');
}
public function getCharByYear()
{
$dataTopUsers = Transaction::selectRaw(
"
CONCAT(users.nama_depan,' ',users.nama_belakang) AS nama_lengkap,
COUNT(CASE WHEN transactions.status_transaksi = 'done' OR refunds.status = 'refund' THEN 1 ELSE NULL END) AS jumlah_transaksi,
COUNT(CASE WHEN transactions.status_transaksi = 'done' THEN 1 ELSE NULL END) AS jumlah_transaksi_berhasil,
COUNT(CASE WHEN refunds.status = 'refund' THEN 1 ELSE NULL END) AS jumlah_refund_berhasil,
SUM(CASE WHEN refunds.status = 'refund' THEN refunds.total ELSE 0 END) AS total_refund_berhasil,
SUM(CASE WHEN transactions.status_transaksi = 'done' THEN transactions.total_harga ELSE 0 END) AS total_transaksi_berhasil,
users.foto_profile
",
)
->leftJoin('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->leftJoin('users', 'users.email', 'transactions.pembeli')
->groupBy('nama_lengkap', 'users.foto_profile')
->orderBy('total_transaksi_berhasil', 'DESC')
->orderBy('total_refund_berhasil', 'ASC')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $endDate)
->limit(5)
->get();
return response()->json([
'countSuccess' => $countSuccess,
'countProcessed' => $countProcessed,
'countCancelled' => $countCancelled,
'countIndicated' => $countIndicated,
'countWaiting' => $countWaiting,
'totalTransaction' => $totalTransaction,
'rateTransaction' => $rateTransaction,
'countPending' => $countPending,
'countApprove' => $countApprove,
'countDeny' => $countDeny,
'totalRefund' => $totalRefund,
'rateRefund' => $rateRefund,
'totalUser' => $totalUser,
'rateUser' => $rateUser,
'rateProfit' => $rateProfit,
'dataChartTransaction' => $dataChartTransaction,
'dataChartRefund' => $dataChartRefund,
'dataChartUser' => $dataChartUser,
'dataLabel' => $dataLabel,
'dataTopUser' => $dataTopUsers,
'endDate' => $request->endDate,
]);
}
}

View File

@ -46,7 +46,7 @@ class AdminNotification extends Controller
public function listNotification(Request $request)
{
try {
$subQuery = Notification::latest()->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notifications.created_at');
$subQuery = Notification::latest('notifications.updated_at')->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notifications.created_at');
if ($request->has('search') && !empty($request->search['value'])) {
$searchNotif = $request->search['value'];
@ -266,6 +266,7 @@ class AdminNotification extends Controller
$email = NotificationReceiver::where('notification_id', $request->id)
->pluck('receiver')
->toArray();
return view('admin.notification.edit', compact('notification', 'email'));
}

View File

@ -11,6 +11,8 @@ use App\Models\RefundDescription;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\Controller;
use App\Models\Notification;
use App\Models\NotificationReceiver;
use App\Models\TransactionDescription;
use Carbon\Carbon;
use Illuminate\Support\Facades\Http;
@ -44,6 +46,7 @@ class AdminRefundController extends Controller
public function approveRefund(Request $request)
{
$refund = Refund::where('id', $request->id)->first();
$transactionDetail = Transaction::where('id', $refund->transaction_id)->first();
$params = [
'refund_key' => $request->id . '-ref1',
@ -60,7 +63,7 @@ class AdminRefundController extends Controller
'Content-Type' => 'application/json',
'Authorization' => "Basic $auth",
])
->post('https://api.sandbox.midtrans.com/v2/'.$request->id.'/refund', $params);
->post('https://api.sandbox.midtrans.com/v2/'.$refund->transaction_id.'/refund', $params);
$result = json_decode($response->body(), true);
$code = $result['status_code'];
@ -85,11 +88,31 @@ class AdminRefundController extends Controller
'deskripsi' => 'Admin telah menyetujui refund.',
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Refund Diterima',
'content' => 'Refund telah diterima dan uang akan dikembalikan ke pembeli. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => 'Refund telah diterima...',
]);
NotificationReceiver::create([
'receiver' => [
$transactionDetail->pembeli,
$transactionDetail->penjual
],
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Refund berhasil dilakukan. Uang akan dikembalikan ke pembeli.',
'receivers' => [
$transactionDetail->pembeli,
$transactionDetail->penjual
]
]);
} catch (Throwable $e) {
DB::rollBack();
@ -98,7 +121,7 @@ class AdminRefundController extends Controller
return response()->json([
'status' => false,
'message' => 'Refund gagal dilakukan',
'message' => 'Refund gagal dilakukan'
]);
}
}else{
@ -116,6 +139,7 @@ class AdminRefundController extends Controller
public function denyRefund(Request $request)
{
$refund = Refund::where('id', $request->id)->first();
$transactionDetail = Transaction::where('id', $refund->transaction_id)->first();
try {
Transaction::where('id', $refund->transaction_id)->update([
@ -136,11 +160,31 @@ class AdminRefundController extends Controller
'deskripsi' => 'Admin telah menolak refund. Transaksi akan diteruskan ke penjual. Alasan: '.$request->complaint,
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Refund Diterima',
'content' => 'Refund ditolak dan transaksi akan diteruskan ke penjual. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => 'Refund ditolak...',
]);
NotificationReceiver::create([
'receiver' => [
$transactionDetail->pembeli,
$transactionDetail->penjual
],
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Refund berhasil ditolak. Transaksi diselesaikan dan uang disampaikan ke penjual.',
'receivers' => [
$transactionDetail->pembeli,
$transactionDetail->penjual
]
]);
} catch (Throwable $e) {
DB::rollBack();
@ -160,7 +204,7 @@ class AdminRefundController extends Controller
$subQuery = Refund::join('transactions', 'refunds.transaction_id', '=', 'transactions.id')
->join('users as b', 'transactions.pembeli', '=', 'b.email')
->join('users as s', 'transactions.penjual', '=', 's.email')
->latest()
->latest('refunds.updated_at')
->select('refunds.id as id', DB::raw("CONCAT(b.nama_depan,' ', b.nama_belakang) as pembeli"), DB::raw("CONCAT(s.nama_depan,' ', s.nama_belakang) as penjual"), 'transactions.nama_barang as nama_barang', 'refunds.total as total', 'refunds.created_at', 'refunds.due_date', 'refunds.status');
if ($request->has('search') && !empty($request->search['value'])) {

View File

@ -86,7 +86,7 @@ class AdminSettingController extends Controller
public function listSetting(Request $request){
try{
$subQuery = Setting::latest()->select('id','bulan','tahun','persentase','status');
$subQuery = Setting::select('id','bulan','tahun','persentase','status')->orderBy('tahun', 'DESC')->orderBy('bulan', 'DESC');
if($request->has('search') && !empty($request->search['value'])){
$searchSetting = $request->search['value'];

View File

@ -4,6 +4,8 @@ namespace App\Http\Controllers\Admin\Transaction;
use App\Models\Transaction;
use App\Http\Controllers\Controller;
use App\Models\Notification;
use App\Models\NotificationReceiver;
use App\Models\TransactionDescription;
use App\Models\TransactionUser;
use Illuminate\Http\Request;
@ -52,6 +54,8 @@ class AdminTransactionController extends Controller
$result = json_decode($response->body(), true);
$code = $result['status_code'];
$transactionDetail = Transaction::where('id', $request->id)->first();
if($code == '200'){
try {
DB::beginTransaction();
@ -71,11 +75,33 @@ class AdminTransactionController extends Controller
'deskripsi' => 'Admin telah menerima pembayaran transaksi dan dilanjutkan ke penjual.',
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Transaksi Diterima',
'content' => 'Transaksi telah diterima dan akan dilanjutkan. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => 'Transaksi telah diterima...',
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->penjual,
'notification_id' => $notif->id
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->pembeli,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Transaksi telah diterima.'
'message' => 'Transaksi telah diterima.',
'receivers' => [
$transactionDetail->penjual,
$transactionDetail->pembeli
]
]);
} catch (Throwable $e) {
DB::rollBack();
@ -111,6 +137,8 @@ class AdminTransactionController extends Controller
$result = json_decode($response->body(), true);
$code = $result['status_code'];
$transactionDetail = Transaction::where('id', $request->id)->first();
if($code == '200'){
try {
DB::beginTransaction();
@ -130,11 +158,26 @@ class AdminTransactionController extends Controller
'deskripsi' => 'Admin telah menolak pembayaran. Alasan: '.$request->compaint,
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Transaksi Ditolak',
'content' => 'Transaksi anda ditolak oleh Admin. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => 'Transaksi anda ditolak...',
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->pembeli,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Transaksi telah ditolak.'
'message' => 'Transaksi telah ditolak.',
'receivers' => $transactionDetail->pembeli
]);
} catch (Throwable $e) {
DB::rollBack();
@ -159,7 +202,7 @@ class AdminTransactionController extends Controller
try {
$subQuery = Transaction::join('users as b', 'transactions.pembeli', '=', 'b.email')
->join('users as s', 'transactions.penjual', '=', 's.email')
->latest()
->latest('transactions.updated_at')
->select('transactions.id', 'transactions.nama_barang', DB::raw("CONCAT(b.nama_depan,' ',b.nama_belakang) as nama_pembeli"), DB::raw("CONCAT(s.nama_depan,' ',s.nama_belakang) as nama_penjual"), 'transactions.total_harga', 'transactions.created_at', 'transactions.status_transaksi');
if ($request->has('search') && !empty($request->search['value'])) {

View File

@ -4,9 +4,12 @@ namespace App\Http\Controllers\Admin\User;
use App\Models\User;
use App\Http\Controllers\Controller;
use App\Mail\approveUser;
use App\Mail\denyUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Yajra\DataTables\DataTables;
use Throwable;
@ -59,6 +62,13 @@ class AdminUserController extends Controller
public function approveUser(Request $request)
{
$user = User::where('id', $request->id)->first();
$email = $user->email;
$content = [
'email' => $email,
];
try {
DB::beginTransaction();
@ -66,6 +76,8 @@ class AdminUserController extends Controller
'status' => 'Finished',
]);
Mail::to($email)->send(new approveUser($content));
DB::commit();
return response()->json([
@ -81,6 +93,15 @@ class AdminUserController extends Controller
public function denyUser(Request $request)
{
$user = User::where('id', $request->id)->first();
$email = $user->email;
$keterangan = $request->keterangan;
$content = [
'keterangan' => $keterangan,
'email' => $email,
];
try {
DB::beginTransaction();
@ -89,6 +110,8 @@ class AdminUserController extends Controller
'keterangan' => $request->keterangan,
]);
Mail::to($email)->send(new denyUser($content));
DB::commit();
return response()->json([
@ -107,7 +130,7 @@ class AdminUserController extends Controller
try {
$subQuery = User::where('role', 'User')
->orderByRaw("CASE WHEN status = 'Progress' THEN 1 WHEN status = 'Finished' THEN 2 WHEN status = 'Rejected' THEN 3 ELSE 4 END ASC")
->latest()
->latest('transactions.updated_at')
->select('users.id', DB::raw("CONCAT(users.nama_depan, ' ', users.nama_belakang) as nama_lengkap"), 'users.email', 'users.foto_profile', 'users.status', 'users.created_at as tanggal_daftar');
if ($request->has('search') && !empty($request->search['value'])) {
@ -146,6 +169,17 @@ class AdminUserController extends Controller
$url .
'">Detail</a>
</li>
';
if($row->status == 'Rejected'){
$html_code .= '
<li><a class="dropdown-item"
id="deleteUser"
href="javascript: void(0);"
data-id="'.$row->id.'">Hapus</a>
</li>
';
}
$html_code .= '
</ul>
</div>';
return $html_code;

View File

@ -23,6 +23,7 @@ use Laravolt\Indonesia\Models\City;
use Laravolt\Indonesia\Models\District;
use Laravolt\Indonesia\Models\Province;
use Laravolt\Indonesia\Models\Village;
use Pusher\Pusher;
use Ramsey\Uuid\Uuid;
class LoginController extends Controller
@ -263,6 +264,19 @@ class LoginController extends Controller
DB::commit();
$options = [
'cluster' => 'ap1',
'useTLS' => true,
];
$pusher = new Pusher('3e5bdc20dddd7fbc655e', 'f2274c37c616d29ff590', '1659859', $options);
$payload = [
'service' => 'User'
];
$pusher->trigger('chanel-update-notifikasi-untuk-admin', 'event-update-notifikasi-untuk-admin', $payload);
return response()->json([
'status' => true,
'message' => 'Akun anda sudah terdaftar dan butuh verifikasi hingga maksimal 1 hari kerja',

View File

@ -26,15 +26,15 @@ class UserContactController extends Controller
{
if($request->input == '' || $request->input == null){
$data = DB::table('contacts')
->join('users', 'contacts.relasi_kontak', '=', 'users.email')
->select('contacts.relasi_kontak', 'users.nama_depan', 'users.nama_belakang')
->where('contacts.pemilik_kontak', '=', Auth::user()->email)
->join('users', 'contacts.relasi_kontak', '=', 'users.email')
->where('contacts.pemilik_kontak', '=', auth()->user()->email)
->paginate(10);
}else{
$data = DB::table('contacts')
->join('users', 'contacts.relasi_kontak', '=', 'users.email')
->select('contacts.relasi_kontak', 'users.nama_depan', 'users.nama_belakang')
->where('contacts.pemilik_kontak', '=', Auth::user()->email)
->where('contacts.pemilik_kontak', '=', auth()->user()->email)
->whereRaw(DB::raw("LOWER(CONCAT(users.nama_depan,' ',users.nama_belakang)) LIKE ?",['%'.strtolower($request->input).'%']))
->paginate(10);
}
@ -143,7 +143,8 @@ class UserContactController extends Controller
->select(
'contacts.id',
DB::raw("CONCAT(users.nama_depan, ' ', users.nama_belakang) as nama_lengkap"),
);
)
->orderBy('nama_lengkap');
if($request->has('search') && !empty($request->search['value'])){
$searchContact = $request->search['value'];

View File

@ -4,56 +4,646 @@ namespace App\Http\Controllers\User\Dashboard;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\RefundUser;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Throwable;
use DateInterval;
use DateTime;
class UserDashboardController extends Controller
{
public function index()
{
$currentMonth = Carbon::now()->month;
$currentYear = Carbon::now()->year;
$currentRole = 'Pembeli';
$today = new DateTime();
$todayDate = $today->format('Y-m-d');
$pickDate = new DateTime();
$interval = new DateInterval('P29D');
$start = $pickDate->sub($interval);
$startDate = $start->format('Y-m-d');
$countCreated = Transaction::where('status_transaksi', 'created')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
$intervalBefore = new DateInterval('P1D');
$intervalBeforeStart = new DateInterval('P29D');
$endBefore = $pickDate->sub($intervalBefore);
$endBeforeDate = $endBefore->format('Y-m-d');
$startBefore = $pickDate->sub($intervalBeforeStart);
$startBeforeDate = $startBefore->format('Y-m-d');
// Semua
$countAllFinished = Transaction::whereIn('status_transaksi', ['finished', 'done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllPending = Transaction::where('status_transaksi', 'created')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllCanceled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllRefund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
// Pembeli
$countBuyerFinished = Transaction::whereIn('status_transaksi', ['finished', 'done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countPending = Transaction::where('status_pembayaran', 'pending')
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
$countBuyerPaid = Transaction::where('status_transaksi', 'success')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countFailure = Transaction::whereIn('status_pembayaran', ['cancel', 'expire', 'failure'])
->whereMonth('updated_at', $currentMonth)
->whereYear('updated_at', $currentYear)
$countBuyerPending = Transaction::where('status_transaksi', 'created')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$sumRefund = '';
$countBuyerProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$sumTransaksi = '';
$countBuyerCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
return view('user.index');
$countBuyerRefundPending = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'pending')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerRefundApproved = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'refund')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerRefundDenied = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'deny')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
// Penjual
$countSellerPending = Transaction::where('status_transaksi', 'success')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerFinished = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerProcessed = Transaction::where('status_transaksi', 'process')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerSending = Transaction::where('status_transaksi', 'sending')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerSent = Transaction::where('status_transaksi', 'sent')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerRefund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$totalTransaction = Transaction::whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$totalTransactionSebelum = Transaction::whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$rateTransaction = floatval((floatval($totalTransaction) - floatval($totalTransactionSebelum)) * 100) / ($totalTransactionSebelum == 0 ? 1 : floatval($totalTransactionSebelum));
$totalPemasukan = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->sum('total_harga');
$totalPemasukanSebelum = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where('penjual', auth()->user()->email)
->sum('total_harga');
$ratePemasukan = floatval((floatval($totalPemasukan) - floatval($totalPemasukanSebelum)) * 100) / ($totalPemasukanSebelum == 0 ? 1 : floatval($totalPemasukanSebelum));
$totalPengeluaran = Transaction::whereIn('status_transaksi', ['finished','done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->sum('total_harga');
$totalPengeluaranSebelum = Transaction::whereIn('status_transaksi', ['finished','done'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where('pembeli', auth()->user()->email)
->sum('total_harga');
$ratePengeluaran = floatval(((floatval($totalPengeluaran) - floatval($totalPengeluaranSebelum)) * 100) / ($totalPengeluaranSebelum == 0 ? 1 : floatval($totalPengeluaranSebelum)));
$totalProfit = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_harga');
$totalProfitSebelum = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_harga');
$rateProfit = floatval(((floatval($totalProfit) - floatval($totalProfitSebelum))*100)/($totalProfitSebelum == 0 ? 1 : floatval($totalProfitSebelum)));
$dataLabel = [];
$dataChartTransaction = [];
$dataChartRefund = [];
$dataChartPemasukan = [];
$dataChartPengeluaran = [];
$startDate = $start;
$intervalDate = new DateInterval('P1D');
$todayDate = $today;
$endDate = $todayDate->add($intervalDate);
for ($date = clone $startDate; $date <= $endDate; $date->modify('+1 day')) {
$transaction = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', $date->format('Y-m-d'))
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_keuntungan');
$refund = Transaction::join('refunds','refunds.transaction_id','=','transactions.id')
->where('status_transaksi', 'refund')
->where('status','refund')
->whereDate('transactions.created_at', $date->format('Y-m-d'))
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_keuntungan');
$pemasukan = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->where('penjual', auth()->user()->email)
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_harga');
$pengeluaran = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->where('pembeli', auth()->user()->email)
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_harga');
$dataChartTransaction[] = floatval($transaction);
$dataChartRefund[] = floatval($refund);
$dataChartPemasukan[] = floatval($pemasukan);
$dataChartPengeluaran[] = floatval($pengeluaran);
$dataLabel[] = $date->format('d/m/Y');
}
public function getSelectedChart(){
$currentMonth = Carbon::now()->month;
$currentYear = Carbon::now()->year;
$currentRole = 'Pembeli';
return view('user.index', compact(
'countAllFinished',
'countAllPending',
'countAllProcessed',
'countAllCanceled',
'countAllRefund',
'countAllIndicated',
'countBuyerFinished',
'countBuyerPaid',
'countBuyerPending',
'countBuyerProcessed',
'countBuyerCancelled',
'countBuyerRefundPending',
'countBuyerRefundApproved',
'countBuyerRefundDenied',
'countBuyerIndicated',
'countSellerPending',
'countSellerFinished',
'countSellerProcessed',
'countSellerSending',
'countSellerSent',
'countSellerCancelled',
'countSellerRefund',
'countSellerIndicated',
'totalTransaction',
'rateTransaction',
'totalPemasukan',
'ratePemasukan',
'totalPengeluaran',
'ratePengeluaran',
'rateProfit',
'dataLabel',
'dataChartTransaction',
'dataChartRefund',
'dataChartPemasukan',
'dataChartPengeluaran'
));
}
if($currentRole == 'Pembeli'){
public function getDataBySearch(Request $request)
{
$startDate = $request->startDate;
$todayDate = $request->endDate;
$pickDate = new DateTime($startDate);
$start = new DateTime($startDate);
$today = new DateTime($todayDate);
$interval = $start->diff($today);
}else{
$intervalBefore = new DateInterval('P1D');
$intervalBeforeStart = new DateInterval('P'.$interval->format('%a').'D');
$endBefore = $pickDate->sub($intervalBefore);
$endBeforeDate = $endBefore->format('Y-m-d');
$startBefore = $pickDate->sub($intervalBeforeStart);
$startBeforeDate = $startBefore->format('Y-m-d');
}
// Semua
$countAllFinished = Transaction::where('status_transaksi', 'Finished')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllPending = Transaction::where('status_transaksi', 'created')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllCanceled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllRefund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$countAllIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
// Pembeli
$countBuyerFinished = Transaction::where('status_transaksi', 'finished')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerPaid = Transaction::where('status_transaksi', 'success')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerPending = Transaction::where('status_transaksi', 'created')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerProcessed = Transaction::whereIn('status_transaksi', ['process', 'sending', 'sent'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerRefundPending = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'pending')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerRefundApproved = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'refund')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerRefundDenied = Transaction::join('refunds', 'refunds.transaction_id', '=', 'transactions.id')
->where('refunds.status', 'deny')
->whereDate('transactions.created_at', '>=', $startDate)
->whereDate('transactions.created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
$countBuyerIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->count();
// Penjual
$countSellerPending = Transaction::where('status_transaksi', 'success')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerFinished = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerProcessed = Transaction::where('status_transaksi', 'process')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerSending = Transaction::where('status_transaksi', 'sending')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerSent = Transaction::where('status_transaksi', 'sent')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerCancelled = Transaction::where('status_transaksi', 'failure')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerRefund = Transaction::where('status_transaksi', 'refund')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$countSellerIndicated = Transaction::where('status_transaksi', 'challenge')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->count();
$totalTransaction = Transaction::whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$totalTransactionSebelum = Transaction::whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->count();
$rateTransaction = floatval((floatval($totalTransaction) - floatval($totalTransactionSebelum)) * 100) / ($totalTransactionSebelum == 0 ? 1 : floatval($totalTransactionSebelum));
$totalPemasukan = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('penjual', auth()->user()->email)
->sum('total_harga');
$totalPemasukanSebelum = Transaction::where('status_transaksi', 'done')
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where('penjual', auth()->user()->email)
->sum('total_harga');
$ratePemasukan = floatval((floatval($totalPemasukan) - floatval($totalPemasukanSebelum)) * 100) / ($totalPemasukanSebelum == 0 ? 1 : floatval($totalPemasukanSebelum));
$totalPengeluaran = Transaction::whereIn('status_transaksi', ['finished','done'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where('pembeli', auth()->user()->email)
->sum('total_harga');
$totalPengeluaranSebelum = Transaction::whereIn('status_transaksi', ['finished','done'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where('pembeli', auth()->user()->email)
->sum('total_harga');
$ratePengeluaran = floatval(((floatval($totalPengeluaran) - floatval($totalPengeluaranSebelum)) * 100) / ($totalPengeluaranSebelum == 0 ? 1 : floatval($totalPengeluaranSebelum)));
$totalProfit = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startDate)
->whereDate('created_at', '<=', $todayDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_harga');
$totalProfitSebelum = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', '>=', $startBeforeDate)
->whereDate('created_at', '<=', $endBeforeDate)
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_harga');
$rateProfit = floatval(((floatval($totalProfit) - floatval($totalProfitSebelum))*100)/($totalProfitSebelum == 0 ? 1 : floatval($totalProfitSebelum)));
$dataLabel = [];
$dataChartTransaction = [];
$dataChartRefund = [];
$dataChartPemasukan = [];
$dataChartPengeluaran = [];
$first = $start;
$intervalDate = new DateInterval('P1D');
$lastDate = $today;
$last = $lastDate->add($intervalDate);
for ($date = clone $first; $date <= $last; $date->modify('+1 day')) {
$transaction = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->whereDate('created_at', $date->format('Y-m-d'))
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_keuntungan');
$refund = Transaction::join('refunds','refunds.transaction_id','=','transactions.id')
->where('status_transaksi', 'refund')
->where('status','refund')
->whereDate('transactions.created_at', $date->format('Y-m-d'))
->where(function ($a) {
$a->where('pembeli', auth()->user()->email)->orWhere('penjual', auth()->user()->email);
})
->sum('total_keuntungan');
$pemasukan = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->where('penjual', auth()->user()->email)
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_harga');
$pengeluaran = Transaction::whereIn('status_transaksi', ['done', 'finished'])
->where('pembeli', auth()->user()->email)
->whereDate('created_at', $date->format('Y-m-d'))
->sum('total_harga');
$dataChartTransaction[] = floatval($transaction);
$dataChartRefund[] = floatval($refund);
$dataChartPemasukan[] = floatval($pemasukan);
$dataChartPengeluaran[] = floatval($pengeluaran);
$dataLabel[] = $date->format('d/m/Y');
}
return response()->json([
'countAllFinished' => $countAllFinished,
'countAllPending' => $countAllPending,
'countAllProcessed' => $countAllProcessed,
'countAllCanceled' => $countAllCanceled,
'countAllRefund' => $countAllRefund,
'countAllIndicated' => $countAllIndicated,
'countBuyerFinished' => $countBuyerFinished,
'countBuyerPaid' => $countBuyerPaid,
'countBuyerPending' => $countBuyerPending,
'countBuyerProcessed' => $countBuyerProcessed,
'countBuyerCancelled' => $countBuyerCancelled,
'countBuyerRefundPending' => $countBuyerRefundPending,
'countBuyerRefundApproved' => $countBuyerRefundApproved,
'countBuyerRefundDenied' => $countBuyerRefundDenied,
'countBuyerIndicated' => $countBuyerIndicated,
'countSellerPending' => $countSellerPending,
'countSellerFinished' => $countSellerFinished,
'countSellerProcessed' => $countSellerProcessed,
'countSellerSending' => $countSellerSending,
'countSellerSent' => $countSellerSent,
'countSellerCancelled' => $countSellerCancelled,
'countSellerRefund' => $countSellerRefund,
'countSellerIndicated' => $countSellerIndicated,
'totalTransaction' => $totalTransaction,
'rateTransaction' => $rateTransaction,
'totalPemasukan' => $totalPemasukan,
'ratePemasukan' => $ratePemasukan,
'totalPengeluaran' => $totalPengeluaran,
'ratePengeluaran' => $ratePengeluaran,
'rateProfit' => $rateProfit,
'dataLabel' => $dataLabel,
'dataChartTransaction' => $dataChartTransaction,
'dataChartRefund' => $dataChartRefund,
'dataChartPemasukan' => $dataChartPemasukan,
'dataChartPengeluaran' => $dataChartPengeluaran
]);
}
}

View File

@ -8,6 +8,7 @@ use App\Models\NotificationReceiver;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Pusher\Pusher;
use Throwable;
use Yajra\DataTables\Facades\DataTables;
@ -23,7 +24,7 @@ class UserNotification extends Controller
try {
$subQuery = Notification::join('notification_receivers','notifications.id','=','notification_receivers.notification_id')
->where('notification_receivers.receiver','=',auth()->user()->email)
->latest()
->latest('notification_receivers.updated_at')
->select('notifications.id', 'notifications.title', 'notifications.teaser', 'notification_receivers.created_at', 'notification_receivers.status');
if ($request->has('search') && !empty($request->search['value'])) {
@ -114,13 +115,53 @@ class UserNotification extends Controller
public function markAllAsRead()
{
NotificationReceiver::where('receiver', auth()->user()->email)->update([
$result = NotificationReceiver::where('receiver', auth()->user()->email)->update([
'status' => 'read',
]);
if($result){
return response()->json([
'status' => true,
'message' => 'Berhasil',
]);
}else{
return response()->json([
'status' => false,
'message' => 'Gagal',
]);
Log::error($result);
}
}
public function updateNewNotification(Request $request)
{
$options = [
'cluster' => 'ap1',
'useTLS' => true,
];
$pusher = new Pusher('3e5bdc20dddd7fbc655e', 'f2274c37c616d29ff590', '1659859', $options);
$payload = [
'receivers' => $request->receiver,
];
$pusher->trigger('chanel-update-notifikasi', 'event-update-notifikasi', $payload);
}
public function updateNotificationToAdmin(Request $request)
{
$options = [
'cluster' => 'ap1',
'useTLS' => true,
];
$pusher = new Pusher('3e5bdc20dddd7fbc655e', 'f2274c37c616d29ff590', '1659859', $options);
$payload = [
'service' => $request->service
];
$pusher->trigger('chanel-update-notifikasi-untuk-admin', 'event-update-notifikasi-untuk-admin', $payload);
}
}

View File

@ -4,6 +4,8 @@ namespace App\Http\Controllers\User\Pembeli;
use App\Http\Controllers\Controller;
use App\Models\Contact;
use App\Models\Notification;
use App\Models\NotificationReceiver;
use App\Models\Refund;
use App\Models\Setting;
use App\Models\Transaction;
@ -15,6 +17,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Pusher\Pusher;
use Throwable;
use Yajra\DataTables\DataTables;
@ -84,7 +87,6 @@ class PembeliController extends Controller
$batas_pembayaran = $now->addDays(1)->toTimeString();
$batas_konfirmasi_transaksi = $now->addDays(2)->toDateTimeString();
$batas_pengiriman_barang_awal = $now->addDays(3)->toDateTimeString();
$batas_pengiriman_barang_akhir = $now->addDays(4)->toDateTimeString();
$status = 'created';
@ -109,7 +111,6 @@ class PembeliController extends Controller
'status_transaksi' => $status,
'batas_pembayaran' => $batas_pembayaran,
'batas_konfirmasi_transaksi' => $batas_konfirmasi_transaksi,
'batas_pengiriman_barang_awal' => $batas_pengiriman_barang_awal,
'batas_pengiriman_barang_akhir' => $batas_pengiriman_barang_akhir,
]);
@ -214,6 +215,8 @@ class PembeliController extends Controller
public function finishTransaction(Request $request)
{
$transactionDetail = Transaction::where('id', $request->id)->first();
try {
DB::beginTransaction();
@ -231,11 +234,23 @@ class PembeliController extends Controller
'deskripsi' => 'Pesanan telah diselesaikan oleh ' . auth()->user()->nama_depan . '. Uang akan dikirim ke penjual.',
]);
$notif = Notification::create([
'title' => 'Transaksi Selesai',
'content' => auth()->user()->nama_depan.' telah menyelesaikan transaksi. Silahkan terima uang anda.',
'teaser' => auth()->user()->nama_depan.' telah...'
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->penjual,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Pesanan anda selesai dan uang akan dikirim ke penjual. Terima kasih telah menggunakan Rekber.',
'receiver' => $transactionDetail->penjual
]);
} catch (Throwable $e) {
DB::rollBack();
@ -253,6 +268,8 @@ class PembeliController extends Controller
{
$auth = base64_encode(env('MIDTRANS_SERVER_KEY'));
$transactionDetail = Transaction::where('id', $request->id)->first();
$response = Http::withOptions([
'verify' => false,
])
@ -307,11 +324,25 @@ class PembeliController extends Controller
'user' => auth()->user()->email,
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Pembayaran Sukses',
'content' => auth()->user()->nama_depan.' telah membayar transaksi. Silahkan proses transaksi ini jika memang dituju kepada anda. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => auth()->user()->nama_depan.' telah...'
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->penjual,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Pembayaran sukses',
'receiver' => $transactionDetail->penjual
]);
} elseif ($transaction == 'challenge') {
TransactionDescription::create([
@ -324,6 +355,19 @@ class PembeliController extends Controller
'keterangan' => $result['status_message'],
]);
$options = [
'cluster' => 'ap1',
'useTLS' => true,
];
$pusher = new Pusher('3e5bdc20dddd7fbc655e', 'f2274c37c616d29ff590', '1659859', $options);
$payload = [
'service' => 'Transaksi'
];
$pusher->trigger('chanel-update-notifikasi-untuk-admin', 'event-update-notifikasi-untuk-admin', $payload);
DB::commit();
return response()->json([
@ -471,11 +515,25 @@ class PembeliController extends Controller
'deskripsi' => 'Transaksi dibatalkan oleh ' . auth()->user()->nama_depan . '. Alasan : ' . $request->complaint,
]);
$url = route('user-transaction.show', ['id' => $transaction->id]);
$notif = Notification::create([
'title' => 'Transaksi Dibatalkan',
'content' => auth()->user()->nama_depan.' telah membatalkan transaksi. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => auth()->user()->nama_depan.' telah...'
]);
NotificationReceiver::create([
'receiver' => $transaction->penjual,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Transaksi telah dibatalkan.',
'receiver' => $transaction->penjual
]);
} catch (Throwable $e) {
DB::rollBack();
@ -740,7 +798,8 @@ class PembeliController extends Controller
'transactions.created_at',
'transactions.status_transaksi',
'transactions.token'
);
)
->latest('transactions.updated_at');
if($request->has('search') && !empty($request->search['value'])){
$searchPembeli = $request->search['value'];

View File

@ -3,6 +3,8 @@
namespace App\Http\Controllers\User\Penjual;
use App\Http\Controllers\Controller;
use App\Models\Notification;
use App\Models\NotificationReceiver;
use App\Models\Refund;
use App\Models\Transaction;
use App\Models\TransactionDescription;
@ -26,7 +28,8 @@ class PenjualController extends Controller
try {
$subQuery = Transaction::join('users', 'transactions.pembeli', '=', 'users.email')
->where('transactions.penjual', auth()->user()->email)
->select('transactions.id', DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_pembeli"), 'transactions.nama_barang', 'transactions.total_harga', 'transactions.created_at', 'transactions.status_transaksi');
->select('transactions.id', DB::raw("CONCAT(users.nama_depan,' ',users.nama_belakang) as nama_pembeli"), 'transactions.nama_barang', 'transactions.total_harga', 'transactions.created_at', 'transactions.status_transaksi')
->latest('transactions.updated_at');
if ($request->has('search') && !empty($request->search['value'])) {
$searchPenjual = $request->search['value'];
@ -103,7 +106,7 @@ class PenjualController extends Controller
';
}
if ($row->status_transaksi == 'progress') {
if ($row->status_transaksi == 'process') {
$html_code .=
'
<li><a class="dropdown-item" id="sendOrder"
@ -156,6 +159,8 @@ class PenjualController extends Controller
public function acceptTransaction(Request $request)
{
$transactionDetail = Transaction::where('id', $request->id)->first();
try {
DB::beginTransaction();
@ -172,11 +177,25 @@ class PenjualController extends Controller
'deskripsi' => 'Transaksi telah diterima oleh ' . auth()->user()->nama_depan,
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Transaksi Diproses',
'content' => auth()->user()->nama_depan.' telah menerima dan memproses transaksi. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => auth()->user()->nama_depan.' telah...'
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->pembeli,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Transaksi telah diterima. Siapkan pesanan untuk dikirim ke penjual.',
'receiver' => $transactionDetail->pembeli
]);
} catch (Throwable $e) {
DB::rollBack();
@ -241,11 +260,25 @@ class PenjualController extends Controller
'deskripsi' => 'Transaksi ditolak ' . auth()->user()->nama_depan . ', uang akan dikembalikan ke pembeli. Alasan : ' . $request->complaint,
]);
$url = route('user-transaction.show', ['id' => $transaction->id]);
$notif = Notification::create([
'title' => 'Transaksi Diproses',
'content' => auth()->user()->nama_depan.' telah menolak transaksi.<a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => auth()->user()->nama_depan.' telah...'
]);
NotificationReceiver::create([
'receiver' => $transaction->pembeli,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Transaksi telah ditolak. Uang akan dikirimkan ke pembeli.',
'receiver' => $transaction->pembeli
]);
} catch (Throwable $e) {
DB::rollBack();
@ -305,6 +338,8 @@ class PenjualController extends Controller
public function sentOrder(Request $request)
{
$transactionDetail = Transaction::where('id', $request->transaction_id)->first();
try {
DB::beginTransaction();
@ -332,11 +367,25 @@ class PenjualController extends Controller
'bukti_foto' => $bukti_foto,
]);
$url = route('user-transaction.show', ['id' => $transactionDetail->id]);
$notif = Notification::create([
'title' => 'Transaksi Sudah Tiba',
'content' => 'Transaksi sudah tiba dan silahkan periksa terlebih dahulu sebelum menyelesaikan transaksi atau mengajukan refund. <a href="'.$url.'">Klik disini</a> untuk langsung ke detail transaksi.',
'teaser' => 'Transaksi sudah tiba dan silahkan per...',
]);
NotificationReceiver::create([
'receiver' => $transactionDetail->pembeli,
'notification_id' => $notif->id
]);
DB::commit();
return response()->json([
'status' => true,
'message' => 'Pesanan telah sampai di tempat pembeli.',
'receiver' => $transactionDetail->pembeli
]);
} catch (Throwable $e) {
DB::rollBack();

View File

@ -83,6 +83,7 @@ class UserRefundController extends Controller
return response()->json([
'status' => true,
'message' => 'Permintaan refund anda telah dikirim ke admin untuk direview. Mohon tunggu maksimal 2 hari.',
'service' => 'Refund'
]);
}catch(Throwable $e){
DB::rollback();
@ -115,7 +116,8 @@ class UserRefundController extends Controller
'refunds.status',
'transactions.nama_barang',
DB::raw("CONCAT(s.nama_depan,' ',s.nama_belakang) as nama_penjual"),
);
)
->latest('refunds.updated_at');
if($request->has('search') && !empty($request->search['value'])){
$searchRefund = $request->search['value'];

59
app/Mail/approveUser.php Normal file
View File

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class approveUser extends Mailable
{
use Queueable, SerializesModels;
public $content;
/**
* Create a new message instance.
*/
public function __construct($content)
{
$this->content = $content;
}
/**
* Get the message envelope.
*/
// public function envelope(): Envelope
// {
// return new Envelope(
// subject: 'Approve User',
// );
// }
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'view.name',
// );
// }
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
// public function attachments(): array
// {
// return [];
// }
public function build(){
return $this->subject('Pendaftaran Akun Sukses')->view('email.approve-user-email');
}
}

59
app/Mail/denyUser.php Normal file
View File

@ -0,0 +1,59 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class denyUser extends Mailable
{
use Queueable, SerializesModels;
public $content;
/**
* Create a new message instance.
*/
public function __construct($content)
{
$this->content = $content;
}
/**
* Get the message envelope.
*/
// public function envelope(): Envelope
// {
// return new Envelope(
// subject: 'Deny User',
// );
// }
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'view.name',
// );
// }
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
// public function attachments(): array
// {
// return [];
// }
public function build(){
return $this->subject('Pendaftaran Akun Gagal')->view('email.deny-user-email');
}
}

View File

@ -30,7 +30,6 @@ class Transaction extends Model
'status_transaksi',
'status_pembayaran',
'batas_pembayaran',
'batas_pengiriman_barang_awal',
'batas_pengiriman_barang_akhir',
'nama_bank_penjual',
'no_rek_penjual'

View File

@ -34,7 +34,8 @@ class UserFactory extends Factory
'status'=> $this->faker->randomElement(['Progress', 'Finished', 'Rejected']),
'gender' => $this->faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
'keterangan' => $this->faker->sentence
'keterangan' => $this->faker->sentence,
'foto_profile' => 'face'.random_int(1,10).'.jpg'
];
}

View File

@ -33,7 +33,6 @@ return new class extends Migration
$table->enum('status_pembayaran',['settlement','capture','pending','expire','failure','cancel','refund'])->nullable(); // status transaksi dari midtrans
$table->timestamp('batas_pembayaran')->nullable();
$table->timestamp('batas_konfirmasi_transaksi')->nullable();
$table->timestamp('batas_pengiriman_barang_awal');
$table->timestamp('batas_pengiriman_barang_akhir');
$table->timestamp('tanggal_transaksi')->nullable();
$table->string('nama_bank_penjual');

View File

@ -50,6 +50,7 @@ class DatabaseSeeder extends Seeder
'persentase_kemiripan' => 100,
'gender' => $faker->randomElement(['Laki-laki', 'Perempuan']),
'kode_kelurahan' => '1101012002',
'foto_profile' => 'face1.jpg'
]);
$user1 = User::factory()->create([
@ -71,7 +72,8 @@ class DatabaseSeeder extends Seeder
'kode_kelurahan' => '1101012002',
'nama_bank' => 'mandiri',
'no_rek' => '019809210873',
'keterangan' => $faker->sentence()
'keterangan' => $faker->sentence(),
'foto_profile' => 'face2.jpg'
]);
$user2 = User::factory()->create([
@ -93,7 +95,8 @@ class DatabaseSeeder extends Seeder
'kode_kelurahan' => '1101012002',
'nama_bank' => 'bca',
'no_rek' => '01980921',
'keterangan' => $faker->sentence()
'keterangan' => $faker->sentence(),
'foto_profile' => 'face3.jpg'
]);
User::factory(100)->create();
@ -125,7 +128,6 @@ class DatabaseSeeder extends Seeder
'token' => 'asda',
'status_transaksi' => 'created',
'batas_pembayaran' => now(),
'batas_pengiriman_barang_awal' => now(),
'batas_pengiriman_barang_akhir' => now(),
'nama_bank_penjual' => $user2->nama_bank,
'no_rek_penjual' => $user2->no_rek,
@ -140,6 +142,36 @@ class DatabaseSeeder extends Seeder
'deskripsi' => $user1->nama_depan . ' telah membuat transaksi baru dengan ' . $user2->nama_depan,
]);
$transaction = Transaction::create([
'id' => Str::uuid(),
'pembeli' => $user2->email,
'penjual' => $user1->email,
'nama_barang' => 'hah',
'deskripsi_transaksi' => null,
'satuan_barang' => 'barang',
'harga_barang' => 2000,
'jumlah_barang' => 2,
'persentase_keuntungan' => 2,
'total_keuntungan' => 2,
'total_harga' => 2,
'total_bayar' => 2,
'token' => 'asda',
'status_transaksi' => 'created',
'batas_pembayaran' => now(),
'batas_pengiriman_barang_akhir' => now(),
'nama_bank_penjual' => $user1->nama_bank,
'no_rek_penjual' => $user1->no_rek,
]);
TransactionDescription::create([
'transaction_id' => $transaction->id,
'status' => 'pending',
'user' => $user2->email,
'judul' => 'fa fa-plus',
'background' => 'bg-buyer',
'deskripsi' => $user2->nama_depan . ' telah membuat transaksi baru dengan ' . $user1->nama_depan,
]);
$transactionRefund = Transaction::create([
'id' => Str::uuid(),
'pembeli' => $user1->email,
@ -157,7 +189,6 @@ class DatabaseSeeder extends Seeder
'status_transaksi' => 'success',
'status_pembayaran' => 'refund',
'batas_pembayaran' => now(),
'batas_pengiriman_barang_awal' => now(),
'batas_pengiriman_barang_akhir' => now(),
'nama_bank_penjual' => $user2->nama_bank,
'no_rek_penjual' => $user2->no_rek,

View File

@ -1271,9 +1271,9 @@ select.form-control:not([size]):not([multiple]) {
margin-bottom: -15px;
}
.card.card-statistic-2 .card-chart canvas {
/* .card.card-statistic-2 .card-chart canvas {
height: 90px !important;
}
} */
.card .card-stats {
width: 100%;

View File

@ -4,109 +4,123 @@
<div class="main-content">
<section class="section">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-stats">
<div class="card-stats-title">List Transaction -
<div class="dropdown d-inline">
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
id="orders-month">August</a>
<ul class="dropdown-menu dropdown-menu-sm">
<li class="dropdown-title">Select Month</li>
<li><a href="#" class="dropdown-item">January</a></li>
<li><a href="#" class="dropdown-item">February</a></li>
<li><a href="#" class="dropdown-item">March</a></li>
<li><a href="#" class="dropdown-item">April</a></li>
<li><a href="#" class="dropdown-item">May</a></li>
<li><a href="#" class="dropdown-item">June</a></li>
<li><a href="#" class="dropdown-item">July</a></li>
<li><a href="#" class="dropdown-item active">August</a></li>
<li><a href="#" class="dropdown-item">September</a></li>
<li><a href="#" class="dropdown-item">October</a></li>
<li><a href="#" class="dropdown-item">November</a></li>
<li><a href="#" class="dropdown-item">December</a></li>
</ul>
<div class="card-stats-title">
<h4>Transaksi</h4>
</div>
</div>
<div class="card-stats-items">
<div class="card-stats-items mt-2">
<div class="card-stats-item">
<div class="card-stats-item-count">{{ $countSuccess }}</div>
<div class="card-stats-item-label">Success</div>
<div class="card-stats-item-count" id="countSuccess">{{ $countSuccess }}</div>
<div class="card-stats-item-label">Selesai</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count">{{ $countPending }}</div>
<div class="card-stats-item-label">Pending</div>
<div class="card-stats-item-count" id="countCancelled">{{ $countCancelled }}</div>
<div class="card-stats-item-label">Gagal</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count">{{ $countCancelled }}</div>
<div class="card-stats-item-label">Canceled</div>
<div class="card-stats-item-count" id="countProcessed">{{ $countProcessed }}</div>
<div class="card-stats-item-label">Diproses</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count">{{ $countRefund }}</div>
<div class="card-stats-item-label">Refund</div>
<div class="card-stats-item-count" id="countIndicated">{{ $countIndicated }}</div>
<div class="card-stats-item-label">Diterindikasi</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countWaiting">{{ $countWaiting }}</div>
<div class="card-stats-item-label">Menunggu</div>
</div>
</div>
</div>
<div class="card-wrap">
<div class="card-header">
<h4>Total Transaksi</h4>
</div>
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-exchange-alt"></i>
</div>
<div class="card-wrap">
<div class="card-header">
<h4>Total Transaction</h4>
</div>
<div class="card-body">
{{ $totalTransaction }}
<div class="card-body" id="totalTransaction">
{{ $totalTransaction }} Transaksi
</div>
</div>
<p class="mb-0 text-muted">
<span class="text-success me-2"><span class="mdi mdi-arrow-up-bold"></span>
1.08%</span>
<span class="text-nowrap">Since last week</span>
<p class="mb-0 text-muted" id="rateTransaction">
<span
class="text-{{ $rateTransaction == 0 ? 'secondary text-black-50' : ($rateTransaction > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $rateTransaction == 0 ? 'mdi-equal' : ($rateTransaction > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($rateTransaction) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-chart">
<canvas id="balance-chart" height="80"></canvas>
<div class="card-stats">
<div class="card-stats-title">
<h4>Refund</h4>
</div>
<div class="card-stats-items mt-2">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countPending">{{ $countPending }}</div>
<div class="card-stats-item-label">Menunggu</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countApprove">{{ $countApprove }}</div>
<div class="card-stats-item-label">Disetujui</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countDeny">{{ $countDeny }}</div>
<div class="card-stats-item-label">Ditolak</div>
</div>
</div>
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-money-check"></i>
</div>
<div class="card-wrap">
<div class="card-header">
<h4>Total Refund</h4>
</div>
<div class="card-body">
{{ $totalRefund }}
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-exchange-alt"></i>
</div>
<div class="card-body" id="totalRefund">
{{ $totalRefund }} Pengajuan
</div>
</div>
<p class="mb-0 text-muted">
<span class="text-success me-2"><span class="mdi mdi-arrow-up-bold"></span>
5.27%</span>
<span class="text-nowrap">Since last month</span>
<p class="mb-0 text-muted" id="rateRefund">
<span
class="text-{{ $rateRefund == 0 ? 'secondary text-black-50' : ($rateRefund > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $rateRefund == 0 ? 'mdi-equal' : ($rateRefund > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($rateRefund) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-stats">
<div class="card-stats-title">
<h4>Pengguna</h4>
</div>
</div>
<div class="card-chart">
<canvas id="sales-chart" height="80"></canvas>
<canvas id="users-chart" height="80"></canvas>
</div>
<div class="card-wrap">
<div class="card-header">
<h4>Total Pengguna</h4>
</div>
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-user"></i>
</div>
<div class="card-wrap">
<div class="card-header">
<h4>Total user</h4>
<div class="card-body" id="totalUser">
{{ $totalUser }} Pengguna
</div>
<div class="card-body">
{{ $totalUser }}</div>
</div>
<p class="mb-0 text-muted">
<span class="text-danger me-2"><span class="mdi mdi-arrow-down-bold"></span>
1.08%</span>
<span class="text-nowrap">Since previous week</span>
<p class="mb-0 text-muted" id="rateUser">
<span
class="text-{{ $rateUser == 0 ? 'secondary text-black-50' : ($rateUser > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $rateUser == 0 ? 'mdi-equal' : ($rateUser > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($rateUser) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
@ -115,18 +129,17 @@
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="alert alert-primary alert-dismissible fade show mb-3" role="alert">
Pendapatan Hari Ini meningkat <span class="mdi mdi-arrow-up-bold"></span>
5.27%</span>
<div id="rateProfit">
<div class="alert alert-{{ $rateProfit == 0 ? 'secondary text-black-50' : ($rateProfit > 0 ? 'success' : 'error') }} alert-dismissible fade show mb-3"
role="alert">
Pendapatan {{ $rateProfit == 0 ? 'sama' : ($rateProfit > 0 ? 'meningkat' : 'menurun') }}
<span
class="mdi {{ $rateProfit == 0 ? 'mdi-equal' : ($rateProfit > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ $rateProfit }}%
</div>
</div>
<div class="card-header">
<h4>Statistics</h4>
<div class="card-header-action">
<div class="btn-group">
<a href="#" class="btn btn-primary">Week</a>
<a href="#" class="btn">Month</a>
</div>
</div>
<h4>Pendapatan</h4>
</div>
<div class="card-body">
<canvas id="myChart1"></canvas>
@ -136,137 +149,60 @@
<div class="col-lg-4">
<div class="input-group mt-4">
<input type="text" name="from-to" class="form-control" id="date-range">
<label class="input-group-text bg-primary text-white align-items-center" for="date-range">
<span class="input-group-text bg-primary text-white align-items-center">
<i class="mdi mdi-calendar-range font-13"></i>
</label>
</span>
</div>
<div class="card gradient-bottom">
<div class="card-header">
<h4>Top 5 Users</h4>
<div class="card-header-action dropdown">
<a href="#" data-toggle="dropdown"
class="btn btn-primary dropdown-toggle">Month</a>
<ul class="dropdown-menu dropdown-menu-sm dropdown-menu-right">
<li class="dropdown-title">Select Period</li>
<li><a href="#" class="dropdown-item">Today</a></li>
<li><a href="#" class="dropdown-item">Week</a></li>
<li><a href="#" class="dropdown-item active">Month</a></li>
<li><a href="#" class="dropdown-item">This Year</a></li>
</ul>
</div>
</div>
<div class="card-body" id="top-5-scroll">
<ul class="list-unstyled list-unstyled-border">
<ul class="list-unstyled list-unstyled-border" id="listTopUser">
@forelse ($dataTopUsers as $user)
<li class="media">
<img class="mr-3 rounded" width="55"
src="{{ asset('assets/img/avatar/avatar-6.png') }}" alt="product">
src="{{ $user->foto_profile == null ? asset('storage/foto-profile/face1.jpg') : asset('storage/foto-profile/' . $user->foto_profile) }}"
alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">86 Sales</div>
<div class="font-weight-600 text-muted text-small">
{{ $user->jumlah_transaksi }} transaksi
</div>
<div class="media-title">Jilhan Haura</div>
</div>
<div class="media-title">{{ $user->nama_lengkap }}</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary" data-width="64%"></div>
<div class="budget-price-label">$68,714</div>
<div class="budget-price-square bg-primary"
data-width="{{ (floatval($user->total_transaksi_berhasil) * 100) / (floatval($user->total_transaksi_berhasil) + floatval($user->total_refund_berhasil)) / 1.5 }}%">
</div>
<div class="budget-price-label">Rp
{{ number_format($user->total_transaksi_berhasil, 2, ',', '.') }}
</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger" data-width="43%"></div>
<div class="budget-price-label">$38,700</div>
</div>
</div>
</div>
</li>
<li class="media">
<img class="mr-3 rounded" width="55"
src="{{ asset('assets/img/avatar/avatar-1.png') }}" alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">67 Sales</div>
</div>
<div class="media-title">Nurul Prima</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary" data-width="84%"></div>
<div class="budget-price-label">$107,133</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger" data-width="60%"></div>
<div class="budget-price-label">$91,455</div>
</div>
</div>
</div>
</li>
<li class="media">
<img class="mr-3 rounded" width="55"
src="{{ asset('assets/img/avatar/avatar-2.png') }}" alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">63 Sales</div>
</div>
<div class="media-title">Muhammad Raihan</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary" data-width="34%"></div>
<div class="budget-price-label">$3,717</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger" data-width="28%"></div>
<div class="budget-price-label">$2,835</div>
</div>
</div>
</div>
</li>
<li class="media">
<img class="mr-3 rounded" width="55"
src="{{ asset('assets/img/avatar/avatar-3.png') }}" alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">28 Sales</div>
</div>
<div class="media-title">Hantu</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary" data-width="45%"></div>
<div class="budget-price-label">$13,972</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger" data-width="30%"></div>
<div class="budget-price-label">$9,660</div>
</div>
</div>
</div>
</li>
<li class="media">
<img class="mr-3 rounded" width="55"
src="{{ asset('assets/img/avatar/avatar-4.png') }}" alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">19 Sales</div>
</div>
<div class="media-title">Testing</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary" data-width="35%"></div>
<div class="budget-price-label">$7,391</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger" data-width="28%"></div>
<div class="budget-price-label">$5,472</div>
<div class="budget-price-square bg-danger"
data-width="{{ (floatval($user->total_refund_berhasil) * 100) / (floatval($user->total_transaksi_berhasil) + floatval($user->total_refund_berhasil)) / 1.5 }}%">
</div>
<div class="budget-price-label">Rp
{{ number_format($user->total_refund_berhasil, 2, ',', '.') }}
</div>
</div>
</div>
</div>
</li>
@empty
@endforelse
</ul>
</div>
<div class="card-footer pt-3 d-flex justify-content-center">
<div class="pt-3 d-flex justify-content-center">
<div class="budget-price justify-content-center">
<div class="budget-price-square bg-primary" data-width="20"></div>
<div class="budget-price-label">Sukses</div>
<div class="budget-price-label">Transaksi Selesai</div>
</div>
<div class="budget-price justify-content-center">
<div class="budget-price-square bg-danger" data-width="20"></div>
<div class="budget-price-label">Refund</div>
<div class="budget-price-label">Refund Selesai</div>
</div>
</div>
</div>
@ -275,61 +211,15 @@
</section>
</div>
@include('admin.transaction.modal-tracking')
@endsection
@section('tambahan-js')
<script>
let dataChartTransaction = {{ json_encode($dataChartTransaction) }};
let dataChartRefund = {{ json_encode($dataChartRefund) }};
let labels = '';
let dataChartTotalRefund = {{ json_encode($dataChartTotalRefund) }};
let dataChartTotalUser = {{ json_encode($dataChartTotalUser) }};
let dataChartUser = {{ json_encode($dataChartUser) }};
let dataLabel = {!! json_encode($dataLabel) !!};
</script>
<script>
// Date picker range
$(document).ready(function() {
let searchParams = new URLSearchParams(window.location.search);
let dateInterval = searchParams.get('from-to');
let start = moment().subtract(29, 'days');
let end = moment();
if (dateInterval) {
dateInterval = dateInterval.split(' - ');
start = moment(dateInterval[0]);
end = moment(dateInterval[1]);
}
$('#date-range').daterangepicker({
"showDropdowns": true,
"showWeekNumbers": true,
"alwaysShowCalendars": true,
startDate: start,
endDate: end,
locale: {
format: 'YYYY-MM-DD',
firstDay: 1,
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1,
'month').endOf(
'month')],
'This Year': [moment().startOf('year'), moment().endOf('year')],
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year')
.endOf(
'year')
],
'All time': [moment().subtract(30, 'year').startOf('month'), moment().endOf('month')],
}
}, function(start, end, label) {
// Menangkap rentang tanggal yang dipilih dan menampilkan di console
console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format(
'YYYY-MM-DD'));
});
});
// Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = 'Nunito',
'-apple-system,system-ui,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif';
Chart.defaults.global.defaultFontColor = '#858796';
@ -338,12 +228,10 @@
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Agu", "Sep",
"Okt", "Nov", "Des"
],
labels: dataLabel,
datasets: [{
label: 'Transaction',
data: {{ json_encode($dataChartTransaction) }},
data: dataChartTransaction,
borderWidth: 2,
backgroundColor: 'rgba(63,82,227,.8)',
borderWidth: 0,
@ -355,7 +243,7 @@
},
{
label: 'Refund',
data: [2207, 3403, 220000, 5025, 2302, 4208, 3880, 4880, 5000],
data: dataChartRefund,
borderWidth: 2,
backgroundColor: 'rgba(254,86,83,.7)',
borderWidth: 0,
@ -381,26 +269,22 @@
scales: {
yAxes: [{
gridLines: {
// display: false,
drawBorder: false,
color: '#f2f2f2',
},
ticks: {
beginAtZero: true,
stepSize: 15000,
callback: function(value, index, values) {
// return 'Rp.' + value;
return new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR',
}).format(value);
},
// stepSize: 1000,
// callback: function(value, index, values) {
// return value;
// },
fontSize: 14,
maxTicksLimit: 6,
},
scaleLabel: {
display: true,
labelString: 'Dalam Ratusan Juta', // Label khusus untuk sumbu Y
fontSize: 16 // Ukuran font untuk label sumbu Y
labelString: 'Dalam Rupiah (Rp)',
fontSize: 16,
},
}],
xAxes: [{
@ -409,91 +293,28 @@
tickMarkLength: 15,
},
ticks: {
fontSize: 16,
}
display: false,
maxTicksLimit: 8,
},
offset: true,
}]
},
}
});
var balance_chart = document.getElementById("balance-chart").getContext('2d');
var users_chart = document.getElementById("users-chart").getContext('2d');
var balance_chart_bg_color = balance_chart.createLinearGradient(0, 0, 0, 70);
balance_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
balance_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var users_chart_bg_color = users_chart.createLinearGradient(0, 0, 0, 80);
var myChart = new Chart(balance_chart, {
var myChartUser = new Chart(users_chart, {
type: 'line',
data: {
labels: ['16-07-2018', '17-07-2018', '18-07-2018', '19-07-2018', '20-07-2018', '21-07-2018',
'22-07-2018', '23-07-2018', '24-07-2018', '25-07-2018', '26-07-2018', '27-07-2018',
'28-07-2018', '29-07-2018', '30-07-2018', '31-07-2018'
],
datasets: [{
label: 'Balance',
data: [50, 61, 80, 50, 72, 52, 60, 41, 30, 45, 70, 40, 93, 63, 50, 62],
backgroundColor: balance_chart_bg_color,
borderWidth: 3,
borderColor: 'rgba(63,82,227,1)',
pointBorderWidth: 0,
pointBorderColor: 'transparent',
pointRadius: 3,
pointBackgroundColor: 'transparent',
pointHoverBackgroundColor: 'rgba(63,82,227,1)',
}]
},
options: {
layout: {
padding: {
bottom: -1,
left: -1
}
},
legend: {
display: false
},
scales: {
yAxes: [{
gridLines: {
display: false,
drawBorder: false,
},
ticks: {
beginAtZero: true,
display: false
}
}],
xAxes: [{
gridLines: {
drawBorder: false,
display: false,
},
ticks: {
display: false
}
}]
},
}
});
var sales_chart = document.getElementById("sales-chart").getContext('2d');
var sales_chart_bg_color = sales_chart.createLinearGradient(0, 0, 0, 80);
balance_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
balance_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var myChart = new Chart(sales_chart, {
type: 'line',
data: {
labels: ['16-07-2018', '17-07-2018', '18-07-2018', '19-07-2018', '20-07-2018', '21-07-2018',
'22-07-2018', '23-07-2018', '24-07-2018', '25-07-2018', '26-07-2018', '27-07-2018',
'28-07-2018', '29-07-2018', '30-07-2018', '31-07-2018'
],
labels: dataLabel,
datasets: [{
label: 'Sales',
data: [70, 62, 44, 40, 21, 63, 82, 52, 50, 31, 70, 50, 91, 63, 51, 60],
data: dataChartUser,
borderWidth: 2,
backgroundColor: balance_chart_bg_color,
backgroundColor: users_chart_bg_color,
borderWidth: 3,
borderColor: 'rgba(63,82,227,1)',
pointBorderWidth: 0,
@ -506,8 +327,8 @@
options: {
layout: {
padding: {
bottom: -1,
left: -1
bottom: 0,
left: 0
}
},
legend: {
@ -518,23 +339,264 @@
gridLines: {
display: false,
drawBorder: false,
color: '#f2f2f2',
},
ticks: {
beginAtZero: true,
display: false
display: false,
maxTicksLimit: 6,
}
}],
xAxes: [{
gridLines: {
drawBorder: false,
display: false,
display: true,
},
ticks: {
display: false
}
display: false,
maxTicksLimit: 8,
},
offset: true,
}]
},
}
});
</script>
<script>
$(document).ready(function() {
const csrfToken = $('meta[name="csrf-token"]').attr('content');
let searchParams = new URLSearchParams(window.location.search);
let dateInterval = searchParams.get('from-to');
let start = moment().subtract(29, 'days');
let end = moment();
if (dateInterval) {
dateInterval = dateInterval.split(' - ');
start = moment(dateInterval[0]);
end = moment(dateInterval[1]);
}
$('#date-range').daterangepicker({
"showDropdowns": true,
"showWeekNumbers": true,
"alwaysShowCalendars": true,
startDate: start,
endDate: end,
locale: {
format: 'YYYY-MM-DD',
firstDay: 1,
},
minDate: "2023-01-01",
maxDate: "2025-12-31",
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1,
'month').endOf(
'month')],
'This Year': [moment().startOf('year'), moment().endOf('year')],
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year')
.endOf(
'year')
]
}
}).on('apply.daterangepicker', function(ev, picker) {
var startDate = picker.startDate.format('YYYY-MM-DD');
var endDate = picker.endDate.format('YYYY-MM-DD');
console.log('Rentang tanggal dipilih:', startDate, 'sampai',
endDate);
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.get-data-dashboard') }}",
type: 'GET',
data: {
startDate: startDate,
endDate: endDate
},
success: function(response) {
Swal.close();
myChart.data.datasets[0].data = response.dataChartTransaction;
myChart.data.datasets[1].data = response.dataChartRefund;
myChart.data.labels = response.dataLabel;
myChart.update();
myChartUser.data.datasets[0].data = response.dataChartUser;
myChartUser.data.labels = response.dataLabel;
myChartUser.update();
$('#countSuccess').html(response.countSuccess);
$('#countCancelled').html(response.countCancelled);
$('#countProcessed').html(response.countProcessed);
$('#countIndicated').html(response.countIndicated);
$('#countWaiting').html(response.countWaiting);
$('#totalTransaction').html(response.totalTransaction);
var activitiesRateTransaction = '';
var rateTransactionClass = response.rateTransaction == 0 ?
"secondary text-black-50" : (response.rateTransaction > 0 ?
"success" : "danger");
var rateTransactionClassIcon = response.rateTransaction == 0 ?
"mdi-equal" : (response.rateTransaction > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesRateTransaction = `
<span class="text-${rateTransactionClass} me-2"><span
class="mdi ${rateTransactionClassIcon}"></span>
${Math.abs(response.rateTransaction)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#rateTransaction').html(activitiesRateTransaction);
$('#countPending').html(response.countPending);
$('#countApprove').html(response.countApprove);
$('#countDeny').html(response.countDeny);
$('#totalRefund').html(response.totalRefund);
var activitiesRateRefund = '';
var rateRefundClass = response.rateRefund == 0 ?
"secondary text-black-50" : (response.rateRefund > 0 ?
"success" : "danger");
var rateRefundClassIcon = response.rateRefund == 0 ?
"mdi-equal" : (response.rateRefund > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesRateRefund = `
<span class="text-${rateRefundClass} me-2"><span
class="mdi ${rateRefundClassIcon}"></span>
${Math.abs(response.rateRefund)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#rateRefund').html(activitiesRateRefund);
$('#totalUser').html(response.totalUser);
var activitiesRateUser = '';
var rateUserClass = response.rateUser == 0 ?
"secondary text-black-50" : (response.rateUser > 0 ?
"success" : "danger");
var rateUserClassIcon = response.rateUser == 0 ?
"mdi-equal" : (response.rateUser > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesRateUser = `
<span class="text-${rateUserClass} me-2"><span
class="mdi ${rateUserClassIcon}"></span>
${Math.abs(response.rateUser)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#rateUser').html(activitiesRateUser);
var activitiesRateProfit = '';
var rateProfitClass = response.rateProfit == 0 ?
"secondary text-black-50" : (response.rateProfit > 0 ?
"success" : "danger");
var rateProfitMention = response.rateProfit == 0 ? "sama" : (response
.rateProfit > 0 ? "meningkat" : "menurun");
var rateProfitClassIcon = response.rateProfit == 0 ?
"sama" : (response.rateProfit > 0 ?
"meningkat" : "menurun");
activitiesRateProfit = `
<div class="alert alert-${rateProfitClass} alert-dismissible fade show mb-3"
role="alert">
Pendapatan ${rateProfitMention}
<span
class="mdi ${rateProfitClassIcon}"></span>
${Math.abs(response.rateProfit)}%
</div>
`;
$('#rateProfit').html(activitiesRateProfit);
// ListTopUser
var activitiesHtml = '';
response.dataTopUser.forEach(user => {
let fotoProfile = user.foto_profile == null ?
"{{ asset('storage/foto-profile/face1.jpg') }}" :
"{{ asset('storage/foto-profile') }}/" + user
.foto_profile;
let totalTransaction = new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR'
}).format(user.total_transaksi_berhasil);
let totalRefund = new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR'
}).format(user.total_refund_berhasil);
let transactionWidth = ((parseFloat(user
.total_transaksi_berhasil) *
100) / (parseFloat(user
.total_transaksi_berhasil) +
parseFloat(user.total_refund_berhasil))) / 1.5;
let refundWidth = ((parseFloat(user.total_refund_berhasil) *
100) / (
parseFloat(user.total_transaksi_berhasil) +
parseFloat(user.total_refund_berhasil))) / 1.5;
activitiesHtml += `
<li class="media">
<img class="mr-3 rounded" width="55"
src="${fotoProfile}"
alt="product">
<div class="media-body">
<div class="float-right">
<div class="font-weight-600 text-muted text-small">
${user.jumlah_transaksi} transaksi
</div>
</div>
<div class="media-title">${user.nama_lengkap}</div>
<div class="mt-1">
<div class="budget-price">
<div class="budget-price-square bg-primary"
data-width="${transactionWidth}%" style="width:${transactionWidth}%">
</div>
<div class="budget-price-label">
${totalTransaction}
</div>
</div>
<div class="budget-price">
<div class="budget-price-square bg-danger"
data-width="${refundWidth}%" style="width:${refundWidth}%">
</div>
<div class="budget-price-label">
${totalRefund}
</div>
</div>
</div>
</div>
</li>
`;
});
$('#listTopUser').html(activitiesHtml);
},
error: function(error) {
Swal.close();
console.log(error);
}
});
});
});
</script>
@endsection

View File

@ -1,5 +1,5 @@
@extends('layouts.main')
@section('content')
@section('tambahan-js')
<script>
$(document).ready(function() {
let selected = [];
@ -126,6 +126,13 @@
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') }}";
}
@ -150,6 +157,8 @@
});
});
</script>
@endsection
@section('content')
<div class="main-content">
<section class="section">
<div class="section-header">

View File

@ -1,5 +1,5 @@
@extends('layouts.main')
@section('content')
@section('tambahan-js')
<script>
$(document).ready(function() {
let selected = {!! json_encode($email) !!};
@ -145,8 +145,8 @@
processData: false,
contentType: false,
});
// location.href =
// "{{ route('admin-notification.index') }}";
location.href =
"{{ route('admin-notification.index') }}";
}
});
},
@ -170,6 +170,8 @@
});
</script>
@endsection
@section('content')
<div class="main-content">
<section class="section">
<div class="section-header">

View File

@ -1,5 +1,5 @@
@extends('layouts.main')
@section('content')
@section('tambahan-js')
<script>
$(document).ready(function() {
let listNotifikasi = $('#table-notifikasi').DataTable({
@ -67,6 +67,8 @@
});
});
</script>
@endsection
@section('content')
<div class="main-content">
<section class="section">
<div class="section-header">

View File

@ -1,5 +1,5 @@
@extends('layouts.main')
@section('content')
@section('tambahan-js')
<script>
$(document).ready(function() {
let listUser = $('#table-user').DataTable({
@ -65,6 +65,8 @@
});
});
</script>
@endsection
@section('content')
<div class="main-content">
<section class="section">
<div class="section-header">
@ -83,7 +85,7 @@
</div>
<div class="d-flex justify-content-start mb-3">
{{ $notification->content }}
{!! $notification->content !!}
</div>
<div class="d-flex justify-content-center mt-5 mb-3">

View File

@ -99,6 +99,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
$('#accept').on('click', function() {
@ -143,6 +145,14 @@
icon: response.status ? 'success' : 'error'
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('admin-notification.update-new-notification') }}",
data: {
receivers: response
.receivers,
},
type: 'GET',
});
location.reload();
}
});
@ -181,11 +191,11 @@
if (result.isConfirmed) {
Swal.fire({
title: 'Tolak Refund?',
text: 'Berikan alasan menolak refund ini'
text: 'Berikan alasan menolak refund ini',
input: 'text',
inputPlaceholder: 'Cth. Bukti foto tidak sesuai',
confirmButtonText: 'Kirim',
showCancelButton: true
showCancelButton: true,
cancelButtonText: 'Batal'
}).then((a) => {
if (a.isConfirmed) {
@ -213,6 +223,14 @@
'success' : 'error'
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('admin-notification.update-new-notification') }}",
data: {
receivers: response
.receivers,
},
type: 'GET',
});
location.reload();
}
});

View File

@ -40,6 +40,9 @@
</section>
</div>
@include('admin.refund.modal-keterangan-status')
@include('admin.transaction.modal-keterangan-status')
@endsection
@section('tambahan-js')
<script>
$(function() {
let listRefund = $('#table-refund').DataTable({
@ -147,5 +150,4 @@
});
});
</script>
@extends('admin.transaction.modal-keterangan-status')
@endsection

View File

@ -97,6 +97,14 @@
</address>
</div>
</div>
<div class="row">
<div class="col-md-12">
<address>
<strong>Deskripsi:</strong><br>
{!! $transaction->deskripsi_transaksi !!}<br>
</address>
</div>
</div>
{{-- batas pembayaran dan pengiriman --}}
<div class="row">
<div class="col-md-6">
@ -107,20 +115,8 @@
</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>
<strong>Batas Pengiriman:</strong><br>
{{ date('d F Y', strtotime($transaction->batas_pengiriman_barang_akhir)) }}<br>
</address>
</div>
</div>
@ -139,13 +135,12 @@
</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' }}
{{ $transaction->fraud_status == null ? 'Tidak ada' : ucwords($transaction->fraud_status) }}
</address>
</div>
<div class="col-md-6 text-md-right">
@ -245,6 +240,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
$('#acceptTransaction').on('click', function() {
@ -289,6 +286,14 @@
icon: response.status ? 'success' : 'error'
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('admin-notification.update-new-notification') }}",
data: {
receivers: response
.receivers
},
type: 'GET',
});
location.reload();
}
});
@ -368,6 +373,14 @@
'success' : 'error'
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('admin-notification.update-new-notification') }}",
data: {
receivers: response
.receivers
},
type: 'GET',
});
location.reload();
}
});

View File

@ -40,6 +40,8 @@
</div>
@include('admin.transaction.modal-tracking')
@include('admin.transaction.modal-keterangan-status')
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
let listTransaction = $('#table-transaction').DataTable({

View File

@ -153,6 +153,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
$('#tampilKTP').on('click', function() {
@ -218,18 +220,18 @@
icon: response.status ? 'success' : 'error',
confirmButtonText: 'OK'
}).then(function() {
if (response.status) {
location.reload();
}
});
},
error: function(error) {
Swal.fire({
title: 'Gagal!',
text: 'Tidak ada data yang dihapus, karena ' +
error,
text: 'Terjadi Kesalahan di server',
icon: 'error'
}).then(function() {
location.reload();
});
console.log(error);
}
});
} else {
@ -298,16 +300,18 @@
'success' : 'error',
confirmButtonText: 'OK'
}).then(function() {
if (response.status) {
location.reload();
}
});
},
error: function(error) {
Swal.fire({
title: 'Gagal!',
text: 'Gagal mengubah status akun, karena ' +
error,
text: 'Terjadi Kesalahan di server',
icon: 'info'
});
console.log(error);
}
});
} else {

View File

@ -35,6 +35,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(function() {
let listUser = $('#table-user').DataTable({
@ -108,6 +110,54 @@
className: 'text-center'
}],
});
$('#table-user').on('click', '#deleteUser', function() {
const id = $(this).data('id');
const csrfToken = $('meta[name="csrf-token"]').attr('content');
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-user.destroy') }}",
type: "DELETE",
data: {
id: id,
},
success: function(response) {
Swal.fire({
title: response.status ? 'Berhasil hapus akun' :
'Gagal hapus akun',
text: response.message,
icon: response.status ? 'success' : 'error'
}).then(function() {
if (response.status) {
listUser.ajax.reload();
}
});
},
error: function(error) {
Swal.fire({
title: 'Error',
text: 'Terjadi kesalahan di server',
icon: 'error'
});
console.log(error);
}
});
})
});
</script>
@endsection

View File

@ -44,6 +44,8 @@
</div>
@include('user.contact.modal-detail-contact')
@include('user.contact.modal-add-contact')
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
let check = false;

View File

@ -1,80 +1,197 @@
@extends('layouts.main')
@section('css-tambahan')
<style>
.select2-container .select2-selection--single {
border: none;
background: none;
outline: none;
box-shadow: none;
padding: 0;
}
.select2-container .select2-selection--single:focus {
border: none;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #900c3e;
line-height: 28px;
}
.select2-container .select2-selection--single .select2-selection__arrow {
border: none;
background: none;
}
.select2-container--default.select2-container--open .select2-selection--single {
border: none;
}
.select2-results {
border-bottom: 1px solid #aaa;
}
.select2-results__option {
padding: 10px;
color: #333;
background-color: white;
}
.select2-container--default .select2-results>.select2-results__options .select2-results__option--highlighted {
background-color: #900c3e !important;
color: #fff !important;
}
</style>
@endsection
@section('content')
<!-- Main Content -->
<div class="main-content">
<section class="section">
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-stats">
<div class="card-stats-title">List Transaction -
<div class="dropdown d-inline">
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
id="orders-month">August</a>
<ul class="dropdown-menu dropdown-menu-sm" aria-labelledby="orders-month"
id="dropdownMenu1">
<li class="dropdown-title">Pilih Bulan</li>
<li><a href="#" class="dropdown-item">Januari</a></li>
<li><a href="#" class="dropdown-item">Februari</a></li>
<li><a href="#" class="dropdown-item">Maret</a></li>
<li><a href="#" class="dropdown-item">April</a></li>
<li><a href="#" class="dropdown-item">May</a></li>
<li><a href="#" class="dropdown-item">Juni</a></li>
<li><a href="#" class="dropdown-item">Juli</a></li>
<li><a href="#" class="dropdown-item">Agustus</a></li>
<li><a href="#" class="dropdown-item">September</a></li>
<li><a href="#" class="dropdown-item">Oktober</a></li>
<li><a href="#" class="dropdown-item">November</a></li>
<li><a href="#" class="dropdown-item">Desember</a></li>
</ul>
<div class="card-stats-title">
<h4>
Transaksi - <select class="input" style="width: 40%;" name="filterRole" id="filterRole">
<option value="1" selected>Semua</option>
<option value="2">Pembeli</option>
<option value="3">Penjual</option>
</select>
</h4>
</div>
<div class="dropdown d-inline">
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
id="orders-year">2023</a>
<ul class="dropdown-menu dropdown-menu-sm" aria-labelledby="orders-year"
id="dropdownMenu2">
<li class="dropdown-title">Pilih Tahun</li>
<li><a href="#" class="dropdown-item">2019</a></li>
<li><a href="#" class="dropdown-item">2020</a></li>
<li><a href="#" class="dropdown-item">2021</a></li>
<li><a href="#" class="dropdown-item">2022</a></li>
<li><a href="#" class="dropdown-item">2023</a></li>
</ul>
<div id="semua">
<div class="card-stats-items">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countAllFinished">{{ $countAllFinished }}
</div>
Sebagai -
<div class="dropdown d-inline">
<a class="font-weight-600 dropdown-toggle" data-toggle="dropdown" href="#"
id="orders-role">Semua</a>
<ul class="dropdown-menu dropdown-menu-sm" aria-labelledby="orders-role"
id="dropdownMenu3">
<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">Penjual</a></li>
</ul>
<div class="card-stats-item-label">Selesai</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countAllPending">{{ $countAllPending }}</div>
<div class="card-stats-item-label">Menunggu</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countAllProcessed">{{ $countAllProcessed }}
</div>
<div class="card-stats-item-label">Diproses</div>
</div>
</div>
<div class="card-stats-items">
<div class="card-stats-item">
<div class="card-stats-item-count">114</div>
<div class="card-stats-item-label">Dibuat</div>
<div class="card-stats-item-count" id="countAllCanceled">{{ $countAllCanceled }}
</div>
<div class="card-stats-item">
<div class="card-stats-item-count">12</div>
<div class="card-stats-item-label">Pending</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-count" id="countAllRefund">{{ $countAllRefund }}</div>
<div class="card-stats-item-label">Refund</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countAllIndicated">{{ $countAllIndicated }}
</div>
<div class="card-stats-item-label">Tertunda</div>
</div>
</div>
</div>
<div id="pembeli" hidden>
<div class="card-stats-items mt-3">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerFinished">{{ $countBuyerFinished }}
</div>
<div class="card-stats-item-label">Selesai</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerPaid">{{ $countBuyerPaid }}
</div>
<div class="card-stats-item-label">Dibayar</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerProcessed">
{{ $countBuyerProcessed }}
</div>
<div class="card-stats-item-label">Diproses</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerPending">{{ $countBuyerPending }}
</div>
<div class="card-stats-item-label">Menunggu</div>
</div>
</div>
<div class="card-stats-items">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerCancelled">
{{ $countBuyerCancelled }}</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-count" id="countBuyerIndicated">
{{ $countBuyerIndicated }}
</div>
<div class="card-stats-item-label">Tertunda</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerRefundPending">
{{ $countBuyerRefundPending }}</div>
<div class="card-stats-item-label">Pengajuan Refund</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerRefundApproved">
{{ $countBuyerRefundApproved }}</div>
<div class="card-stats-item-label">Disetujui</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countBuyerRefundDenied">
{{ $countBuyerRefundDenied }}</div>
<div class="card-stats-item-label">Ditolak</div>
</div>
</div>
</div>
<div id="penjual" hidden>
<div class="card-stats-items mt-3">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerFinished">
{{ $countSellerFinished }}</div>
<div class="card-stats-item-label">selesai</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerProcessed">
{{ $countSellerProcessed }}</div>
<div class="card-stats-item-label">Diproses</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerSending">
{{ $countSellerSending }}</div>
<div class="card-stats-item-label">Dikirim</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerSent">{{ $countSellerSent }}
</div>
<div class="card-stats-item-label">Sampai</div>
</div>
</div>
<div class="card-stats-items">
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerPending">
{{ $countSellerPending }}</div>
<div class="card-stats-item-label">Menunggu</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerCancelled">
{{ $countSellerCancelled }}</div>
<div class="card-stats-item-label">Gagal</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerRefund">
{{ $countSellerRefund }}</div>
<div class="card-stats-item-label">Refund</div>
</div>
<div class="card-stats-item">
<div class="card-stats-item-count" id="countSellerIndicated">
{{ $countSellerIndicated }}</div>
<div class="card-stats-item-label">Tertunda</div>
</div>
</div>
</div>
</div>
<div class="card-icon shadow-primary bg-primary">
@ -84,16 +201,23 @@
<div class="card-header">
<h4>Jumlah Transaction</h4>
</div>
<div class="card-body">
159 Transaksi
<div class="card-body" id="totalTransaction">
{{ $totalTransaction }} Transaksi
</div>
</div>
<p class="mb-0 text-muted" id="rateTransaction">
<span
class="text-{{ $rateTransaction == 0 ? 'secondary text-black-50' : ($rateTransaction > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $rateTransaction == 0 ? 'mdi-equal' : ($rateTransaction > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($rateTransaction) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-chart">
<canvas id="balance-chart" height="80"></canvas>
<canvas id="pemasukan-chart" height="100"></canvas>
</div>
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-dollar-sign"></i>
@ -102,16 +226,23 @@
<div class="card-header">
<h4>Pemasukan</h4>
</div>
<div class="card-body">
Rp. 35.000.000,00
<div class="card-body" id="totalPemasukan">
Rp {{ number_format($totalPemasukan, 2, ',', '.') }}
</div>
</div>
<p class="mb-0 text-muted" id="ratePemasukan">
<span
class="text-{{ $ratePemasukan == 0 ? 'secondary text-black-50' : ($ratePemasukan > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $ratePemasukan == 0 ? 'mdi-equal' : ($ratePemasukan > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($ratePemasukan) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-12">
<div class="col-lg-4 col-md-12 col-sm-12">
<div class="card card-statistic-2">
<div class="card-chart">
<canvas id="sales-chart" height="80"></canvas>
<canvas id="pengeluaran-chart" height="100"></canvas>
</div>
<div class="card-icon shadow-primary bg-primary">
<i class="fas fa-shopping-bag"></i>
@ -120,35 +251,62 @@
<div class="card-header">
<h4>Pengeluaran</h4>
</div>
<div class="card-body">Rp. 35.000.000,00</div>
<div class="card-body" id="totalPengeluaran">Rp
{{ number_format($totalPengeluaran, 2, ',', '.') }}
</div>
</div>
<p class="mb-0 text-muted" id="ratePengeluaran">
<span
class="text-{{ $ratePengeluaran == 0 ? 'secondary text-black-50' : ($ratePengeluaran > 0 ? 'success' : 'danger') }} me-2"><span
class="mdi {{ $ratePengeluaran == 0 ? 'mdi-equal' : ($ratePengeluaran > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ abs($ratePengeluaran) }}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
</p>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="input-group">
<input type="text" name="from-to" class="form-control" id="date-range">
<span class="input-group-text bg-primary text-white align-items-center">
<i class="mdi mdi-calendar-range font-13"></i>
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="alert alert-primary alert-dismissible fade show mb-3" role="alert">
Pendapatan Hari Ini meningkat <span class="mdi mdi-arrow-up-bold"></span>
5.27%</span>
<div id="rateProfit">
<div class="alert alert-{{ $rateProfit == 0 ? 'secondary text-black-50' : ($rateProfit > 0 ? 'success' : 'error') }} alert-dismissible fade show mb-3"
role="alert">
Transaksi {{ $rateProfit == 0 ? 'sama' : ($rateProfit > 0 ? 'meningkat' : 'menurun') }}
<span
class="mdi {{ $rateProfit == 0 ? 'mdi-equal' : ($rateProfit > 0 ? 'mdi-arrow-up-bold' : 'mdi-arrow-down-bold') }}"></span>
{{ $rateProfit }}%
</div>
</div>
<div class="card-header">
<h4 style="font-size: 36px;">Transaksi</h4>
<div class="card-header-action">
<div class="btn-group">
<a href="#" class="btn btn-primary">Week</a>
<a href="#" class="btn">Month</a>
</div>
</div>
<h4>Transaksi</h4>
</div>
<div class="card-body">
<canvas id="myChart" height="150"></canvas>
<canvas id="myChart" height="120"></canvas>
</div>
</div>
</div>
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
let dataLabel = {!! json_encode($dataLabel) !!}
let dataChartTransaction = {{ json_encode($dataChartTransaction) }}
let dataChartRefund = {{ json_encode($dataChartRefund) }}
let dataChartPemasukan = {{ json_encode($dataChartPemasukan) }}
let dataChartPengeluaran = {{ json_encode($dataChartPengeluaran) }}
</script>
<script>
// Set new default font family and font color to mimic Bootstrap's default styling
Chart.defaults.global.defaultFontFamily = 'Nunito',
@ -156,15 +314,13 @@
Chart.defaults.global.defaultFontColor = '#858796';
var ctx = document.getElementById("myChart").getContext('2d');
var myChart = new Chart(ctx, {
var myChartTransaksi = new Chart(ctx, {
type: 'line',
data: {
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Agu", "Sep",
"Okt", "Nov", "Des"
],
labels: dataLabel,
datasets: [{
label: 'Transaksi',
data: [3200, 18009, 4305, 3022, 6310, 5120, 5880, 6154, 0],
data: dataChartTransaction,
borderWidth: 2,
backgroundColor: 'rgba(63,82,227,.8)',
borderWidth: 0,
@ -176,7 +332,7 @@
},
{
label: 'Refund',
data: [2207, 3403, 2200, 5025, 2302, 4208, 3880, 4880, 5000],
data: dataChartRefund,
borderWidth: 2,
backgroundColor: 'rgba(254,86,83,.7)',
borderWidth: 0,
@ -208,19 +364,12 @@
},
ticks: {
beginAtZero: true,
stepSize: 15000,
callback: function(value, index, values) {
// return 'Rp.' + value;
return new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR',
}).format(value);
},
fontSize: 14,
maxTicksLimit: 6,
},
scaleLabel: {
display: true,
labelString: 'Dalam Ratusan Juta', // Label khusus untuk sumbu Y
labelString: 'Dalam Rupiah (Rp)', // Label khusus untuk sumbu Y
fontSize: 16 // Ukuran font untuk label sumbu Y
},
}],
@ -230,30 +379,32 @@
tickMarkLength: 15,
},
ticks: {
fontSize: 16,
}
display: false,
maxTicksLimit: 8,
},
offset: true,
}]
},
}
});
var balance_chart = document.getElementById("balance-chart").getContext('2d');
var pemasukan_chart = document.getElementById("pemasukan-chart").getContext('2d');
var balance_chart_bg_color = balance_chart.createLinearGradient(0, 0, 0, 70);
balance_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
balance_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var pemasukan_chart_bg_color = pemasukan_chart.createLinearGradient(0, 0, 0, 70);
var myChart = new Chart(balance_chart, {
pemasukan_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
pemasukan_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var myChartPemasukan = new Chart(
pemasukan_chart, {
type: 'line',
data: {
labels: ['16-07-2018', '17-07-2018', '18-07-2018', '19-07-2018', '20-07-2018', '21-07-2018',
'22-07-2018', '23-07-2018', '24-07-2018', '25-07-2018', '26-07-2018', '27-07-2018',
'28-07-2018', '29-07-2018', '30-07-2018', '31-07-2018'
],
labels: dataLabel,
datasets: [{
label: 'Balance',
data: [50, 61, 80, 50, 72, 52, 60, 41, 30, 45, 70, 40, 93, 63, 50, 62],
backgroundColor: balance_chart_bg_color,
label: 'Pemasukan',
data: dataChartPemasukan,
backgroundColor: pemasukan_chart_bg_color,
borderWidth: 3,
borderColor: 'rgba(63,82,227,1)',
pointBorderWidth: 0,
@ -265,10 +416,7 @@
},
options: {
layout: {
padding: {
bottom: -1,
left: -1
}
padding: 10
},
legend: {
display: false
@ -281,40 +429,41 @@
},
ticks: {
beginAtZero: true,
display: false
display: false,
maxTicksLimit: 4,
}
}],
xAxes: [{
gridLines: {
drawBorder: false,
display: false,
display: true,
},
ticks: {
display: false
}
display: false,
maxTicksLimit: 8,
},
offset: true,
}]
},
}
});
var sales_chart = document.getElementById("sales-chart").getContext('2d');
var pengeluaran = document.getElementById("pengeluaran-chart");
var pengeluaran_chart = pengeluaran.getContext('2d');
var sales_chart_bg_color = sales_chart.createLinearGradient(0, 0, 0, 80);
balance_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
balance_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var pengeluaran_chart_bg_color = pengeluaran_chart.createLinearGradient(0, 0, 0, 80);
pengeluaran_chart_bg_color.addColorStop(0, 'rgba(63,82,227,.2)');
pengeluaran_chart_bg_color.addColorStop(1, 'rgba(63,82,227,0)');
var myChart = new Chart(sales_chart, {
var myChartPengeluaran = new Chart(pengeluaran_chart, {
type: 'line',
data: {
labels: ['16-07-2018', '17-07-2018', '18-07-2018', '19-07-2018', '20-07-2018', '21-07-2018',
'22-07-2018', '23-07-2018', '24-07-2018', '25-07-2018', '26-07-2018', '27-07-2018',
'28-07-2018', '29-07-2018', '30-07-2018', '31-07-2018'
],
labels: dataLabel,
datasets: [{
label: 'Sales',
data: [70, 62, 44, 40, 21, 63, 82, 52, 50, 31, 70, 50, 91, 63, 51, 60],
label: 'Pengeluaran',
data: dataChartPengeluaran,
borderWidth: 2,
backgroundColor: balance_chart_bg_color,
backgroundColor: pengeluaran_chart_bg_color,
borderWidth: 3,
borderColor: 'rgba(63,82,227,1)',
pointBorderWidth: 0,
@ -326,10 +475,7 @@
},
options: {
layout: {
padding: {
bottom: -1,
left: -1
}
padding: 10
},
legend: {
display: false
@ -342,20 +488,244 @@
},
ticks: {
beginAtZero: true,
display: false
display: false,
maxTicksLimit: 4,
}
}],
xAxes: [{
gridLines: {
drawBorder: false,
display: false,
display: true,
},
ticks: {
display: false
}
display: false,
maxTicksLimit: 8,
},
offset: true,
}]
},
}
});
</script>
<script>
$(document).ready(function() {
const csrfToken = $('meta[name="csrf-token"]').attr('content');
let searchParams = new URLSearchParams(window.location.search);
let dateInterval = searchParams.get('from-to');
let start = moment().subtract(29, 'days');
let end = moment();
$('#filterRole').select2();
$('#filterRole').change(function() {
let id = $(this).val();
if (id == "1") {
$('#semua').removeAttr('hidden');
$('#pembeli').attr('hidden', true);
$('#penjual').attr('hidden', true);
} else if (id == "2") {
$('#semua').attr('hidden', true);
$('#pembeli').removeAttr('hidden');
$('#penjual').attr('hidden', true);
} else {
$('#semua').attr('hidden', true);
$('#pembeli').attr('hidden', true);
$('#penjual').removeAttr('hidden');
}
});
if (dateInterval) {
dateInterval = dateInterval.split(' - ');
start = moment(dateInterval[0]);
end = moment(dateInterval[1]);
}
$('#date-range').daterangepicker({
"showDropdowns": true,
"showWeekNumbers": true,
"alwaysShowCalendars": true,
startDate: start,
endDate: end,
locale: {
format: 'YYYY-MM-DD',
firstDay: 1,
},
minDate: "2023-01-01",
maxDate: "2025-12-31",
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1,
'month').endOf(
'month')],
'This Year': [moment().startOf('year'), moment().endOf('year')],
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year')
.endOf(
'year')
]
}
}).on('apply.daterangepicker', function(ev, picker) {
var startDate = picker.startDate.format('YYYY-MM-DD');
var endDate = picker.endDate.format('YYYY-MM-DD');
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('user.get-data-dashboard') }}",
type: 'GET',
data: {
startDate: startDate,
endDate: endDate
},
success: function(response) {
Swal.close();
myChartTransaksi.data.datasets[0].data = response.dataChartTransaction;
myChartTransaksi.data.datasets[1].data = response.dataChartRefund;
myChartTransaksi.data.labels = response.dataLabel;
myChartTransaksi.update();
myChartPemasukan.data.datasets[0].data = response.dataChartUser;
myChartPemasukan.data.labels = response.dataLabel;
myChartPemasukan.update();
myChartPengeluaran.data.datasets[0].data = response.dataChartUser;
myChartPengeluaran.data.labels = response.dataLabel;
myChartPengeluaran.update();
// Semua
$('#countAllFinished').html(response.countAllFinished);
$('#countAllPending').html(response.countAllPending);
$('#countAllProcessed').html(response.countAllProcessed);
$('#countAllCanceled').html(response.countAllCanceled);
$('#countAllRefund').html(response.countAllRefund);
$('#countAllIndicated').html(response.countAllIndicated);
// Pembeli
$('#countBuyerFinished').html(response.countBuyerFinished);
$('#countBuyerPaid').html(response.countBuyerPaid);
$('#countBuyerPending').html(response.countBuyerPending);
$('#countBuyerProcessed').html(response.countBuyerProcessed);
$('#countBuyerCancelled').html(response.countBuyerCancelled);
$('#countBuyerRefundPending').html(response.countBuyerRefundPending);
$('#countBuyerRefundApproved').html(response.countBuyerRefundApproved);
$('#countBuyerRefundDenied').html(response.countBuyerRefundDenied);
$('#countBuyerIndicated').html(response.countBuyerIndicated);
// Penjual
$('#countSellerPending').html(response.countSellerPending);
$('#countSellerFinished').html(response.countSellerFinished);
$('#countSellerProcessed').html(response.countSellerProcessed);
$('#countSellerSending').html(response.countSellerSending);
$('#countSellerSent').html(response.countSellerSent);
$('#countSellerCancelled').html(response.countSellerCancelled);
$('#countSellerRefund').html(response.countSellerRefund);
$('#countSellerIndicated').html(response.countSellerIndicated);
$('#totalTransaction').html(response.totalTransaction);
var activitiesRateTransaction = '';
var rateTransactionClass = response.rateTransaction == 0 ?
"secondary text-black-50" : (response.rateTransaction > 0 ?
"success" : "danger");
var rateTransactionClassIcon = response.rateTransaction == 0 ?
"mdi-equal" : (response.rateTransaction > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesRateTransaction = `
<span class="text-${rateTransactionClass} me-2"><span
class="mdi ${rateTransactionClassIcon}"></span>
${Math.abs(response.rateTransaction)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#rateTransaction').html(activitiesRateTransaction);
// Pemasukan
$('#totalPemasukan').html(response.totalPemasukan);
var activitiesratePemasukan = '';
var ratePemasukanClass = response.ratePemasukan == 0 ?
"secondary text-black-50" : (response.ratePemasukan > 0 ?
"success" : "danger");
var ratePemasukanClassIcon = response.ratePemasukan == 0 ?
"mdi-equal" : (response.ratePemasukan > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesratePemasukan = `
<span class="text-${ratePemasukanClass} me-2"><span
class="mdi ${ratePemasukanClassIcon}"></span>
${Math.abs(response.ratePemasukan)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#ratePemasukan').html(activitiesratePemasukan);
// Pengeluaran
$('#totalPengeluaran').html(response.totalPengeluaran);
var activitiesRatePengeluaran = '';
var ratePengeluaranClass = response.ratePengeluaran == 0 ?
"secondary text-black-50" : (response.ratePengeluaran > 0 ?
"success" : "danger");
var ratePengeluaranClassIcon = response.ratePengeluaran == 0 ?
"mdi-equal" : (response.ratePengeluaran > 0 ?
"mdi-arrow-up-bold" : "mdi-arrow-down-bold");
activitiesRatePengeluaran = `
<span class="text-${ratePengeluaranClass} me-2"><span
class="mdi ${ratePengeluaranClassIcon}"></span>
${Math.abs(response.ratePengeluaran)}%</span>
<span class="text-nowrap">Dibandingkan sebelumnya</span>
`;
$('#ratePengeluaran').html(activitiesRatePengeluaran);
// Profit
var activitiesRateProfit = '';
var rateProfitClass = response.rateProfit == 0 ?
"secondary text-black-50" : (response.rateProfit > 0 ?
"success" : "danger");
var rateProfitMention = response.rateProfit == 0 ? "sama" : (response
.rateProfit > 0 ? "meningkat" : "menurun");
var rateProfitClassIcon = response.rateProfit == 0 ?
"sama" : (response.rateProfit > 0 ?
"meningkat" : "menurun");
activitiesRateProfit = `
<div class="alert alert-${rateProfitClass} alert-dismissible fade show mb-3"
role="alert">
Pendapatan ${rateProfitMention}
<span
class="mdi ${rateProfitClassIcon}"></span>
${Math.abs(response.rateProfit)}%
</div>
`;
$('#rateProfit').html(activitiesRateProfit);
},
error: function(error) {
Swal.close();
console.log(error);
}
});
});
});
</script>
@endsection

View File

@ -18,7 +18,7 @@
</div>
<div class="d-flex justify-content-start mb-3">
{{ $notification->content }}
{!! $notification->content !!}
</div>
</div>
</div>

View File

@ -1,12 +1,5 @@
@extends('layouts.main')
@section('content')
<style>
.unread {
background-color: #a3194e;
font-weight: bold;
color: #ffffff;
}
</style>
@section('tambahan-js')
<script>
$(document).ready(function() {
let listUser = $('#table-notifikasi').DataTable({
@ -62,6 +55,14 @@
});
});
</script>
@endsection
@section('content')
<style>
.unread {
font-weight: bold;
color: #000000;
}
</style>
<div class="main-content">
<section class="section">
<div class="section-header">

View File

@ -42,6 +42,8 @@
</section>
</div>
@include('user.refund.modal-keterangan-status')
@endsection
@section('tambahan-js')
<script>
$(function() {
let listRefund = $('#table-refund').DataTable({

View File

@ -1,56 +0,0 @@
<div class="modal fade" id="awaldetailrefund" role="dialog">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
</div>
<div class="d-flex justify-content-center">
<h4 class="modal-title" id="myModalLabel">Detail Refund</h4>
</div>
<div class="modal-body">
<p class="statusMsg"></p>
<div class="card-body">
<div class="form-group">
<label for="inputOrderId">Order ID</label>
<p class="form-control-static" id="orderid">1452667</p>
</div>
<div class="form-group">
<label for="inputCustomer">Customer</label>
<p class="form-control-static" id="customer">Nurul Prima</p>
</div>
<div class="form-group">
<label for="inputEmail">Email Customer</label>
<p class="form-control-static" id="inputEmail">npannisa@gmail.com</p>
</div>
<div class="form-group">
<label for="inputSeller">Seller Name</label>
<p class="form-control-static" id="sellername">Zakiaa</p>
</div>
<div class="form-group">
<label for="inputDueDate">Due Date</label>
<p class="form-control-static" id="duedate">29 Januari 2002</p>
</div>
<div class="form-group">
<label for="inputComplaint">Reason Complaint</label>
<p class="form-control-static" id="reasoncomplaint">Pengembalian product dikarenakan tidak
sesuai dengan aslinya</p>
</div>
<div class="form-group">
<label for="inputBukti">Bukti</label>
<p class="form-control-static" id="inputbukti"></p>
<img class="mr-3 rounded" width="200" src="assets/img/avatar/rusak.jpeg">
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -51,7 +51,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
$('#formPengajuan').on('submit', function(e) {
@ -95,6 +96,14 @@
icon: response.status ? 'success' : 'error',
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-notification-to-admin') }}",
type: 'GET',
data: {
service: response
.service,
}
});
location.href =
"{{ route('user-refund.index') }}";
}

View File

@ -8,6 +8,9 @@
<div class="d-flex justify-content-center">
<h2 class="mb-4"> Informasi Pesanan</h2>
</div>
<div class="d-flex justify-content-center">
<p>#{{ $transaction->id }}</p>
</div>
</div>
</div>
</div>
@ -98,6 +101,58 @@
</address>
</div>
</div>
<div class="row">
<div class="col-md-12">
<address>
<strong>Deskripsi:</strong><br>
{!! $transaction->deskripsi_transaksi !!}<br>
</address>
</div>
</div>
<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>Batas Pengiriman:</strong><br>
{{ date('d F Y', strtotime($transaction->batas_pengiriman_barang_akhir)) }}<br>
</address>
</div>
</div>
<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>
@if ($transaction->fraud_status != null)
<div class="row">
<div class="col-md-6">
<address>
<strong>Status Indikasi Penipuan:</strong><br>
{{ $transaction->fraud_status == null ? 'Tidak ada' : ucwords($transaction->fraud_status) }}
</address>
</div>
<div class="col-md-6 text-md-right">
<address>
<strong>Keterangan:</strong><br>
{{ $transaction->keterangan }}
</address>
</div>
</div>
@endif
</div>
</div>
@ -119,11 +174,11 @@
<td>1</td>
<td>{{ $transaction->nama_barang }}</td>
<td class="text-center">
Rp.{{ number_format($transaction->harga_barang, 2, ',', '.') }}
Rp {{ number_format($transaction->harga_barang, 2, ',', '.') }}
</td>
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
<td class="text-right">
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
Rp {{ number_format($transaction->total_harga, 2, ',', '.') }}
</td>
</tr>
</table>
@ -142,21 +197,22 @@
<div class="col-lg-4 text-right">
<div class="invoice-detail-item">
<div class="invoice-detail-name">Subtotal</div>
<div class="invoice-detail-value">Rp
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
<div class="invoice-detail-value">
Rp {{ number_format($transaction->total_harga, 2, ',', '.') }}
</div>
</div>
<div class="invoice-detail-item">
<div class="invoice-detail-name">Biaya Admin</div>
<div class="invoice-detail-value">
Rp.{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
Rp
{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
</div>
</div>
<hr class="mt-2 mb-2">
<div class="invoice-detail-item">
<div class="invoice-detail-name">Total</div>
<div class="invoice-detail-value invoice-detail-value-lg">
Rp.{{ number_format($transaction->total_bayar, 2, ',', '.') }}
Rp {{ number_format($transaction->total_bayar, 2, ',', '.') }}
</div>
</div>
</div>

View File

@ -59,7 +59,9 @@
@include('user.transaction.pembeli.modal-end-transaction')
@include('user.transaction.pembeli.modal-tracking')
@include('user.transaction.pembeli.modal-keterangan-status')
@endsection
@section('tambahan-js')
<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js"
data-client-key="SB-Mid-client-lEMALcmIPviksRRe"></script>
<script>
@ -203,6 +205,14 @@
'error'
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response
.receiver,
}
});
listPembeli.ajax.reload();
}
});
@ -469,6 +479,14 @@
}).then(function() {
Swal.close();
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response
.receiver
}
});
listPembeli.ajax
.reload();
}
@ -624,6 +642,13 @@
icon: response.status ? 'success' : 'error',
}).then(function() {
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response.receiver,
}
});
location.reload();
}
});

View File

@ -119,6 +119,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
var persentaseKeuntungan = {{ $persentase_keuntungan }};
@ -260,18 +262,18 @@
});
$.ajax({
url: "{{ route('user-contact.email', ':email') }}".replace(
":email",
email
),
url: "{{ route('user-contact.email') }}",
data: {
email: email
},
type: "GET",
success: function(response) {
if (
response.status &&
(response.message.nama_bank == null ||
response.message.nama_bank == "") &&
(response.message.no_rek == null ||
response.message.no_rek == "")
(response.message.nama_bank != null ||
response.message.nama_bank != "") &&
(response.message.no_rek != null ||
response.message.no_rek != "")
) {
Swal.fire({
title: "Berhasil",
@ -285,6 +287,7 @@
icon: "error",
});
}
console.log(response.message.nama_bank);
},
error: function(error) {
Swal.fire({

View File

@ -53,6 +53,8 @@
@include('user.transaction.penjual.modal-tracking')
@include('user.transaction.penjual.modal-pengiriman-selesai')
@include('user.transaction.penjual.modal-keterangan-status')
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
let listPenjual = $('#table-penjual').DataTable({
@ -274,6 +276,14 @@
}).then(function() {
Swal.close();
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response
.receiver,
}
});
listPenjual.ajax.reload();
}
});
@ -349,6 +359,14 @@
}).then(function() {
Swal.close();
if (response.status) {
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response
.receiver,
}
});
listPenjual.ajax
.reload();
}
@ -516,6 +534,13 @@
if (response.status) {
$('#formBukti').trigger('reset');
$('#modalOrderSent').modal('hide');
$.ajax({
url: "{{ route('user-notification.update-new-notification') }}",
type: 'GET',
data: {
receiver: response.receiver,
}
});
listPenjual.ajax.reload();
}
});

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Arial", sans-serif;
background-color: #f4f4f4;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.card {
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
max-width: 400px;
width: 100%;
}
.card-rekber {
text-align: center;
margin-bottom: 20px;
}
.large-text {
font-size: 3.5em;
font-weight: bold;
color: #b61754;
}
.small-text {
font-size: 0.8em;
color: #888;
}
.code-verifikasi,
.code,
.masa-berlaku {
margin-bottom: 15px;
}
.code-pendaftaran {
background-color: #b61754;
color: #fff;
text-align: center;
padding: 10px;
border-radius: 4px;
font-size: 3.5em;
margin: 10px 0;
font-weight: bold;
}
@media only screen and (max-width: 600px) {
.card {
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<div class="card-rekber">
<p class="large-text">Rekber</p>
<span class="small-text">Pendaftaran Akun Sukses</span>
</div>
<div class="code-verifikasi">
<p>Selamat, anda dengan email</p>
<p><b>{{ $content['email'] }}</b></p>
</div>
<div class="code">
<p>dinyatakan</p>
</div>
<div class="code-pendaftaran">
<p>Berhasil</p>
</div>
<div class="masa-berlaku">
<p>Selamat bergabung di Rekber dan bertransaksi.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Arial", sans-serif;
background-color: #f4f4f4;
}
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.card {
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
max-width: 400px;
width: 100%;
}
.card-rekber {
text-align: center;
margin-bottom: 20px;
}
.large-text {
font-size: 3.5em;
font-weight: bold;
color: #b61754;
}
.small-text {
font-size: 0.8em;
color: #888;
}
.code-verifikasi,
.code,
.masa-berlaku {
margin-bottom: 15px;
}
.code-pendaftaran {
background-color: #b61754;
color: #fff;
text-align: center;
padding: 10px;
border-radius: 4px;
font-size: 3.5em;
margin: 10px 0;
font-weight: bold;
}
@media only screen and (max-width: 600px) {
.card {
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="card">
<div class="card-rekber">
<p class="large-text">Rekber</p>
<span class="small-text">Pendaftaran Akun Gagal</span>
</div>
<div class="code-verifikasi">
<p>Maaf, Anda dengan email</p>
<p><b>{{ $content['email'] }}</b></p>
</div>
<div class="code">
<p>dinyatakan</p>
</div>
<div class="code-pendaftaran">
<p>Gagal</p>
</div>
<div class="masa-berlaku">
<p>Dengan alasan {{ $content['keterangan'] }}</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -4,7 +4,6 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
box-sizing: border-box;

View File

@ -394,6 +394,7 @@
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="{{ asset('assets/js/login_register/app.js') }}"></script>
<script src="{{ asset('assets/js/login_register/script.js') }}"></script>
@if (Session::has('message'))
<script>
Swal.fire({

View File

@ -33,19 +33,28 @@
</div>
</div>
<div class="row">
<div class="col-md-12">
<address>
<strong>Deskripsi:</strong><br>
{!! $transaction->deskripsi_transaksi !!}<br>
</address>
</div>
</div>
<div class="row">
@if (in_array($transaction->status_pembayaran, ['settlement', 'capture']))
<div class="col-md-6">
<address>
<strong>Payment Method:</strong><br>
Visa ending **** 4242<br>
npannisa@gmail.com
<strong>Status Pembayaran:</strong><br>
{{ ucwords($transaction->status_pembayaran) }}<br>
</address>
</div>
<div class="col-md-6 text-md-right">
<address>
<strong>Tanggal Transaksi:</strong><br>
<strong>Tanggal Pembayaran:</strong><br>
{{ $transaction->created_at->format('d M Y, g:i') }}<br><br>
</address>
</div>
@endif
</div>
</div>
</div>
@ -67,10 +76,10 @@
<td>1</td>
<td>{{ $transaction->nama_barang }}</td>
<td class="text-center">
Rp.{{ number_format($transaction->harga_barang, 2, ',', '.') }}</td>
Rp {{ number_format($transaction->harga_barang, 2, ',', '.') }}</td>
<td class="text-center">{{ $transaction->jumlah_barang }}</td>
<td class="text-right">
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
Rp {{ number_format($transaction->total_harga, 2, ',', '.') }}
</td>
</tr>
</table>
@ -90,20 +99,20 @@
<div class="invoice-detail-item">
<div class="invoice-detail-name">Subtotal</div>
<div class="invoice-detail-value">
Rp.{{ number_format($transaction->total_harga, 2, ',', '.') }}
Rp {{ number_format($transaction->total_harga, 2, ',', '.') }}
</div>
</div>
<div class="invoice-detail-item">
<div class="invoice-detail-name">Biaya Admin</div>
<div class="invoice-detail-value">
Rp.{{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
Rp {{ number_format($transaction->total_keuntungan, 2, ',', '.') }}
</div>
</div>
<hr class="mt-2 mb-2">
<div class="invoice-detail-item">
<div class="invoice-detail-name">Total</div>
<div class="invoice-detail-value invoice-detail-value-lg">
Rp.{{ number_format($transaction->total_bayar, 2, ',', '.') }}
Rp {{ number_format($transaction->total_bayar, 2, ',', '.') }}
</div>
</div>
</div>
@ -120,6 +129,8 @@
</div>
</section>
</div>
@endsection
@section('tambahan-js')
<script>
$(document).ready(function() {
$('#btnPDF').on('click', function() {

View File

@ -22,14 +22,14 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
<div class="dropdown-menu dropdown-list dropdown-menu-right">
<div class="dropdown-header">Notifikasi
<div class="float-right">
<a href="javascript: void(0);" id="markAllAsRead">Mark All As Read</a>
<a href="javascript: void(0);" id="markAllAsRead">Tandai semua telah dibaca</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
<a href="{{ route('user-notification.index') }}">Lihat semua<i
class="fas fa-chevron-right"></i></a>
</div>
</div>
@ -55,12 +55,17 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
</li>
</ul>
</nav>
@section('js-header')
<script>
$(document).ready(function() {
var notifBtn = $('#notifBtn');
function updateNotif() {
notifBtn.toggleClass("beep");
notifBtn.addClass("beep");
}
function removeNotif() {
notifBtn.removeClass("beep");
}
$('#notifBtn').on('click', function() {
@ -95,7 +100,8 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
var minutes = date.getMinutes();
var formattedDate = day + ' ' + month + ' ' + year +
" | " + hours + ":" + +(minutes < 10 ? '0' : '') +
" | " + hours + ":" + +(minutes < 10 ? '0' :
'') +
minutes;
activitiesHtml += `
@ -130,11 +136,11 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
console.log(error);
}
});
});
$('#markAllAsRead').on('click', function() {
const csrfToken = $('meta[name="csrf-token"]').attr('content');
console.log("Berhasil");
$.ajaxSetup({
headers: {
@ -147,8 +153,7 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
type: 'GET',
success: function(response) {
if (response.status) {
updateNotif();
console.log(response);
removeNotif();
} else {
console.log(response);
}
@ -159,7 +164,7 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
});
});
Pusher.logToConsole = true;
// Pusher.logToConsole = true;
var pusher = new Pusher('3e5bdc20dddd7fbc655e', {
cluster: 'ap1'
});
@ -169,11 +174,19 @@ $new = NotificationReceiver::where('receiver', auth()->user()->email)
channel.bind('event-update-notifikasi', function(data) {
let receivers = data.receivers;
let userEmail = "{{ auth()->user()->email }}";
if (Array.isArray(receivers)) {
receivers.forEach(email => {
if (email == userEmail) {
updateNotif();
}
});
} else {
if (receivers == userEmail) {
updateNotif();
}
}
console.log(data);
});
});
</script>
@endsection

View File

@ -9,6 +9,8 @@
@include('layouts.css')
@yield('css-tambahan')
@include('layouts.js')
</head>
@ -29,8 +31,16 @@
@include('layouts.footer')
</footer>
@yield('js-khusus')
@include('layouts.js-bawah')
@yield('js-header')
@yield('js-sidebar')
@yield('tambahan-js')
</body>
</html>

View File

@ -17,14 +17,14 @@
@if (Auth::user()->role == 'Admin')
<li><a class="nav-link {{ request()->routeIs('admin-user.index') ? 'active' : '' }}"
href="{{ route('admin-user.index') }}"><i class="far fa-user"></i>
<span>User</span></a></li>
href="{{ route('admin-user.index') }}" id="clickUser"><i class="far fa-user"></i>
<span id="userBeep">User</span></a></li>
<li><a class="nav-link {{ request()->routeIs('admin-transaction.index') ? 'active' : '' }}"
href="{{ route('admin-transaction.index') }}"><i
class="fas fa-columns"></i><span>Transaction</span></a></li>
href="{{ route('admin-transaction.index') }}" id="clickTransaction"><i
class="fas fa-columns"></i><span id="transactionBeep">Transaction</span></a></li>
<li><a class="nav-link {{ request()->routeIs('admin-refund.index') ? 'active' : '' }}"
href="{{ route('admin-refund.index') }}"><i class="far fa-square"></i>
<span>Refund</span></a>
href="{{ route('admin-refund.index') }}" id="clickRefund"><i class="far fa-square"></i>
<span id="refundBeep">Refund</span></a>
</li>
<li><a class="nav-link {{ request()->routeIs('admin-setting.index') ? 'active' : '' }}"
href="{{ route('admin-setting.index') }}"><i class="fas fa-cog"></i>
@ -73,4 +73,52 @@
</ul>
</aside>
</div>
@section('js-khusus')
<script src="{{ asset('assets/modules/nicescroll/jquery.nicescroll.min.js') }}"></script>
@endsection
@section('js-sidebar')
<script>
$(document).ready(function() {
function updateNotifSideBar(layanan) {
layanan.addClass("beep");
}
function removeNotifSideBar(layanan) {
layanan.removeClass("beep");
}
$('#clickRefund').on('click', function() {
removeNotifSideBar($('#refundBeep'));
});
$('#clickTransaction').on('click', function() {
removeNotifSideBar($('#transactionBeep'));
});
$('#clickUser').on('click', function() {
removeNotifSideBar($('#userBeep'));
});
var pusher = new Pusher('3e5bdc20dddd7fbc655e', {
cluster: 'ap1'
});
var channel = pusher.subscribe('chanel-update-notifikasi-untuk-admin');
channel.bind('event-update-notifikasi-untuk-admin', function(data) {
let service = data.service;
let userEmail = "{{ auth()->user()->email }}";
if ("{{ auth()->user()->role }}" == 'Admin') {
if (service == 'Refund') {
updateNotifSideBar($('#refundBeep'));
} else if (service == 'Transaksi') {
updateNotifSideBar($('#transactionBeep'));
} else if (service == 'User') {
updateNotifSideBar($('#userBeep'));
}
}
});
});
</script>
@endsection

View File

@ -351,8 +351,8 @@
</div>
</section>
</div>
{{-- profile --}}
@endsection
@section('tambahan-js')
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
@ -683,5 +683,4 @@
});
});
</script>
{{-- profile --}}
@endsection

View File

@ -9,6 +9,7 @@ use App\Http\Controllers\API\Penjual\PenjualApiController;
use App\Http\Controllers\API\Profile\ProfileApiController;
use App\Http\Controllers\API\Transaction\TransactionApiController;
use App\Http\Controllers\API\Invoice\InvoiceApiController;
use App\Http\Controllers\API\Notification\NotificationApiController;
use Illuminate\Support\Facades\Auth;
/*
@ -103,6 +104,12 @@ Route::middleware(['auth:api'])->group(function () {
Route::get('get-invoice', 'getInvoice')->name('invoice.get-invoice'); // Bisa
Route::get('export-invoice', 'exportInvoice')->name('invoice.export-invoice'); // Bisa
}); // sudah
Route::controller(NotificationApiController::class)->group(function(){
Route::get('list-notification','listNotification')->name('notification.list-notification');
Route::get('get-detail-notification','getDetailNotification')->name('notification.get-detail-notification');
Route::get('mark-all-as-read','markAllAsRead')->name('notification.mark-all-as-read');
});
});
});
});

View File

@ -89,6 +89,7 @@ Route::middleware(['auth'])->group(function(){
// Tampilan dashboard admin beserta perhitungan
Route::controller(AdminDashboardController::class)->group(function(){
Route::get('/','index')->name('admin.index');
Route::get('admin-dashboard/get-data-dashboard','getDataBySearch')->name('admin.get-data-dashboard');
});
// Tampilan, aprove atau deny dan hapus user
@ -96,7 +97,7 @@ Route::middleware(['auth'])->group(function(){
Route::get('admin-user','index')->name('admin-user.index');
Route::get('admin-user/list-user','listUser')->name('admin-user.list-user');
Route::get('admin-user/{id}','show')->name('admin-user.show');
Route::delete('admin-user/hapus-user','delete')->name('admin-user.destroy');
Route::delete('admin-user/hapus-user','destroy')->name('admin-user.destroy');
Route::put('admin-user/approve-user', 'approveUser')->name('admin-user.approve');
Route::put('admin-user/deny-user', 'denyUser')->name('admin-user.deny');
});
@ -137,7 +138,7 @@ Route::middleware(['auth'])->group(function(){
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::get('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');
@ -152,6 +153,7 @@ Route::middleware(['auth'])->group(function(){
// Tampilan dashboard user beserta perhitungan
Route::controller(UserDashboardController::class)->group(function(){
Route::get('/','index')->name('user.index');
Route::get('user-dashboard/get-data-dashboard','getDataBySearch')->name('user.get-data-dashboard');
});
// Tampilan, tambah dan hapus kontak
@ -201,7 +203,7 @@ Route::middleware(['auth'])->group(function(){
Route::controller(UserRefundController::class)->group(function(){
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/ajukan-komplain','create')->name('user-refund.create');
Route::get('user-refund/ajukan-komplain/{id}','create')->name('user-refund.create');
Route::get('user-refund/detail-refund/{id}','show')->name('user-refund.show');
Route::post('user-refund','store')->name('user-refund.store');
});
@ -212,6 +214,8 @@ Route::middleware(['auth'])->group(function(){
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');
Route::get('user-notification/update-new-notification','updateNewNotification')->name('user-notification.update-new-notification');
Route::get('user-notification/update-notification-to-admin','updateNotificationToAdmin')->name('user-notification.update-notification-to-admin');
});
});
});