update data pemanding dan otorisator, pembuatan seeder kjpp mengunakan exel
This commit is contained in:
55
resources/views/surveyor/js/utils.blade.php
Normal file
55
resources/views/surveyor/js/utils.blade.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<script>
|
||||
function showLoadingSwal(message) {
|
||||
Swal.fire({
|
||||
title: message,
|
||||
allowOutsideClick: false,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hideLoadingSwal() {
|
||||
Swal.close();
|
||||
}
|
||||
|
||||
function previewImage(input, imageId) {
|
||||
const preview = document.getElementById(imageId);
|
||||
if (input.files && input.files[0]) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
preview.src = e.target.result;
|
||||
preview.classList.remove('hidden');
|
||||
}
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function formatNumber(input) {
|
||||
let value = input.value.replace(/[^\d.]/g, '');
|
||||
input.value = value;
|
||||
}
|
||||
|
||||
|
||||
function formatCurrency(value) {
|
||||
if (!value) return '';
|
||||
|
||||
// Jika input adalah elemen, ambil nilainya
|
||||
const numericValue = typeof value === 'string' ? value : value.value;
|
||||
|
||||
// Hapus semua karakter non-digit
|
||||
const cleanValue = numericValue.toString().replace(/[^\d]/g, '');
|
||||
|
||||
// Format ke currency
|
||||
const formattedValue = new Intl.NumberFormat('id-ID').format(cleanValue);
|
||||
|
||||
// Jika input adalah elemen, update nilainya
|
||||
if (typeof value !== 'string') {
|
||||
value.value = formattedValue;
|
||||
}
|
||||
|
||||
return formattedValue;
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user