final upload form

This commit is contained in:
Fiqh Pratama
2025-10-13 17:28:34 +07:00
parent e8acdd3303
commit 8321df6d2b
13 changed files with 1966 additions and 244 deletions
@@ -59,10 +59,6 @@
<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">Bukti Allowance <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="file" class="form-control" name="bukti_allowance" value="{{ old('bukti_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 }}">
@@ -70,21 +66,105 @@
</div>
<div class="col-lg-6">
<div class="mb-3">
<label class="form-label">Bukti Transport Antar Kota <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="file" class="form-control" name="bukti_transport_ankot" value="{{ old('bukti_transport_ankot') }}">
</div>
<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 class="mb-3">
<label class="form-label">Bukti Hotel <span class="font-italic font-weight-normal">(optional)</span></label>
<input type="file" class="form-control" name="bukti_hotel" value="{{ old('bukti_hotel') }}">
</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">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="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'] }}">
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 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 attachment.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<button type="submit" class="btn btn-primary ml-2">Update</button>
<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 Attachment
</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">Preview</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 attachment.</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>
@@ -131,4 +211,7 @@
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