feat: cooperation archive

This commit is contained in:
myqnrrhmn 2025-05-28 10:00:18 +07:00
parent 1a9d78f70d
commit 74fe0c05a6
8 changed files with 628 additions and 147 deletions

View File

@ -0,0 +1,109 @@
<?php
namespace App\Exports;
use App\Models\Cooperation;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class CooperationArchiveExport implements FromCollection, WithHeadings, WithStyles, WithMapping
{
/**
* @return \Illuminate\Support\Collection
*/
protected $no = 1;
protected $year;
protected $month;
protected $date;
public function __construct($year, $month, $date)
{
$this->year = $year;
$this->month = $month;
$this->date = $date;
}
public function collection()
{
$query = Cooperation::with(['media', 'mediaOrder']);
if (is_role(['1'])) {
// Hanya untuk role 1: filter kerja sama lebih dari 1 tahun
if (!$this->year && !$this->month && !$this->date) {
$query->where('created_at', '<=', Carbon::now()->subYear());
}
} else if (is_role(['3'])) {
$mediaId = Auth::user()->company->media->id;
$query->whereHas('proposals', function ($query) use ($mediaId) {
$query->where('status', 1)->where('media_id', $mediaId);
});
if (!$this->year && !$this->month && !$this->date) {
$query->where('created_at', '<=', Carbon::now()->subYear());
}
}
if ($this->year) {
$query->whereYear('created_at', $this->year);
}
if ($this->month) {
$monthYear = Carbon::parse($this->month);
$query->whereYear('created_at', $monthYear->year)
->whereMonth('created_at', $monthYear->month);
}
if ($this->date) {
$query->whereDate('created_at', $this->date);
}
return $query->get();
}
public function map($cooperationArchive): array
{
return [
$this->no++,
$cooperationArchive->name,
Carbon::parse($cooperationArchive->start_date)->locale('id')->translatedFormat('l, d F Y'),
Carbon::parse($cooperationArchive->end_date)->locale('id')->translatedFormat('l, d F Y'),
$cooperationArchive->description,
Carbon::parse($cooperationArchive->created_at)->locale('id')->translatedFormat('l, d F Y'),
];
}
public function headings(): array
{
return [
['Data Rekap Konten', '', '', '', '', ''],
['NO', 'Nama Kerjasama', 'Taanggal Mulai', 'Tanggal Selesai', 'Deskripsi', 'Dibuat Pada']
];
}
public function styles(Worksheet $sheet)
{
$sheet->mergeCells('A1:I1'); // A1 sampai D1 digabung
// Set alignment untuk pusat horizontal dan vertikal
$sheet->getStyle('A1:J1')->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);
// Menambahkan gaya lain jika diperlukan
$sheet->getStyle('A1:F1')->getFont()->setBold(true);
$sheet->getStyle('A1:F1')->getFont()->setSize(14);
}
}

View File

