2025-01-11 13:31:44 +07:00
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
|
|
@section('title')
|
|
|
|
|
{{ $pageInfo['title'] }}
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section('admin-content')
|
2026-06-01 15:01:03 +07:00
|
|
|
<section class="content-header">
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<div class="row mb-3">
|
2025-01-11 13:31:44 +07:00
|
|
|
<div class="col-sm-6">
|
2026-06-01 15:01:03 +07:00
|
|
|
<h1 class="fw-bold">{{ $pageInfo['title'] }}</h1>
|
2025-01-11 13:31:44 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
2026-06-01 15:01:03 +07:00
|
|
|
<li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">{{ __('Dashboard') }}</a></li>
|
|
|
|
|
<li class="breadcrumb-item active">{{ $pageInfo['title'] }}</li>
|
2025-01-11 13:31:44 +07:00
|
|
|
</ol>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
{{-- Summary Widgets --}}
|
|
|
|
|
<div class="row mt-4">
|
|
|
|
|
<div class="col-lg-3 col-6">
|
|
|
|
|
<div class="small-box bg-info shadow-sm" style="border-radius: 15px;">
|
|
|
|
|
<div class="inner">
|
|
|
|
|
<h3>Rp {{ number_format($forms->sum('total'), 0, ',', '.') }}</h3>
|
|
|
|
|
<div class="fw-bold">Total Submission</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="icon"><i class="fas fa-wallet"></i></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-3 col-6">
|
|
|
|
|
<div class="small-box bg-success shadow-sm" style="border-radius: 15px;">
|
|
|
|
|
<div class="inner">
|
|
|
|
|
<h3>Rp {{ number_format($forms->whereIn('status', ['Approved', 'Approved 1', 'Approved 2', 'Closed', 'Final Approved'])->sum('approved_total'), 0, ',', '.') }}</h3>
|
|
|
|
|
<div class="fw-bold">Total Approved</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="icon"><i class="fas fa-check-circle"></i></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-3 col-6">
|
|
|
|
|
<div class="small-box bg-warning shadow-sm" style="border-radius: 15px;">
|
|
|
|
|
<div class="inner">
|
|
|
|
|
<h3 class="text-white">Rp {{ number_format($forms->where('status', 'On Progress')->sum('total'), 0, ',', '.') }}</h3>
|
|
|
|
|
<div class="text-white fw-bold">Total Pending</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="icon"><i class="fas fa-hourglass-half"></i></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-3 col-6">
|
|
|
|
|
<div class="small-box bg-purple shadow-sm" style="border-radius: 15px; background-color: #6f42c1 !important;">
|
|
|
|
|
<div class="inner">
|
|
|
|
|
<h3 class="text-white">{{ !$availableBudget || $availableBudget == 0 ? '-' : 'Rp ' . number_format((float)$availableBudget, 0, ',', '.') }}</h3>
|
|
|
|
|
<div class="text-white fw-bold">Budget Available</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="icon"><i class="fas fa-money-bill"></i></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-11 13:31:44 +07:00
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
{{-- Filter Section - Sistem Periode Bulan Akuntansi --}}
|
|
|
|
|
<div class="row mt-4">
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
<div class="card shadow-sm border-0" style="border-radius: 15px;">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<form action="{{ route('reports.all') }}" method="GET">
|
|
|
|
|
<div class="row align-items-end">
|
|
|
|
|
<div class="col-md-3">
|
|
|
|
|
<div class="form-group mb-3">
|
|
|
|
|
<label class="small fw-bold text-muted">Pilih Region</label>
|
|
|
|
|
<select name="region" id="region" class="form-control select2">
|
|
|
|
|
<option value="">Semua Region</option>
|
|
|
|
|
@foreach ($regions as $region)
|
|
|
|
|
<option value="{{ $region->code }}" {{ request()->region == $region->code ? 'selected' : '' }}>
|
|
|
|
|
{{ $region->name }}
|
|
|
|
|
</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-3">
|
|
|
|
|
<div class="form-group mb-3">
|
|
|
|
|
<label class="small fw-bold text-muted">Pilih Cabang</label>
|
|
|
|
|
<select name="cabang" id="cabang" class="form-control select2">
|
|
|
|
|
<option value="">Semua Cabang</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-2">
|
|
|
|
|
<div class="form-group mb-3">
|
|
|
|
|
<label class="small fw-bold text-muted">Periode Bulan</label>
|
|
|
|
|
<select name="month" id="month" class="form-control">
|
|
|
|
|
<option value="">Pilih Bulan</option>
|
|
|
|
|
@foreach(['january','february','march','april','may','june','july','august','september','october','november','december'] as $m)
|
|
|
|
|
<option value="{{ $m }}" {{ (request()->month ?? strtolower(date('F'))) == $m ? 'selected' : '' }}>{{ ucfirst($m) }}</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-2">
|
|
|
|
|
<div class="form-group mb-3">
|
|
|
|
|
<label class="small fw-bold text-muted">Tahun</label>
|
|
|
|
|
<select name="year" id="year" class="form-control">
|
|
|
|
|
<option value="">Pilih Tahun</option>
|
|
|
|
|
@for ($i = 2024; $i <= date('Y'); $i++)
|
|
|
|
|
<option value="{{ $i }}" {{ (request()->year ?? date('Y')) == $i ? 'selected' : '' }}>{{ $i }}</option>
|
|
|
|
|
@endfor
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-2">
|
|
|
|
|
<div class="form-group mb-3">
|
|
|
|
|
<label class="small fw-bold text-muted">Status</label>
|
|
|
|
|
<select name="status" id="status" class="form-control">
|
|
|
|
|
<option value="">Semua Status</option>
|
|
|
|
|
@foreach(['On Progress', 'Approved 1', 'Approved 2', 'Closed', 'Rejected'] as $st)
|
|
|
|
|
<option value="{{ $st }}" {{ request()->status == $st ? 'selected' : '' }}>{{ $st }}</option>
|
|
|
|
|
@endforeach
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-12 text-right mt-2">
|
|
|
|
|
<button type="submit" class="btn btn-primary px-4 shadow-sm"><i class="fas fa-filter mr-1"></i> Filter</button>
|
|
|
|
|
<a href="{{ route('reports.all') }}" class="btn btn-outline-secondary px-4 shadow-sm">Reset</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-11 13:31:44 +07:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
@php use App\Helpers\NextCloudHelper; @endphp
|
2025-01-11 13:31:44 +07:00
|
|
|
|
|
|
|
|
<section class="content">
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12">
|
2026-06-01 15:01:03 +07:00
|
|
|
<div class="card shadow-sm border-0" style="border-radius: 15px;">
|
2025-01-11 13:31:44 +07:00
|
|
|
<div class="card-body">
|
2026-06-01 15:01:03 +07:00
|
|
|
<h4 class="header-title mb-4">Database Konsolidasi (All Forms)</h4>
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
@include('backend.layouts.partials.messages')
|
|
|
|
|
<table id="dataTable-table" class="table table-hover w-100">
|
|
|
|
|
<thead class="bg-light text-capitalize">
|
|
|
|
|
<tr>
|
|
|
|
|
<th>#</th>
|
|
|
|
|
<th>No Expense</th>
|
|
|
|
|
<th>Kategori</th>
|
|
|
|
|
<th>Nama Pengaju</th>
|
|
|
|
|
<th>Region / Cabang</th>
|
|
|
|
|
<th>Tgl. Dibuat</th>
|
|
|
|
|
<th>Nominal (Appr)</th>
|
|
|
|
|
<th class="text-center">Bukti</th>
|
|
|
|
|
<th>Status</th>
|
|
|
|
|
<th>Detail Rejeksi</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
@foreach ($forms as $item)
|
|
|
|
|
<tr>
|
|
|
|
|
<td>{{ $loop->iteration }}</td>
|
|
|
|
|
<td class="fw-bold text-primary">{{ $item->expense_number }}</td>
|
|
|
|
|
<td>
|
|
|
|
|
<span class="badge badge-light border text-capitalize px-2 py-1">
|
|
|
|
|
{{ str_replace(['form_', '_'], ['', ' '], (string)$item->type) }}
|
|
|
|
|
</span>
|
|
|
|
|
</td>
|
|
|
|
|
<td>{{ $item->user->name ?? '-' }}</td>
|
|
|
|
|
<td>
|
|
|
|
|
<span class="d-block small fw-bold text-dark">{{ $item->user->region->cabang->region->name ?? '-' }}</span>
|
|
|
|
|
<span class="text-muted small">{{ $item->user->cabang->cabang->name ?? '-' }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
@php $createdAt = \Carbon\Carbon::parse($item->created_at); @endphp
|
|
|
|
|
<div class="fw-bold small">{{ $createdAt->locale('id')->translatedFormat('d F Y') }}</div>
|
|
|
|
|
<small class="text-muted">{{ $createdAt->format('H:i') }} WIB</small>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="text-success fw-bold">
|
|
|
|
|
{{ $item->approved_total ? 'Rp ' . number_format($item->approved_total, 0, ',', '.') : '-' }}
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td class="text-center">
|
|
|
|
|
@php
|
|
|
|
|
$fileData = [];
|
|
|
|
|
$imgExts = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'];
|
|
|
|
|
if (!empty($item->main_proof)) {
|
|
|
|
|
$ext = strtolower(pathinfo($item->main_proof, PATHINFO_EXTENSION));
|
|
|
|
|
$fileData[] = [
|
|
|
|
|
'url' => NextCloudHelper::getFileUrl($item->main_proof),
|
|
|
|
|
'is_img' => in_array($ext, $imgExts)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
if(isset($item->extra_attachments)) {
|
|
|
|
|
foreach ($item->extra_attachments as $att) {
|
|
|
|
|
$ext = strtolower(pathinfo($att->file_path, PATHINFO_EXTENSION));
|
|
|
|
|
$fileData[] = [
|
|
|
|
|
'url' => NextCloudHelper::getFileUrl($att->file_path),
|
|
|
|
|
'is_img' => in_array($ext, $imgExts)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$uniqueFiles = collect($fileData)->unique('url')->values()->all();
|
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
|
|
@if (count($uniqueFiles) > 0)
|
|
|
|
|
<button type="button" class="btn btn-sm btn-info rounded-pill px-3 shadow-sm btn-preview-bukti"
|
|
|
|
|
data-expense="{{ $item->expense_number }}"
|
|
|
|
|
data-files='@json($uniqueFiles)'>
|
|
|
|
|
<i class="fas fa-eye"></i> {{ count($uniqueFiles) }}
|
|
|
|
|
</button>
|
|
|
|
|
@else
|
|
|
|
|
<span class="text-muted small">-</span>
|
|
|
|
|
@endif
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td>
|
|
|
|
|
@php
|
|
|
|
|
$badgeClass = match($item->status) {
|
|
|
|
|
'On Progress' => 'badge-warning text-white',
|
|
|
|
|
'Approved 1', 'Approved 2', 'Closed', 'Final Approved' => 'badge-success text-white',
|
|
|
|
|
'Rejected' => 'badge-danger text-white',
|
|
|
|
|
default => 'badge-secondary'
|
|
|
|
|
};
|
|
|
|
|
@endphp
|
|
|
|
|
<span class="badge {{ $badgeClass }} px-3 py-2">{{ $item->status }}</span>
|
|
|
|
|
|
|
|
|
|
{{-- Tgl Final Approved --}}
|
|
|
|
|
@if(isset($item->report_date) && in_array($item->status, ['Approved 2', 'Closed', 'Final Approved']))
|
|
|
|
|
<div class="mt-2" style="line-height: 1.2;">
|
|
|
|
|
<small class="text-success fw-bold d-block" style="font-size: 10px;">
|
|
|
|
|
<i class="fas fa-check-double mr-1"></i> Final Approved:
|
|
|
|
|
</small>
|
|
|
|
|
<small class="text-muted d-block" style="font-size: 10px;">
|
|
|
|
|
{{ \Carbon\Carbon::parse($item->report_date)->translatedFormat('d M Y') }}
|
|
|
|
|
</small>
|
|
|
|
|
</div>
|
|
|
|
|
@endif
|
|
|
|
|
|
|
|
|
|
{{-- Penanda Tgl Waktu Rejeksi --}}
|
|
|
|
|
@if($item->status == 'Rejected' && isset($item->rejected_at))
|
|
|
|
|
<div class="mt-2" style="line-height: 1.2;">
|
|
|
|
|
<small class="text-danger fw-bold d-block" style="font-size: 10px;">
|
|
|
|
|
<i class="fas fa-times-circle mr-1"></i> Rejected At:
|
|
|
|
|
</small>
|
|
|
|
|
<small class="text-muted d-block" style="font-size: 10px;">
|
|
|
|
|
{{ \Carbon\Carbon::parse($item->rejected_at)->translatedFormat('d M Y H:i') }} WIB
|
|
|
|
|
</small>
|
|
|
|
|
</div>
|
|
|
|
|
@endif
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
{{-- Kolom Detail Rejeksi Sinkron --}}
|
|
|
|
|
<td>
|
|
|
|
|
@if($item->status == 'Rejected')
|
|
|
|
|
<div class="mt-1 p-2 bg-light border border-danger rounded" style="line-height: 1.3; min-width: 160px; border-style: dashed !important;">
|
|
|
|
|
<div class="mb-1">
|
|
|
|
|
<small class="fw-bold text-dark" style="font-size: 10px;">Oleh:</small>
|
|
|
|
|
<small class="text-primary font-weight-bold" style="font-size: 10px;">{{ $item->rejector->name ?? $item->rejected_by ?? 'System' }}</small>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<small class="fw-bold text-dark" style="font-size: 10px;">Alasan:</small>
|
|
|
|
|
<small class="text-danger font-italic d-block mt-1" style="font-size: 10px; line-height: 1.1;">"{{ $item->remarks ?? '-' }}"</small>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@else
|
|
|
|
|
<span class="text-muted small">-</span>
|
|
|
|
|
@endif
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
2025-01-11 13:31:44 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-06-01 15:01:03 +07:00
|
|
|
</div>
|
2025-01-11 13:31:44 +07:00
|
|
|
</section>
|
2026-06-01 15:01:03 +07:00
|
|
|
|
|
|
|
|
{{-- MODAL PREVIEW --}}
|
|
|
|
|
<div class="modal fade" id="modalPreviewBukti" tabindex="-1" role="dialog" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered modal-lg">
|
|
|
|
|
<div class="modal-content" style="border-radius: 15px; border: none; overflow: hidden;">
|
|
|
|
|
<div class="modal-header bg-primary text-white border-0">
|
|
|
|
|
<h5 class="modal-title fw-bold"><i class="fas fa-images mr-2"></i>Lampiran Bukti <span id="textExpenseNum"></span></h5>
|
|
|
|
|
<button type="button" class="close text-white" data-dismiss="modal">×</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body bg-light" id="containerPreview" style="max-height: 70vh; overflow-y: auto; padding: 25px;"></div>
|
|
|
|
|
<div class="modal-footer bg-light border-0">
|
|
|
|
|
<button type="button" class="btn btn-secondary rounded-pill px-4" data-dismiss="modal">Tutup</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{{-- MODAL ZOOM --}}
|
|
|
|
|
<div class="modal fade" id="modalImageFull" tabindex="-2" role="dialog" aria-hidden="true" style="background: rgba(0,0,0,0.85); z-index: 1060;">
|
|
|
|
|
<div class="modal-dialog modal-dialog-centered modal-xl">
|
|
|
|
|
<div class="modal-content" style="background: transparent; border: none;">
|
|
|
|
|
<div class="modal-header border-0 p-0">
|
|
|
|
|
<button type="button" class="close text-white" data-dismiss="modal" style="font-size: 2.5rem; position: absolute; right: 15px; top: 10px; z-index: 999;">×</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body p-0 text-center">
|
|
|
|
|
<img src="" id="imgFullDisplay" style="max-width: 100%; max-height: 90vh; border-radius: 8px;">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-01-11 13:31:44 +07:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section('scripts')
|
|
|
|
|
<script>
|
2026-06-01 15:01:03 +07:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
if ($('#dataTable-table').length) {
|
|
|
|
|
$('#dataTable-table').DataTable({
|
|
|
|
|
responsive: false,
|
|
|
|
|
dom: 'Blfrtip',
|
|
|
|
|
deferRender: true, // Optimasi performa loading render DOM fisik tabel
|
|
|
|
|
lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
|
|
|
|
|
buttons: [
|
|
|
|
|
{
|
|
|
|
|
extend: 'excelHtml5',
|
|
|
|
|
text: '<i class="fas fa-file-excel mr-1"></i> Excel',
|
|
|
|
|
className: 'btn-success',
|
|
|
|
|
exportOptions: {
|
|
|
|
|
columns: [0, 1, 2, 3, 4, 5, 6, 8, 9],
|
|
|
|
|
format: {
|
|
|
|
|
body: function (data, row, column, node) {
|
|
|
|
|
let text = node.textContent || node.innerText || "";
|
|
|
|
|
text = text.replace(/\s+/g, ' ').trim();
|
|
|
|
|
|
|
|
|
|
if (column === 6) {
|
|
|
|
|
return text.replace(/Rp\s?|[.]/g, '');
|
|
|
|
|
}
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
extend: 'pdfHtml5',
|
|
|
|
|
text: '<i class="fas fa-file-pdf mr-1"></i> PDF',
|
|
|
|
|
className: 'btn-danger',
|
|
|
|
|
orientation: 'landscape',
|
|
|
|
|
pageSize: 'A4',
|
|
|
|
|
exportOptions: { columns: [0, 1, 2, 3, 4, 5, 6, 8, 9] },
|
|
|
|
|
customize: function(doc) {
|
|
|
|
|
doc.defaultStyle.fontSize = 7;
|
|
|
|
|
doc.styles.tableHeader.fontSize = 8;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'colvis'
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
}
|
2025-01-15 14:50:53 +07:00
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
$(document).on('click', '.btn-preview-bukti', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
const expenseNum = $(this).data('expense');
|
|
|
|
|
const files = $(this).data('files');
|
|
|
|
|
let html = '<div class="row">';
|
2025-01-15 14:50:53 +07:00
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
$('#textExpenseNum').text('#' + expenseNum);
|
|
|
|
|
$('#containerPreview').html('<div class="text-center py-5"><i class="fas fa-spinner fa-spin fa-3x text-primary"></i></div>');
|
2025-01-15 14:50:53 +07:00
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
if(files && files.length > 0) {
|
|
|
|
|
files.forEach((file) => {
|
|
|
|
|
html += `
|
|
|
|
|
<div class="col-md-6 mb-4">
|
|
|
|
|
<div class="card h-100 border-0 shadow-sm rounded-lg overflow-hidden">
|
|
|
|
|
<div class="card-body p-2 text-center bg-white">
|
|
|
|
|
<div class="mb-3" style="height: 220px; display: flex; align-items: center; justify-content: center; background: #f8f9fa; border-radius: 8px; overflow: hidden; border: 1px solid #eee;">
|
|
|
|
|
${file.is_img
|
|
|
|
|
? `<img src="${file.url}" class="img-fluid" style="max-height: 100%; object-fit: contain; cursor: zoom-in;" onclick="openFullImage('${file.url}')">`
|
|
|
|
|
: `<div class="text-center"><i class="fas fa-file-pdf fa-4x text-danger"></i><p class="small text-muted mt-2 fw-bold">Dokumen Digital</p></div>`
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btn-group w-100">
|
|
|
|
|
${file.is_img
|
|
|
|
|
? `<button type="button" onclick="openFullImage('${file.url}')" class="btn btn-outline-primary btn-sm px-3"><i class="fas fa-eye"></i> Preview</button>`
|
|
|
|
|
: `<a href="${file.url}" target="_blank" class="btn btn-outline-primary btn-sm px-3"><i class="fas fa-external-link-alt"></i> Open PDF</a>`
|
|
|
|
|
}
|
|
|
|
|
<a href="${file.url}" download class="btn btn-primary btn-sm px-3"><i class="fas fa-download"></i> Download</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
$('#containerPreview').html(html + '</div>');
|
|
|
|
|
$('#modalPreviewBukti').modal('show');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function loadCabang(regionCode, selectedCabang = null) {
|
|
|
|
|
const cabangSelect = $('#cabang');
|
|
|
|
|
if (regionCode) {
|
|
|
|
|
fetch(`/api/cabang-by-region/${regionCode}`)
|
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
cabangSelect.html('<option value="">Semua Cabang</option>');
|
|
|
|
|
data.forEach(cabang => {
|
|
|
|
|
const isSelected = (selectedCabang && cabang.code === selectedCabang) ? 'selected' : '';
|
|
|
|
|
cabangSelect.append(`<option value="${cabang.code}" ${isSelected}>${cabang.name}</option>`);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#region').on('change', function() { loadCabang(this.value); });
|
|
|
|
|
const currentRegion = '{{ request()->region }}';
|
|
|
|
|
const currentCabang = '{{ request()->cabang }}';
|
|
|
|
|
if (currentRegion) { loadCabang(currentRegion, currentCabang); }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function openFullImage(url) {
|
|
|
|
|
$('#imgFullDisplay').attr('src', url);
|
|
|
|
|
$('#modalImageFull').modal('show');
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
@endsection
|