feat: add filter and export in cooperation completion
This commit is contained in:
parent
ff3173f886
commit
7a6bfddb21
124
app/Exports/CooperationCompletionExport.php
Normal file
124
app/Exports/CooperationCompletionExport.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\CooperationCompletion;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class CooperationCompletionExport implements FromCollection, WithHeadings, WithStyles, WithMapping
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected $no = 1;
|
||||
protected $media;
|
||||
protected $status;
|
||||
protected $year;
|
||||
protected $from_month;
|
||||
protected $to_month;
|
||||
protected $date;
|
||||
|
||||
public function __construct($media, $status, $year, $from_month, $to_month, $date)
|
||||
{
|
||||
$this->media = $media;
|
||||
$this->status = $status;
|
||||
$this->year = $year;
|
||||
$this->from_month = $from_month;
|
||||
$this->to_month = $to_month;
|
||||
$this->date = $date;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
if(is_role(['1', '5'])){
|
||||
$query = CooperationCompletion::with(['media.company']);
|
||||
}else if(is_role(['3'])){
|
||||
$mediaId = Auth::user()->company->media->id;
|
||||
$query = CooperationCompletion::with(['media.company', 'order.cooperation'])->where('media_id', '=', $mediaId);
|
||||
}
|
||||
|
||||
if (!empty($this->media[0])) {
|
||||
$query->whereIn('media_id', $this->media);
|
||||
}
|
||||
|
||||
if ($this->status) {
|
||||
switch($this->status){
|
||||
case 'waiting':
|
||||
$query->where('status', '0');
|
||||
break;
|
||||
case 'accepted':
|
||||
$query->where('status', '1');
|
||||
break;
|
||||
case 'rejected':
|
||||
$query->where('status', '2');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->year) {
|
||||
$query->whereYear('created_at', $this->year);
|
||||
}
|
||||
|
||||
if ($this->from_month && $this->to_month) {
|
||||
$start = Carbon::parse($this->from_month)->startOfMonth();
|
||||
$end = Carbon::parse($this->to_month)->endOfMonth();
|
||||
|
||||
$query->whereBetween('created_at', [$start, $end]);
|
||||
}
|
||||
|
||||
if ($this->date) {
|
||||
$query->whereDate('created_at', $this->date);
|
||||
}
|
||||
|
||||
return $query->get();
|
||||
}
|
||||
|
||||
public function map($report): array
|
||||
{
|
||||
return [
|
||||
$this->no++,
|
||||
$report->order->cooperation->name,
|
||||
$report->media->name,
|
||||
$report->media->company->name,
|
||||
Carbon::parse($report->created_at)->locale('id')->translatedFormat('l, d F Y'),
|
||||
$report->status === '0' ? 'Menunggu' : ($report->status === '1' ? 'Diterima' : 'Ditolak'),
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['Penyelesaian Kerja Sama', '', '', '', '', ''],
|
||||
['NO', 'Nama Kerjasama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Status']
|
||||
];
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
$sheet->mergeCells('A1:F1'); // A1 sampai F1 digabung
|
||||
|
||||
// Set alignment untuk pusat horizontal dan vertikal
|
||||
$sheet->getStyle('A1:F1')->getAlignment()->setHorizontal('center');
|
||||
$sheet->getStyle('A1:F1')->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->getStyle('F:F')->getAlignment()->setWrapText(true);
|
||||
|
||||
$sheet->getColumnDimension('F')->setAutoSize(true);
|
||||
|
||||
// Menambahkan gaya lain jika diperlukan
|
||||
$sheet->getStyle('A1:F1')->getFont()->setBold(true);
|
||||
$sheet->getStyle('A1:F1')->getFont()->setSize(14);
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ public function map($report): array
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['Data Rekap Konten', '', '', '', '', '', '', ''],
|
||||
['Laporan Bukti Tayang', '', '', '', '', '', '', ''],
|
||||
['NO', 'Nama Kerjasama', 'Media', 'Perusahaan', 'Tanggal Upload', 'Tanggal Melaporkan', 'Status']
|
||||
];
|
||||
}
|
||||
|
||||
@ -2,14 +2,19 @@
|
||||
|
||||
namespace App\Http\Controllers\Dashboard;
|
||||
|
||||
use App\Exports\CooperationCompletionExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\CooperationCompletionRequest;
|
||||
use App\Models\Announcement;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\CooperationCompletion;
|
||||
use App\Models\Media;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class CooperationCompletionController extends Controller
|
||||
{
|
||||
@ -17,8 +22,12 @@ class CooperationCompletionController extends Controller
|
||||
public function index(Request $request){
|
||||
return view('dashboard.cooperation-completions.index', [
|
||||
'title' => 'Penyelesaian Kerjasama',
|
||||
'mediaCollection' => Media::all(),
|
||||
'media' => $request->input('media', []),
|
||||
'status' => $request->input('status', null),
|
||||
'date' => $request->input('date', null),
|
||||
'month' => $request->input('month', null),
|
||||
'from_month' => $request->input('from_month', null),
|
||||
'to_month' => $request->input('to_month', null),
|
||||
'year' => $request->input('year', null),
|
||||
]);
|
||||
}
|
||||
@ -190,4 +199,87 @@ public function rejectActionIndex(Request $request, $id){
|
||||
return redirect()->back()->with('success-status', 'Berhasil menolak penyelesaian kerjasama.');
|
||||
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
try{
|
||||
$export_type = $request->input('export_type', 'excel');
|
||||
|
||||
$status = $request->input('status', null);
|
||||
$media = $request->input('media', null);
|
||||
$year = $request->input('year', null);
|
||||
$from_month = $request->input('from_month', null);
|
||||
$to_month = $request->input('to_month', null);
|
||||
$date = $request->input('date', null);
|
||||
|
||||
if($export_type === 'excel'){
|
||||
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
|
||||
return Excel::download(new CooperationCompletionExport($media, $status, $year, $from_month, $to_month, $date), 'reports-'.$formattedNow.'.xlsx');
|
||||
}elseif($export_type === 'pdf'){
|
||||
if(is_role(['1', '5'])){
|
||||
$query = CooperationCompletion::with(['media.company']);
|
||||
}else if(is_role(['3'])){
|
||||
$mediaId = Auth::user()->company->media->id;
|
||||
$query = CooperationCompletion::with(['media.company', 'order.cooperation'])->where('media_id', '=', $mediaId);
|
||||
}
|
||||
|
||||
if (!empty($media) && is_array($media)) {
|
||||
$query->whereIn('media_id', $media);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
switch($status){
|
||||
case 'waiting':
|
||||
$query->where('status', '0');
|
||||
break;
|
||||
case 'accepted':
|
||||
$query->where('status', '1');
|
||||
break;
|
||||
case 'rejected':
|
||||
$query->where('status', '2');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($year) {
|
||||
$query->whereYear('created_at', $year);
|
||||
}
|
||||
|
||||
if ($from_month && $to_month) {
|
||||
$start = Carbon::parse($from_month)->startOfMonth();
|
||||
$end = Carbon::parse($to_month)->endOfMonth();
|
||||
|
||||
$query->whereBetween('created_at', [$start, $end]);
|
||||
}
|
||||
|
||||
if ($date) {
|
||||
$query->whereDate('created_at', $date);
|
||||
}
|
||||
|
||||
$cooperationCompletions = $query->get();
|
||||
|
||||
$pdf = Pdf::loadView('dashboard.cooperation-completions.prints.collection', compact('cooperationCompletions'));
|
||||
|
||||
return $pdf->stream(slugify('laporan bukti tayang ').'.pdf');
|
||||
}
|
||||
|
||||
}catch(\Exception $e){
|
||||
return redirect()->back()->with('failed-status', 'Gagal melakukan proses export data.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function singlePrint(){
|
||||
try{
|
||||
$cooperationCompletion = CooperationCompletion::with(['media.company'])->first();
|
||||
// dd('hai');
|
||||
|
||||
$pdf = Pdf::loadView('dashboard.cooperation-completions.prints.single', compact('cooperationCompletion'));
|
||||
|
||||
|
||||
return $pdf->stream(slugify('Penyelesaian kerja sama '. $cooperationCompletion->media->name).'.pdf');
|
||||
}catch(\Exception $e){
|
||||
return redirect()->back()->with('failed-status', 'Gagal melakukan proses print data.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2126,13 +2126,58 @@ class="text-dark"
|
||||
public function cooperationCompletionIndex(Request $request){
|
||||
if ($request->ajax()) {
|
||||
|
||||
$mediaStrArr = $request->input('media', null);
|
||||
$media = explode(',', $mediaStrArr);
|
||||
|
||||
$status = $request->input('status', null);
|
||||
|
||||
$year = $request->input('year', null);
|
||||
$from_month = $request->input('from_month', null);
|
||||
$to_month = $request->input('to_month', null);
|
||||
$date = $request->input('date', null);
|
||||
|
||||
if(is_role(['1', '5'])){
|
||||
$data = CooperationCompletion::with(['media.company'])->get();
|
||||
$query = CooperationCompletion::with(['media.company']);
|
||||
}else if(is_role(['3'])){
|
||||
$mediaId = Auth::user()->company->media->id;
|
||||
$data = CooperationCompletion::with(['media.company', 'order.cooperation'])->where('media_id', '=', $mediaId)->get();
|
||||
$query = CooperationCompletion::with(['media.company', 'order.cooperation'])->where('media_id', '=', $mediaId);
|
||||
}
|
||||
|
||||
if (!empty($media[0])) {
|
||||
$query->whereIn('media_id', $media);
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
switch($status){
|
||||
case 'waiting':
|
||||
$query->where('status', '0');
|
||||
break;
|
||||
case 'accepted':
|
||||
$query->where('status', '1');
|
||||
break;
|
||||
case 'rejected':
|
||||
$query->where('status', '2');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($year) {
|
||||
$query->whereYear('created_at', $year);
|
||||
}
|
||||
|
||||
if ($from_month && $to_month) {
|
||||
$start = Carbon::parse($from_month)->startOfMonth();
|
||||
$end = Carbon::parse($to_month)->endOfMonth();
|
||||
|
||||
$query->whereBetween('created_at', [$start, $end]);
|
||||
}
|
||||
|
||||
if ($date) {
|
||||
$query->whereDate('created_at', $date);
|
||||
}
|
||||
|
||||
$data = $query->get();
|
||||
|
||||
return DataTables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('cooperation', function ($data) {
|
||||
@ -2169,6 +2214,8 @@ class="text-dark"
|
||||
|
||||
$processUrl = route('dashboard.cooperation.completions.process.index', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$printUrl = route('dashboard.cooperation.completions.print.single', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
// $rejectUrl = route('dashboard.cooperation.completions.reject', ['id' => encrypt_id($data->id)]);
|
||||
|
||||
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
|
||||
@ -2185,6 +2232,10 @@ class="text-dark"
|
||||
$dropdown .= '<li><a href="'.$processUrl.'"><em class="icon ni ni-loader"></em><span>Proses</span></a></li>';
|
||||
}
|
||||
|
||||
if (is_role(['1', '5'])) {
|
||||
$dropdown .= '<li><a href="'.$printUrl.'"><em class="icon ni ni-printer"></em><span>Cetak</span></a></li>';
|
||||
}
|
||||
|
||||
$dropdown .= '</ul>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
@ -19,8 +19,8 @@ class ReportController extends Controller
|
||||
|
||||
public function index(Request $request){
|
||||
return view('dashboard.reports.index', [
|
||||
'mediaCollection' => Media::all(),
|
||||
'title' => 'Laporan Bukti Tayang',
|
||||
'mediaCollection' => Media::all(),
|
||||
'media' => $request->input('media', []),
|
||||
'date' => $request->input('date', null),
|
||||
'from_month' => $request->input('from_month', null),
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
</div>
|
||||
</li> --}}
|
||||
<li>
|
||||
@if (filled(value: $date) || filled(value: $month) ||filled(value: $year))
|
||||
@if ((filled(value: $media) && !empty($media[0])) || filled($status) || filled(value: $date) || (filled(value: $from_month) && filled(value: $to_month)) ||filled(value: $year))
|
||||
<span class="mx-1">
|
||||
<a href="{{route('dashboard.cooperations.index')}}" class="text-secondary">
|
||||
<a href="{{route('dashboard.cooperation.completions.index')}}" class="text-secondary">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="icon icon-tabler icons-tabler-filled icon-tabler-xbox-x"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10 -10 10s-10 -4.477 -10 -10s4.477 -10 10 -10m3.6 5.2a1 1 0 0 0 -1.4 .2l-2.2 2.933l-2.2 -2.933a1 1 0 1 0 -1.6 1.2l2.55 3.4l-2.55 3.4a1 1 0 1 0 1.6 1.2l2.2 -2.933l2.2 2.933a1 1 0 0 0 1.6 -1.2l-2.55 -3.4l2.55 -3.4a1 1 0 0 0 -.2 -1.4" /></svg>
|
||||
</a>
|
||||
</span>
|
||||
@ -84,19 +84,47 @@
|
||||
<em class="icon ni ni-cross"></em>
|
||||
</a>
|
||||
</div>
|
||||
<form action="{{route('dashboard.cooperations.filter')}}" class="form-validate is-alter" method="post">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<form action="{{route('dashboard.cooperation.completions.index')}}" class="form-validate is-alter" method="get">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Media</label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" multiple="multiple" data-placeholder="Media" name="media[]">
|
||||
@foreach ($mediaCollection as $item)
|
||||
<option value="{{$item->id}}">{{$item->name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Status</label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" name="status">
|
||||
<option value="all">Semua</option>
|
||||
<option value="waiting">Menunggu</option>
|
||||
<option value="accepted">Diterima</option>
|
||||
<option value="rejected">Ditolak</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="year">Tahun</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="number" class="form-control" id="year" placeholder="Contoh: 2025" name="year" value="{{ old('year', $year ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="month">Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="month" placeholder="Data berita pada bulan dan tahun" name="month" value="{{ old('month', $month ?? '') }}">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label class="form-label" for="from_month">Dari Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="from_month" placeholder="Data berita pada bulan dan tahun" name="from_month" value="{{ old('from_month', $from_month ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="form-label" for="to_month">Sampai Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="to_month" placeholder="Data berita pada bulan dan tahun" name="to_month" value="{{ old('to_month', $to_month ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -124,19 +152,67 @@
|
||||
<em class="icon ni ni-cross"></em>
|
||||
</a>
|
||||
</div>
|
||||
<form action="{{route('dashboard.cooperations.export')}}" class="form-validate is-alter" method="post">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<form action="{{route('dashboard.cooperation.completions.export')}}" class="form-validate is-alter" method="post">
|
||||
@csrf
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="year">Tipe Dokumen</label>
|
||||
<div class="form-control-wrap">
|
||||
<ul class="custom-control-group">
|
||||
<li>
|
||||
<div class="custom-control custom-control-sm custom-radio custom-control-pro">
|
||||
<input type="radio" class="custom-control-input" name="export_type" id="exportType1" checked value="excel">
|
||||
<label class="custom-control-label" for="exportType1">Excel</label>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="custom-control custom-control-sm custom-radio custom-control-pro">
|
||||
<input type="radio" class="custom-control-input" name="export_type" id="exportType2" value="pdf">
|
||||
<label class="custom-control-label" for="exportType2">PDF</label>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Media</label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" multiple="multiple" data-placeholder="Media" name="media[]">
|
||||
@foreach ($mediaCollection as $item)
|
||||
<option value="{{$item->id}}">{{$item->name}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Status</label>
|
||||
<div class="form-control-wrap">
|
||||
<select class="form-select js-select2" name="status">
|
||||
<option value="all">Semua</option>
|
||||
<option value="waiting">Menunggu</option>
|
||||
<option value="accepted">Diterima</option>
|
||||
<option value="rejected">Ditolak</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="year">Tahun</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="number" class="form-control" id="year" placeholder="Contoh: 2025" name="year" value="{{ old('year', $year ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="month">Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="month" placeholder="Data berita pada bulan dan tahun" name="month" value="{{ old('month', $month ?? '') }}">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-6">
|
||||
<label class="form-label" for="from_month">Dari Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="from_month" placeholder="Data berita pada bulan dan tahun" name="from_month" value="{{ old('from_month', $from_month ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="form-label" for="to_month">Sampai Bulan</label>
|
||||
<div class="form-control-wrap">
|
||||
<input type="month" class="form-control" id="to_month" placeholder="Data berita pada bulan dan tahun" name="to_month" value="{{ old('to_month', $to_month ?? '') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Laporan Bukti Tayang</title>
|
||||
<style>
|
||||
@page {
|
||||
size: A4;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
top: 40%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-image: url('{{ public_path('assets/defaults/simedkom-logo-circle.png') }}');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
opacity: 0.03;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
header .icon {
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
header .icon img {
|
||||
width: 150px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 2px solid #e0e0e0;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.header h2 {
|
||||
font-size: 18px;
|
||||
color: #3A59D1;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
thead {
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 6px;
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.link-cell {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
img.proof-img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: right;
|
||||
font-size: 10px;
|
||||
color: #888;
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="icon">
|
||||
<img src="{{ public_path('assets/defaults/simedkom-logo-full.png') }}" alt="Logo">
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h2>Laporan Bukti Tayang</h2>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 5%;">No</th>
|
||||
<th>Kerja Sama</th>
|
||||
<th>Media</th>
|
||||
<th>Tgl Upload</th>
|
||||
<th>Status</th>
|
||||
<th>Bukti</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($cooperationCompletions as $i => $cooperationCompletion)
|
||||
<tr>
|
||||
<td>{{ $i + 1 }}</td>
|
||||
<td>{{ $cooperationCompletion->order->cooperation->name }}</td>
|
||||
<td>{{ $cooperationCompletion->media->name }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($cooperationCompletion->created_at)->locale('id')->translatedFormat('l, d F Y') }}</td>
|
||||
<td>
|
||||
@if ($cooperationCompletion->status === '0')
|
||||
Menunggu
|
||||
@elseif ($cooperationCompletion->status === '1')
|
||||
Diterima
|
||||
@elseif ($cooperationCompletion->status === '2')
|
||||
Ditolak
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@php
|
||||
$payment_request_letter_ext = pathinfo($cooperationCompletion->payment_request_letter, PATHINFO_EXTENSION);
|
||||
$invoice_ext = pathinfo($cooperationCompletion->payment_request_letter, PATHINFO_EXTENSION);
|
||||
$bank_reference_ext = pathinfo($cooperationCompletion->payment_request_letter, PATHINFO_EXTENSION);
|
||||
$electronic_tax_invoice_ext = pathinfo($cooperationCompletion->payment_request_letter, PATHINFO_EXTENSION);
|
||||
|
||||
if ($cooperationCompletion->other_document) {
|
||||
$other_document_ext = pathinfo($cooperationCompletion->other_document, PATHINFO_EXTENSION);
|
||||
}
|
||||
@endphp
|
||||
@if($cooperationCompletion->payment_request_letter)
|
||||
@if(in_array(strtolower($payment_request_letter_ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img class="proof-img" src="{{ public_path('storage/uploads/cooperation-completions/' . $cooperationCompletion->payment_request_letter) }}" alt="Bukti">
|
||||
@elseif(strtolower($payment_request_letter_ext) === 'pdf')
|
||||
<a href="{{ asset('storage/uploads/cooperation-completions/' . $cooperationCompletion->payment_request_letter) }}" target="_blank">{{'[Surat Permohonan Pembayaran]'}}</a>
|
||||
@else
|
||||
Tidak dikenali
|
||||
@endif
|
||||
@endif
|
||||
@if($cooperationCompletion->invoice)
|
||||
@if(in_array(strtolower($invoice_ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img class="proof-img" src="{{ public_path('storage/uploads/cooperation-completions/' . $cooperationCompletion->invoice) }}" alt="Bukti">
|
||||
@elseif(strtolower($invoice_ext) === 'pdf')
|
||||
{{' - '}}<a href="{{ asset('storage/uploads/cooperation-completions/' . $cooperationCompletion->invoice) }}" target="_blank">{{'[Invoice/Tagihan]'}}</a>
|
||||
@else
|
||||
Tidak dikenali
|
||||
@endif
|
||||
@endif
|
||||
@if($cooperationCompletion->bank_reference)
|
||||
@if(in_array(strtolower($bank_reference_ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img class="proof-img" src="{{ public_path('storage/uploads/cooperation-completions/' . $cooperationCompletion->bank_reference) }}" alt="Bukti">
|
||||
@elseif(strtolower($bank_reference_ext) === 'pdf')
|
||||
{{' - '}}<a href="{{ asset('storage/uploads/cooperation-completions/' . $cooperationCompletion->bank_reference) }}" target="_blank">{{'[Referensi Bank]'}}</a>
|
||||
@else
|
||||
Tidak dikenali
|
||||
@endif
|
||||
@endif
|
||||
@if($cooperationCompletion->electronic_tax_invoice)
|
||||
@if(in_array(strtolower($electronic_tax_invoice_ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img class="proof-img" src="{{ public_path('storage/uploads/cooperation-completions/' . $cooperationCompletion->electronic_tax_invoice) }}" alt="Bukti">
|
||||
@elseif(strtolower($electronic_tax_invoice_ext) === 'pdf')
|
||||
{{' - '}}<a href="{{ asset('storage/uploads/cooperation-completions/' . $cooperationCompletion->electronic_tax_invoice) }}" target="_blank">{{'[E-Faktur]'}}</a>
|
||||
@else
|
||||
Tidak dikenali
|
||||
@endif
|
||||
@endif
|
||||
@if($cooperationCompletion->other_document)
|
||||
@if(in_array(strtolower($other_document_ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img class="proof-img" src="{{ public_path('storage/uploads/cooperation-completions/' . $cooperationCompletion->other_document) }}" alt="Bukti">
|
||||
@elseif(strtolower($other_document_ext) === 'pdf')
|
||||
{{' - '}}<a href="{{ asset('storage/uploads/cooperation-completions/' . $cooperationCompletion->other_document) }}" target="_blank">{{'[Dokumen Lainnya]'}}</a>
|
||||
@else
|
||||
Tidak dikenali
|
||||
@endif
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="footer">
|
||||
Dicetak pada {{ now()->format('d-m-Y H:i') }} – {{ $app->app_title ?? 'SIMEDKOM' }}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Laporan Bukti Tayang {{$cooperationCompletion->media->name}}</title>
|
||||
<style>
|
||||
/* Styling tetap sama seperti sebelumnya */
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('assets/defaults/simedkom-logo-circle.png');
|
||||
background-size: 300px auto;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
opacity: 0.05;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
header .icon {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header .icon img {
|
||||
width: 20% !important;
|
||||
max-width: 200px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 80%;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 2px solid #e0e0e0;
|
||||
}
|
||||
.header h2 {
|
||||
font-size: 24px;
|
||||
color: #3A59D1;
|
||||
}
|
||||
.header h3 {
|
||||
font-size: 20px;
|
||||
color: #555;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 15px;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid #f1f1f1;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
font-weight: bold;
|
||||
width: 35%;
|
||||
color: #444;
|
||||
}
|
||||
.value {
|
||||
width: 60%;
|
||||
color: #555;
|
||||
}
|
||||
.section {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.document {
|
||||
margin-top: 10px;
|
||||
padding: 5px 0;
|
||||
}
|
||||
.document img {
|
||||
max-width: 300px;
|
||||
margin-bottom: 10px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.document .content {
|
||||
background-color: rgba(241, 237, 237, 0.363);
|
||||
padding: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center; /* ini yang bikin vertikal align tengah */
|
||||
text-align: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
|
||||
.document a {
|
||||
color: #007bff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
.footer {
|
||||
text-align: right;
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="icon">
|
||||
<img src="{{ public_path('assets/defaults/simedkom-logo-full.png') }}" alt="">
|
||||
</div>
|
||||
</header>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h2>Penyelesaian Kerja Sama</h2>
|
||||
{{-- <h3>{{ $cooperationCompletion->content_theme }}</h3> --}}
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="row">
|
||||
<div class="label">Kerja Sama</div>
|
||||
<div class="value">{{ $cooperationCompletion->order->cooperation->name }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">Media</div>
|
||||
<div class="value">{{ $cooperationCompletion->media->name }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">Perusahaan</div>
|
||||
<div class="value">{{ $cooperationCompletion->media->company->name }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">Tanggal Upload</div>
|
||||
<div class="value">{{ idn_date($cooperationCompletion->created_at, 'l, d F Y') }}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">Status</div>
|
||||
<div class="value">
|
||||
@if ($cooperationCompletion->status === '0')
|
||||
Menunggu
|
||||
@elseif ($cooperationCompletion->status === '1')
|
||||
Diterima
|
||||
@elseif ($cooperationCompletion->status === '2')
|
||||
Ditolak
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="label">Deskripsi</div>
|
||||
<div class="value">{{ strip_tags($cooperationCompletion->description) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Dokumen --}}
|
||||
<div class="section">
|
||||
|
||||
@php
|
||||
$documents = [
|
||||
'Surat Permohonan Pembayaran' => $cooperationCompletion->payment_request_letter,
|
||||
'Invoice/Tagihan' => $cooperationCompletion->invoice,
|
||||
'Referensi Bank' => $cooperationCompletion->bank_reference,
|
||||
'E-Faktur' => $cooperationCompletion->electronic_tax_invoice,
|
||||
'Dokumen Lainnya' => $cooperationCompletion->other_document,
|
||||
];
|
||||
@endphp
|
||||
|
||||
@foreach($documents as $label => $doc)
|
||||
<div class="document">
|
||||
<strong>{{ $label }}</strong><br>
|
||||
<div class="content">
|
||||
@if($doc)
|
||||
@php
|
||||
$ext = pathinfo($doc, PATHINFO_EXTENSION);
|
||||
@endphp
|
||||
@if(in_array(strtolower($ext), ['jpg', 'jpeg', 'png', 'gif', 'webp']))
|
||||
<img src="{{ public_path('storage/uploads/cooperation-completions/' . $doc) }}" alt="{{ "Tidak ada " . $label }}">
|
||||
@elseif(strtolower($ext) === 'pdf')
|
||||
<a href="{{ asset('storage/uploads/cooperation-completions/' . $doc) }}" target="_blank">Lihat Dokumen PDF</a>
|
||||
@else
|
||||
File tidak dikenali.
|
||||
@endif
|
||||
@else
|
||||
Tidak Ada Dokumen
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
Dicetak pada {{ now()->format('d-m-Y H:i') . ' - ' . $app->app_title }}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -30,7 +30,7 @@
|
||||
</div>
|
||||
</li> --}}
|
||||
<li>
|
||||
@if ((filled(value: $media) && $media[0] !== 'nothing') || filled(value: $date) || (filled(value: $from_month) && filled(value: $to_month)) ||filled(value: $year))
|
||||
@if ((filled(value: $media) && !empty($media[0])) || filled(value: $date) || (filled(value: $from_month) && filled(value: $to_month)) ||filled(value: $year))
|
||||
<span class="mx-1">
|
||||
<a href="{{route('dashboard.reports.index')}}" class="text-secondary">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" class="icon icon-tabler icons-tabler-filled icon-tabler-xbox-x"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10 -10 10s-10 -4.477 -10 -10s4.477 -10 10 -10m3.6 5.2a1 1 0 0 0 -1.4 .2l-2.2 2.933l-2.2 -2.933a1 1 0 1 0 -1.6 1.2l2.55 3.4l-2.55 3.4a1 1 0 1 0 1.6 1.2l2.2 -2.933l2.2 2.933a1 1 0 0 0 1.6 -1.2l-2.55 -3.4l2.55 -3.4a1 1 0 0 0 -.2 -1.4" /></svg>
|
||||
|
||||
@ -987,7 +987,18 @@
|
||||
$('#cooperationCompletionsTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: '{{ route('dashboard.cooperation.completions.data.index') }}',
|
||||
ajax: {
|
||||
url: '{{ route('dashboard.cooperation.completions.data.index') }}',
|
||||
type: 'GET',
|
||||
data: function(d) {
|
||||
d.media = '{{ implode(',', $media) }}';
|
||||
d.status = '{{ $status }}';
|
||||
d.year = '{{ $year }}';
|
||||
d.from_month = '{{ $from_month }}';
|
||||
d.to_month = '{{ $to_month }}';
|
||||
d.date = '{{ $date }}';
|
||||
}
|
||||
},
|
||||
columns: [
|
||||
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
|
||||
{ data: 'cooperation', name: 'cooperation' },
|
||||
|
||||
@ -488,6 +488,10 @@
|
||||
Route::get('/show/{id}', 'showIndex')->name('show.index');
|
||||
Route::get('/process/{id}', 'processIndex')->name('process.index');
|
||||
Route::get('/{mediaOrderId}/show/{id}', 'show')->name('show');
|
||||
|
||||
Route::get('/print/{id}', 'singlePrint')->name('print.single');
|
||||
Route::post('/export', 'export')->name('export');
|
||||
|
||||
Route::post('/{id}', 'store')->name('store');
|
||||
Route::get('/{id}/edit', 'edit')->name('edit');
|
||||
Route::put('/{id}', 'update')->name('update');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user