Merge remote-tracking branch 'composer/feature/senior-officer' into staging

This commit is contained in:
Daeng Deni Mardaeni
2024-12-23 16:55:56 +07:00
14 changed files with 896 additions and 131 deletions

View File

@@ -46,7 +46,7 @@
@endphp
<div id="luas_tanah_bagunan_tidak_sesuai" class="flex items-baseline gap-2"
style="{{ old('luas_tanah_bagunan_tidak_sesuai', $selectedData) ? '' : 'display: none'}}">
style="{{ old('luas_tanah_bagunan_tidak_sesuai', $selectedData) ? '' : 'display: none' }}">
<input type="text" id="analisa_bangunan_tidak_sesuai"
name="luas_tanah_bagunan_tidak_sesuai" class="input w-full"
placeholder="Masukan Luas Bangunan Tidak Sesuai..."
@@ -75,10 +75,11 @@
<input class="checkbox" name="jenis_bangunan[]" type="checkbox"
value="{{ $item->name }}"
{{ (is_array(old('jenis_bangunan')) && in_array($item->name, old('jenis_bangunan'))) ||
(isset($forminspeksi['bangunan']['jenis_bangunan']) &&
(isset($forminspeksi['bangunan']['jenis_bangunan']) &&
(is_array($forminspeksi['bangunan']['jenis_bangunan']) &&
in_array($item->name, $forminspeksi['bangunan']['jenis_bangunan'])))
? 'checked' : '' }}
in_array($item->name, $forminspeksi['bangunan']['jenis_bangunan'])))
? 'checked'
: '' }}
onclick="toggleCheckboxVisibility('jenis_bangunan', 'jenis_bangunan_lainnya', ['lainnya'])" />
{{ $item->name }}
</label>
@@ -169,17 +170,14 @@
@if (@isset($basicData['spekKategoriBangunan']))
@foreach ($basicData['spekKategoriBangunan'] as $item)
<div>
<input type="hidden" name="spek_kategori_bangunan[]"
value="{{ $item->name }}">
<input type="hidden" name="spek_kategori_bangunan[]" value="{{ $item->name }}">
<label
class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="flex flex-col items-start gap-4"
style="margin-top: 10px">
<div class="flex flex-col items-start gap-4" style="margin-top: 10px">
@foreach ($basicData['spekBangunan'] as $spek)
@if ($spek->spek_kategori_bangunan_id == $item->id)
<label
class="form-label flex items-center gap-2.5">
<label class="form-label flex items-center gap-2.5">
<input class="checkbox"
name="spek_bangunan[{{ $index }}][{{ $item->name }}][]"
type="checkbox"
@@ -192,17 +190,20 @@
</label>
@endif
@endforeach
<label class="form-label flex items-center gap-2.5 mt-2">
<input class="input" type="text"
name="spek_bangunan[{{ $index }}][{{ $item->name }}][lainnya]"
placeholder="Lainnya (sebutkan)"
value="{{ isset($bangunan['spek_kategori_bangunan'][$item->name]['lainnya']) ? $bangunan['spek_kategori_bangunan'][$item->name]['lainnya'] : '' }}">
</label>
</div>
<em id="error-spek_bangunan_{{ $item->name }}"
class="alert text-danger text-sm"></em>
<em id="error-spek_bangunan_{{ $item->name }}" class="alert text-danger text-sm"></em>
</div>
</div>
@endforeach
@endif
</div>
<button type="button"
class="mt-2 btn btn-danger btn-outline btn-xs delete-button"
style="display: none;">Hapus</button>
<button type="button" class="mt-2 btn btn-danger btn-outline btn-xs delete-button" style="display: none;">Hapus</button>
</div>
@endforeach
@else
@@ -213,13 +214,10 @@
@if (@isset($basicData['spekKategoriBangunan']))
@foreach ($basicData['spekKategoriBangunan'] as $item)
<div>
<input type="hidden" name="spek_kategori_bangunan[]"
value="{{ $item->name }}">
<label
class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
<input type="hidden" name="spek_kategori_bangunan[]" value="{{ $item->name }}">
<label class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="flex flex-col items-start gap-4"
style="margin-top: 10px">
<div class="flex flex-col items-start gap-4" style="margin-top: 10px">
@foreach ($basicData['spekBangunan'] as $spek)
@if ($spek->spek_kategori_bangunan_id == $item->id)
<label class="form-label flex items-center gap-2.5">
@@ -231,16 +229,19 @@
</label>
@endif
@endforeach
<label class="form-label flex items-center gap-2.5 mt-2">
<input class=input" type="text"
name="spek_bangunan[0][{{ $item->name }}][lainnya]"
placeholder="Lainnya (sebutkan)">
</label>
</div>
<em id="error-spek_bangunan_{{ $item->name }}"
class="alert text-danger text-sm"></em>
<em id="error-spek_bangunan_{{ $item->name }}" class="alert text-danger text-sm"></em>
</div>
</div>
@endforeach
@endif
</div>
<button type="button" class="mt-2 btn btn-danger btn-outline btn-xs delete-button"
style="display: none;">Hapus</button>
<button type="button" class="mt-2 btn btn-danger btn-outline btn-xs delete-button" style="display: none;">Hapus</button>
</div>
@endif
</div>
@@ -252,10 +253,10 @@
<i class="ki-filled ki-plus"></i>
</button>
</div>
</div>
<!-- Sarana pelengkap -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Sarana Pelengkap</label>
@@ -326,7 +327,7 @@
input.name = `spek_bangunan[${index}][${matches[1]}][]`;
}
} else {
// Handle other array inputs
// Handle lainnya array inputs
input.name = input.name.replace(/\[\d*\]/, `[${index}]`);
}
}

