diff --git a/app/Http/Controllers/Dashboard/StatisticController.php b/app/Http/Controllers/Dashboard/StatisticController.php
index 80080e4..79d4989 100644
--- a/app/Http/Controllers/Dashboard/StatisticController.php
+++ b/app/Http/Controllers/Dashboard/StatisticController.php
@@ -118,7 +118,7 @@ public function show(Request $request, $category){
$loginActivities = LoginHistory::with(['user']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$loginActivities->whereYear('created_at', '=', $year);
}
@@ -140,7 +140,7 @@ public function show(Request $request, $category){
$mediaCooperation = MediaCooperation::with(['cooperation', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$mediaCooperation->whereYear('created_at', '=', $year);
}
@@ -216,7 +216,7 @@ public function show(Request $request, $category){
$airingProofReport = Report::with(['order', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$airingProofReport->whereYear('created_at', '=', $year);
}
@@ -294,7 +294,7 @@ public function show(Request $request, $category){
$issues = IssueManagement::with(['mediaMonitoring']);
$mediaMonitorings = MediaMonitoring::with(['issue']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$issues->whereYear('created_at', $year);
$mediaMonitorings->whereYear('created_at', $year);
}
@@ -361,7 +361,7 @@ public function show(Request $request, $category){
});
$mediaMonitoringWithoutIssue = MediaMonitoring::doesntHave('issue')
- ->when($year && $year !== 'all', function ($query) use ($year) {
+ ->when($year && $year !== 'all' && !(filled($from_month) || filled($to_month)), function ($query) use ($year) {
$query->whereYear('created_at', $year);
})
->when($from_month && $to_month, function ($query) use ($from_month, $to_month) {
@@ -373,7 +373,7 @@ public function show(Request $request, $category){
->get();
$mediaMonitoringWithIssue = MediaMonitoring::has('issue')
- ->when($year && $year !== 'all', function ($query) use ($year) {
+ ->when($year && $year !== 'all' && !(filled($from_month) || filled($to_month)), function ($query) use ($year) {
$query->whereYear('created_at', $year);
})
->when($from_month && $to_month, function ($query) use ($from_month, $to_month) {
@@ -392,12 +392,12 @@ public function show(Request $request, $category){
return view('dashboard.statistics.show.media-monitoring-issue-management', $data);
case 'cooperation-completions':
- $data['title'] = 'Statistik Laporan Bukti Tayang';
+ $data['title'] = 'Statistik Penyelesaian Kerja Sama';
$data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year;
$cooperationCompletion = CooperationCompletion::with(['order', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$cooperationCompletion->whereYear('created_at', '=', $year);
}
@@ -475,7 +475,7 @@ public function show(Request $request, $category){
$registerUsers = User::query();
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$registerUsers->whereYear('created_at', '=', $year);
}
@@ -513,7 +513,7 @@ public function show(Request $request, $category){
$contenteRecap = ContentRecap::with(['enhancer', 'classification']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$contenteRecap->whereYear('created_at', '=', $year);
}
@@ -576,7 +576,7 @@ public function show(Request $request, $category){
$websiteVisitors = Visitor::query();
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$websiteVisitors->whereYear('created_at', '=', $year);
}
@@ -617,14 +617,17 @@ 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);
+ $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;
+
+ $data['year'] = $year;
+ $data['from_month'] = $from_month;
+ $data['to_month'] = $to_month;
+
+ // dd($from_month.' - '. $to_month);
switch($category){
case 'login-activities':
@@ -634,7 +637,7 @@ public function export(Request $request, $category){
$loginActivities = LoginHistory::with(['user']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$loginActivities->whereYear('created_at', '=', $year);
}
@@ -657,7 +660,7 @@ public function export(Request $request, $category){
$mediaCooperation = MediaCooperation::with(['cooperation', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$mediaCooperation->whereYear('created_at', '=', $year);
}
@@ -736,7 +739,7 @@ public function export(Request $request, $category){
$airingProofReport = Report::with(['order', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$airingProofReport->whereYear('created_at', '=', $year);
}
@@ -815,7 +818,7 @@ public function export(Request $request, $category){
$issues = IssueManagement::with(['mediaMonitoring']);
$mediaMonitorings = MediaMonitoring::with(['issue']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$issues->whereYear('created_at', $year);
$mediaMonitorings->whereYear('created_at', $year);
}
@@ -882,7 +885,7 @@ public function export(Request $request, $category){
});
$mediaMonitoringWithoutIssue = MediaMonitoring::doesntHave('issue')
- ->when($year && $year !== 'all', function ($query) use ($year) {
+ ->when($year && $year !== 'all' && !(filled($from_month) || filled($to_month)), function ($query) use ($year) {
$query->whereYear('created_at', $year);
})
->when($from_month && $to_month, function ($query) use ($from_month, $to_month) {
@@ -894,7 +897,7 @@ public function export(Request $request, $category){
->get();
$mediaMonitoringWithIssue = MediaMonitoring::has('issue')
- ->when($year && $year !== 'all', function ($query) use ($year) {
+ ->when($year && $year !== 'all' && !(filled($from_month) || filled($to_month)), function ($query) use ($year) {
$query->whereYear('created_at', $year);
})
->when($from_month && $to_month, function ($query) use ($from_month, $to_month) {
@@ -911,14 +914,15 @@ public function export(Request $request, $category){
$data['mediaMonitoringMonthly'] = $mediaMonitoringMonthly;
$data['issueManagementMonthly'] = $issueManagementMonthly;
- return view('dashboard.statistics.show.media-monitoring-issue-management', $data);
+ $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.media-monitoring-issue-management', $data);
+ return $pdf->stream('monitoring-media-manajemen-isu.pdf');
case 'cooperation-completions':
- $data['title'] = 'Statistik Laporan Bukti Tayang';
+ $data['title'] = 'Statistik Penyelesaian Kerja Sama';
$data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year;
$cooperationCompletion = CooperationCompletion::with(['order', 'media']);
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$cooperationCompletion->whereYear('created_at', '=', $year);
}
@@ -987,7 +991,8 @@ public function export(Request $request, $category){
$data['cooperationCompletionAccepted'] = $cooperationCompletionCount->get('1', 0);
$data['cooperationCompletionRejected'] = $cooperationCompletionCount->get('2', 0);
- return view('dashboard.statistics.show.cooperation-completion', $data);
+ $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.cooperation-completion', $data);
+ return $pdf->stream('penyelesaian-kerja-sama.pdf');
case 'users':
$data['title'] = 'Statistik Pengguna';
$data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year;
@@ -996,7 +1001,7 @@ public function export(Request $request, $category){
$registerUsers = User::query();
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$registerUsers->whereYear('created_at', '=', $year);
}
@@ -1027,14 +1032,15 @@ public function export(Request $request, $category){
$data['registerUserMonth'] = $monthlyCount;
- return view('dashboard.statistics.show.user', $data);
+ $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.user', $data);
+ return $pdf->stream('pengguna.pdf');
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'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$contenteRecap->whereYear('created_at', '=', $year);
}
@@ -1088,7 +1094,8 @@ public function export(Request $request, $category){
$data['socialMedia2ContentRecap'] = $contentRecapSocialMediaCount->get('PPID Diskominfo Purwakarta', 0);
$data['socialMedia3ContentRecap'] = $contentRecapSocialMediaCount->get('Purwakarta Saber Hoaks', 0);
- return view('dashboard.statistics.show.content-recap', $data);
+ $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.content-recap', $data);
+ return $pdf->stream('rekap-konten.pdf');
case 'website-visitors':
$data['title'] = 'Statistik Pengunjung Website';
$data['data_time'] = $year === 'all' ? 'Semua' : 'Tahun '.$year;
@@ -1097,7 +1104,7 @@ public function export(Request $request, $category){
$websiteVisitors = Visitor::query();
- if($year && $year !== 'all'){
+ if($year && $year !== 'all' && !(filled($from_month) || filled($to_month))){
$websiteVisitors->whereYear('created_at', '=', $year);
}
@@ -1128,7 +1135,8 @@ public function export(Request $request, $category){
$data['websiteVisitorMonth'] = $monthlyCount;
- return view('dashboard.statistics.show.website-visitor', $data);
+ $pdf = Pdf::loadView('dashboard.statistics.exports.pdf.website-visitor', $data);
+ return $pdf->stream('pengunjung-aplikasi.pdf');
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
index e69de29..946d20a 100644
--- a/resources/views/dashboard/statistics/exports/pdf/airing-proof-report.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/airing-proof-report.blade.php
@@ -0,0 +1,176 @@
+
+
+
+
+ {{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
Total Laporan Bukti Tayang Berdasarkan Status
+
+
+
+
+ | Status |
+ Jumlah |
+
+
+
+
+ | Menunggu |
+ {{$airingProofReportWaiting}} |
+
+
+ | Diterima |
+ {{$airingProofReportAccepted}} |
+
+
+ | Ditolak |
+ {{$airingProofReportRejected}} |
+
+
+
+
+
+
Total Laporan Bukti Tayang Perbulan Berdasarkan Status
+
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+
+ - Menunggu: {{$airingProofReportStatusMonthly['waiting'][$i]}}
+ - Diterima: {{$airingProofReportStatusMonthly['accepted'][$i]}}
+ - Ditolak: {{$airingProofReportStatusMonthly['rejected'][$i]}}
+ - Total: {{$airingProofReportStatusMonthly['waiting'][$i] + $airingProofReportStatusMonthly['accepted'][$i] + $airingProofReportStatusMonthly['rejected'][$i]}}
+
+ |
+
+ @endfor
+
+
+
+
+
+
+
diff --git a/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php b/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php
index e69de29..bcc93b3 100644
--- a/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/content-recap.blade.php
@@ -0,0 +1,213 @@
+
+
+
+
+ {{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+
+
+
Kanal Rekap Konten
+
+
+
+ | Kanal |
+ Jumlah |
+
+
+
+
+ | Facebook |
+ {{$facebookContentRecap}} |
+
+
+ | Twitter |
+ {{$twitterContentRecap}} |
+
+
+ | Website |
+ {{$websiteContentRecap}} |
+
+
+ | YouTube |
+ {{$youtubeContentRecap}} |
+
+
+ | Instagram |
+ {{$instagramContentRecap}} |
+
+
+ | TikTok |
+ {{$tiktokContentRecap}} |
+
+
+ | Cetak |
+ {{$cetakContentRecap}} |
+
+
+
+
+
+
+
Sosial Media
+
+
+
+ | Sosial Media |
+ Jumlah |
+
+
+
+
+ | Diskominfo Purwakarta |
+ {{$socialMedia1ContentRecap}} |
+
+
+ | PPID Diskominfo Purwakarta |
+ {{$socialMedia2ContentRecap}} |
+
+
+ | Purwakarta Saber Hoaks |
+ {{$socialMedia3ContentRecap}} |
+
+
+
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
Pembuatan Rekap Konten
+
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+ {{$contentRecapMonthly[$i]}}
+ |
+
+ @endfor
+
+
+
+
+
+
+
diff --git a/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php b/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php
index e69de29..ccf3ab0 100644
--- a/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/cooperation-completion.blade.php
@@ -0,0 +1,197 @@
+
+
+
+
+ {{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+
+
+
Status Penyelesaian Kerjasama
+
+
+
+ | Status |
+ Jumlah |
+
+
+
+
+ | Menunggu |
+ {{$cooperationCompletionWaiting}} |
+
+
+ | Diterima |
+ {{$cooperationCompletionAccepted}} |
+
+
+ | Ditolak |
+ {{$cooperationCompletionRejected}} |
+
+
+
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
Status Penyelesaian Kerja Sama
+
+
+
+
+ | Bulan |
+ Status |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+
+ - Menunggu: {{$cooperationCompletionStatusMonthly['waiting'][$i]}}
+ - Diterima: {{$cooperationCompletionStatusMonthly['accepted'][$i]}}
+ - Ditolak: {{$cooperationCompletionStatusMonthly['rejected'][$i]}}
+
+ |
+
+ @endfor
+
+
+
+
+
Penyelesaian Kerja Sama
+
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+ {{$cooperationCompletionMonthly[$i]}}
+ |
+
+ @endfor
+
+
+
+
+
+
+
diff --git a/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php b/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php
index f9acd55..4b8a938 100644
--- a/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/login-activity.blade.php
@@ -105,7 +105,7 @@
@php
diff --git a/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php b/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php
index 3d8e0f1..c5ff7c9 100644
--- a/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/media-cooperation.blade.php
@@ -105,7 +105,7 @@
@php
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
index e69de29..e3f1c98 100644
--- 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
@@ -0,0 +1,241 @@
+
+
+
+
+
{{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+
+
+
Kanal Monitoring Media
+
+
+
+ | Kanal |
+ Jumlah |
+
+
+
+
+ | Facebook |
+ {{$facebookMediaMonitoring}} |
+
+
+ | Twitter |
+ {{$twitterMediaMonitoring}} |
+
+
+ | Website |
+ {{$websiteMediaMonitoring}} |
+
+
+ | YouTube |
+ {{$youtubeMediaMonitoring}} |
+
+
+ | Instagram |
+ {{$instagramMediaMonitoring}} |
+
+
+ | TikTok |
+ {{$tiktokMediaMonitoring}} |
+
+
+ | Cetak |
+ {{$cetakMediaMonitoring}} |
+
+
+
+
+
+
+
Isu
+
+
+
+ | Isu |
+ Jumlah |
+
+
+
+
+ | Krisis |
+ {{$crisisIssue}} |
+
+
+ | Negatif |
+ {{$negativeIssue}} |
+
+
+ | Netral |
+ {{$neutralIssue}} |
+
+
+ | Positif |
+ {{$positiveIssue}} |
+
+
+
+
+
+
+
Status Monitoring Media
+
+
+
+ | Status |
+ Jumlah |
+
+
+
+
+ | Belum Memiliki Isu |
+ {{$mediaMonitoringWithoutIssueCount}} |
+
+
+ | Sudah Memiliki Isu |
+ {{$mediaMonitoringWithIssueCount}} |
+
+
+
+
+
+
Monitoring Media dan Manajemen Isu
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+
+ - Monitoring Media: {{$mediaMonitoringMonthly[$i]}}
+ - Isu: {{$issueManagementMonthly[$i]}}
+
+ |
+
+ @endfor
+
+
+
+
+
+
+
diff --git a/resources/views/dashboard/statistics/exports/pdf/user.blade.php b/resources/views/dashboard/statistics/exports/pdf/user.blade.php
index e69de29..78cd7a7 100644
--- a/resources/views/dashboard/statistics/exports/pdf/user.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/user.blade.php
@@ -0,0 +1,171 @@
+
+
+
+
+
{{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+ {{--
+
+
Status Penyelesaian Kerjasama
+
+
+
+ | Status |
+ Jumlah |
+
+
+
+
+ | Menunggu |
+ {{$cooperationCompletionWaiting}} |
+
+
+ | Diterima |
+ {{$cooperationCompletionAccepted}} |
+
+
+ | Ditolak |
+ {{$cooperationCompletionRejected}} |
+
+
+
--}}
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
Traffic Pendaftaran Akun
+
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+ {{$registerUserMonth[$i]}}
+ |
+
+ @endfor
+
+
+
+
+
+
+
diff --git a/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php b/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php
index e69de29..7a4bbef 100644
--- a/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php
+++ b/resources/views/dashboard/statistics/exports/pdf/website-visitor.blade.php
@@ -0,0 +1,171 @@
+
+
+
+
+
{{ $title }}
+
+
+
+
+
+
 }})
+
+
+
+
+
+
+ {{--
+
+
Status Penyelesaian Kerjasama
+
+
+
+ | Status |
+ Jumlah |
+
+
+
+
+ | Menunggu |
+ {{$cooperationCompletionWaiting}} |
+
+
+ | Diterima |
+ {{$cooperationCompletionAccepted}} |
+
+
+ | Ditolak |
+ {{$cooperationCompletionRejected}} |
+
+
+
--}}
+
+ @php
+ $month = [
+ "Januari", "Februari", "Maret", "April", "Mei", "Juni",
+ "Juli", "Agustus", "September", "Oktober", "November", "Desember"
+ ];
+ @endphp
+
+
+
Pengunjung Aplikasi
+
+
+
+
+ | Bulan |
+ Jumlah |
+
+
+
+ @for ($i = 0; $i < count($month); $i++)
+
+ | {{ $month[$i] }} |
+
+ {{$websiteVisitorMonth[$i]}}
+ |
+
+ @endfor
+
+
+
+
+
+
+