From e851b5c07270108a62c9e4d3132c18d11c534a5a Mon Sep 17 00:00:00 2001 From: myqnrrhmn Date: Mon, 14 Jul 2025 14:27:23 +0700 Subject: [PATCH] feat: login activity export PDF feat: media cooperation export PDF --- .../Dashboard/IssueManagementController.php | 1 - .../Dashboard/StatisticController.php | 522 ++++++++++++++++++ .../exports/pdf/airing-proof-report.blade.php | 0 .../exports/pdf/content-recap.blade.php | 0 .../pdf/cooperation-completion.blade.php | 0 .../exports/pdf/login-activity.blade.php | 140 +++++ .../exports/pdf/media-cooperation.blade.php | 176 ++++++ ...edia-monitoring-issue-management.blade.php | 0 .../statistics/exports/pdf/user.blade.php | 0 .../exports/pdf/website-visitor.blade.php | 0 .../show/airing-proof-report.blade.php | 125 +++-- .../statistics/show/content-recap.blade.php | 125 +++-- .../show/cooperation-completion.blade.php | 125 +++-- .../statistics/show/login-activity.blade.php | 81 ++- .../show/media-cooperation.blade.php | 125 +++-- ...edia-monitoring-issue-management.blade.php | 3 +- .../dashboard/statistics/show/user.blade.php | 125 +++-- .../statistics/show/website-visitor.blade.php | 125 +++-- routes/web.php | 1 + 19 files changed, 1407 insertions(+), 267 deletions(-) create mode 100644 resources/views/dashboard/statistics/exports/pdf/airing-proof-report.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/media-monitoring-issue-management.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/user.blade.php create mode 100644 resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php diff --git a/app/Http/Controllers/Dashboard/IssueManagementController.php b/app/Http/Controllers/Dashboard/IssueManagementController.php index 42fc435..6f05006 100644 --- a/app/Http/Controllers/Dashboard/IssueManagementController.php +++ b/app/Http/Controllers/Dashboard/IssueManagementController.php @@ -202,7 +202,6 @@ public function printData($id){ 'location', 'subLocation', 'classification', 'subClassification', 'governmentAgencies','enhancer', 'mediaMonitoring' ])->findOrFail(decrypt_id($id)); - $pdf = Pdf::loadView('dashboard.issue-managements.print', compact('issueManagement')); return $pdf->stream(slugify('manajemen isu '. $issueManagement->mediaMonitoring->code).'.pdf'); diff --git a/app/Http/Controllers/Dashboard/StatisticController.php b/app/Http/Controllers/Dashboard/StatisticController.php index 992ec16..80080e4 100644 --- a/app/Http/Controllers/Dashboard/StatisticController.php +++ b/app/Http/Controllers/Dashboard/StatisticController.php @@ -12,6 +12,7 @@ use App\Models\Report; use App\Models\User; use App\Models\Visitor; +use Barryvdh\DomPDF\Facade\Pdf; use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; @@ -611,4 +612,525 @@ public function show(Request $request, $category){ abort(404); } } + + public function export(Request $request, $category){ + + $data = [ + 'category' => $category, + 'year' => $request->input('year') ? $request->input('year') : Carbon::now()->year, + 'from_month' => $request->input('from_month') ? $request->input('from_month') : null, + 'to_month' => $request->input('to_month') ? $request->input('to_month') : null, + ]; + + $year = $request->input('year', Carbon::now()->year); + $from_month = $request->input('from_month', null); + $to_month = $request->input('to_month', null); + + switch($category){ + case 'login-activities': + $data['title'] = 'Statistik Aktivitas Login'; + + $monthlyCount = array_fill(0, 12, 0); + + $loginActivities = LoginHistory::with(['user']); + + if($year && $year !== 'all'){ + $loginActivities->whereYear('created_at', '=', $year); + } + + $loginActivities = $loginActivities->get(); + + $loginActivities->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + // Simpan jumlah item tiap bulan ke index bulan - 1 (0-based) + $monthlyCount[$month - 1] = $items->count(); + }); + + $data['loginActivities'] = $monthlyCount; + + $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.login-activity', $data); + return $pdf->stream('aktivitas-login-'.$data['year'].'.pdf'); + case 'media-cooperations': + $data['title'] = 'Statistik Kerja Sama Media'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $mediaCooperation = MediaCooperation::with(['cooperation', 'media']); + + if($year && $year !== 'all'){ + $mediaCooperation->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $mediaCooperation->whereBetween('created_at', [$start, $end]); + } + + $mediaCooperation = $mediaCooperation->get(); + + $mediaCooperationCount = $mediaCooperation->groupBy('status')->map(function ($group) { + return $group->count(); + }); + + // Inisialisasi array 12 bulan untuk masing-masing status + $monthlyStatus = [ + 'waiting' => array_fill(0, 12, 0), + 'accepted' => array_fill(0, 12, 0), + 'rejected' => array_fill(0, 12, 0), + ]; + + // Kelompokkan data berdasarkan status lalu bulan + $mediaCooperation->groupBy('status')->each(function ($groupedByStatus, $status) use (&$monthlyStatus) { + $label = match ((int)$status) { + 0 => 'waiting', + 1 => 'accepted', + 2 => 'rejected', + default => null, + }; + + if ($label) { + $groupedByStatus->groupBy(function ($item) { + return (int)$item->created_at->format('m'); // bulan sebagai angka 1–12 + })->each(function ($items, $month) use (&$monthlyStatus, $label) { + $monthlyStatus[$label][$month - 1] = $items->count(); + }); + } + }); + + $monthlyCount = array_fill(0, 12, 0); + + $mediaCooperation->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + // Simpan jumlah item tiap bulan ke index bulan - 1 (0-based) + $monthlyCount[$month - 1] = $items->count(); + }); + + // Simpan ke variabel `$data` + $data['mediaCooperationStatusMonthly'] = $monthlyStatus; + $data['mediaCooperationMonthly'] = $monthlyCount; + + $data['mediaCooperationWaiting'] = $mediaCooperationCount->get('0', 0); + $data['mediaCooperationAccepted'] = $mediaCooperationCount->get('1', 0); + $data['mediaCooperationRejected'] = $mediaCooperationCount->get('2', 0); + + // dd($data); + + $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-cooperation', $data); + return $pdf->stream('kerja-sama-media.pdf'); + case 'airing-proof-reports': + $data['title'] = 'Statistik Laporan Bukti Tayang'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $airingProofReport = Report::with(['order', 'media']); + + if($year && $year !== 'all'){ + $airingProofReport->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $airingProofReport->whereBetween('created_at', [$start, $end]); + } + + $airingProofReport = $airingProofReport->get(); + + $airingProofReportCount = $airingProofReport->groupBy('status')->map(function ($group) { + return $group->count(); + }); + + // Inisialisasi array 12 bulan untuk masing-masing status + $monthlyStatus = [ + 'waiting' => array_fill(0, 12, 0), + 'accepted' => array_fill(0, 12, 0), + 'rejected' => array_fill(0, 12, 0), + ]; + + // Kelompokkan data berdasarkan status lalu bulan + $airingProofReport->groupBy('status')->each(function ($groupedByStatus, $status) use (&$monthlyStatus) { + $label = match ((int)$status) { + 0 => 'waiting', + 1 => 'accepted', + 2 => 'rejected', + default => null, + }; + + if ($label) { + $groupedByStatus->groupBy(function ($item) { + return (int)$item->created_at->format('m'); // bulan sebagai angka 1–12 + })->each(function ($items, $month) use (&$monthlyStatus, $label) { + $monthlyStatus[$label][$month - 1] = $items->count(); + }); + } + }); + + $monthlyCount = array_fill(0, 12, 0); + + $airingProofReport->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->publication_date)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + // Simpan jumlah item tiap bulan ke index bulan - 1 (0-based) + $monthlyCount[$month - 1] = $items->count(); + }); + + // Simpan ke variabel `$data` + $data['airingProofReportStatusMonthly'] = $monthlyStatus; + $data['airingProofReportPublicationMonthly'] = $monthlyCount; + + $data['airingProofReportWaiting'] = $airingProofReportCount->get('0', 0); + $data['airingProofReportAccepted'] = $airingProofReportCount->get('1', 0); + $data['airingProofReportRejected'] = $airingProofReportCount->get('2', 0); + + $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.airing-proof-report', $data); + return $pdf->stream('laporan-bukti-tayang.pdf'); + case 'media-monitorings-issue-management': + $data['title'] = 'Statistik Monitoring Media & Manajemen Isu'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + // Statistik Isu + $issues = IssueManagement::with(['mediaMonitoring']); + $mediaMonitorings = MediaMonitoring::with(['issue']); + + if($year && $year !== 'all'){ + $issues->whereYear('created_at', $year); + $mediaMonitorings->whereYear('created_at', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $issues->whereBetween('created_at', [$start, $end]); + $mediaMonitorings->whereBetween('created_at', [$start, $end]); + } + + $issues = $issues->get(); + $mediaMonitorings = $mediaMonitorings->get(); + + + $issueCounts = $issues->groupBy('issue')->map(function ($group) { + return $group->count(); + }); + + $data['crisisIssue'] = $issueCounts->get('krisis', 0); + $data['negativeIssue'] = $issueCounts->get('negatif', 0); + $data['neutralIssue'] = $issueCounts->get('netral', 0); + $data['positiveIssue'] = $issueCounts->get('positif', 0); + // Akhir Statistik Isu + + // Statistik Monitoring Media + $mediaMonitoringCount = $mediaMonitorings->groupBy('channel')->map(function ($group) { + return $group->count(); + }); + $data['facebookMediaMonitoring'] = $mediaMonitoringCount->get('facebook', 0); + $data['twitterMediaMonitoring'] = $mediaMonitoringCount->get('twitter', 0); + $data['websiteMediaMonitoring'] = $mediaMonitoringCount->get('website', 0); + $data['youtubeMediaMonitoring'] = $mediaMonitoringCount->get('youtube', 0); + $data['instagramMediaMonitoring'] = $mediaMonitoringCount->get('instagram', 0); + $data['tiktokMediaMonitoring'] = $mediaMonitoringCount->get('tiktok', 0); + $data['cetakMediaMonitoring'] = $mediaMonitoringCount->get('cetak', 0); + // Akhir Statistik Monitoring Media + + // Media Monitoring 2 (pakai koleksi yang sudah ada) + $mediaMonitoringMonthly = array_fill(0, 12, 0); // Init array 12 bulan + $mediaMonitorings->groupBy(function ($item) { + return (int) $item->created_at->format('m'); // bulan sebagai int + })->each(function ($group, $month) use (&$mediaMonitoringMonthly) { + $mediaMonitoringMonthly[$month - 1] = $group->count(); + }); + + // Issue Management 2 (pakai koleksi yang sudah ada) + $issueManagementMonthly = array_fill(0, 12, 0); + $issues->groupBy(function ($item) { + return (int) $item->created_at->format('m'); + })->each(function ($group, $month) use (&$issueManagementMonthly) { + $issueManagementMonthly[$month - 1] = $group->count(); + }); + + $mediaMonitoringWithoutIssue = MediaMonitoring::doesntHave('issue') + ->when($year && $year !== 'all', function ($query) use ($year) { + $query->whereYear('created_at', $year); + }) + ->when($from_month && $to_month, function ($query) use ($from_month, $to_month) { + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + $query->whereBetween('created_at', [$start, $end]); + }) + ->get(); + + $mediaMonitoringWithIssue = MediaMonitoring::has('issue') + ->when($year && $year !== 'all', function ($query) use ($year) { + $query->whereYear('created_at', $year); + }) + ->when($from_month && $to_month, function ($query) use ($from_month, $to_month) { + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + $query->whereBetween('created_at', [$start, $end]); + }) + ->get(); + + $data['mediaMonitoringWithoutIssueCount'] = $mediaMonitoringWithoutIssue->count(); + $data['mediaMonitoringWithIssueCount'] = $mediaMonitoringWithIssue->count(); + + $data['mediaMonitoringMonthly'] = $mediaMonitoringMonthly; + $data['issueManagementMonthly'] = $issueManagementMonthly; + + return view('dashboard.statistics.show.media-monitoring-issue-management', $data); + case 'cooperation-completions': + $data['title'] = 'Statistik Laporan Bukti Tayang'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $cooperationCompletion = CooperationCompletion::with(['order', 'media']); + + if($year && $year !== 'all'){ + $cooperationCompletion->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $cooperationCompletion->whereBetween('created_at', [$start, $end]); + } + + $cooperationCompletion = $cooperationCompletion->get(); + + $cooperationCompletionCount = $cooperationCompletion->groupBy('status')->map(function ($group) { + return $group->count(); + }); + + // Inisialisasi array 12 bulan untuk masing-masing status + $monthlyStatus = [ + 'waiting' => array_fill(0, 12, 0), + 'accepted' => array_fill(0, 12, 0), + 'rejected' => array_fill(0, 12, 0), + ]; + + // Kelompokkan data berdasarkan status lalu bulan + $cooperationCompletion->groupBy('status')->each(function ($groupedByStatus, $status) use (&$monthlyStatus) { + $label = match ((int)$status) { + 0 => 'waiting', + 1 => 'accepted', + 2 => 'rejected', + default => null, + }; + + if ($label) { + $groupedByStatus->groupBy(function ($item) { + return (int)$item->created_at->format('m'); // bulan sebagai angka 1–12 + })->each(function ($items, $month) use (&$monthlyStatus, $label) { + $monthlyStatus[$label][$month - 1] = $items->count(); + }); + } + }); + + $monthlyCount = array_fill(0, 12, 0); + + $cooperationCompletion->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + // Simpan jumlah item tiap bulan ke index bulan - 1 (0-based) + $monthlyCount[$month - 1] = $items->count(); + }); + + // Simpan ke variabel `$data` + $data['cooperationCompletionStatusMonthly'] = $monthlyStatus; + $data['cooperationCompletionMonthly'] = $monthlyCount; + + $data['cooperationCompletionWaiting'] = $cooperationCompletionCount->get('0', 0); + $data['cooperationCompletionAccepted'] = $cooperationCompletionCount->get('1', 0); + $data['cooperationCompletionRejected'] = $cooperationCompletionCount->get('2', 0); + + return view('dashboard.statistics.show.cooperation-completion', $data); + case 'users': + $data['title'] = 'Statistik Pengguna'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $monthlyCount = array_fill(0, 12, 0); + + $registerUsers = User::query(); + + if($year && $year !== 'all'){ + $registerUsers->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $registerUsers->whereBetween('created_at', [$start, $end]); + } + + $registerUsers = $registerUsers->get(); + + $registerUsers->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + $monthlyCount[$month - 1] = $items->count(); + }); + + $data['registerUserMonth'] = $monthlyCount; + + return view('dashboard.statistics.show.user', $data); + case 'content-recaps': + $data['title'] = 'Statistik Rekap Konten'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $contenteRecap = ContentRecap::with(['enhancer', 'classification']); + + if($year && $year !== 'all'){ + $contenteRecap->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $contenteRecap->whereBetween('created_at', [$start, $end]); + } + + $contenteRecap = $contenteRecap->get(); + + $contentRecapChannelCount = $contenteRecap->groupBy('channel')->map(function ($group) { + return $group->count(); + }); + + $contentRecapSocialMediaCount = $contenteRecap->groupBy('social_media')->map(function ($group) { + return $group->count(); + }); + + $monthlyCount = array_fill(0, 12, 0); + + $contenteRecap->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + // Simpan jumlah item tiap bulan ke index bulan - 1 (0-based) + $monthlyCount[$month - 1] = $items->count(); + }); + + $data['contentRecapMonthly'] = $monthlyCount; + + $data['facebookContentRecap'] = $contentRecapChannelCount->get('facebook', 0); + $data['twitterContentRecap'] = $contentRecapChannelCount->get('twitter', 0); + $data['websiteContentRecap'] = $contentRecapChannelCount->get('website', 0); + $data['youtubeContentRecap'] = $contentRecapChannelCount->get('youtube', 0); + $data['instagramContentRecap'] = $contentRecapChannelCount->get('instagram', 0); + $data['tiktokContentRecap'] = $contentRecapChannelCount->get('tiktok', 0); + $data['cetakContentRecap'] = $contentRecapChannelCount->get('cetak', 0); + + $data['socialMedia1ContentRecap'] = $contentRecapSocialMediaCount->get('Diskominfo Purwakarta', 0); + $data['socialMedia2ContentRecap'] = $contentRecapSocialMediaCount->get('PPID Diskominfo Purwakarta', 0); + $data['socialMedia3ContentRecap'] = $contentRecapSocialMediaCount->get('Purwakarta Saber Hoaks', 0); + + return view('dashboard.statistics.show.content-recap', $data); + case 'website-visitors': + $data['title'] = 'Statistik Pengunjung Website'; + $data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year; + + $monthlyCount = array_fill(0, 12, 0); + + $websiteVisitors = Visitor::query(); + + if($year && $year !== 'all'){ + $websiteVisitors->whereYear('created_at', '=', $year); + } + + if($from_month && $to_month){ + $start = Carbon::parse($from_month)->startOfMonth(); + $end = Carbon::parse($to_month)->endOfMonth(); + + // Asumsikan from_month dan to_month dalam format 'YYYY-MM' + $fromDate = $from_month ? Carbon::createFromFormat('Y-m', $from_month) : null; + $toDate = $to_month ? Carbon::createFromFormat('Y-m', $to_month) : null; + + // Format ke bentuk "Mei 2025" + $fromFormatted = $fromDate ? $fromDate->translatedFormat('F Y') : '-'; + $toFormatted = $toDate ? $toDate->translatedFormat('F Y') : '-'; + + $data['data_time'] = $fromFormatted . ' - ' . $toFormatted; + + $websiteVisitors->whereBetween('created_at', [$start, $end]); + } + + $websiteVisitors = $websiteVisitors->get(); + + $websiteVisitors->groupBy(function ($item) { + return (int) \Carbon\Carbon::parse($item->created_at)->format('m'); + })->each(function ($items, $month) use (&$monthlyCount) { + $monthlyCount[$month - 1] = $items->count(); + }); + + $data['websiteVisitorMonth'] = $monthlyCount; + + return view('dashboard.statistics.show.website-visitor', $data); + default: + abort(404); + } + } } diff --git a/resources/views/dashboard/statistics/exports/pdf/airing-proof-report.blade.php b/resources/views/dashboard/statistics/exports/pdf/airing-proof-report.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php b/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php b/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php b/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php new file mode 100644 index 0000000..f9acd55 --- /dev/null +++ b/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php @@ -0,0 +1,140 @@ + + + + + {{ $title }} + + + +
+
+ Logo Simedkom +
+
+ +
+
+

Aktivitas Login

+

Data: Tahun {{ $year }}

+
+ + @php + $month = [ + "Januari", "Februari", "Maret", "April", "Mei", "Juni", + "Juli", "Agustus", "September", "Oktober", "November", "Desember" + ]; + @endphp + + + + + + + + + + @for ($i = 0; $i < count($month); $i++) + + + + + @endfor + +
BulanJumlah
{{ $month[$i] }}{{ $loginActivities[$i] }}
+ + +
+ + diff --git a/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php b/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php new file mode 100644 index 0000000..3d8e0f1 --- /dev/null +++ b/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php @@ -0,0 +1,176 @@ + + + + + {{ $title }} + + + +
+
+ Logo Simedkom +
+
+ +
+
+

Kerja Sama Media

+

Data: Tahun {{ $year }}

+
+ + @php + $month = [ + "Januari", "Februari", "Maret", "April", "Mei", "Juni", + "Juli", "Agustus", "September", "Oktober", "November", "Desember" + ]; + @endphp + + +
+

Total Jumlah Kerja Sama Media Berdasarkan Status

+
+ + + + + + + + + + + + + + + + + + + + +
StatusJumlah
Menunggu{{$mediaCooperationWaiting}}
Diterima{{$mediaCooperationAccepted}}
Ditolak{{$mediaCooperationRejected}}
+ +
+

Total Semua Kerja Sama Media Perbulan Berdasarkan Status

+
+ + + + + + + + + @for ($i = 0; $i < count($month); $i++) + + + + + @endfor + +
BulanJumlah
{{ $month[$i] }} +
    +
  • Menunggu: {{$mediaCooperationStatusMonthly['waiting'][$i]}}
  • +
  • Diterima: {{$mediaCooperationStatusMonthly['accepted'][$i]}}
  • +
  • Ditolak: {{$mediaCooperationStatusMonthly['rejected'][$i]}}
  • +
  • Total: {{$mediaCooperationStatusMonthly['waiting'][$i] + $mediaCooperationStatusMonthly['accepted'][$i] + $mediaCooperationStatusMonthly['rejected'][$i]}}
  • +
+
+ + +
+ + diff --git a/resources/views/dashboard/statistics/exports/pdf/media-monitoring-issue-management.blade.php b/resources/views/dashboard/statistics/exports/pdf/media-monitoring-issue-management.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/exports/pdf/user.blade.php b/resources/views/dashboard/statistics/exports/pdf/user.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php b/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/dashboard/statistics/show/airing-proof-report.blade.php b/resources/views/dashboard/statistics/show/airing-proof-report.blade.php index 8ab8155..a12ee1d 100644 --- a/resources/views/dashboard/statistics/show/airing-proof-report.blade.php +++ b/resources/views/dashboard/statistics/show/airing-proof-report.blade.php @@ -34,7 +34,10 @@ @endif
- Filter + Filter +
+
+ Export
@@ -112,47 +115,89 @@