@ -17,182 +17,184 @@
// }
// }
// if (! function_exists('store_file')) {
// function store_file($file = null, $path, $disk = null)
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
if(env('FILESYSTEM_DISK') === 's3'){
if (! function_exists('store_file')) {
function store_file($file = null, $path, $disk = null)
{
$disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (filled($file) && $file instanceof \Illuminate\Http\UploadedFile) {
// $randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
// $originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) . '.' . $file->getClientOriginalExtension();
if (filled($file) && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35) . time() . '.' . $file->getClientOriginalExtension();
$originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)) . '.' . $file->getClientOriginalExtension();
// $stored = $file->storeAs($path, $randomFilename, $disk);
$stored = $file->storeAs($path, $randomFilename, $disk);
// if ($stored) {
// $url = Storage::disk($disk)->url($stored);
if ($stored) {
$url = Storage::disk($disk)->url($stored);
// return [
// 'randomFileName' => $randomFilename,
// 'originalFileName' => $originalFileName,
// 'url' => $url,
// 'isSuccess' => true,
// ];
// }
// }
return [
'randomFileName' => $randomFilename,
'originalFileName' => $originalFileName,
'url' => $url,
'isSuccess' => true,
];
}
}
// return [
// 'randomFileName' => null,
// 'originalFileName' => null,
// 'url' => null,
// 'isSuccess' => false,
// ];
// }
// }
if (! function_exists('store_file')) {
function store_file($file = null, $path, $disk = 'public')
{
if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35).time().'.'.$file->getClientOriginalExtension();
$originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)).'.'.$file->getClientOriginalExtension();
$file->storeAs($path, $randomFilename, $disk);
return [
'randomFileName' => $randomFilename,
'originalFileName' => $originalFileName,
'isSuccess' => true,
];
} else {
return [
'randomFileName' => null,
'originalFileName' => null,
'url' => null,
'isSuccess' => false,
];
}
}
}
// if (!function_exists('display_file')) {
// function display_file($dir, $filename, $disk = null, $expirationMinutes = 60): string
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
if (!function_exists('display_file')) {
function display_file($dir, $filename, $disk = null, $expirationMinutes = 60): string
{
$disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// if (!filled($filename)) {
// return '<p class="text-center">Belum ditambahkan.</p>';
// }
if (!filled($filename)) {
return '<p class="text-center">Belum ditambahkan.</p>';
}
// $path = "uploads/{$dir}/{$filename}";
$path = "uploads/{$dir}/{$filename}";
// try {
// $fileExists = is_file_exists($path, $disk);
try {
$fileExists = is_file_exists($path, $disk);
// if (!$fileExists) {
// return '<p class="text-center">File tidak ditemukan.</p>';
// }
if (!$fileExists) {
return '<p class="text-center">File tidak ditemukan.</p>';
}
// if ($disk === 's3') {
// $fileUrl = Storage::disk($disk)->temporaryUrl($path, now()->addMinutes($expirationMinutes));
// } else {
// $fileUrl = Storage::disk($disk)->url($path);
// }
if ($disk === 's3') {
$fileUrl = Storage::disk($disk)->temporaryUrl($path, now()->addMinutes($expirationMinutes));
} else {
$fileUrl = Storage::disk($disk)->url($path);
}
// $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
// $mimeType = match ($ext) {
// 'jpg', 'jpeg', 'png', 'gif', 'webp' => 'image/' . $ext,
// 'pdf' => 'application/pdf',
// default => 'unknown',
// };
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$mimeType = match ($ext) {
'jpg', 'jpeg', 'png', 'gif', 'webp' => 'image/' . $ext,
'pdf' => 'application/pdf',
default => 'unknown',
};
// if (str_contains($mimeType, 'image')) {
// return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
// } elseif ($mimeType === 'application/pdf') {
// return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
// }
if (str_contains($mimeType, 'image')) {
return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
} elseif ($mimeType === 'application/pdf') {
return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
}
// return '<p class="text-center">Format file tidak didukung</p>';
// } catch (\Exception $e) {
// return '<p class="text-center text-danger">Terjadi kesalahan saat menampilkan file.</p>';
// }
// }
// }
if (!function_exists('display_file')) {
function display_file($dir, $filename)
{
$path = storage_path("app/public/uploads/{$dir}/{$filename}");
if(!filled($filename)){
return '<p class="text-center">Belum ditambahkan.</p>';
return '<p class="text-center">Format file tidak didukung</p>';
} catch (\Exception $e) {
return '<p class="text-center text-danger">Terjadi kesalahan saat menampilkan file.</p>';
}
}
if (!file_exists($path)) {
return '<p class="text-center">File tidak ditemukan.</p>';
}
$mimeType = mime_content_type($path);
$fileUrl = asset("storage/uploads/{$dir}/{$filename}");
if (str_contains($mimeType, 'image')) {
return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
} elseif ($mimeType === 'application/pdf') {
return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
}
return '<p class="text-center">Format file tidak didukung</p>';
}
}
// if (! function_exists('delete_file')) {
// function delete_file($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
if (! function_exists('delete_file')) {
function delete_file($path, $disk = null): bool
{
$disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// try {
// if(is_file_exists($path)){
// return Storage::disk($disk)->delete($path);
// }else{
// return false;
// }
// } catch (\Exception $e) {
// return false;
// }
// }
// }
if (! function_exists('delete_file')) {
function delete_file($path)
{
// Menggunakan public_path untuk file yang berada di dalam storage/public
$fullPath = public_path('storage/' . $path);
if (File::exists($fullPath)) {
File::delete($fullPath);
return true;
try {
if(is_file_exists($path)){
return Storage::disk($disk)->delete($path);
}else{
return false;
}
} catch (\Exception $e) {
return false;
}
}
return false;
}
}
// if (!function_exists('is_file_exists')) {
// function is_file_exists($path, $disk = null): bool
// {
// $disk = $disk ?? env('FILESYSTEM_DISK', 'public');
if (!function_exists('is_file_exists')) {
function is_file_exists($path, $disk = null): bool
{
$disk = $disk ?? env('FILESYSTEM_DISK', 'public');
// try {
// $file = Storage::disk($disk)->get($path);
// return !empty($file);
// } catch (\Throwable $e) {
// return false;
// }
// }
// }
try {
$file = Storage::disk($disk)->get($path);
return !empty($file);
} catch (\Throwable $e) {
return false;
}
}
}
}else if(env('FILESYSTEM_DISK') === 'local'){
if (! function_exists('store_file')) {
function store_file($file = null, $path, $disk = 'public')
{
if (filled($file) && $file && $file instanceof \Illuminate\Http\UploadedFile) {
$randomFilename = Str::random(35).time().'.'.$file->getClientOriginalExtension();
$originalFileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME)).'.'.$file->getClientOriginalExtension();
if (! function_exists('is_file_exists')) {
function is_file_exists($path)
{
return File::exists(public_path('storage/' . $path));
$file->storeAs($path, $randomFilename, $disk);
return [
'randomFileName' => $randomFilename,
'originalFileName' => $originalFileName,
'isSuccess' => true,
];
} else {
return [
'randomFileName' => null,
'originalFileName' => null,
'isSuccess' => false,
];
}
}
}
if (!function_exists('display_file')) {
function display_file($dir, $filename)
{
$path = storage_path("app/public/uploads/{$dir}/{$filename}");
if(!filled($filename)){
return '<p class="text-center">Belum ditambahkan.</p>';
}
if (!file_exists($path)) {
return '<p class="text-center">File tidak ditemukan.</p>';
}
$mimeType = mime_content_type($path);
$fileUrl = asset("storage/uploads/{$dir}/{$filename}");
if (str_contains($mimeType, 'image')) {
return "<img src='{$fileUrl}' alt='File Image' class='img-fluid'>";
} elseif ($mimeType === 'application/pdf') {
return "<iframe src='{$fileUrl}' width='100%' height='600px'></iframe>";
}
return '<p class="text-center">Format file tidak didukung</p>';
}
}
if (! function_exists('delete_file')) {
function delete_file($path)
{
// Menggunakan public_path untuk file yang berada di dalam storage/public
$fullPath = public_path('storage/' . $path);
if (File::exists($fullPath)) {
File::delete($fullPath);
return true;
}
return false;
}
}
if (! function_exists('is_file_exists')) {
function is_file_exists($path)
{
return File::exists(public_path('storage/' . $path));
}
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Http\Controllers\Dashboard;
use App\Exports\CooperationArchiveExport;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
class CooperationArchiveController extends Controller
{
public function index(Request $request){
return view('dashboard.cooperation-archives.index', [
'title' => 'Arsip Kerjasama',
'date' => $request->input('date', null),
'month' => $request->input('month', null),
'year' => $request->input('year', null),
]);
}
public function export(Request $request)
{
try{
$year = $request->input('year', null);
$month = $request->input('month', null);
$date = $request->input('date', null);
return Excel::download(new CooperationArchiveExport($year, $month, $date), 'cooperation-archive.xlsx');
}catch(\Exception $e){
return redirect()->back()->with('failed-status', 'Gagal melakukan proses export data.');
}
}
public function filter(Request $request){
try{
$filteredRequest = $request->except('_token');
$filterField = array_filter($filteredRequest, function ($value) {
return filled($value);
});
return redirect()->route('dashboard.cooperation.archives.index', $filterField);
}catch(\Exception $e){
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filtering data.');
}
}
}

View File

@ -2092,6 +2092,108 @@ class="text-dark"
}
public function cooperationArchive(Request $request){
if ($request->ajax()) {
$year = $request->input('year', null);
$month = $request->input('month', null);
$date = $request->input('date', null);
$query = Cooperation::with(['media', 'mediaOrder']);
if (is_role(['1'])) {
// Hanya untuk role 1: filter kerja sama lebih dari 1 tahun
if (!$year && !$month && !$date) {
$query->where('created_at', '<=', Carbon::now()->subYear());
}
} else if (is_role(['3'])) {
$mediaId = Auth::user()->company->media->id;
$query->whereHas('proposals', function ($query) use ($mediaId) {
$query->where('status', 1)->where('media_id', $mediaId);
});
if (!$year && !$month && !$date) {
$query->where('created_at', '<=', Carbon::now()->subYear());
}
}
if ($year) {
$query->whereYear('created_at', $year);
}
if ($month) {
$monthYear = Carbon::parse($month);
$query->whereYear('created_at', $monthYear->year)
->whereMonth('created_at', $monthYear->month);
}
if ($date) {
$query->whereDate('created_at', $date);
}
$data = $query->get();
return DataTables::of($data)
->addIndexColumn()
->addColumn('name', function ($data) {
return '<div style="width: 100%;word-wrap: break-word; white-space: normal;">' . $data->name . '</div>';
})
// ->addColumn('start_date', function ($data) {
// return idn_date($data->start_date, 'l, d F Y');
// })
// ->addColumn('end_date', function ($data) {
// return idn_date($data->end_date, 'l, d F Y');
// })
->addColumn('posted_at', function ($data) {
return idn_date($data->created_at, 'l, d F Y');
})
->addColumn('status', function ($data) {
$isHaveMediaOrder = !is_null($data->mediaOrder);
if ($isHaveMediaOrder) {
return '<span class="badge bg-info" style="display:inline-block;font-size:0.8rem;">Media Order</span> <br> <span class="badge bg-primary" style="display:inline-block;font-size:0.8rem;">Sudah Media Order</span>';
}else{
return '<span class="badge bg-info" style="display:inline-block;font-size:0.8rem;">Pengajuan Kerjasama</span> <br> <span class="badge bg-warning" style="display:inline-block;font-size:0.8rem;">Belum Media Order</span>';
}
})
->addColumn('action', function ($data) {
$isHaveMediaOrder = $data->mediaorder;
$showUrl = route('dashboard.cooperations.show', ['id' => encrypt_id($data->id)]);
$processUrl = route('dashboard.cooperations.process', ['id' => encrypt_id($data->id), 'process' => 'cooperation']);
$createMediaOrderUrl = route('dashboard.media.orders.create', ['id' => encrypt_id($data->id)]);
$proposalsUrl = route('dashboard.cooperations.media.proposal', ['id' => encrypt_id($data->id)]);
$editUrl = route('dashboard.cooperations.edit', ['id' => encrypt_id($data->id)]);
$deleteUrl = route('dashboard.cooperations.destroy', ['id' => encrypt_id($data->id)]);
$dropdown = '<div class="dropdown" style="display:flex; justify-content:center;">
<a class="dropdown-toggle btn btn-icon btn-light" data-bs-toggle="dropdown"><em class="icon ni ni-more-v"></em></a>
<div class="dropdown-menu dropdown-menu-datatable-custom dropdown-menu-end">
<ul class="link-list-opt">
<li><a href="'.$showUrl.'"><em class="icon ni ni-eye"></em><span>Detail</span></a></li>';
$dropdown .= '</ul>
</div>
</div>';
return $dropdown;
})
->rawColumns(['status', 'name', 'action'])
->make(true);
}
return response()->json(['error' => 'Unauthorized'], 401);
}
public function contentRecap(Request $request){
if ($request->ajax()) {

View File

@ -0,0 +1,163 @@
@include('partials.dashboard.head')
@include('partials.dashboard.sidebar', ['page' => 'cooperation_archives'])
@include('partials.dashboard.header')
<!-- content @s -->
<div class="nk-content ">
<div class="container-fluid">
<div class="nk-content-inner">
<div class="nk-content-body">
<div class="nk-block-head nk-block-head-sm">
<div class="nk-block-between">
<div class="nk-block-head-content">
<h3 class="nk-block-title page-title">{{$title}}</h3>
</div><!-- .nk-block-head-content -->
@if (is_role(['1']))
<div class="nk-block-head-content">
<div class="toggle-wrap nk-block-tools-toggle">
<a href="#" class="btn btn-icon btn-trigger toggle-expand me-n1" data-target="pageMenu"><em class="icon ni ni-more-v"></em></a>
<div class="toggle-expand-content" data-content="pageMenu">
<ul class="nk-block-tools g-3">
{{-- <li>
<div class="drodown">
<a href="#" class="dropdown-toggle btn btn-white btn-dim btn-outline-light" data-bs-toggle="dropdown"><em class="d-none d-sm-inline icon ni ni-calender-date"></em><span><span class="d-none d-md-inline">Last</span> 30 Days</span><em class="dd-indc icon ni ni-chevron-right"></em></a>
<div class="dropdown-menu dropdown-menu-end">
<ul class="link-list-opt no-bdr">
<li><a href="#"><span>Last 30 Days</span></a></li>
<li><a href="#"><span>Last 6 Months</span></a></li>
<li><a href="#"><span>Last 1 Years</span></a></li>
</ul>
</div>
</div>
</li> --}}
{{-- <li class="nk-block-tools-opt"><a href="{{route('dashboard.cooperations.create')}}" class="btn btn-primary"><em class="icon ni ni-plus"></em><span>Tambah</span></a></li> --}}
<li>
@if (filled(value: $year))
<span class="mx-1">
<a href="{{route('dashboard.cooperation.archives.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>
@endif
<div>
<a href="javascript: void(0);" class="btn btn-white btn-dim btn-outline-light" data-bs-toggle="modal" data-bs-target="#modalFilter"><em class="d-none d-sm-inline icon ni ni-filter"></em><span><span class="d-none d-md-inline">Filter</a>
</div>
</li>
<li>
<div>
<a href="javascript: void(0);" class="btn btn-info" data-bs-toggle="modal" data-bs-target="#modalExport"><em class="d-none d-sm-inline icon ni ni-upload"></em><span><span class="d-none d-md-inline">Export</a>
</div>
</li>
</ul>
</div>
</div>
</div><!-- .nk-block-head-content -->
@endif
</div><!-- .nk-block-between -->
</div><!-- .nk-block-head -->
<div class="nk-block nk-block-lg">
<div class="card card-bordered card-preview">
<div class="card-inner">
<div class="table-responsive">
<table class="table table-striped table-bordered nowrap" id="cooperationArchivesTable" border="1">
<thead>
<tr>
<th style="width: 10% !important;">No</th>
<th>Nama Kegiatan</th>
{{-- <th>Tanggal Mulai Pengajuan</th>
<th>Tanggal Akhir Pengajuan</th> --}}
<th>Dibuat Pada</th>
<th>Step/Status</th>
<th style="width: 10% !important;"></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalFilter">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Filter</h5>
<a href="javascript:void(0);" class="close" data-bs-dismiss="modal" aria-label="Close">
<em class="icon ni ni-cross"></em>
</a>
</div>
<form action="{{route('dashboard.cooperation.archives.filter')}}" class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<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="Data kerjasama pada tahun" 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>
</div>
<div class="form-group">
<label class="form-label" for="date">Tanggal</label>
<div class="form-control-wrap">
<input type="date" class="form-control" id="date" placeholder="Data berita pada bulan dan tahun" name="date" value="{{ old('date', $date ?? '') }}">
</div>
</div>
</div>
<div class="modal-footer bg-light">
<span class="sub-text">
<button type="submit" class="btn btn-sm btn-primary">Filter</button>
</span>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="modalExport">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Export</h5>
<a href="javascript:void(0);" class="close" data-bs-dismiss="modal" aria-label="Close">
<em class="icon ni ni-cross"></em>
</a>
</div>
<form action="{{route('dashboard.cooperation.archives.export')}}" class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<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="Data kerjasama pada tahun" 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>
</div>
<div class="form-group">
<label class="form-label" for="date">Tanggal</label>
<div class="form-control-wrap">
<input type="date" class="form-control" id="date" placeholder="Data berita pada bulan dan tahun" name="date" value="{{ old('date', $date ?? '') }}">
</div>
</div>
</div>
<div class="modal-footer bg-light">
<span class="sub-text">
<button type="submit" class="btn btn-sm btn-primary">Export</button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content @e -->
@include('partials.dashboard.footer' ,['datatable' => 'cooperation_archive'])

View File

@ -973,6 +973,45 @@
</script>
@endif
@if ($datatable === 'cooperation_archive')
<script>
$(document).ready(function() {
$('#cooperationArchivesTable').DataTable({
processing: true,
serverSide: true,
ajax: {
url: '{{ route('dashboard.cooperation.archives.data') }}',
type: 'GET',
data: function(d) {
d.year = '{{ $year }}';
d.month = '{{ $month }}';
d.date = '{{ $date }}';
}
},
columns: [
{ data: 'DT_RowIndex', name: 'DT_RowIndex', orderable: false, searchable: false },
{ data: 'name', name: 'name' },
// { data: 'start_date', name: 'start_date' },
// { data: 'end_date', name: 'end_date' },
{ data: 'posted_at', name: 'posted_at' },
{ data: 'status', name: 'status' },
{ data: 'action', name: 'action', orderable: false, searchable: false },
{ data: 'created_at', name: 'created_at', visible: false },
{ data: 'id', name: 'id', orderable: true, searchable: false, visible: false },
],
language: datatableLanguage,
responsive: true,
autoWidth: false,
order: [[6, 'desc']],
pagingType: "simple",
lengthMenu: [[10, 25, 50, 100, -1], ['Tampilkan 10 data', 'Tampilkan 25 data', 'Tampilkan 50 data', 'Tampilkan 100 data', 'Tampilkan semua']],
scrollX: true,
// scrollY: true,
});
});
</script>
@endif
@if ($datatable === 'content_recap')
<script>
$(document).ready(function() {

View File

@ -164,7 +164,7 @@
</li><!-- .nk-menu-item -->
@endif --}}
<li class="nk-menu-item">
<a href="javascript:void(0);" class="nk-menu-link">
<a href="{{route('dashboard.cooperation.archives.index')}}" class="nk-menu-link {{$page === 'cooperation_archives' ? 'active-page' : ''}}">
<span class="nk-menu-icon"><em class="icon ni ni-archive"></em></span>
<span class="nk-menu-text">Arsip</span>
</a>

View File

@ -7,6 +7,7 @@
use App\Http\Controllers\Dashboard\CompanyController;
use App\Http\Controllers\Dashboard\ContentRecapClassificationController;
use App\Http\Controllers\Dashboard\ContentRecapController;
use App\Http\Controllers\Dashboard\CooperationArchiveController;
use App\Http\Controllers\Dashboard\CooperationCompletionController;
use App\Http\Controllers\Dashboard\CooperationRequestController;
use App\Http\Controllers\Dashboard\DatatableController;
@ -485,6 +486,19 @@
});
});
Route::middleware('role:1,3')->group(function(){
Route::prefix('cooperation-archives')->name('cooperation.archives.')->group(function(){
Route::controller(CooperationArchiveController::class)->group(function(){
Route::get('/', 'index')->name('index');
Route::post('/filter', 'filter')->name('filter');
Route::post('/export', 'export')->name('export');
});
Route::get('/data', [DatatableController::class, 'cooperationArchive'])->name('data');
});
});
Route::middleware('role:1,4')->group(function(){
Route::prefix('content-recaps')->name('content.recaps.')->group(function(){
Route::controller(ContentRecapController::class)->group(function(){