feat(issue management): add date range and user for export data and filder datatable

This commit is contained in:
Yoga Pangestu 2025-10-10 15:37:25 +07:00
parent 019c6374f2
commit 51c2365cfa
5 changed files with 1284 additions and 1112 deletions

View File

@ -11,26 +11,54 @@
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class IssueManagementExport implements FromCollection, WithHeadings, WithStyles, WithMapping
class IssueManagementExport implements FromCollection, WithHeadings, WithMapping, WithStyles
{
/**
* @return \Illuminate\Support\Collection
*/
* @return \Illuminate\Support\Collection
*/
protected $no = 1;
protected $classification;
protected $sub_classification;
protected $location;
protected $sub_location;
protected $government_agency;
protected $issue;
protected $response;
protected $year;
protected $month;
protected $date;
public function __construct($classification, $sub_classification, $location, $sub_location, $government_agency, $issue, $response, $year, $month, $date)
{
protected $start_date;
protected $end_date;
protected $user;
public function __construct(
$classification,
$sub_classification,
$location,
$sub_location,
$government_agency,
$issue,
$response,
$year,
$month,
$date,
$start_date,
$end_date,
$user
) {
$this->classification = $classification;
$this->sub_classification = $sub_classification;
$this->location = $location;
@ -41,83 +69,97 @@ public function __construct($classification, $sub_classification, $location, $su
$this->year = $year;
$this->month = $month;
$this->date = $date;
$this->start_date = $start_date;
$this->end_date = $end_date;
$this->user = $user;
}
public function collection()
{
$query = IssueManagement::with(['location', 'subLocation', 'classification', 'subClassification', 'enhancer', 'governmentAgencies']);
if ($this->classification) {
$query->where('classification_id', decrypt_id($this->classification));
}
if ($this->classification) {
$query->where('classification_id', decrypt_id($this->classification));
}
if ($this->sub_classification) {
$query->where('sub_classification_id', decrypt_id($this->sub_classification));
}
if ($this->sub_classification) {
$query->where('sub_classification_id', decrypt_id($this->sub_classification));
}
if ($this->location) {
$query->where('location_id', decrypt_id($this->location));
}
if ($this->location) {
$query->where('location_id', decrypt_id($this->location));
}
if ($this->sub_location) {
$query->where('sub_location_id', decrypt_id($this->sub_location));
}
if ($this->sub_location) {
$query->where('sub_location_id', decrypt_id($this->sub_location));
}
if ($this->government_agency) {
$query->whereHas('governmentAgencies', function ($query) {
$query->where('issue_managements_government_agencies.government_agency_id', decrypt_id($this->government_agency));
});
}
if ($this->government_agency) {
$query->whereHas('governmentAgencies', function ($query) {
$query->where('issue_managements_government_agencies.government_agency_id', decrypt_id($this->government_agency));
});
}
if ($this->issue) {
switch($this->issue){
case 'positive':
$query->where('issue', 'positif');
break;
case 'negative':
$query->where('issue', 'negatif');
break;
case 'neutral':
$query->where('issue', 'netral');
break;
case 'crisis':
$query->where('issue', 'krisis');
break;
}
if ($this->issue) {
switch ($this->issue) {
case 'positive':
$query->where('issue', 'positif');
break;
case 'negative':
$query->where('issue', 'negatif');
break;
case 'neutral':
$query->where('issue', 'netral');
break;
case 'crisis':
$query->where('issue', 'krisis');
break;
}
}
if ($this->response) {
switch($this->response){
case 'positive':
$query->where('response', 'positif');
break;
case 'negative':
$query->where('response', 'negatif');
break;
case 'neutral':
$query->where('response', 'netral');
break;
case 'crisis':
$query->where('response', 'krisis');
break;
}
if ($this->response) {
switch ($this->response) {
case 'positive':
$query->where('response', 'positif');
break;
case 'negative':
$query->where('response', 'negatif');
break;
case 'neutral':
$query->where('response', 'netral');
break;
case 'crisis':
$query->where('response', 'krisis');
break;
}
}
if ($this->year) {
$query->whereYear('created_at', $this->year);
}
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->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);
}
if ($this->date) {
$query->whereDate('created_at', $this->date);
}
return $query->get();
if ($this->start_date && $this->end_date) {
$start = \Carbon\Carbon::createFromFormat('m/d/Y', $this->start_date)->startOfDay();
$end = \Carbon\Carbon::createFromFormat('m/d/Y', $this->end_date)->endOfDay();
$query->whereBetween('created_at', [$start, $end]);
}
if ($this->user) {
$query->where('enhancer_id', decrypt_id($this->user));
}
return $query->get();
}
public function map($issueManagement): array
@ -132,7 +174,7 @@ public function map($issueManagement): array
$issueManagement->subLocation->name,
ucfirst($issueManagement->issue),
ucfirst($issueManagement->response),
$issueManagement->governmentAgencies->map(function($agency) {
$issueManagement->governmentAgencies->map(function ($agency) {
return Str::ucfirst($agency->name);
})->implode(', '),
$issueManagement->enhancer->name ?? 'Admin',
@ -144,7 +186,7 @@ public function headings(): array
{
return [
['Data Managemen Isu', '', '', '', '', '', '', '', '', '', '', ''],
['NO', 'Kode', 'Monitoring Media', 'Klasifikasi', 'Sub Klasifikasi', 'Lokus', 'Sub Lokus', 'Isu', 'Tanggapan', 'Dinas', 'Oleh', 'Dibuat Pada']
['NO', 'Kode', 'Monitoring Media', 'Klasifikasi', 'Sub Klasifikasi', 'Lokus', 'Sub Lokus', 'Isu', 'Tanggapan', 'Dinas', 'Oleh', 'Dibuat Pada'],
];
}

File diff suppressed because it is too large Load Diff

View File

@ -12,16 +12,17 @@
use App\Models\MediaMonitoring;
use App\Models\SubClassification;
use App\Models\SubLocation;
use App\Models\User;
use Barryvdh\DomPDF\Facade\Pdf;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
class IssueManagementController extends Controller
{
public function index(Request $request){
public function index(Request $request)
{
return view('dashboard.issue-managements.index', [
'title' => 'Manajemen Isu',
'classification' => $request->input('classification', null),
@ -35,23 +36,28 @@ public function index(Request $request){
'year' => $request->input('year', null),
'month' => $request->input('month', null),
'date' => $request->input('date', null),
'start_date' => $request->input('start_date', null),
'end_date' => $request->input('end_date', null),
'user' => $request->input('user', null),
'locations' => Location::all(),
'sub_locations' => SubLocation::all(),
'classifications' => Classification::all(),
'sub_classifications' => SubClassification::all(),
'government_agencies' => GovernmentAgency::all(),
'users' => User::all(),
]);
}
public function create(Request $request){
public function create(Request $request)
{
return view('dashboard.issue-managements.create', [
'title' => 'Tambah Manajemen Isu',
'locations' => Location::all(),
'classifications' => Classification::all(),
'governmentAgencies' => GovernmentAgency::all(),
'mediaMonitoring' => MediaMonitoring::with(['enhancer'])->find(decrypt_id($request->input('media_monitoring'))),
'mediaMonitoringId' => $request->input('media_monitoring') ?? null
'mediaMonitoringId' => $request->input('media_monitoring') ?? null,
]);
}
@ -60,8 +66,8 @@ public function store(IssueManagementRequest $request, $media_monitoring_id)
$validatedData = $request->validated();
$validatedData['media_monitoring_id'] = decrypt_id($media_monitoring_id);
try{
$createdIssueManagement = DB::transaction(function()use($validatedData, $request){
try {
$createdIssueManagement = DB::transaction(function () use ($validatedData, $request) {
$createdIssueManagement = IssueManagement::create($validatedData);
$createdIssueManagement->governmentAgencies()->attach($request->input('government_agencies'));
@ -73,15 +79,20 @@ public function store(IssueManagementRequest $request, $media_monitoring_id)
} else {
return redirect()->back()->with('failed-status', 'Gagal menambahkan manajemen isu');
}
}catch(\Exception $e){
} catch (\Exception $e) {
return redirect()->back()->with('failed-status', 'Gagal menambahkan manajemen isu');
}
}
public function edit(Request $request, $id) {
public function edit(Request $request, $id)
{
$issueManagement = IssueManagement::with([
'location', 'subLocation', 'classification', 'subClassification', 'mediaMonitoring', 'enhancer'
'location',
'subLocation',
'classification',
'subClassification',
'mediaMonitoring',
'enhancer',
])->findOrFail(decrypt_id($id));
return view('dashboard.issue-managements.edit', [
@ -92,17 +103,22 @@ public function edit(Request $request, $id) {
'selectedGovernmentAgencies' => $issueManagement->governmentAgencies->pluck('id')->toArray(),
'issueManagement' => $issueManagement,
'mediaMonitoring' => MediaMonitoring::with(['enhancer'])->find($issueManagement->media_monitoring_id),
'mediaMonitoringId' => $request->input('media_monitoring') ?? null
'mediaMonitoringId' => $request->input('media_monitoring') ?? null,
]);
}
public function update(IssueManagementRequest $request, $id){
public function update(IssueManagementRequest $request, $id)
{
$validatedData = $request->validated();
try{
try {
$issueManagement = IssueManagement::with([
'location', 'subLocation', 'classification', 'subClassification', 'mediaMonitoring', 'enhancer'
'location',
'subLocation',
'classification',
'subClassification',
'mediaMonitoring',
'enhancer',
])->findOrFail(decrypt_id($id));
$validatedData['media_monitoring_id'] = $issueManagement->media_monitoring_id;
@ -110,26 +126,33 @@ public function update(IssueManagementRequest $request, $id){
if ($request->has('government_agencies')) {
$issueManagement->governmentAgencies()->sync($validatedData['government_agencies']);
}
}catch(\Exception $e){
} catch (\Exception $e) {
return redirect()->back()->with('failed-status', 'Gagal mengubah manajemen isu');
}
return redirect()->route('dashboard.issue.managements.show', ['id' => encrypt_id($issueManagement->id)])->with('success-status', 'Berhasil mengubah manajemen isu.');
}
public function show($id){
public function show($id)
{
$issueManagement = IssueManagement::with([
'location', 'subLocation', 'classification', 'subClassification', 'mediaMonitoring', 'enhancer'
'location',
'subLocation',
'classification',
'subClassification',
'mediaMonitoring',
'enhancer',
])->findOrFail(decrypt_id($id));
return view('dashboard.issue-managements.show', [
'title' => 'Detail Manajemen Isu',
'issueManagement' => $issueManagement,
'mediaMonitoring' => MediaMonitoring::with(['enhancer'])->find($issueManagement->media_monitoring_id)
'mediaMonitoring' => MediaMonitoring::with(['enhancer'])->find($issueManagement->media_monitoring_id),
]);
}
public function destroy($id){
public function destroy($id)
{
try {
$issueManagement = IssueManagement::findOrFail(decrypt_id($id));
@ -156,9 +179,9 @@ public function getSubClassifications($location_id)
return response()->json(['sub_classifications' => $subLocations]);
}
public function filter(Request $request){
try{
public function filter(Request $request)
{
try {
$filteredRequest = $request->except('_token');
$filterField = array_filter($filteredRequest, function ($value) {
@ -166,15 +189,14 @@ public function filter(Request $request){
});
return redirect()->route('dashboard.issue.managements.index', $filterField);
}catch(\Exception $e){
} catch (\Exception $e) {
return redirect()->back()->with('status-failed', 'Gagal melakukan proses filter data.');
}
}
public function export(Request $request)
{
try{
try {
$classification = $request->input('classification', null);
$sub_classification = $request->input('sub_classification', null);
$location = $request->input('location', null);
@ -185,27 +207,49 @@ public function export(Request $request)
$year = $request->input('year', null);
$month = $request->input('month', null);
$date = $request->input('date', null);
$start_date = $request->input('start_date', null);
$end_date = $request->input('end_date', null);
$user = $request->input('user', null);
$formattedNow = Carbon::parse(now())->locale('id')->translatedFormat('d-m-Y');
return Excel::download(new IssueManagementExport($classification, $sub_classification, $location, $sub_location, $government_agency, $issue, $response, $year, $month, $date), 'issue-managements-'.$formattedNow.'.xlsx');
}catch(\Exception $e){
return Excel::download(new IssueManagementExport(
$classification,
$sub_classification,
$location,
$sub_location,
$government_agency,
$issue,
$response,
$year,
$month,
$date,
$start_date,
$end_date,
$user
), 'issue-managements-'.$formattedNow.'.xlsx');
} catch (\Exception $e) {
return redirect()->back()->with('failed-status', 'Gagal melakukan proses export data.');
}
}
public function printData($id){
try{
public function printData($id)
{
try {
$issueManagement = IssueManagement::with([
'location', 'subLocation', 'classification', 'subClassification', 'governmentAgencies','enhancer', 'mediaMonitoring'
'location',
'subLocation',
'classification',
'subClassification',
'governmentAgencies',
'enhancer',
'mediaMonitoring',
])->findOrFail(decrypt_id($id));
$pdf = Pdf::loadView('dashboard.issue-managements.print', compact('issueManagement'));
return $pdf->stream(slugify('manajemen isu '. $issueManagement->mediaMonitoring->code).'.pdf');
}catch(\Exception $e){
return $pdf->stream(slugify('manajemen isu '.$issueManagement->mediaMonitoring->code).'.pdf');
} catch (\Exception $e) {
return redirect()->back()->with('failed-status', 'Gagal melakukan proses print data.');
}
}

View File

@ -1,311 +1,431 @@
@include('partials.dashboard.head')
@include('partials.dashboard.sidebar', ['page' => 'issue_managements'])
@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 -->
<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>
@if (filled(value: $media_monitoring) || filled(value: $classification) || filled(value: $sub_classification) || filled(value: $location) || filled(value: $sub_location) || filled($year) || filled(value: $government_agency) || filled(value: $issue) || filled($response) || filled($year) || filled($month) || filled($date))
<span class="mx-1">
<a href="{{route('dashboard.issue.managements.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>
<!-- 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 -->
<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>
@if (filled(value: $media_monitoring) ||
filled(value: $classification) ||
filled(value: $sub_classification) ||
filled(value: $location) ||
filled(value: $sub_location) ||
filled($year) ||
filled(value: $government_agency) ||
filled(value: $issue) ||
filled($response) ||
filled($year) ||
filled($month) ||
filled($date) ||
filled($start_date) ||
filled($end_date))
<span class="mx-1">
<a href="{{ route('dashboard.issue.managements.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>
</div>
</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="issueManagementsTable" border="1">
<thead>
<tr>
<th style="width: 10% !important;">No</th>
<th>Kode</th>
<th>Media</th>
<th>Monitoring Media</th>
<th>Lokus</th>
<th>Sub Lokus</th>
<th>Klasifikasi</th>
<th>Sub Klasifikasi</th>
<th>Isu</th>
<th>Tanggapan</th>
<th>Dinas</th>
<th style="width: 10% !important;"></th>
</tr>
</thead>
</table>
</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>
</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.issue.managements.filter')}}" class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<div class="form-group">
<label class="form-label">Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="location">
<option value="all" @selected(isset($location) && $location == 'all') selected disabled>Semua</option>
@foreach ($locations as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($location) && $location == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_location">
<option value="all" @selected(isset($sub_location) && $sub_location == 'all') selected disabled>Semua</option>
@foreach ($sub_locations as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($sub_location) && $sub_location == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="classification">
<option value="all" @selected(isset($classification) && $classification == 'all') selected disabled>Semua</option>
@foreach ($classifications as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($classification) && $classification == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_classification">
<option value="all" @selected(isset($sub_classification) && $sub_classification == 'all') selected disabled>Semua</option>
@foreach ($sub_classifications as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($sub_classification) && $sub_classification == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Dinas/OPD</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="government_agency">
<option value="all" @selected(isset($government_agency) && $government_agency == 'all') selected disabled>Semua</option>
@foreach ($government_agencies as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($government_agency) && $government_agency == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Isu</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="issue">
<option value="all" @selected(isset($issue) && $issue == 'all') selected disabled>Semua</option>
<option value="positive" @selected(isset($issue) && $issue == 'positive')>Positif</option>
<option value="negative" @selected(isset($issue) && $issue == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($issue) && $issue == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($issue) && $issue == 'crisis')>Krisis</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Tanggapan</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="response">
<option value="all" @selected(isset($response) && $response == 'all') selected disabled>Semua</option>
<option value="positive" @selected(isset($response) && $response == 'positive')>Positif</option>
<option value="negative" @selected(isset($response) && $response == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($response) && $response == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($response) && $response == 'crisis')>Krisis</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="Data isu 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.issue.managements.export')}}" class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<div class="form-group">
<label class="form-label">Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="location">
<option value="all" @selected(isset($location) && $location == 'all') selected disabled>Semua</option>
@foreach ($locations as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($location) && $location == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_location">
<option value="all" @selected(isset($sub_location) && $sub_location == 'all') selected disabled>Semua</option>
@foreach ($sub_locations as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($sub_location) && $sub_location == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="classification">
<option value="all" @selected(isset($classification) && $classification == 'all') selected disabled>Semua</option>
@foreach ($classifications as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($classification) && $classification == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_classification">
<option value="all" @selected(isset($sub_classification) && $sub_classification == 'all') selected disabled>Semua</option>
@foreach ($sub_classifications as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($sub_classification) && $sub_classification == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Dinas/OPD</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="government_agency">
<option value="all" @selected(isset($government_agency) && $government_agency == 'all') selected disabled>Semua</option>
@foreach ($government_agencies as $item)
<option value="{{ encrypt_id($item->id) }}" @selected(isset($government_agency) && $government_agency == encrypt_id($item->id))>{{$item->name}}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Isu</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="issue">
<option value="all" @selected(isset($issue) && $issue == 'all') selected disabled>Semua</option>
<option value="positive" @selected(isset($issue) && $issue == 'positive')>Positif</option>
<option value="negative" @selected(isset($issue) && $issue == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($issue) && $issue == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($issue) && $issue == 'crisis')>Krisis</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Tanggapan</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="response">
<option value="all" @selected(isset($response) && $response == 'all') selected disabled>Semua</option>
<option value="positive" @selected(isset($response) && $response == 'positive')>Positif</option>
<option value="negative" @selected(isset($response) && $response == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($response) && $response == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($response) && $response == 'crisis')>Krisis</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="Data isu 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>
</li>
</ul>
</div>
</div>
</div>
</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="issueManagementsTable"
border="1">
<thead>
<tr>
<th style="width: 10% !important;">No</th>
<th>Kode</th>
<th>Media</th>
<th>Monitoring Media</th>
<th>Lokus</th>
<th>Sub Lokus</th>
<th>Klasifikasi</th>
<th>Sub Klasifikasi</th>
<th>Isu</th>
<th>Tanggapan</th>
<th>Dinas</th>
<th style="width: 10% !important;"></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<!-- content @e -->
@include('partials.dashboard.footer' ,['datatable' => 'issue_management'])
<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.issue.managements.filter') }}"
class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<div class="form-group">
<label class="form-label">Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="location">
<option value="all" @selected(isset($location) && $location == 'all') selected disabled>
Semua</option>
@foreach ($locations as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($location) && $location == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_location">
<option value="all" @selected(isset($sub_location) && $sub_location == 'all') selected disabled>
Semua</option>
@foreach ($sub_locations as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($sub_location) && $sub_location == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="classification">
<option value="all" @selected(isset($classification) && $classification == 'all') selected disabled>
Semua</option>
@foreach ($classifications as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($classification) && $classification == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_classification">
<option value="all" @selected(isset($sub_classification) && $sub_classification == 'all') selected disabled>
Semua</option>
@foreach ($sub_classifications as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($sub_classification) && $sub_classification == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Dinas/OPD</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="government_agency">
<option value="all" @selected(isset($government_agency) && $government_agency == 'all') selected disabled>
Semua</option>
@foreach ($government_agencies as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($government_agency) && $government_agency == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Isu</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="issue">
<option value="all" @selected(isset($issue) && $issue == 'all') selected disabled>
Semua</option>
<option value="positive" @selected(isset($issue) && $issue == 'positive')>Positif</option>
<option value="negative" @selected(isset($issue) && $issue == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($issue) && $issue == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($issue) && $issue == 'crisis')>Krisis</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Tanggapan</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="response">
<option value="all" @selected(isset($response) && $response == 'all') selected disabled>
Semua</option>
<option value="positive" @selected(isset($response) && $response == 'positive')>Positif</option>
<option value="negative" @selected(isset($response) && $response == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($response) && $response == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($response) && $response == 'crisis')>Krisis</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="Data isu 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 class="form-group"> <label class="form-label">Rentang Tanggal</label>
<div class="form-control-wrap">
<div class="input-daterange date-picker-range input-group">
<input type="text" class="form-control" id="start-date"
name="start_date"
value="{{ old('start_date', $start_date ?? '') }}" />
<div class="input-group-addon">TO</div>
<input type="text" class="form-control" id="end-date"
name="end_date" value="{{ old('end_date', $end_date ?? '') }}" />
</div>
</div>
</div>
<div class="form-group">
<label class="form-label">Pengguna</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="user">
<option value="all" @selected(isset($user) && $user == 'all') selected disabled>
Semua</option>
@foreach ($users as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($user) && $user == encrypt_id($item->id))>{{ $item->name }}
</option>
@endforeach
</select>
</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.issue.managements.export') }}"
class="form-validate is-alter" method="post">
@csrf
<div class="modal-body">
<div class="form-group">
<label class="form-label">Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="location">
<option value="all" @selected(isset($location) && $location == 'all') selected disabled>
Semua</option>
@foreach ($locations as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($location) && $location == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Lokus</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_location">
<option value="all" @selected(isset($sub_location) && $sub_location == 'all') selected disabled>
Semua</option>
@foreach ($sub_locations as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($sub_location) && $sub_location == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="classification">
<option value="all" @selected(isset($classification) && $classification == 'all') selected disabled>
Semua</option>
@foreach ($classifications as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($classification) && $classification == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Sub Klasifikasi</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="sub_classification">
<option value="all" @selected(isset($sub_classification) && $sub_classification == 'all') selected disabled>
Semua</option>
@foreach ($sub_classifications as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($sub_classification) && $sub_classification == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Dinas/OPD</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="government_agency">
<option value="all" @selected(isset($government_agency) && $government_agency == 'all') selected disabled>
Semua</option>
@foreach ($government_agencies as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($government_agency) && $government_agency == encrypt_id($item->id))>{{ $item->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Isu</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="issue">
<option value="all" @selected(isset($issue) && $issue == 'all') selected disabled>
Semua</option>
<option value="positive" @selected(isset($issue) && $issue == 'positive')>Positif</option>
<option value="negative" @selected(isset($issue) && $issue == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($issue) && $issue == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($issue) && $issue == 'crisis')>Krisis</option>
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Tanggapan</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="response">
<option value="all" @selected(isset($response) && $response == 'all') selected disabled>
Semua</option>
<option value="positive" @selected(isset($response) && $response == 'positive')>Positif</option>
<option value="negative" @selected(isset($response) && $response == 'negative')>Negatif</option>
<option value="neutral" @selected(isset($response) && $response == 'neutral')>Netral</option>
<option value="crisis" @selected(isset($response) && $response == 'crisis')>Krisis</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="Data isu 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 class="form-group"> <label class="form-label">Rentang Tanggal</label>
<div class="form-control-wrap">
<div class="input-daterange date-picker-range input-group">
<input type="text" class="form-control" id="start-date"
name="start_date"
value="{{ old('start_date', $start_date ?? '') }}" />
<div class="input-group-addon">TO</div>
<input type="text" class="form-control" id="end-date"
name="end_date" value="{{ old('end_date', $end_date ?? '') }}" />
</div>
</div>
</div>
<div class="form-group">
<label class="form-label">Pengguna</label>
<div class="form-control-wrap">
<select class="form-select js-select2" name="user">
<option value="all" @selected(isset($user) && $user == 'all') selected disabled>
Semua</option>
@foreach ($users as $item)
<option value="{{ encrypt_id($item->id) }}"
@selected(isset($user) && $user == encrypt_id($item->id))>{{ $item->name }}
</option>
@endforeach
</select>
</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' => 'issue_management'])

View File

@ -1237,6 +1237,8 @@
d.year = '{{ $year }}';
d.month = '{{ $month }}';
d.date = '{{ $date }}';
d.start_date = '{{ $start_date }}';
d.end_date = '{{ $end_date }}';
}
},
columns: [