diff --git a/app/Exports/CompanyExport.php b/app/Exports/CompanyExport.php index d6bc18a..4fe4518 100644 --- a/app/Exports/CompanyExport.php +++ b/app/Exports/CompanyExport.php @@ -92,8 +92,8 @@ public function map($company): array $company->name, $company->email, $company->director_name, - get_user_status($company->user->status), $company->address, + get_user_status($company->user->status), get_edit_status($company->edit_status), Carbon::parse($company->created_at)->locale('id')->translatedFormat('l, d F Y'), Carbon::parse($company->validated_at)->locale('id')->translatedFormat('l, d F Y') @@ -104,7 +104,7 @@ public function headings(): array { return [ ['Data Perusahaan', '', '', '', '', '', '', '', '', ''], - ['NO', 'Nama Perusahaan', 'Email', 'Direktur', 'Status Akun', 'Alamat', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi'] + ['NO', 'Nama Perusahaan', 'Email', 'Direktur', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi'] ]; } diff --git a/app/Exports/MediaExport.php b/app/Exports/MediaExport.php new file mode 100644 index 0000000..8e135f0 --- /dev/null +++ b/app/Exports/MediaExport.php @@ -0,0 +1,165 @@ +type = $type; + $this->classification = $classification; + $this->status = $status; + $this->edit_status = $edit_status; + $this->address = $address; + $this->register_year = $register_year; + $this->register_month = $register_month; + $this->register_date = $register_date; + } + + public function collection() + { + $query = Media::with(['company.user']); + + if($this->type !== 'all'){ + if($this->type === 'online'){ + $query->where('type', 'online'); + }elseif($this->type === 'print'){ + $query->where('type', 'cetak'); + }else if($this->type === 'radio'){ + $query->where('type', 'radio'); + }else if($this->type === 'television'){ + $query->where('type', 'televisi'); + } + } + + if($this->classification !== 'all'){ + if($this->classification === 'local'){ + $query->where('classification', 'lokal'); + }elseif($this->classification === 'regional'){ + $query->where('classification', 'regional'); + }else if($this->classification === 'national'){ + $query->where('classification', 'nasional'); + } + } + + if($this->status !== 'all'){ + if($this->status === 'waiting'){ + $query->whereHas('user', function ($q){ + $q->where('status', '0'); + }); + }else if($this->status === 'accepted'){ + $query->whereHas('user', function ($q){ + $q->where('status', '1'); + }); + }else if($this->status === 'rejected'){ + $query->whereHas('user', function ($q){ + $q->where('status', '2'); + }); + } + } + + if($this->edit_status !== 'all'){ + if($this->edit_status === 'no-edit'){ + $query->where('edit_status', '0'); + }elseif($this->edit_status === 'waiting'){ + $query->where('edit_status', '1'); + }else if($this->edit_status === 'accepted'){ + $query->where('edit_status', '2'); + }else if($this->edit_status === 'rejected'){ + $query->where('edit_status', '3'); + } + } + + if ($this->address) { + $query->where('address', 'LIKE', '%'.$this->address.'%'); + } + + if ($this->register_year) { + $query->whereYear('created_at', $this->register_year); + } + + if ($this->register_month) { + $monthYear = Carbon::parse($this->register_month); + $query->whereYear('created_at', $monthYear->year) + ->whereMonth('created_at', $monthYear->month); + } + + if ($this->register_date) { + $query->whereDate('created_at', $this->register_date); + } + + return $query->get(); + } + + public function map($media): array + { + return [ + $this->no++, + $media->name, + $media->company->name, + $media->company->email, + ucfirst($media->type), + ucfirst($media->classification), + $media->address, + get_user_status($media->company->user->status), + get_edit_status($media->edit_status), + Carbon::parse($media->created_at)->locale('id')->translatedFormat('l, d F Y'), + Carbon::parse($media->company->validated_at)->locale('id')->translatedFormat('l, d F Y') + ]; + } + + public function headings(): array + { + return [ + ['Data Media', '', '', '', '', '', '', '', '', '', '', ''], + ['NO', 'Nama Media', 'Nama Perusahaan', 'Email', 'Tipe', 'Klasifikasi', 'Alamat', 'Status', 'Status Edit', 'Tanggal Daftar', 'Tanggal Validasi'] + ]; + } + + public function styles(Worksheet $sheet) + { + $sheet->mergeCells('A1:K1'); // A1 sampai D1 digabung + + // Set alignment untuk pusat horizontal dan vertikal + $sheet->getStyle('A1:K1')->getAlignment()->setHorizontal('center'); + $sheet->getStyle('A1:K1')->getAlignment()->setVertical('center'); + + $sheet->getColumnDimension('A')->setWidth(7); // Set column A width + $sheet->getColumnDimension('B')->setAutoSize(true); + $sheet->getColumnDimension('C')->setAutoSize(true); + $sheet->getColumnDimension('D')->setAutoSize(true); + $sheet->getColumnDimension('E')->setAutoSize(true); + $sheet->getColumnDimension('F')->setAutoSize(true); + $sheet->getColumnDimension('G')->setAutoSize(true); + $sheet->getColumnDimension('H')->setAutoSize(true); + $sheet->getColumnDimension('I')->setAutoSize(true); + $sheet->getColumnDimension('J')->setAutoSize(true); + $sheet->getColumnDimension('K')->setAutoSize(true); + + // Menambahkan gaya lain jika diperlukan + $sheet->getStyle('A1:K1')->getFont()->setBold(true); + $sheet->getStyle('A1:K1')->getFont()->setSize(14); + } +} diff --git a/app/Helpers/CustomHelper.php b/app/Helpers/CustomHelper.php index c5d3ee8..1d5dde7 100644 --- a/app/Helpers/CustomHelper.php +++ b/app/Helpers/CustomHelper.php @@ -297,7 +297,7 @@ function display_file($dir, $filename) if (! function_exists('change_status')) { function change_status($status, $category) { - if($category === 'company_edit'){ + if(in_array($category, ['company_edit', 'media_edit'])){ switch($status){ case '0': return '1'; diff --git a/app/Http/Controllers/Dashboard/DatatableController.php b/app/Http/Controllers/Dashboard/DatatableController.php index d3613b0..ac12a10 100644 --- a/app/Http/Controllers/Dashboard/DatatableController.php +++ b/app/Http/Controllers/Dashboard/DatatableController.php @@ -762,7 +762,7 @@ public function company(Request $request){ case 0: return 'Tidak Ada'; case 1: - return 'Menunggu'; + return 'Menunggu'; case 2: return 'Diterima'; case 3: @@ -823,9 +823,90 @@ public function company(Request $request){ public function media(Request $request){ if ($request->ajax()) { + $type = $request->input('type', null); + $classification = $request->input('classification', null); + $status = $request->input('status', null); + $edit_status = $request->input('edit_status', null); + $address = $request->input('address', null); + $register_year = $request->input('register_year', null); + $register_month = $request->input('register_month', null); + $register_date = $request->input('register_date', null); + + $query = Media::with(['company.user']); + + if($type !== 'all'){ + if($type === 'online'){ + $query->where('type', 'online'); + }elseif($type === 'print'){ + $query->where('type', 'cetak'); + }else if($type === 'radio'){ + $query->where('type', 'radio'); + }else if($type === 'television'){ + $query->where('type', 'televisi'); + } + } + + if($classification !== 'all'){ + if($classification === 'local'){ + $query->where('classification', 'lokal'); + }elseif($classification === 'regional'){ + $query->where('classification', 'regional'); + }else if($classification === 'national'){ + $query->where('classification', 'nasional'); + } + } + + if($status !== 'all'){ + if($status === 'waiting'){ + $query->whereHas('user', function ($q){ + $q->where('status', '0'); + }); + }else if($status === 'accepted'){ + $query->whereHas('user', function ($q){ + $q->where('status', '1'); + }); + }else if($status === 'rejected'){ + $query->whereHas('user', function ($q){ + $q->where('status', '2'); + }); + } + } + + if($edit_status !== 'all'){ + if($edit_status === 'no-edit'){ + $query->where('edit_status', '0'); + }elseif($edit_status === 'waiting'){ + $query->where('edit_status', '1'); + }else if($edit_status === 'accepted'){ + $query->where('edit_status', '2'); + }else if($edit_status === 'rejected'){ + $query->where('edit_status', '3'); + } + } + + if ($address) { + $query->where('address', 'LIKE', '%'.$address.'%'); + } + + if ($register_year) { + $query->whereYear('created_at', $register_year); + } + + if ($register_month) { + $monthYear = Carbon::parse($register_month); + $query->whereYear('created_at', $monthYear->year) + ->whereMonth('created_at', $monthYear->month); + } + + if ($register_date) { + $query->whereDate('created_at', $register_date); + } + + $data = $query->get(); - $data = Media::with(['company.user'])->get(); + + // $data = ->get(); return DataTables::of($data) ->addIndexColumn() @@ -858,40 +939,46 @@ public function media(Request $request){ case 1: return 'Diterima'; case 2: - return 'Ditolak'; - case 3: + return 'Ditolak'; + default: return 'Tidak Diketahui'; } }) ->addColumn('status_edit', function ($data) { switch($data->edit_status){ case 0: - return 'Menunggu'; + return 'Tidak Ada'; case 1: - return 'Diterima'; + return 'Menunggu'; case 2: - return 'Ditolak'; + return 'Diterima'; case 3: + return 'Ditolak'; + default: return 'Tidak Diketahui'; } }) ->addColumn('action', function ($data) { - $showUrl = route('dashboard.media.show', ['id' => encrypt_id($data->id)]); - - $editUrl = route('dashboard.media.edit', ['id' => encrypt_id($data->id)]); + $showUrl = route('dashboard.media.show', ['id' => encrypt_id($data->user->id), 'type' => 'media']); $deleteUrl = route('dashboard.media.destroy', ['id' => encrypt_id($data->id)]); + $processEditRequestCompanyUrl = route('dashboard.media.process', ['id' => encrypt_id($data->user->id), 'type' => 'media', 'category' => 'edit-request']); + $dropdown = ' diff --git a/resources/views/dashboard/companies/index.blade.php b/resources/views/dashboard/companies/index.blade.php index 25b14a7..ca90cd1 100644 --- a/resources/views/dashboard/companies/index.blade.php +++ b/resources/views/dashboard/companies/index.blade.php @@ -269,7 +269,7 @@
- {!!$company->rejection_reason ?? '-' !!} + {!!$user->company->rejection_reason ?? '-' !!}
diff --git a/resources/views/dashboard/media/admin/index.blade.php b/resources/views/dashboard/media/admin/index.blade.php new file mode 100644 index 0000000..5f617be --- /dev/null +++ b/resources/views/dashboard/media/admin/index.blade.php @@ -0,0 +1,256 @@ +@include('partials.dashboard.head') +@include('partials.dashboard.sidebar', ['page' => 'media']) +@include('partials.dashboard.header') + +
+
+
+
+
+
+
+

{{$title}}

+
+
+
+ +
+
    +
  • + @if (filled(value: $type) || filled(value: $classification) || filled(value: $status) || filled($edit_status) || filled($address) || filled($register_year) || filled($register_month) || filled($register_date)) + + + + + + @endif +
    + Filter +
    +
  • +
  • +
    + Export +
    +
  • +
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + +
NoNama MediaPerusahaanJenisKlasifikasiLinkAlamatStatusStatus Edit
+
+
+
+
+ + +
+
+
+
+ +@include('partials.dashboard.footer' ,['datatable' => 'media']) diff --git a/resources/views/dashboard/media/edit-request.blade.php b/resources/views/dashboard/media/edit-request.blade.php new file mode 100644 index 0000000..44f2c01 --- /dev/null +++ b/resources/views/dashboard/media/edit-request.blade.php @@ -0,0 +1,65 @@ +@include('partials.dashboard.head') +@include('partials.dashboard.sidebar', ['page' => 'media']) +@include('partials.dashboard.header') + +
+
+
+
+
+
+
+

Ubah Data Media

+
+
    +
  • Buat permohonan untuk mengubah data media Anda di sini.
  • +
+
+
+
+ Kembali + +
+
+
+
+
+
+ Mohon berikan deskripsi permohonan yang jelas dan informatif untuk menjelaskan alasan perubahan data media serta data apa saja yang ingin diubah. Hal ini akan mempercepat proses validasi oleh tim kami. +
+
+
+
+
+
+ {{--
--}} +
+ @csrf + @method('put') +
+
+ Deskripsi Permohonan* +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ +@include('partials.dashboard.footer', ['rich_editor' => false]) diff --git a/resources/views/dashboard/media/edit.blade.php b/resources/views/dashboard/media/edit.blade.php new file mode 100644 index 0000000..0d0a5f5 --- /dev/null +++ b/resources/views/dashboard/media/edit.blade.php @@ -0,0 +1,208 @@ +@include('partials.dashboard.head') +@include('partials.dashboard.sidebar', ['page' => 'media']) +@include('partials.dashboard.header') + +
+
+
+
+
+
+
+

Ubah Data Media

+
+
    +
  • Ubah data media Anda di sini.
  • +
+
+
+
+ Kembali + +
+
+
+
+
+
+ Mohon lakukan pembaruan data media sesuai dengan informasi yang telah diajukan sebelumnya. Pastikan seluruh data telah diisi dengan lengkap dan benar. +
+
+
+
+
+
+ {{--
--}} +
+ @csrf +
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+ +
    +
  • +
    + company->media->type == 'online' ? 'checked' : '' }}> + +
    +
  • +
  • +
    + company->media->type === 'cetak' ? 'checked' : '' }}> + +
    +
  • +
  • +
    + company->media->type === 'radio' ? 'checked' : '' }}> + +
    +
  • +
  • +
    + company->media->type === 'televisi' ? 'checked' : '' }}> + +
    +
  • +
