This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
@@ -16,7 +17,6 @@
|
||||
<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>
|
||||
@@ -45,7 +45,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form id="expense-form" method="POST" action="{{ route('forms.entertainment.store') }}" enctype="multipart/form-data">
|
||||
<form id="expense-form" method="POST" action="{{ route('forms.entertainment.store') }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
@@ -57,7 +57,7 @@
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control form-control-md" name="jenis" required >
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="" disabled {{ old('jenis') == '' ? 'selected' : '' }}>Pilih Jenis</option>
|
||||
<option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }} >Entertainment</option>
|
||||
<option value="presentation" {{ old('jenis') == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
||||
<option value="sponsorship" {{ old('jenis') == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
|
||||
@@ -78,9 +78,25 @@
|
||||
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Nama Perusahaan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="nama_perusahaan" class="form-control" placeholder="Contoh: PT. Maju Jaya" required value="{{ old('nama_perusahaan') }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Jabatan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="jabatan" class="form-control" placeholder="Contoh: Manager Operasional" required value="{{ old('jabatan') }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Jenis Usaha <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="jenis_usaha" class="form-control" placeholder="Contoh: Farmasi / Manufaktur" required value="{{ old('jenis_usaha') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-3">
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
<input type="text" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
@@ -122,13 +138,13 @@
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<div id="loading-spinner-overlay" class="d-none">
|
||||
<div class="spinner-wrapper">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
</div>
|
||||
<p>Submitting, please wait...</p>
|
||||
<p class="mt-2">Submitting, please wait...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,21 +153,50 @@
|
||||
</section>
|
||||
|
||||
<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
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// 1. Inisialisasi AutoNumeric
|
||||
const totalInput = new AutoNumeric('#total', {
|
||||
digitGroupSeparator: '.', // Pemisah ribuan
|
||||
decimalCharacter: ',', // Karakter desimal
|
||||
currencySymbol: 'Rp. ', // Simbol mata uang
|
||||
decimalPlaces: 0, // Tidak ada angka desimal
|
||||
minimumValue: '0', // Cegah minus
|
||||
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||
});
|
||||
|
||||
document.getElementById('expense-form').addEventListener('submit', function (e) {
|
||||
const spinnerOverlay = document.getElementById('loading-spinner-overlay');
|
||||
spinnerOverlay.classList.remove('d-none'); // Show overlay
|
||||
spinnerOverlay.classList.add('d-flex'); // Use flexbox for centering
|
||||
// 2. Mencegah Scroll Mouse Wheel pada Input Nominal
|
||||
$('#total').on('wheel font-wheel', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
});
|
||||
|
||||
// 3. Interseptor Form Submit untuk Validasi Maksimal Rp 1 Juta
|
||||
$('#expense-form').on('submit', function (e) {
|
||||
e.preventDefault(); // Tahan pengiriman sementara
|
||||
const form = this;
|
||||
const spinnerOverlay = $('#loading-spinner-overlay');
|
||||
|
||||
// Ambil nilai nominal mentah dari AutoNumeric
|
||||
const totalExpense = totalInput.getNumber() || 0;
|
||||
|
||||
// Cek Aturan Bisnis: Tidak Boleh Lebih dari Rp 1.000.000
|
||||
if (totalExpense > 1000000) {
|
||||
Swal.fire({
|
||||
title: 'Nominal Melebihi Batas!',
|
||||
text: `Pengajuan Anda sebesar Rp ${new Intl.NumberFormat('id-ID').format(totalExpense)} melebihi batas maksimal yang diizinkan yaitu Rp 1.000.000. Mohon sesuaikan nominal Anda.`,
|
||||
icon: 'error',
|
||||
confirmButtonColor: '#d33',
|
||||
confirmButtonText: 'Revisi Angka'
|
||||
});
|
||||
} else {
|
||||
// Lolos Validasi -> Tampilkan Spinner & Eksekusi Submit
|
||||
spinnerOverlay.removeClass('d-none').addClass('d-flex');
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-modal')
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-scripts')
|
||||
@endsection
|
||||
@endsection
|
||||
@@ -1,11 +1,12 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title')
|
||||
Dashboard
|
||||
Dashboard
|
||||
@endsection
|
||||
|
||||
@section('admin-content')
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
@@ -16,12 +17,12 @@
|
||||
<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>
|
||||
|
||||
<style>
|
||||
#loading-spinner-overlay {
|
||||
position: fixed;
|
||||
@@ -29,23 +30,20 @@
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
|
||||
z-index: 9999; /* High z-index to cover everything */
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.spinner-wrapper {
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
.spinner-wrapper { text-align: center; color: white; }
|
||||
</style>
|
||||
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<form id="expense-form" method="POST" action="{{ route('forms.entertainment.update', $form->id) }}" enctype="multipart/form-data">
|
||||
<form id="expense-form" method="POST" action="{{ route('forms.entertainment.update', $form->id) }}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
@include('backend.layouts.partials.messages')
|
||||
@@ -53,14 +51,15 @@
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tanggal <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ $form->tanggal }}">
|
||||
{{-- Diubah menjadi input date murni --}}
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ \Carbon\Carbon::parse($form->tanggal)->format('Y-m-d') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control form-control-md" name="jenis" required>
|
||||
<option value="">Pilih Jenis</option>
|
||||
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
||||
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
||||
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
||||
<option value="sponsorship" {{ $form->jenis == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -79,9 +78,25 @@
|
||||
<label class="form-label">Alamat <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="alamat" id="alamat" required value="{{ $form->alamat }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Nama Perusahaan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="nama_perusahaan" class="form-control" required value="{{ old('nama_perusahaan', $form->nama_perusahaan) }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Jabatan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="jabatan" class="form-control" required value="{{ old('jabatan', $form->jabatan) }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Jenis Usaha <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" name="jenis_usaha" class="form-control" required value="{{ old('jenis_usaha', $form->jenis_usaha) }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 mt-3">
|
||||
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||
<input type="text" class="form-control" name="total" id="total" required value="{{ $form->total }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Keterangan <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
@@ -89,6 +104,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Lampiran Existing --}}
|
||||
<div class="col-12">
|
||||
<hr class="my-4">
|
||||
<h5 class="mb-3">Lampiran Saat Ini</h5>
|
||||
@@ -100,55 +116,41 @@
|
||||
<th>Nama File</th>
|
||||
<th style="width: 120px;" class="text-center">Preview</th>
|
||||
<th style="width: 120px;" class="text-center">Download</th>
|
||||
<th style="width: 100px;" class="text-center">Delete</th>
|
||||
<th style="width: 100px;" class="text-center">Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($attachments as $attachment)
|
||||
<tr class="entertainment-attachment-row">
|
||||
<td>{{ $attachment['category_label'] ?? '-' }}</td>
|
||||
<td>{{ ucwords(str_replace('_', ' ', $attachment['file_category'])) }}</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 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">
|
||||
<a href="{{ $attachment['download_url'] }}" class="btn btn-sm btn-outline-success" target="_blank">Download</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger entertainment-delete-existing-attachment"
|
||||
data-delete-url="{{ route('forms.entertainment.attachments.destroy', [$form->id, $attachment['id']]) }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</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>
|
||||
<td class="text-center">
|
||||
@if (!empty($attachment['can_delete']))
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-outline-danger entertainment-delete-existing-attachment"
|
||||
data-delete-url="{{ route('forms.entertainment.attachments.destroy', [$form->id, $attachment['id']]) }}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@else
|
||||
<span class="text-muted">Tidak tersedia</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr class="entertainment-empty-row">
|
||||
<td colspan="5" class="text-center text-muted">Belum ada attachment.</td>
|
||||
</tr>
|
||||
<tr class="text-center text-muted"><td colspan="5">Belum ada lampiran tersimpan.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<hr class="my-4">
|
||||
{{-- Lampiran Baru --}}
|
||||
<div class="col-12 mt-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h5 class="mb-0">Tambah Lampiran Baru</h5>
|
||||
<button type="button" class="btn btn-sm btn-primary" id="entertainment-add-attachment-row">
|
||||
@@ -156,7 +158,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped mb-0" id="entertainment-new-attachments-table" data-next-index="0">
|
||||
<table class="table table-bordered align-middle" id="entertainment-new-attachments-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th style="width: 30%;">Kategori</th>
|
||||
@@ -166,27 +168,21 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="entertainment-empty-row">
|
||||
<td colspan="4" class="text-center text-muted">Belum ada attachment.</td>
|
||||
</tr>
|
||||
<tr class="entertainment-empty-row"><td colspan="4" class="text-center text-muted">Belum ada lampiran baru.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<small class="text-muted d-block mt-2">
|
||||
Maksimum 10 MB per file. Tidak diperbolehkan: {{ implode(', ', $entertainmentBlockedExtensions ?? []) }}.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="col-12 text-right mt-4">
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<div id="loading-spinner-overlay" class="d-none">
|
||||
<div class="spinner-wrapper">
|
||||
<div class="spinner-border text-primary" role="status">
|
||||
</div>
|
||||
<div class="spinner-border text-primary" role="status"></div>
|
||||
<p>Submitting, please wait...</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,21 +192,37 @@
|
||||
</section>
|
||||
|
||||
<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
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// 1. Inisialisasi AutoNumeric Aman
|
||||
const totalInput = new AutoNumeric('#total', {
|
||||
digitGroupSeparator: '.',
|
||||
decimalCharacter: ',',
|
||||
currencySymbol: 'Rp. ',
|
||||
decimalPlaces: 0,
|
||||
minimumValue: '0',
|
||||
unformatOnSubmit: true
|
||||
});
|
||||
|
||||
document.getElementById('expense-form').addEventListener('submit', function (e) {
|
||||
const spinnerOverlay = document.getElementById('loading-spinner-overlay');
|
||||
spinnerOverlay.classList.remove('d-none'); // Show overlay
|
||||
spinnerOverlay.classList.add('d-flex'); // Use flexbox for centering
|
||||
// 2. Cegah Scroll Wheel pada Input
|
||||
$('#total').on('wheel', function(e) { e.preventDefault(); $(this).blur(); });
|
||||
|
||||
// 3. Interseptor Form Submit dengan Validasi 1 Juta
|
||||
$('#expense-form').on('submit', function (e) {
|
||||
const totalExpense = totalInput.getNumber() || 0;
|
||||
if (totalExpense > 1000000) {
|
||||
e.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Nominal Melebihi Batas!',
|
||||
text: 'Total pengajuan melebihi batas Rp 1.000.000. Mohon revisi nominal Anda.',
|
||||
icon: 'error'
|
||||
});
|
||||
} else {
|
||||
$('#loading-spinner-overlay').removeClass('d-none').addClass('d-flex');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-modal')
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-scripts')
|
||||
@endsection
|
||||
@endsection
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,11 +26,11 @@
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
<div>
|
||||
<div>
|
||||
@include('backend.layouts.partials.messages')
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="mb-3">
|
||||
<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>
|
||||
@@ -55,6 +55,10 @@
|
||||
<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 class="mb-3">
|
||||
<label class="form-label">Nama Perusahaan</label>
|
||||
<input type="text" class="form-control" name="nama_perusahaan" id="nama_perusahaan" readonly value="{{ $form->nama_perusahaan }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
@@ -62,6 +66,14 @@
|
||||
<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">Jabatan</label>
|
||||
<input type="text" class="form-control" name="jabatan" id="jabatan" readonly value="{{ $form->jabatan }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Jenis Usaha</label>
|
||||
<input type="text" class="form-control" name="jenis_usaha" id="jenis_usaha" readonly value="{{ $form->jenis_usaha }}">
|
||||
</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 }}">
|
||||
@@ -118,7 +130,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<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>
|
||||
@@ -130,196 +142,210 @@
|
||||
@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>
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-danger open-reject-modal"
|
||||
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
||||
Reject
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-danger open-reject-modal"
|
||||
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
||||
Reject
|
||||
</button>
|
||||
@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>
|
||||
|
||||
<button type="button"
|
||||
class="btn btn-danger open-reject-modal"
|
||||
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
||||
Reject
|
||||
</button>
|
||||
<button type="button"
|
||||
class="btn btn-danger open-reject-modal"
|
||||
data-action="{{ route('forms.entertainment.reject', $form->id) }}">
|
||||
Reject
|
||||
</button>
|
||||
@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
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<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>
|
||||
<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">
|
||||
<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>
|
||||
|
||||
<!-- 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 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="modal_expense_number"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>User:</strong> <span id="modal_user"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>NIK/NPWP Penerima:</strong> <span id="modal_nik_or_npwp"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Nama Perusahaan:</strong> <span id="modal_nama_perusahaan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jabatan:</strong> <span id="modal_jabatan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jenis Usaha:</strong> <span id="modal_jenis_usaha"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Tanggal:</strong> <span id="modal_tanggal"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Nama Penerima:</strong> <span id="modal_name"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jenis:</strong> <span id="modal_jenis"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Keterangan:</strong> <span id="modal_keterangan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Bukti Total:</strong> <span id="modal_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>
|
||||
<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="finalApproveModalLabel">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">
|
||||
<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 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>Nama Perusahaan:</strong> <span id="final_nama_perusahaan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jabatan:</strong> <span id="final_jabatan"></span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>Jenis Usaha:</strong> <span id="final_jenis_usaha"></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>
|
||||
<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>
|
||||
<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="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>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
@@ -329,7 +355,7 @@
|
||||
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
|
||||
unformatOnSubmit: true // Nilai asli tanpa format saat dikirimkan
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -351,131 +377,141 @@
|
||||
});
|
||||
|
||||
$(document).on('click', '.open-approve-modal', function() {
|
||||
const approveUrl = $(this).data('id');
|
||||
const approveUrl = $(this).data('id');
|
||||
|
||||
// Show spinner and hide content initially
|
||||
$('#loadingSpinner').show();
|
||||
$('#modalContent').addClass('d-none');
|
||||
// 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
|
||||
$('#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
|
||||
});
|
||||
// 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));
|
||||
$('#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'
|
||||
}));
|
||||
// Detail data
|
||||
$('#modal_user').text(data.user.name);
|
||||
$('#modal_expense_number').text(data.expense_number);
|
||||
$('#modal_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);
|
||||
$('#modal_nik_or_npwp').text(data.nik_or_npwp);
|
||||
|
||||
// Tambahan Mapping Data Perusahaan
|
||||
$('#modal_nama_perusahaan').text(data.nama_perusahaan || '-');
|
||||
$('#modal_jabatan').text(data.jabatan || '-');
|
||||
$('#modal_jenis_usaha').text(data.jenis_usaha || '-');
|
||||
|
||||
$('#modal_name').text(data.name);
|
||||
$('#modal_jenis').text(data.jenis);
|
||||
$('#modal_keterangan').text(data.keterangan);
|
||||
|
||||
$('#bukti_total').html(data.total ? '<a href="' + data.total + '" target="_blank">Download</a>' : '-');
|
||||
$('#modal_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');
|
||||
// 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);
|
||||
});
|
||||
});
|
||||
// Reset the total to zero
|
||||
$('#total').val(0);
|
||||
});
|
||||
});
|
||||
|
||||
// Handle Approve Button Click
|
||||
$(document).on('click', '.final-approve-modal', function() {
|
||||
const approveUrl = $(this).data('id');
|
||||
// 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');
|
||||
// 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
|
||||
$('#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
|
||||
});
|
||||
// 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));
|
||||
$('#final_total_value').text(formatter.format(data.total));
|
||||
|
||||
// Assign data values to checkboxes
|
||||
$('#final_total').data('value', 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'
|
||||
}));
|
||||
// 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_nik_or_npwp').text(data.nik_or_npwp);
|
||||
|
||||
// Tambahan Mapping Data Perusahaan
|
||||
$('#final_nama_perusahaan').text(data.nama_perusahaan || '-');
|
||||
$('#final_jabatan').text(data.jabatan || '-');
|
||||
$('#final_jenis_usaha').text(data.jenis_usaha || '-');
|
||||
|
||||
$('#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>' : '-');
|
||||
|
||||
$('#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');
|
||||
|
||||
// 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);
|
||||
});
|
||||
});
|
||||
|
||||
// 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);
|
||||
});
|
||||
|
||||
// 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,
|
||||
});
|
||||
|
||||
const formatter = new Intl.NumberFormat('id-ID', {
|
||||
style: 'currency',
|
||||
currency: 'IDR',
|
||||
minimumFractionDigits: 0,
|
||||
});
|
||||
$('#total').val(formatter.format(total));
|
||||
});
|
||||
|
||||
$('#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
|
||||
});
|
||||
// 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>
|
||||
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-modal')
|
||||
@include('backend.pages.forms.entertainment.partials.attachment-scripts')
|
||||
@endsection
|
||||
@endsection
|
||||
Reference in New Issue
Block a user