Files
2025-10-23 17:21:46 +07:00

221 lines
13 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@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>Edit Expense Meeting & Seminar</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>
<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>
<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.meeting.update', $form->id) }}" enctype="multipart/form-data">
@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>
<input type="date" class="form-control" name="tanggal" id="tanggal" value="{{ $form->tanggal }}">
</div>
<div class="mb-3">
<label class="form-label">Allowance <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="text" class="form-control" name="allowance" id="allowance" value="{{ $form->allowance }}">
</div>
<div class="mb-3">
<label class="form-label">Transport Antar Kota <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="text" class="form-control" name="transport_ankot" id="transport_ankot" value="{{ $form->transport_ankot }}">
</div>
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Hotel <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="text" class="form-control" name="hotel" id="hotel" value="{{ $form->hotel }}">
</div>
</div>
<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="meeting-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">Pratinjau</th>
<th style="width: 120px;" class="text-center">Unduh</th>
<th style="width: 100px;" class="text-center">Hapus</th>
</tr>
</thead>
<tbody>
@php
$attachmentCategoryLabels = $meetingAttachmentCategories ?? [];
@endphp
@forelse ($attachments as $attachment)
<tr class="meeting-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 meeting-preview-trigger"
data-preview-type="{{ $attachment['preview_type'] }}"
data-preview-source="{{ $attachment['preview_url'] ?? '' }}"
data-download-url="{{ $attachment['download_url'] ?? '' }}"
data-filename="{{ $attachment['filename'] }}">
Pratinjau
</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">
Unduh
</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 meeting-delete-existing-attachment"
data-delete-url="{{ route('forms.meeting.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="meeting-empty-row">
<td colspan="5" class="text-center text-muted">Belum ada lampiran.</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="meeting-add-attachment-row">
<i class="fas fa-plus mr-1"></i> Tambah Lampiran
</button>
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped mb-0" id="meeting-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">Pratinjau</th>
<th style="width: 80px;" class="text-center">Aksi</th>
</tr>
</thead>
<tbody>
<tr class="meeting-empty-row">
<td colspan="4" class="text-center text-muted">Belum ada lampiran.</td>
</tr>
</tbody>
</table>
</div>
<small class="text-muted d-block mt-2">
Maksimum 10 MB per file. Tidak diperbolehkan: {{ implode(', ', $meetingBlockedExtensions ?? []) }}.
</small>
</div>
<div class="col-12 text-right mt-4">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</div>
</form>
<div id="loading-spinner-overlay" class="d-none">
<div class="spinner-wrapper">
<div class="spinner-border text-primary" role="status">
</div>
<p>Sedang mengirim, mohon tunggu...</p>
</div>
</div>
</div>
</div>
</div>
</section>
<script>
new AutoNumeric('#allowance', {
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
});
new AutoNumeric('#transport_ankot', {
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
});
new AutoNumeric('#hotel', {
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.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
});
</script>
@include('backend.pages.forms.meeting.partials.attachment-modal')
@include('backend.pages.forms.meeting.partials.attachment-scripts')
@endsection