View File

@@ -154,7 +154,7 @@
<td class="px-4 py-2">Hak atas properti yang dialihkan</td>
<td class="px-4 py-2">
<input type="text" name="hak_properti" class="input"
value="{{ $inspectionData['hak_properti'] ?? '' }}">
value="{{ $inspectionData['asset']['hak_properti'] ?? '' }}">
</td>
<td class="px-4 py-2">
<input type="text" name="hak_properti_pembanding[]"
@@ -165,7 +165,7 @@
<td class="px-4 py-2">Penawaran/ Transaksi</td>
<td class="px-4 py-2">
<input type="text" name="penawaran" class="input"
value="{{ $inspectionData['penawaran'] ?? '' }}">
value="{{ $inspectionData['asset']['penawaran'] ?? '' }}">
</td>
<td class="px-4 py-2">
<input type="text" name="penawaran_pembanding[]"
@@ -178,7 +178,7 @@
<td class="px-4 py-2">Telepon Contact Person</td>
<td class="px-4 py-2">
<input type="text" name="telepon" class="input"
value="{{ $inspectionData['telepon'] ?? '' }}">
value="{{ $inspectionData['asset']['telepon'] ?? '' }}">
</td>
<td class="px-4 py-2">
<input type="text" name="telepon_pembanding[]"
@@ -523,7 +523,9 @@
// Ambil nilai numerik dari input
const harga = parseFloat(hargaInput.value.replace(/[^\d]/g, '') || '0');
let diskon = parseFloat(diskonInput.value.replace(/[^\d]/g, '') || '0');
let diskonInput_value = diskonInput.value.replace(',', '.');
let diskon = parseFloat(diskonInput_value.replace(/[^\d.]/g, '') || '0');
// Batasi diskon maksimal 100%
diskon = Math.min(diskon, 100);
@@ -582,6 +584,9 @@
'harga_diskon_pembanding[]': data.harga_diskon,
'total_pembanding[]': data.total,
'diskon_pembanding[]': data.diskon,
'hak_properti_pembanding[]': data.hak_properti,
'telepon_pembanding[]': data.telepon,
'penawaran_pembanding[]': data.penawaran,
};
Object.entries(inputs).forEach(([name, value]) => {

View File

@@ -386,14 +386,15 @@
<div id="inputContainerLantai" class="w-full">
<div class="flex w-full items-center justify-center gap-4">
<label class="form-label max-w-56">
<span class="form-label">Foto Lantai 1</span>
<span class="form-label">Foto Lantai {{ $loop->iteration }}</span>
</label>
<div class="input-group w-full grid gap-5">
<div class="preview-container">
<img id="foto_lantai-preview"
<img id="foto_lantai-preview-{{ $loop->index }}"
src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
alt="Foto Rute" class="mt-2 h-auto"
style="display: none; width: 30rem;">
alt="Foto Lantai" class="mt-2 h-auto"
style="{{ old('foto_lantai_unit', $item['foto_lantai_unit']) ? 'display: block;' : 'display: none;' }} width: 30rem;">
</div>
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
@@ -417,8 +418,11 @@
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<div class="preview-container">
<img id="foto_lantai-preview" src="" alt="Foto Rute"
class="mt-2 h-auto" style="display: none; width: 30rem;">
<img id="foto_lantai-preview-{{ $loop->index }}"
src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
alt="Foto Lantai" class="mt-2 h-auto"
style="{{ old('foto_lantai_unit', $item['foto_lantai_unit']) ? 'display: block;' : 'display: none;' }} width: 30rem;">
</div>
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"

View File

@@ -53,6 +53,9 @@
@push('scripts')
<script type="text/javascript">
const datas = @json($forminspeksi);
console.log(datas);
function updateAlamatFields(status) {
// Ambil elemen formulir
const addressForm = document.getElementById('alamat_form');

View File

@@ -62,19 +62,14 @@
class="input tomselect w-full @error('spek_kategori_bangunan_id') border-danger bg-danger-light @enderror"
name="spek_kategori_bangunan_id">
<option value="">Select Kategori Bangunan</option>
@if (isset($spekKategoriBagunan))
@if (!empty($spekKategoriBagunan))
@foreach ($spekKategoriBagunan as $item)
@if (isset($model->spek_kategori_bangunan_id))
<option value="{{ $model->spek_kategori_bangunan_id }}"
{{ $model->spek_kategori_bangunan_id == $item->id ? 'selected' : '' }}>
{{ $item->name }}
</option>
@else
<option value="{{ $item->id }}"
{{ old('spek_kategori_bangunan_id') == $item->id ? 'selected' : '' }}>
{{ $item->name }}
</option>
@endif
<option value="{{ $item->id }}"
@if (
(isset($model->spek_kategori_bangunan_id) && $model->spek_kategori_bangunan_id == $item->id) ||
old('spek_kategori_bangunan_id') == $item->id) selected @endif>
{{ $item->name }}
</option>
@endforeach
@endif
</select>

View File

@@ -45,6 +45,13 @@
<span class="sort"> <span class="sort-label">{{ isset($header[0]) ? $header[0] : '' }}</span>
<span class="sort-icon"> </span> </span>
</th>
@if ($header[1] == 'spek-bangunan')
<th class="min-w-[250px]" data-datatable-column="code">
<span class="sort"> <span class="sort-label"> Kategori </span>
<span class="sort-icon"> </span> </span>
</th>
@endif
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
</thead>
@@ -125,6 +132,14 @@
name: {
title: 'Jenis Aset',
},
...(header == 'spek-bangunan' && {
kategories:{
title: 'Kategori',
render: (item, data)=>{
return data.bangunan_kategori.name;
}
}
}),
actions: {
title: 'Status',
render: (item, data) => {

View File

@@ -33,25 +33,35 @@
}
function formatCurrency(value) {
if (!value) return '';
function formatCurrency(value, isDiskon = false) {
// Konversi value ke string, pastikan bukan null/undefined
let stringValue = value === null || value === undefined ? '' : String(value);
// Jika input adalah elemen, ambil nilainya
const numericValue = typeof value === 'string' ? value : value.value;
// Ganti koma dengan titik untuk memastikan parsing numerik
stringValue = stringValue.replace(/,/g, '.');
// Hapus semua karakter non-digit
const cleanValue = numericValue.toString().replace(/[^\d]/g, '');
// Hapus karakter non-numerik kecuali titik
let numericValue = stringValue.replace(/[^\d.]/g, '');
// Format ke currency
const formattedValue = new Intl.NumberFormat('id-ID').format(cleanValue);
// Parse nilai numerik
const parsedValue = parseFloat(numericValue);
// Jika input adalah elemen, update nilainya
if (typeof value !== 'string') {
value.value = formattedValue;
}
return formattedValue;
if (isDiskon) {
// Format untuk diskon
return isNaN(parsedValue) ? '' : parsedValue.toLocaleString('id-ID', {
minimumFractionDigits: 0,
maximumFractionDigits: 2
});
} else {
// Format untuk mata uang tanpa desimal
return isNaN(parsedValue) ? '' : parsedValue.toLocaleString('id-ID', {
minimumFractionDigits: 0,
maximumFractionDigits: 0
});
}
}
function previewImage(input, previewId) {
if (input.files && input.files[0]) {