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>Edit 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>
|
2026-06-01 15:01:03 +07:00
|
|
|
|
2025-01-18 15:01:28 +07:00
|
|
|
<style>
|
|
|
|
|
#loading-spinner-overlay {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
2026-06-01 15:01:03 +07:00
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
|
z-index: 9999;
|
2025-01-18 15:01:28 +07:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2026-06-01 15:01:03 +07:00
|
|
|
.spinner-wrapper { text-align: center; color: white; }
|
2025-01-18 15:01:28 +07:00
|
|
|
</style>
|
2026-06-01 15:01:03 +07:00
|
|
|
|
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.update', $form->id) }}" enctype="multipart/form-data">
|
2024-12-18 12:56:16 +07:00
|
|
|
@csrf
|
|
|
|
|
@method('PUT')
|
|
|
|
|
@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>
|
2026-06-01 15:01:03 +07:00
|
|
|
{{-- Diubah menjadi input date murni --}}
|
|
|
|
|
<input type="date" class="form-control" name="tanggal" required value="{{ \Carbon\Carbon::parse($form->tanggal)->format('Y-m-d') }}">
|
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">Jenis <span class="font-italic font-weight-normal">(required)</span></label>
|
2024-12-18 12:56:16 +07:00
|
|
|
<select class="form-control form-control-md" name="jenis" required>
|
|
|
|
|
<option value="">Pilih Jenis</option>
|
|
|
|
|
<option value="entertainment" {{ $form->jenis == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
|
2026-06-01 15:01:03 +07:00
|
|
|
<option value="presentation" {{ $form->jenis == 'presentation' ? 'selected' : '' }}>Presentation</option>
|
2024-12-18 12:56:16 +07:00
|
|
|
<option value="sponsorship" {{ $form->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="{{ $form->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="{{ $form->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="{{ $form->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" 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">
|
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="{{ $form->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>{{ $form->keterangan }}</textarea>
|
2024-12-18 12:56:16 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
{{-- Lampiran Existing --}}
|
2025-10-13 17:28:34 +07:00
|
|
|
<div class="col-12">
|
|
|
|
|
<hr class="my-4">
|
|
|
|
|
<h5 class="mb-3">Lampiran Saat Ini</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: 25%;">Kategori</th>
|
|
|
|
|
<th>Nama File</th>
|
|
|
|
|
<th style="width: 120px;" class="text-center">Preview</th>
|
|
|
|
|
<th style="width: 120px;" class="text-center">Download</th>
|
2026-06-01 15:01:03 +07:00
|
|
|
<th style="width: 100px;" class="text-center">Aksi</th>
|
2025-10-13 17:28:34 +07:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
@forelse ($attachments as $attachment)
|
|
|
|
|
<tr class="entertainment-attachment-row">
|
2026-06-01 15:01:03 +07:00
|
|
|
<td>{{ ucwords(str_replace('_', ' ', $attachment['file_category'])) }}</td>
|
2025-10-13 17:28:34 +07:00
|
|
|
<td>{{ $attachment['filename'] }}</td>
|
|
|
|
|
<td class="text-center">
|
2026-06-01 15:01:03 +07:00
|
|
|
<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>
|
2025-10-13 17:28:34 +07:00
|
|
|
</td>
|
|
|
|
|
<td class="text-center">
|
2026-06-01 15:01:03 +07:00
|
|
|
<a href="{{ $attachment['download_url'] }}" class="btn btn-sm btn-outline-success" target="_blank">Download</a>
|
2025-10-13 17:28:34 +07:00
|
|
|
</td>
|
|
|
|
|
<td class="text-center">
|
2026-06-01 15:01:03 +07:00
|
|
|
<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>
|
2025-10-13 17:28:34 +07:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@empty
|
2026-06-01 15:01:03 +07:00
|
|
|
<tr class="text-center text-muted"><td colspan="5">Belum ada lampiran tersimpan.</td></tr>
|
2025-10-13 17:28:34 +07:00
|
|
|
@endforelse
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
{{-- Lampiran Baru --}}
|
|
|
|
|
<div class="col-12 mt-4">
|
2025-10-13 17:28:34 +07:00
|
|
|
<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">
|
|
|
|
|
<i class="fas fa-plus mr-1"></i> Tambah Attachment
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-responsive">
|
2026-06-01 15:01:03 +07:00
|
|
|
<table class="table table-bordered align-middle" id="entertainment-new-attachments-table">
|
2025-10-13 17:28:34 +07:00
|
|
|
<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>
|
2026-06-01 15:01:03 +07:00
|
|
|
<tr class="entertainment-empty-row"><td colspan="4" class="text-center text-muted">Belum ada lampiran baru.</td></tr>
|
2025-10-13 17:28:34 +07:00
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-12 text-right mt-4">
|
|
|
|
|
<button type="submit" class="btn btn-primary">Update</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">
|
2026-06-01 15:01:03 +07:00
|
|
|
<div class="spinner-border text-primary" role="status"></div>
|
2025-01-17 16:39:37 +07:00
|
|
|
<p>Submitting, please wait...</p>
|
|
|
|
|
</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 Aman
|
|
|
|
|
const totalInput = new AutoNumeric('#total', {
|
|
|
|
|
digitGroupSeparator: '.',
|
|
|
|
|
decimalCharacter: ',',
|
|
|
|
|
currencySymbol: 'Rp. ',
|
|
|
|
|
decimalPlaces: 0,
|
|
|
|
|
minimumValue: '0',
|
|
|
|
|
unformatOnSubmit: true
|
|
|
|
|
});
|
2025-01-17 16:39:37 +07:00
|
|
|
|
2026-06-01 15:01:03 +07:00
|
|
|
// 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');
|
|
|
|
|
}
|
|
|
|
|
});
|
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
|