Files
expense/resources/views/backend/pages/forms/entertainment/edit.blade.php
T

217 lines
13 KiB
PHP
Raw Normal View History

2024-12-18 12:56:16 +07:00
@extends('layouts.app')
@section('title')
Dashboard
@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>
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>
</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">
2025-01-17 16:39:37 +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">
<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="{{ $form->tanggal }}">
</div>
<div class="mb-3">
<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>
2025-10-12 18:29:07 +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">
<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">
<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">
<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>
<div class="mb-3">
<label class="form-label">Total <span class="font-italic font-weight-normal">(required)</span></label>
2024-12-20 11:07:07 +07:00
<input type="string" class="form-control" name="total" id="total" required value="{{ $form->total }}">
2024-12-18 12:56:16 +07:00
</div>
<div class="mb-3">
<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>
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>
<th style="width: 100px;" class="text-center">Delete</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>
<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>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="col-12">
<hr class="my-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">
<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">Update</button>
</div>
2024-12-18 12:56:16 +07:00
</div>
</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>
<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>
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
});
2025-01-17 16:39:37 +07:00
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
});
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')
2024-12-18 12:56:16 +07:00
@endsection