Merge branch 'staging' into feature/senior-officer

This commit is contained in:
majid
2024-12-29 11:50:28 +07:00
3 changed files with 29 additions and 19 deletions

View File

@@ -158,21 +158,23 @@ class PenilaiController extends Controller
$provinces = Province::all(); $provinces = Province::all();
$basicData = $this->surveyorController->getCommonData(); $basicData = $this->surveyorController->getCommonData();
$formFoto = $formPeta = $cities = $districts = $villages= null; $formFoto = $formPeta = $cities = $districts = $villages= $memo = null;
if ($inspeksi) { if ($inspeksi) {
$formFoto = json_decode($inspeksi->foto_form, true); $formFoto = json_decode($inspeksi->foto_form, true);
$formPeta = json_decode($inspeksi->data_form, true); $formPeta = json_decode($inspeksi->data_form, true);
$memo = json_decode($penilai->memo); if(isset($penilai->memo)) {
if(isset($memo->province_code)){ $memo = json_decode($penilai->memo);
$cities = City::where('province_id', $memo->province_code)->get(); }
if(isset($memo->lokasi->province_code)){
$cities = City::where('province_code', $memo->lokasi->province_code)->get();
} }
if(isset($memo->city_code)){ if(isset($memo->lokasi->city_code)){
$districts = District::where('city_id', $memo->city_code)->get(); $districts = District::where('city_code', $memo->lokasi->city_code)->get();
} }
if(isset($memo->district_code)) { if(isset($memo->lokasi->district_code)) {
$villages = Village::where('district_id', $memo->district_code)->get(); $villages = Village::where('district_code', $memo->lokasi->district_code)->get();
} }
} }

View File

