2025-01-06 16:00:51 +07:00
|
|
|
|
@extends('layouts.app')
|
|
|
|
|
|
|
|
|
|
|
|
@section('title')
|
|
|
|
|
|
Dashboard
|
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
|
|
@section('admin-content')
|
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
<section class="content-header">
|
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
|
<div class="row mb-2">
|
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
|
|
<h1>Lihat Expense Entertainment & Presentation</h1>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="col-sm-6">
|
|
|
|
|
|
<ol class="breadcrumb float-sm-right">
|
|
|
|
|
|
<li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ol>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
<section class="content">
|
|
|
|
|
|
<div class="container-fluid">
|
|
|
|
|
|
<div class="card card-primary card-outline">
|
|
|
|
|
|
<div class="card-body">
|
2025-03-04 15:58:55 +07:00
|
|
|
|
<div>
|
2025-01-06 16:00:51 +07:00
|
|
|
|
@include('backend.layouts.partials.messages')
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">No Expense</label>
|
|
|
|
|
|
<input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Tanggal</label>
|
|
|
|
|
|
<input type="date" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Jenis</label>
|
|
|
|
|
|
<select class="form-control form-control-md" name="jenis" disabled>
|
|
|
|
|
|
<option value="">Pilih Jenis</option>
|
|
|
|
|
|
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
2025-10-12 18:29:07 +07:00
|
|
|
|
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
2025-01-06 16:00:51 +07:00
|
|
|
|
<option value="sponsorship" {{ $form->jenis == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Nama Penerima</label>
|
|
|
|
|
|
<input type="text" class="form-control" name="name" readonly value="{{ $form->name }}">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">NPWP / NIK</label>
|
|
|
|
|
|
<input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" readonly value="{{ $form->nik_or_npwp }}">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Alamat</label>
|
|
|
|
|
|
<input type="text" class="form-control" name="alamat" id="alamat" readonly value="{{ $form->alamat }}">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Total</label>
|
|
|
|
|
|
<input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Keterangan</label>
|
|
|
|
|
|
<textarea class="form-control" name="keterangan" readonly>{{ $form->keterangan }}</textarea>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-10-13 17:28:34 +07:00
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
|
<hr class="my-4">
|
|
|
|
|
|
<h5 class="mb-3">Lampiran</h5>
|
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
|
<table class="table table-bordered table-striped mb-0" id="entertainment-existing-attachments-table">
|
|
|
|
|
|
<thead class="bg-light">
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<th style="width: 30%;">Kategori</th>
|
|
|
|
|
|
<th>Nama File</th>
|
|
|
|
|
|
<th style="width: 120px;" class="text-center">Preview</th>
|
|
|
|
|
|
<th style="width: 120px;" class="text-center">Download</th>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
@forelse ($attachments ?? [] as $attachment)
|
|
|
|
|
|
<tr class="entertainment-attachment-row">
|
|
|
|
|
|
<td>{{ $attachment['category_label'] ?? '-' }}</td>
|
|
|
|
|
|
<td>{{ $attachment['filename'] }}</td>
|
|
|
|
|
|
<td class="text-center">
|
|
|
|
|
|
<button type="button"
|
|
|
|
|
|
class="btn btn-sm btn-outline-secondary entertainment-preview-trigger"
|
|
|
|
|
|
data-preview-type="{{ $attachment['preview_type'] }}"
|
|
|
|
|
|
data-preview-source="{{ $attachment['preview_url'] ?? '' }}"
|
|
|
|
|
|
data-download-url="{{ $attachment['download_url'] ?? '' }}"
|
|
|
|
|
|
data-filename="{{ $attachment['filename'] }}">
|
|
|
|
|
|
Preview
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</td>
|
|
|
|
|
|
<td class="text-center">
|
|
|
|
|
|
@if (!empty($attachment['download_url']))
|
|
|
|
|
|
<a href="{{ $attachment['download_url'] }}" class="btn btn-sm btn-outline-success" target="_blank" rel="noopener">Download</a>
|
|
|
|
|
|
@else
|
|
|
|
|
|
<span class="text-muted">Tidak tersedia</span>
|
|
|
|
|
|
@endif
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
@empty
|
|
|
|
|
|
<tr class="entertainment-empty-row">
|
|
|
|
|
|
<td colspan="4" class="text-center text-muted">Belum ada attachment.</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
@endforelse
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-03-04 14:48:50 +07:00
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
|
<div class="mb-3">
|
|
|
|
|
|
<label class="form-label">Status</label>
|
|
|
|
|
|
<input type="text" class="form-control" name="status" value="{{ $form->status }}" readonly>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-01-06 16:00:51 +07:00
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
|
<a href="{{ route('forms.entertainment') }}" class="btn btn-secondary">Kembali</a>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
@if (auth()->user()->can('approval.approve') && $form->status == 'On Progress')
|
|
|
|
|
|
<button type="button" class="btn btn-success final-approve-modal" data-id="{{ route('forms.entertainment.approve', $form->id) }}">Approve 1</button>
|
2025-03-04 15:20:23 +07:00
|
|
|
|
|
2025-10-12 20:47:43 +07:00
|
|
|
|
<button type="button"
|
|
|
|
|
|
class="btn btn-danger open-reject-modal"
|
|
|
|
|
|
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
|
|
|
|
|
Reject
|
|
|
|
|
|
</button>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
@elseif(auth()->user()->can('approval2.approve') && $form->status == 'Approved 1')
|
|
|
|
|
|
<button type="button" class="btn btn-success open-approve-modal" data-id="{{ route('forms.entertainment.approve2', $form->id) }}">Approve 2</button>
|
2025-03-04 15:20:23 +07:00
|
|
|
|
|
2025-10-12 20:47:43 +07:00
|
|
|
|
<button type="button"
|
|
|
|
|
|
class="btn btn-danger open-reject-modal"
|
|
|
|
|
|
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
|
|
|
|
|
Reject
|
|
|
|
|
|
</button>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
@elseif(auth()->user()->can('final_approval.approve') && $form->status == 'Approved 2')
|
|
|
|
|
|
<button type="button" class="btn btn-primary open-approve-modal" data-id="{{ route('forms.entertainment.final-approve', $form->id) }}">Final Approve</button>
|
|
|
|
|
|
@endif
|
2025-01-06 16:00:51 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-03-04 15:58:55 +07:00
|
|
|
|
</div>
|
2025-01-06 16:00:51 +07:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
<section>
|
|
|
|
|
|
<div class="modal fade" id="approveModal" tabindex="-1" role="dialog" aria-labelledby="approveModalLabel" aria-hidden="true">
|
|
|
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
|
<form id="approveForm" method="POST" action="">
|
|
|
|
|
|
@csrf
|
|
|
|
|
|
@method('PUT')
|
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
|
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
|
<!-- Loading spinner -->
|
|
|
|
|
|
<div id="loadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
|
|
|
|
|
<div class="spinner-border text-primary" role="status">
|
|
|
|
|
|
<span class="sr-only">Loading...</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2025-01-06 16:00:51 +07:00
|
|
|
|
|
2025-03-04 14:35:50 +07:00
|
|
|
|
<!-- Modal content (hidden initially) -->
|
|
|
|
|
|
<div id="modalContent" class="d-none">
|
|
|
|
|
|
<p>Please review the details below:</p>
|
|
|
|
|
|
<ul class="list-group">
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Expense Number:</strong> <span id="expense_number"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>User:</strong> <span id="user"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>NIK/NPWP Penerima:</strong> <span id="nik_or_npwp"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Tanggal:</strong> <span id="tanggal"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Nama Penerima:</strong> <span id="name"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Jenis:</strong> <span id="jenis"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Keterangan:</strong> <span id="keterangan"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Bukti Total:</strong> <span id="bukti_total"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Nominal Total:</strong> <span id="total_value"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">Approve</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
|
|
|
|
|
<section>
|
|
|
|
|
|
<div class="modal fade" id="finalApproveModal" tabindex="-1" role="dialog" aria-labelledby="finalApproveModalLabel" aria-hidden="true">
|
|
|
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
|
<form id="finalApproveForm" method="POST" action="">
|
|
|
|
|
|
@csrf
|
|
|
|
|
|
@method('PUT')
|
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
|
<h5 class="modal-title" id="approveModalLabel">Approve Item</h5>
|
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
|
<!-- Loading spinner -->
|
|
|
|
|
|
<div id="finalLoadingSpinner" class="d-flex justify-content-center align-items-center" style="height: 200px;">
|
|
|
|
|
|
<div class="spinner-border text-primary" role="status">
|
|
|
|
|
|
<span class="sr-only">Loading...</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Modal content (hidden initially) -->
|
|
|
|
|
|
<div id="finalModalContent" class="d-none">
|
|
|
|
|
|
<p>Please review the details below:</p>
|
|
|
|
|
|
<ul class="list-group">
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Expense Number:</strong> <span id="final_expense_number"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>User:</strong> <span id="final_user"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>NIK/NPWP Penerima:</strong> <span id="final_nik_or_npwp"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Tanggal:</strong> <span id="final_tanggal"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Nama Penerima:</strong> <span id="final_name"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Jenis:</strong> <span id="final_jenis"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Keterangan:</strong> <span id="final_keterangan"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
<li class="list-group-item">
|
|
|
|
|
|
<strong>Bukti Total:</strong> <span id="final_bukti_total"></span>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
<p class="mt-2">Please select the items you want to approve:</p>
|
|
|
|
|
|
<ul class="list-group list-unstyled">
|
|
|
|
|
|
<li>
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<div class="custom-control custom-checkbox">
|
|
|
|
|
|
<input type="checkbox" class="custom-control-input" id="final_total" name="total" required>
|
|
|
|
|
|
<label class="custom-control-label" for="final_total">Total (<span id="final_total_value"></span>)</label>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
|
|
|
|
<button type="submit" class="btn btn-primary">Approve</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2025-10-12 20:47:43 +07:00
|
|
|
|
<section>
|
|
|
|
|
|
<div class="modal fade" id="rejectModal" tabindex="-1" role="dialog" aria-labelledby="rejectModalLabel" aria-hidden="true">
|
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
|
<form id="rejectForm" method="POST" action="">
|
|
|
|
|
|
@csrf
|
|
|
|
|
|
@method('PUT')
|
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
|
<h5 class="modal-title" id="rejectModalLabel">Reject Expense</h5>
|
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
|
<label for="rejectRemarks">Remarks <span class="text-danger">*</span></label>
|
|
|
|
|
|
<textarea class="form-control" name="remarks" id="rejectRemarks" rows="3" required></textarea>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<p class="mb-0 text-muted small">Pengajuan akan ditolak setelah Anda mengirimkan catatan ini.</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
|
|
|
|
|
<button type="submit" class="btn btn-danger">Reject</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
|
|
@section('scripts')
|
2025-01-06 16:00:51 +07:00
|
|
|
|
<script>
|
|
|
|
|
|
new AutoNumeric('#total', {
|
|
|
|
|
|
digitGroupSeparator: '.', // Pemisah ribuan
|
|
|
|
|
|
decimalCharacter: ',', // Karakter desimal (tidak digunakan karena tanpa desimal)
|
|
|
|
|
|
currencySymbol: 'Rp.', // Simbol mata uang
|
|
|
|
|
|
decimalPlaces: 0, // Tidak ada angka desimal
|
|
|
|
|
|
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
2025-03-04 14:35:50 +07:00
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-10-12 20:47:43 +07:00
|
|
|
|
$(document).on('click', '.open-reject-modal', function () {
|
|
|
|
|
|
const rejectUrl = $(this).data('action');
|
|
|
|
|
|
$('#rejectForm').attr('action', rejectUrl);
|
|
|
|
|
|
$('#rejectRemarks').val('');
|
|
|
|
|
|
$('#rejectModal').modal('show');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#rejectModal').on('shown.bs.modal', function () {
|
|
|
|
|
|
$('#rejectRemarks').trigger('focus');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#rejectModal').on('hidden.bs.modal', function () {
|
|
|
|
|
|
$('#rejectForm').attr('action', '');
|
|
|
|
|
|
$('#rejectRemarks').val('');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$(document).on('click', '.open-approve-modal', function() {
|
2025-03-04 14:35:50 +07:00
|
|
|
|
const approveUrl = $(this).data('id');
|
|
|
|
|
|
|
|
|
|
|
|
// Show spinner and hide content initially
|
|
|
|
|
|
$('#loadingSpinner').show();
|
|
|
|
|
|
$('#modalContent').addClass('d-none');
|
|
|
|
|
|
|
|
|
|
|
|
$('#approveForm').attr('action', approveUrl); // Set the form action
|
|
|
|
|
|
$('#loadingSpinner').addClass('d-flex');
|
|
|
|
|
|
$('#approveModal').modal('show'); // Show the modal
|
|
|
|
|
|
|
|
|
|
|
|
// Get detail from /forms/entertainment/detail/{id}
|
|
|
|
|
|
$.get(approveUrl.replace(/approve2|final-approve/g, 'detail'), function (data) {
|
|
|
|
|
|
const formatter = new Intl.NumberFormat('id-ID', {
|
|
|
|
|
|
style: 'currency',
|
|
|
|
|
|
currency: 'IDR',
|
|
|
|
|
|
minimumFractionDigits: 0
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#total_value').text(formatter.format(data.total));
|
|
|
|
|
|
|
|
|
|
|
|
// Detail data
|
|
|
|
|
|
$('#user').text(data.user.name);
|
|
|
|
|
|
$('#expense_number').text(data.expense_number);
|
|
|
|
|
|
$('#tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
|
|
|
|
|
year: 'numeric',
|
|
|
|
|
|
month: 'long',
|
|
|
|
|
|
day: 'numeric'
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
$('#nik_or_npwp').text(data.nik_or_npwp);
|
|
|
|
|
|
$('#name').text(data.name);
|
|
|
|
|
|
$('#jenis').text(data.jenis);
|
|
|
|
|
|
$('#keterangan').text(data.keterangan);
|
|
|
|
|
|
|
|
|
|
|
|
$('#bukti_total').html(data.total ? '<a href="' + data.total + '" target="_blank">Download</a>' : '-');
|
|
|
|
|
|
|
|
|
|
|
|
// Hide spinner and show content
|
|
|
|
|
|
$('#loadingSpinner').hide();
|
|
|
|
|
|
$('#loadingSpinner').removeClass('d-flex');
|
|
|
|
|
|
$('#loadingSpinner').addClass('d-none');
|
|
|
|
|
|
$('#modalContent').removeClass('d-none');
|
|
|
|
|
|
|
|
|
|
|
|
// Reset the total to zero
|
|
|
|
|
|
$('#total').val(0);
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Handle Approve Button Click
|
|
|
|
|
|
$(document).on('click', '.final-approve-modal', function() {
|
|
|
|
|
|
const approveUrl = $(this).data('id');
|
|
|
|
|
|
|
|
|
|
|
|
// Show spinner and hide content initially
|
|
|
|
|
|
$('#finalLoadingSpinner').show();
|
|
|
|
|
|
$('#finalModalContent').addClass('d-none');
|
|
|
|
|
|
|
|
|
|
|
|
$('#finalApproveForm').attr('action', approveUrl); // Set the form action
|
|
|
|
|
|
$('#finalLoadingSpinner').addClass('d-flex');
|
|
|
|
|
|
$('#finalApproveModal').modal('show'); // Show the modal
|
|
|
|
|
|
|
|
|
|
|
|
// Get detail from /forms/entertainment/detail/{id}
|
|
|
|
|
|
$.get(approveUrl.replace('approve', 'detail'), function (data) {
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
const formatter = new Intl.NumberFormat('id-ID', {
|
|
|
|
|
|
style: 'currency',
|
|
|
|
|
|
currency: 'IDR',
|
|
|
|
|
|
minimumFractionDigits: 0
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#final_total_value').text(formatter.format(data.total));
|
|
|
|
|
|
|
|
|
|
|
|
// Assign data values to checkboxes
|
|
|
|
|
|
$('#final_total').data('value', data.total);
|
|
|
|
|
|
|
|
|
|
|
|
// Detail data
|
|
|
|
|
|
$('#final_user').text(data.user.name);
|
|
|
|
|
|
$('#final_expense_number').text(data.expense_number);
|
|
|
|
|
|
$('#final_tanggal').text(new Date(data.created_at).toLocaleDateString('id-ID', {
|
|
|
|
|
|
year: 'numeric',
|
|
|
|
|
|
month: 'long',
|
|
|
|
|
|
day: 'numeric'
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
$('#final_nik_or_npwp').text(data.nik_or_npwp);
|
|
|
|
|
|
$('#final_name').text(data.name);
|
|
|
|
|
|
$('#final_jenis').text(data.jenis);
|
|
|
|
|
|
$('#final_keterangan').text(data.keterangan);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#final_bukti_total').html(data.bukti_total ? '<a href="' + data.bukti_total + '" target="_blank">Download</a>' : '-');
|
|
|
|
|
|
|
|
|
|
|
|
// Hide spinner and show content
|
|
|
|
|
|
$('#finalLoadingSpinner').hide();
|
|
|
|
|
|
$('#finalLoadingSpinner').removeClass('d-flex');
|
|
|
|
|
|
$('#finalLoadingSpinner').addClass('d-none');
|
|
|
|
|
|
$('#finalModalContent').removeClass('d-none');
|
|
|
|
|
|
|
|
|
|
|
|
// Reset the total to zero
|
|
|
|
|
|
$('#total').val(0);
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Update total dynamically
|
|
|
|
|
|
$('.custom-control-input').on('change', function () {
|
|
|
|
|
|
let total = 0;
|
|
|
|
|
|
$('.custom-control-input:checked').each(function () {
|
|
|
|
|
|
total += parseFloat($(this).data('value') || 0);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const formatter = new Intl.NumberFormat('id-ID', {
|
|
|
|
|
|
style: 'currency',
|
|
|
|
|
|
currency: 'IDR',
|
|
|
|
|
|
minimumFractionDigits: 0,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#total').val(formatter.format(total));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Uncheck all checkboxes when the modal is closed
|
|
|
|
|
|
$('#finalApproveModal').on('hidden.bs.modal', function () {
|
|
|
|
|
|
$('.custom-control-input').prop('checked', false); // Uncheck all checkboxes
|
|
|
|
|
|
$('#total').val('0'); // Reset total to 0
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
2025-10-13 17:28:34 +07:00
|
|
|
|
|
|
|
|
|
|
@include('backend.pages.forms.entertainment.partials.attachment-modal')
|
|
|
|
|
|
@include('backend.pages.forms.entertainment.partials.attachment-scripts')
|
2025-01-06 16:00:51 +07:00
|
|
|
|
@endsection
|