+ @error('media_type') + {{$message}} + @enderror +
+
+ +
    +
  • +
    + company->media->classification === 'lokal' ? 'checked' : '' }}> + +
    +
  • +
  • +
    + company->media->classification === 'regional' ? 'checked' : '' }}> + +
    +
  • +
  • +
    + company->media->classification === 'nasional' ? 'checked' : '' }}> + +
    +
  • +
+ @error('media_classification') + {{$message}} + @enderror +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+
+
+
+
+
+ Reset Perubahan + +
+
+
+
+
+
+
+
+
+
+
+
+ +@include('partials.dashboard.footer', ['rich_editor' => false]) diff --git a/resources/views/dashboard/media/index.blade.php b/resources/views/dashboard/media/index.blade.php index c741b1b..6e0dda1 100644 --- a/resources/views/dashboard/media/index.blade.php +++ b/resources/views/dashboard/media/index.blade.php @@ -7,56 +7,189 @@
-
+
-

{{$title}}

-
- {{--
-
- -
- -
-
-
--}} -
-
-
-
-
-
- - - - - - - - - - - - - - - -
NoNama MediaPerusahaanJenisKlasifikasiLinkAlamatStatusStatus Edit
+

Data Media

+
+
    +
  • Lihat informasi media Anda di sini.
  • +