@@ -91,10 +91,10 @@
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<div class="grid gap-2.5 w-full"> <div class="grid gap-2.5 w-full">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 w-full">
<label for="address" class="form-label max-w-56">Lokasi</label> <label for="lokasi" class="form-label max-w-56">Lokasi</label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input type="text" id="address" name="address" class="input w-full" <input type="text" id="lokasi" name="lokasi" class="input w-full"
placeholder="Masukkan Jl." value="{{ $memo->address ?? old('address') }}"> placeholder="Masukkan Jl." value="{{ $memo->lokasi->lokasi ?? old('lokasi') }}">
</div> </div>
</div> </div>
@@ -104,7 +104,7 @@
<select id="province_code" name="province_code" class="input w-full"> <select id="province_code" name="province_code" class="input w-full">
<option value="">Pilih Provinsi</option> <option value="">Pilih Provinsi</option>
@foreach ($provinces as $item) @foreach ($provinces as $item)
<option value="{{ $item->code }}" {{ ($memo->province_code ?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option> <option value="{{ $item->code }}" {{ ($memo->lokasi->province_code ?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach @endforeach
</select> </select>
</div> </div>
@@ -117,7 +117,7 @@
<option value="">Pilih Kota/Kabupaten</option> <option value="">Pilih Kota/Kabupaten</option>
@if(isset($cities)) @if(isset($cities))
@foreach ($cities as $item) @foreach ($cities as $item)
<option value="{{ $item->code }}" {{ ($memo->city_code?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option> <option value="{{ $item->code }}" {{ ($memo->lokasi->city_code?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach @endforeach
@endif @endif
</select> </select>
@@ -131,7 +131,7 @@
<option value="">Pilih Kecamatan</option> <option value="">Pilih Kecamatan</option>
@if(isset($districts)) @if(isset($districts))
@foreach ($districts as $item) @foreach ($districts as $item)
<option value="{{ $item->code }}" {{ ($memo->district_code?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option> <option value="{{ $item->code }}" {{ ($memo->lokasi->district_code?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach @endforeach
@endif @endif
</select> </select>
@@ -145,7 +145,7 @@
<option value="">Pilih Kelurahan</option> <option value="">Pilih Kelurahan</option>
@if(isset($villages)) @if(isset($villages))
@foreach ($villages as $item) @foreach ($villages as $item)
<option value="{{ $item->code }}" {{ ($memo->village_code ?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option> <option value="{{ $item->code }}" {{ ($memo->lokasi->village_code ?? '') == $item->code ? 'selected' : '' }}>{{ $item->name }}</option>
@endforeach @endforeach
@endif @endif
</select> </select>
@@ -156,7 +156,7 @@
<label for="address" class="form-label max-w-56">Address</label> <label for="address" class="form-label max-w-56">Address</label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input type="text" id="address" name="address" class="input w-full" <input type="text" id="address" name="address" class="input w-full"
placeholder="Masukkan Jl." value="{{ $memo->address ?? old('address') }}"> placeholder="Masukkan Jl." value="{{ $memo->lokasi->address ?? old('address') }}">
</div> </div>
</div> </div>
@@ -172,7 +172,7 @@
<label for="penilai" class="form-label max-w-56">Penilai</label> <label for="penilai" class="form-label max-w-56">Penilai</label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input type="text" id="penilai" name="penilai" class="input w-full" <input type="text" id="penilai" name="penilai" class="input w-full"
placeholder="Masukkan Penilai" value="{{ $memo->penilai ?? old('penilai') }}"> placeholder="Masukkan Penilai" value="{{ $memo->lokasi->penilai ?? old('penilai') }}">
</div> </div>
</div> </div>
@@ -323,7 +323,7 @@
</h3> </h3>
</div> </div>
<div class=""> <div class="">
@if (isset($formFoto)) @if (isset($formFoto) && isset($formFoto['rute_menuju_lokasi']) && is_array($formFoto['rute_menuju_lokasi']))
@foreach ($formFoto['rute_menuju_lokasi'] as $item) @foreach ($formFoto['rute_menuju_lokasi'] as $item)
<div class="flex items-center justify-between mt-5"> <div class="flex items-center justify-between mt-5">
<div class="grid gap-5"> <div class="grid gap-5">
@@ -336,6 +336,8 @@
</div> </div>
</div> </div>
@endforeach @endforeach
@else
<p>No route information available.</p>
@endif @endif
</div> </div>
</div> </div>
@@ -475,11 +477,14 @@
perihal: formData.get('perihal'), perihal: formData.get('perihal'),
jenis_asset_tidak_sesuai: formData.get('jenis_asset_tidak_sesuai'), jenis_asset_tidak_sesuai: formData.get('jenis_asset_tidak_sesuai'),
lokasi: { lokasi: {
lokasi: formData.get('lokasi') || '',
address: formData.get('address') || '', address: formData.get('address') || '',
province_code: formData.get('province_code') || '', province_code: formData.get('province_code') || '',
city_code: formData.get('city_code') || '', city_code: formData.get('city_code') || '',
district_code: formData.get('district_code') || '', district_code: formData.get('district_code') || '',
village_code: formData.get('village_code') || '', village_code: formData.get('village_code') || '',
tanggal_survey: formData.get('tanggal_survey') || '',
penilai: formData.get('penilai') || '',
}, },
terlampir: (formData.getAll('terlampir[]') || []), terlampir: (formData.getAll('terlampir[]') || []),
hasil_survey: (formData.getAll('hasil_survey[]') || []), hasil_survey: (formData.getAll('hasil_survey[]') || []),

View File

@@ -78,7 +78,10 @@
@if (isset($kjpp)) @if (isset($kjpp))
<option value="{{ $row->id }}" <option value="{{ $row->id }}"
{{ in_array($row->id, old('kjpp', [])) ? 'selected' : '' }}> {{ in_array($row->id, old('kjpp', [])) ? 'selected' : '' }}>
{{ $row->name }} || {{ $row->jenis_kantor }} {{ $row->name }} | {{ $row->jenis_kantor }}
@if($row->jenis_kantor == 'Kantor Cabang')
{{ str_replace(['KOTA','KAB.','KAB'],'',$row->city->name) }}
@endif
</option> </option>
@endif @endif
@endforeach @endforeach