2024-12-18 12:56:16 +07:00
@ extends ( 'layouts.app' )
@ section ( 'title' )
2026-06-01 15:01:03 +07:00
Dashboard
2024-12-18 12:56:16 +07:00
@ endsection
@ section ( 'admin-content' )
2024-12-20 11:07:07 +07:00
< script src = " https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js " ></ script >
2026-06-01 15:01:03 +07:00
< script src = " https://cdn.jsdelivr.net/npm/sweetalert2@11 " ></ script >
2024-12-20 11:07:07 +07:00
2024-12-18 12:56:16 +07:00
< section class = " content-header " >
< div class = " container-fluid " >
< div class = " row mb-2 " >
< div class = " col-sm-6 " >
< h1 > Tambahkan 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 >
</ ol >
</ div >
</ div >
</ div >
</ section >
2025-01-18 15:01:28 +07:00
< style >
#loading-spinner-overlay {
position : fixed ;
top : 0 ;
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 */
display : flex ;
justify - content : center ;
align - items : center ;
}
. spinner - wrapper {
text - align : center ;
color : white ;
}
</ style >
2024-12-18 12:56:16 +07:00
< section class = " content " >
< div class = " container-fluid " >
< div class = " card card-primary card-outline " >
< div class = " card-body " >
2026-06-01 15:01:03 +07:00
< form id = " expense-form " method = " POST " action = " { { route('forms.entertainment.store') }} " enctype = " multipart/form-data " >
2024-12-18 12:56:16 +07:00
@ csrf
@ include ( 'backend.layouts.partials.messages' )
< div class = " row " >
< div class = " col-lg-6 " >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > Tanggal < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
2024-12-18 12:56:16 +07:00
< input type = " date " class = " form-control " name = " tanggal " required value = " { { old('tanggal') }} " >
</ div >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > Jenis < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
2025-10-12 18:29:07 +07:00
< select class = " form-control form-control-md " name = " jenis " required >
2026-06-01 15:01:03 +07:00
< option value = " " disabled {{ old ( 'jenis' ) == '' ? 'selected' : '' }} > Pilih Jenis </ option >
2025-10-12 18:29:07 +07:00
< option value = " entertainment " {{ old ( 'jenis' ) == 'entertainment' ? 'selected' : '' }} > Entertainment </ option >
2024-12-18 12:56:16 +07:00
< option value = " presentation " {{ old ( 'jenis' ) == 'presentation' ? 'selected' : '' }} > Presentation </ option >
< option value = " sponsorship " {{ old ( 'jenis' ) == 'sponsorship' ? 'selected' : '' }} > Sponsorship </ option >
</ select >
</ div >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > Nama Penerima < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
2024-12-18 12:56:16 +07:00
< input type = " text " class = " form-control " name = " name " required value = " { { old('name') }} " >
</ div >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > NPWP / NIK < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
< input type = " text " class = " form-control " name = " nik_or_npwp " id = " nik_or_npwp " required value = " { { old('nik_or_npwp') }} " >
2024-12-18 12:56:16 +07:00
</ div >
</ div >
< div class = " col-lg-6 " >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< 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') }} " >
2024-12-18 12:56:16 +07:00
</ div >
2026-06-01 15:01:03 +07:00
< 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 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > Total < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
2026-06-01 15:01:03 +07:00
< input type = " text " class = " form-control " name = " total " id = " total " required value = " { { old('total') }} " >
2024-12-18 12:56:16 +07:00
</ div >
< div class = " mb-3 " >
2025-01-06 16:00:51 +07:00
< label class = " form-label " > Keterangan < span class = " font-italic font-weight-normal " > ( required ) </ span ></ label >
< textarea class = " form-control " name = " keterangan " required > {{ old ( 'keterangan' ) }} </ textarea >
2024-12-18 12:56:16 +07:00
</ div >
</ div >
2025-10-13 17:28:34 +07:00
< div class = " col-12 " >
< hr class = " my-4 " >
< div class = " d-flex justify-content-between align-items-center mb-2 " >
< h5 class = " mb-0 " > Lampiran </ h5 >
< button type = " button " class = " btn btn-sm btn-primary " id = " entertainment-add-attachment-row " >
< i class = " fas fa-plus mr-1 " ></ i > Tambah Attachment
</ button >
</ div >
< div class = " table-responsive " >
< table class = " table table-bordered table-striped mb-0 " id = " entertainment-new-attachments-table " data - next - index = " 0 " >
< thead class = " bg-light " >
< tr >
< th style = " width: 30%; " > Kategori </ th >
< th > File </ th >
< th style = " width: 120px; " class = " text-center " > Preview </ th >
< th style = " width: 80px; " class = " text-center " > Aksi </ th >
</ tr >
</ thead >
< tbody >
< tr class = " entertainment-empty-row " >
< td colspan = " 4 " class = " text-center text-muted " > Belum ada attachment .</ 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 " > Submit </ button >
</ div >
2024-12-18 12:56:16 +07:00
</ div >
2026-06-01 15:01:03 +07:00
</ form >
2025-01-17 16:39:37 +07:00
< div id = " loading-spinner-overlay " class = " d-none " >
< div class = " spinner-wrapper " >
< div class = " spinner-border text-primary " role = " status " >
</ div >
2026-06-01 15:01:03 +07:00
< p class = " mt-2 " > Submitting , please wait ...</ p >
2025-01-17 16:39:37 +07:00
</ div >
</ div >
2024-12-18 12:56:16 +07:00
</ div >
</ div >
</ div >
</ section >
2024-12-20 11:07:07 +07:00
< script >
2026-06-01 15:01:03 +07:00
$ ( 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
});
// 2. Mencegah Scroll Mouse Wheel pada Input Nominal
$ ( '#total' ) . on ( 'wheel font-wheel' , function ( e ) {
e . preventDefault ();
$ ( this ) . blur ();
});
2025-01-17 16:39:37 +07:00
2026-06-01 15:01:03 +07:00
// 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 ();
}
});
2025-01-17 16:39:37 +07:00
});
2024-12-20 11:07:07 +07:00
</ 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' )
2026-06-01 15:01:03 +07:00
@ endsection