This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
@section('admin-content')
|
||||
<script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
@@ -28,8 +29,8 @@
|
||||
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 */
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
@@ -51,7 +52,8 @@
|
||||
<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="datetime-local" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
{{-- Mengubah datetime-local menjadi date --}}
|
||||
<input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Tipe Pengeluaran <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
@@ -63,11 +65,11 @@
|
||||
|
||||
<div class="mb-3 gasoline-fields">
|
||||
<label class="form-label">Liter Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="text" class="form-control" name="liter" value="{{ old('liter') }}">
|
||||
<input type="number" step="0.01" class="form-control" name="liter" id="liter" value="{{ old('liter') }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Total Harga <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
<input type="text" class="form-control" name="total" id="total" required value="{{ old('total') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -78,7 +80,8 @@
|
||||
</div>
|
||||
<div class="mb-3 gasoline-fields">
|
||||
<label class="form-label">Tipe Bensin <span class="font-italic font-weight-normal">(required)</span></label>
|
||||
<select class="form-control" name="tipe_bensin" id="tipe_bensin" value="{{ old('tipe_bensin') }}">
|
||||
<select class="form-control" name="tipe_bensin" id="tipe_bensin">
|
||||
<option value="" disabled selected>Pilih Tipe</option>
|
||||
<option value="pertamax" {{ old('tipe_bensin') == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
|
||||
<option value="pertalite" {{ old('tipe_bensin') == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
|
||||
</select>
|
||||
@@ -135,9 +138,8 @@
|
||||
|
||||
<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 class="spinner-border text-primary" role="status"></div>
|
||||
<p class="mt-2">Submitting, please wait...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,226 +148,211 @@
|
||||
</section>
|
||||
|
||||
<script>
|
||||
new AutoNumeric('#total', {
|
||||
digitGroupSeparator: '.',
|
||||
decimalCharacter: ',',
|
||||
currencySymbol: 'Rp.',
|
||||
decimalPlaces: 0,
|
||||
unformatOnSubmit: true
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// 1. Inisialisasi Aman AutoNumeric (Sesuai Standar Up Country)
|
||||
const autoNumericConfig = {
|
||||
digitGroupSeparator: '.',
|
||||
decimalCharacter: ',',
|
||||
currencySymbol: 'Rp. ',
|
||||
decimalPlaces: 0,
|
||||
minimumValue: '0', // Mencegah nilai minus
|
||||
unformatOnSubmit: true
|
||||
};
|
||||
const totalInput = new AutoNumeric('#total', autoNumericConfig);
|
||||
|
||||
const spinnerOverlay = document.getElementById('loading-spinner-overlay');
|
||||
|
||||
document.getElementById('expense-form').addEventListener('submit', function () {
|
||||
spinnerOverlay.classList.remove('d-none');
|
||||
spinnerOverlay.classList.add('d-flex');
|
||||
});
|
||||
|
||||
// Toggle gasoline specific fields
|
||||
const expenseTypeSelect = document.getElementById('expense_type');
|
||||
const gasolineFields = document.querySelectorAll('.gasoline-fields');
|
||||
const literInput = document.querySelector('input[name="liter"]');
|
||||
const jarakInput = document.querySelector('input[name="jarak"]');
|
||||
const tipeBensinSelect = document.getElementById('tipe_bensin');
|
||||
const nopolInput = document.getElementById('nopol');
|
||||
|
||||
function toggleGasolineFields() {
|
||||
if (expenseTypeSelect.value === 'gasoline') {
|
||||
gasolineFields.forEach(field => field.style.display = 'block');
|
||||
literInput.setAttribute('required', 'required');
|
||||
jarakInput.setAttribute('required', 'required');
|
||||
tipeBensinSelect.setAttribute('required', 'required');
|
||||
nopolInput.setAttribute('required', 'required');
|
||||
} else {
|
||||
gasolineFields.forEach(field => field.style.display = 'none');
|
||||
literInput.value = '';
|
||||
jarakInput.value = '';
|
||||
tipeBensinSelect.value = '';
|
||||
nopolInput.value = '';
|
||||
literInput.removeAttribute('required');
|
||||
jarakInput.removeAttribute('required');
|
||||
tipeBensinSelect.removeAttribute('required');
|
||||
nopolInput.removeAttribute('required');
|
||||
}
|
||||
}
|
||||
|
||||
toggleGasolineFields();
|
||||
expenseTypeSelect.addEventListener('change', toggleGasolineFields);
|
||||
|
||||
const attachmentCategories = @json($attachmentCategories ?? ($vehicleAttachmentCategories ?? []));
|
||||
const blockedExtensions = ['exe', 'bat', 'sh', 'cmd', 'dll', 'msi'];
|
||||
const maxFileSizeBytes = 10 * 1024 * 1024;
|
||||
const vehicleAttachmentEmptyRow = '<tr class="vehicle-attachments-empty text-center text-muted"><td colspan="4">Belum ada lampiran.</td></tr>';
|
||||
let vehicleAttachmentIndex = 0;
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function categoryToLabel(value) {
|
||||
if (!value) {
|
||||
return 'Pilih Kategori';
|
||||
}
|
||||
return value.replace(/_/g, ' ').replace(/\b\w/g, function (char) {
|
||||
return char.toUpperCase();
|
||||
// 2. Cegah Scroll Wheel agar angka tidak berubah tanpa sengaja
|
||||
$('#total, #liter, #jarak').on('wheel font-wheel', function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
});
|
||||
}
|
||||
|
||||
function detectPreviewType(extension) {
|
||||
const images = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||||
if (images.indexOf(extension) !== -1) {
|
||||
return 'image';
|
||||
}
|
||||
if (extension === 'pdf') {
|
||||
return 'pdf';
|
||||
}
|
||||
return 'other';
|
||||
}
|
||||
// 3. Toggle Logika Field Bensin
|
||||
const expenseTypeSelect = document.getElementById('expense_type');
|
||||
const gasolineFields = document.querySelectorAll('.gasoline-fields');
|
||||
const literInput = document.getElementById('liter');
|
||||
const jarakInput = document.getElementById('jarak');
|
||||
const tipeBensinSelect = document.getElementById('tipe_bensin');
|
||||
const nopolInput = document.getElementById('nopol');
|
||||
|
||||
function buildCategoryOptions() {
|
||||
return attachmentCategories.map(function (category) {
|
||||
return '<option value="' + category + '">' + escapeHtml(categoryToLabel(category)) + '</option>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function setInlinePreview($row, type, source) {
|
||||
const $box = $row.find('.vehicle-attachment-inline-preview');
|
||||
$box.removeClass('bg-light').html('<i class="fas fa-file-upload text-muted"></i>');
|
||||
|
||||
if (type === 'image' && source) {
|
||||
$box.addClass('bg-light').html(
|
||||
'<img src="' + source + '" class="img-thumbnail" style="width:100%;height:100%;object-fit:cover;" alt="Preview">'
|
||||
);
|
||||
} else if (type === 'pdf') {
|
||||
$box.addClass('bg-light').html('<i class="fas fa-file-pdf text-danger fa-lg"></i>');
|
||||
} else if (type === 'other') {
|
||||
$box.addClass('bg-light').html('<i class="fas fa-file-alt text-secondary fa-lg"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
function resetAttachmentRowData($row, clearInput = true) {
|
||||
const existingUrl = $row.data('objectUrl');
|
||||
if (existingUrl) {
|
||||
URL.revokeObjectURL(existingUrl);
|
||||
}
|
||||
|
||||
$row.removeData('objectUrl')
|
||||
.removeData('previewType')
|
||||
.removeData('previewSource')
|
||||
.removeData('previewFileName')
|
||||
.removeData('downloadUrl');
|
||||
|
||||
setInlinePreview($row, null, null);
|
||||
$row.find('.vehicle-preview-new-attachment').addClass('d-none');
|
||||
$row.find('.vehicle-preview-filename').text('');
|
||||
|
||||
if (clearInput) {
|
||||
$row.find('.vehicle-attachment-file').val('');
|
||||
}
|
||||
}
|
||||
|
||||
function openAttachmentModal(modalSelector, options) {
|
||||
const settings = Object.assign({
|
||||
title: 'Lampiran',
|
||||
type: 'other',
|
||||
source: null,
|
||||
downloadUrl: null,
|
||||
fileName: 'Lampiran'
|
||||
}, options || {});
|
||||
|
||||
const $modal = $(modalSelector);
|
||||
const $image = $modal.find('.attachment-preview-image');
|
||||
const $object = $modal.find('.attachment-preview-object');
|
||||
const $placeholder = $modal.find('.attachment-preview-placeholder');
|
||||
|
||||
$modal.find('.attachment-preview-modal-title').text(settings.title || 'Lampiran');
|
||||
|
||||
$image.addClass('d-none').attr('src', '');
|
||||
$object.addClass('d-none').attr('data', '').attr('src', '');
|
||||
$placeholder.removeClass('d-none').html('Tidak ada file untuk ditampilkan.');
|
||||
|
||||
if (settings.type === 'image' && settings.source) {
|
||||
$image.attr('src', settings.source).removeClass('d-none');
|
||||
$placeholder.addClass('d-none');
|
||||
} else if (settings.type === 'pdf' && settings.source) {
|
||||
$object.attr('data', settings.source).attr('src', settings.source).removeClass('d-none');
|
||||
$placeholder.addClass('d-none');
|
||||
} else {
|
||||
const safeName = escapeHtml(settings.fileName || 'Lampiran');
|
||||
let message = '<p class="mb-2">' + safeName + '</p><p class="text-muted mb-0">Preview tidak tersedia. Silakan unduh file untuk melihat konten.</p>';
|
||||
if (settings.downloadUrl) {
|
||||
message += '<div class="mt-3"><a href="' + settings.downloadUrl + '" target="_blank" class="btn btn-sm btn-outline-primary">Download</a></div>';
|
||||
function toggleGasolineFields() {
|
||||
if (expenseTypeSelect.value === 'gasoline') {
|
||||
gasolineFields.forEach(field => field.style.display = 'block');
|
||||
literInput.setAttribute('required', 'required');
|
||||
jarakInput.setAttribute('required', 'required');
|
||||
tipeBensinSelect.setAttribute('required', 'required');
|
||||
nopolInput.setAttribute('required', 'required');
|
||||
} else {
|
||||
gasolineFields.forEach(field => field.style.display = 'none');
|
||||
literInput.value = '';
|
||||
jarakInput.value = '';
|
||||
tipeBensinSelect.value = '';
|
||||
nopolInput.value = '';
|
||||
literInput.removeAttribute('required');
|
||||
jarakInput.removeAttribute('required');
|
||||
tipeBensinSelect.removeAttribute('required');
|
||||
nopolInput.removeAttribute('required');
|
||||
}
|
||||
$placeholder.html(message);
|
||||
}
|
||||
|
||||
if (window.bootstrap && bootstrap.Modal && typeof bootstrap.Modal.getOrCreateInstance === 'function') {
|
||||
bootstrap.Modal.getOrCreateInstance($modal[0]).show();
|
||||
} else {
|
||||
toggleGasolineFields();
|
||||
expenseTypeSelect.addEventListener('change', toggleGasolineFields);
|
||||
|
||||
// 4. Integrasi Interseptor Form Submit & SweetAlert
|
||||
const spinnerOverlay = $('#loading-spinner-overlay');
|
||||
|
||||
$('#expense-form').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
const form = this;
|
||||
const totalExpense = totalInput.getNumber() || 0;
|
||||
|
||||
if (totalExpense > 1000000) {
|
||||
Swal.fire({
|
||||
title: 'Nominal Melebihi Batas Expense!',
|
||||
text: `Total pengajuan Anda adalah Rp ${new Intl.NumberFormat('id-ID').format(totalExpense)}. Jumlah ini melebihi batas standar Rp 1.000.000. Apakah yakin tetap ajukan?`,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Tetap Ajukan!',
|
||||
cancelButtonText: 'No, Batalkan'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
spinnerOverlay.removeClass('d-none').addClass('d-flex');
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
spinnerOverlay.removeClass('d-none').addClass('d-flex');
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
// 5. Lampiran Engine (Tetap Utuh)
|
||||
const attachmentCategories = @json($attachmentCategories ?? ($vehicleAttachmentCategories ?? []));
|
||||
const blockedExtensions = ['exe', 'bat', 'sh', 'cmd', 'dll', 'msi'];
|
||||
const maxFileSizeBytes = 10 * 1024 * 1024;
|
||||
const vehicleAttachmentEmptyRow = '<tr class="vehicle-attachments-empty text-center text-muted"><td colspan="4">Belum ada lampiran.</td></tr>';
|
||||
let vehicleAttachmentIndex = 0;
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value || '')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
function categoryToLabel(value) {
|
||||
if (!value) return 'Pilih Kategori';
|
||||
return value.replace(/_/g, ' ').replace(/\b\w/g, function (char) { return char.toUpperCase(); });
|
||||
}
|
||||
|
||||
function detectPreviewType(extension) {
|
||||
const images = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||||
if (images.indexOf(extension) !== -1) return 'image';
|
||||
if (extension === 'pdf') return 'pdf';
|
||||
return 'other';
|
||||
}
|
||||
|
||||
function buildCategoryOptions() {
|
||||
return attachmentCategories.map(function (category) {
|
||||
return '<option value="' + category + '">' + escapeHtml(categoryToLabel(category)) + '</option>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function setInlinePreview($row, type, source) {
|
||||
const $box = $row.find('.vehicle-attachment-inline-preview');
|
||||
$box.removeClass('bg-light').html('<i class="fas fa-file-upload text-muted"></i>');
|
||||
|
||||
if (type === 'image' && source) {
|
||||
$box.addClass('bg-light').html('<img src="' + source + '" class="img-thumbnail" style="width:100%;height:100%;object-fit:cover;" alt="Preview">');
|
||||
} else if (type === 'pdf') {
|
||||
$box.addClass('bg-light').html('<i class="fas fa-file-pdf text-danger fa-lg"></i>');
|
||||
} else if (type === 'other') {
|
||||
$box.addClass('bg-light').html('<i class="fas fa-file-alt text-secondary fa-lg"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
function resetAttachmentRowData($row, clearInput = true) {
|
||||
const existingUrl = $row.data('objectUrl');
|
||||
if (existingUrl) URL.revokeObjectURL(existingUrl);
|
||||
|
||||
$row.removeData('objectUrl').removeData('previewType').removeData('previewSource').removeData('previewFileName').removeData('downloadUrl');
|
||||
setInlinePreview($row, null, null);
|
||||
$row.find('.vehicle-preview-new-attachment').addClass('d-none');
|
||||
$row.find('.vehicle-preview-filename').text('');
|
||||
if (clearInput) $row.find('.vehicle-attachment-file').val('');
|
||||
}
|
||||
|
||||
function openAttachmentModal(modalSelector, options) {
|
||||
const settings = Object.assign({ title: 'Lampiran', type: 'other', source: null, downloadUrl: null, fileName: 'Lampiran' }, options || {});
|
||||
const $modal = $(modalSelector);
|
||||
const $image = $modal.find('.attachment-preview-image');
|
||||
const $object = $modal.find('.attachment-preview-object');
|
||||
const $placeholder = $modal.find('.attachment-preview-placeholder');
|
||||
|
||||
$modal.find('.attachment-preview-modal-title').text(settings.title || 'Lampiran');
|
||||
$image.addClass('d-none').attr('src', '');
|
||||
$object.addClass('d-none').attr('data', '').attr('src', '');
|
||||
$placeholder.removeClass('d-none').html('Tidak ada file untuk ditampilkan.');
|
||||
|
||||
if (settings.type === 'image' && settings.source) {
|
||||
$image.attr('src', settings.source).removeClass('d-none');
|
||||
$placeholder.addClass('d-none');
|
||||
} else if (settings.type === 'pdf' && settings.source) {
|
||||
$object.attr('data', settings.source).attr('src', settings.source).removeClass('d-none');
|
||||
$placeholder.addClass('d-none');
|
||||
} else {
|
||||
const safeName = escapeHtml(settings.fileName || 'Lampiran');
|
||||
let message = '<p class="mb-2">' + safeName + '</p><p class="text-muted mb-0">Preview tidak tersedia. Silakan unduh file untuk melihat konten.</p>';
|
||||
if (settings.downloadUrl) message += '<div class="mt-3"><a href="' + settings.downloadUrl + '" target="_blank" class="btn btn-sm btn-outline-primary">Download</a></div>';
|
||||
$placeholder.html(message);
|
||||
}
|
||||
$modal.modal('show');
|
||||
}
|
||||
}
|
||||
|
||||
function addVehicleAttachmentRow() {
|
||||
const $tbody = $('#vehicle-attachments-table tbody');
|
||||
function addVehicleAttachmentRow() {
|
||||
const $tbody = $('#vehicle-attachments-table tbody');
|
||||
if ($tbody.find('.vehicle-attachments-empty').length) $tbody.empty();
|
||||
|
||||
if ($tbody.find('.vehicle-attachments-empty').length) {
|
||||
$tbody.empty();
|
||||
const index = vehicleAttachmentIndex++;
|
||||
const rowHtml = `
|
||||
<tr class="vehicle-attachment-row" data-index="${index}">
|
||||
<td>
|
||||
<select class="form-control vehicle-attachment-category" name="attachments[${index}][file_category]" required>
|
||||
<option value="">${escapeHtml(categoryToLabel(''))}</option>
|
||||
${buildCategoryOptions()}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="vehicle-attachment-inline-preview border rounded d-flex align-items-center justify-content-center bg-white mr-2" style="width:56px;height:56px;">
|
||||
<i class="fas fa-file-upload text-muted"></i>
|
||||
</div>
|
||||
<input type="file" class="form-control vehicle-attachment-file" name="attachments[${index}][file_path]" required>
|
||||
</div>
|
||||
<div class="small text-muted mt-1 vehicle-preview-filename"></div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary vehicle-preview-new-attachment d-none">Preview</button>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger vehicle-remove-attachment-row"><i class="fas fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
$tbody.append(rowHtml);
|
||||
}
|
||||
|
||||
const index = vehicleAttachmentIndex++;
|
||||
const rowHtml = `
|
||||
<tr class="vehicle-attachment-row" data-index="${index}">
|
||||
<td>
|
||||
<select class="form-control vehicle-attachment-category" name="attachments[${index}][file_category]" required>
|
||||
<option value="">${escapeHtml(categoryToLabel(''))}</option>
|
||||
${buildCategoryOptions()}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="vehicle-attachment-inline-preview border rounded d-flex align-items-center justify-content-center bg-white mr-2" style="width:56px;height:56px;">
|
||||
<i class="fas fa-file-upload text-muted"></i>
|
||||
</div>
|
||||
<input type="file" class="form-control vehicle-attachment-file" name="attachments[${index}][file_path]">
|
||||
</div>
|
||||
<div class="small text-muted mt-1 vehicle-preview-filename"></div>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary vehicle-preview-new-attachment d-none">
|
||||
Preview
|
||||
</button>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger vehicle-remove-attachment-row">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
$tbody.append(rowHtml);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$('#vehicle-add-attachment-row').on('click', function () {
|
||||
addVehicleAttachmentRow();
|
||||
});
|
||||
$('#vehicle-add-attachment-row').on('click', function () { addVehicleAttachmentRow(); });
|
||||
|
||||
$(document).on('click', '.vehicle-remove-attachment-row', function () {
|
||||
const $row = $(this).closest('tr');
|
||||
const $tbody = $('#vehicle-attachments-table tbody');
|
||||
resetAttachmentRowData($row, true);
|
||||
$row.remove();
|
||||
|
||||
if (!$tbody.find('.vehicle-attachment-row').length) {
|
||||
$tbody.html(vehicleAttachmentEmptyRow);
|
||||
}
|
||||
if (!$tbody.find('.vehicle-attachment-row').length) $tbody.html(vehicleAttachmentEmptyRow);
|
||||
});
|
||||
|
||||
$(document).on('change', '.vehicle-attachment-file', function () {
|
||||
@@ -378,9 +365,7 @@
|
||||
filenameHolder.text('');
|
||||
|
||||
const file = this.files && this.files[0];
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
if (!file) return;
|
||||
|
||||
if (file.size > maxFileSizeBytes) {
|
||||
alert('Ukuran file melebihi 10 MB.');
|
||||
@@ -419,7 +404,6 @@
|
||||
$row.data('previewSource', null);
|
||||
setInlinePreview($row, 'other', null);
|
||||
}
|
||||
|
||||
previewButton.removeClass('d-none');
|
||||
});
|
||||
|
||||
@@ -438,8 +422,8 @@
|
||||
});
|
||||
});
|
||||
|
||||
// Add initial attachment row for user convenience
|
||||
// Berikan 1 baris input file kosong sebagai default awal
|
||||
addVehicleAttachmentRow();
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@endsection
|
||||
Reference in New Issue
Block a user