+
+ @if (in_array($user->company->media->edit_status,['1']) ) + Ubah Data + + @elseif(in_array($user->company->media->edit_status, ['0', '3'])) + Ubah Data + + @elseif(in_array($user->company->media->edit_status, ['2'])) + Ubah Data + + @endif +
+
+
+
+
+
+
+
+
+
+
Informasi Media
+

Informasi umum terkait media Anda

+
+
+
+
+ Nama Media + {{$user->company->media->name ?? '-'}} +
+
+
+
+ Jenis + {{ucfirst($user->company->media->type) ?? '-'}} +
+
+
+
+ Klasifikasi + {{ucfirst($user->company->media->classification) ?? '-'}} +
+
+
+
+ Link + + @if (filled($user->company->media->link)) + {{$user->company->media->link}} + @else + - + @endif + +
+
+
+
+ Alamat + {{$user->company->media->address ?? '-'}} +
+
+
+
+ Organisasi Kewartawanan + {{$user->company->media->journalism_organization ?? '-'}} +
+
+
+
+ Sertifikat Dewan Press + {{$user->company->media->press_council_certificate ?? '-'}} +
+
+
+
+ Status + + @switch($user->status) + @case(0) + Menunggu + @break + @case(1) + Diterima + @break + @case(2) + + + Ditolak + + + @break + @default + Tidak Diketahui + @endswitch + +
+
+
+
+ Status Edit + + @switch($user->company->media->edit_status) + @case(0) + Tidak Ada + @break + @case(1) + Menunggu + @break + @case(2) + Diterima + @break + @case(3) + + + Ditolak + + + @break + @default + Tidak Diketahui + @endswitch + +
+
+
+
+ {{--
--}} +
+ {{--
+
Admin Note
+
--}} +
+
+ +
+
+ {!! display_file('media', $user->company->media->journalism_organization_doc) !!} +
+
+
+
+ +
+
+ {!! display_file('media', $user->company->press_council_certificate_doc) !!} +
+
+
+
+
+ {{--
--}} + @if (filled($user->company->rejection_reason)) +
+
+ Alasan Penolakan +
+
+
+
+ {!!$user->company->rejection_reason ?? '-' !!} +
+
+
+
+ @endif +
+
+
@@ -64,4 +197,4 @@
-@include('partials.dashboard.footer' ,['datatable' => 'media']) +@include('partials.dashboard.footer', ['rich_editor' => false]) diff --git a/resources/views/dashboard/media/show.blade.php b/resources/views/dashboard/media/show.blade.php deleted file mode 100644 index 6110eb0..0000000 --- a/resources/views/dashboard/media/show.blade.php +++ /dev/null @@ -1,136 +0,0 @@ -@include('partials.dashboard.head') -@include('partials.dashboard.sidebar', ['page' => 'media']) -@include('partials.dashboard.header') - -
-
-
-
-
-
-
-
- -
-
- {{--
-
Personal Information
-

Basic info, like your name and address, that you use on Nio Platform.

-
--}} -
-
-
- Nama Media - {{$media->name}} -
-
-
-
- Jenis - {{ucfirst($media->type)}} -
-
-
-
- Klasifikasi - {{ucfirst($media->classification)}} -
-
-
-
- Alamat - {{$media->address}} -
-
-
-
- Organisasi Kewartawanan - - @if ($media->journalism_organization_doc) - {{$media->journalism_organization}} - @else - {{$media->journalism_organization ?? '-'}} - @endif - -
-
-
-
- Sertifikat Dewan Press - - @if ($media->press_council_certificate_doc) - {{$media->press_council_certificate}} - @else - {{$media->press_council_certificate ?? '-'}} - @endif - -
-
-
-
- Status - @switch($media->company->user->status) - @case(0) - Menunggu - @break - @case(1) - Diterima - @break - @case(2) - Ditolak - @break - @default - Tidak Diketahui - @endswitch -
- -
-
-
- {{--
--}} - {{-- @if (filled($media->rejection_reason)) -
-
- Alasan Penolakan -
-
-
-
- {!!$company->rejection_reason ?? '-' !!} -
-
-
-
- @endif --}} - {{--
-
- Konten -
-
-
-
- {!!$mediaMonitoring->content!!} -
-
-
-
--}} -
-
- Kembali - {{-- Ubah --}} -
-
-
-
-
-
-
-
-
-
- -@include('partials.dashboard.footer', ['rich_editor' => false]) diff --git a/resources/views/dashboard/users/profiles/action.blade.php b/resources/views/dashboard/users/profiles/action.blade.php index 5938587..fa9019f 100644 --- a/resources/views/dashboard/users/profiles/action.blade.php +++ b/resources/views/dashboard/users/profiles/action.blade.php @@ -47,46 +47,46 @@
@endif -@if (isset($purpose) && $purpose === 'process' && $page === 'company' && filled($category)) -@if ($category === 'account-status' && $user->status === '0') -
- Tolak - +@if (isset($purpose) && $purpose === 'process' && in_array($page, ['company', 'media']) && filled($category)) + @if ($category === 'account-status' && $user->status === '0') +
+ Tolak + + Terima + +
+ @elseif($category === 'edit-request' && ($page === 'company' ? $user->company->edit_status === '1' : $user->company->media->edit_status === '1')) +
+ Tolak + Terima - -
- @elseif($category === 'edit-request' && $user->company->edit_status === '1') -
- Tolak - - Terima - -
+ +
@endif -