Merge branch 'staging' of https://git.putrakuningan.com/daengdeni/lpj into andydev

This commit is contained in:
Andy Chaerudin
2024-11-06 10:24:58 +07:00
21 changed files with 1334 additions and 407 deletions

View File

@@ -30,43 +30,43 @@ class ActivityController extends Controller
*/ */
public function progres_activity() public function progres_activity()
{ {
// Ambil user yang sedang login // Ambil user yang sedang login
$user = auth()->user(); $user = auth()->user();
$roles = $user->load('roles'); $roles = $user->load('roles');
// Inisialisasi regionId dan teamId sebagai null agar bisa dinamis // Inisialisasi regionId dan teamId sebagai null agar bisa dinamis
$regionId = null; $regionId = null;
$teamId = null; $teamId = null;
if ($roles->roles->pluck('name')->contains('senior-officer')) { if ($roles->roles->pluck('name')->contains('senior-officer')) {
$userTeam = TeamsUsers::with('team') $userTeam = TeamsUsers::with('team')
->where('user_id', $user->id) ->where('user_id', $user->id)
->first(); ->first();
$regionId = $userTeam?->team->regions_id; $regionId = $userTeam?->team->regions_id;
$teamId = $userTeam?->teams_id; $teamId = $userTeam?->teams_id;
} }
$teamsActivity = TeamsUsers::with(['user', 'team', 'team.regions', 'user.roles']) $teamsActivity = TeamsUsers::with(['user', 'team', 'team.regions', 'user.roles'])
->whereHas('team', function ($q) use ($regionId, $teamId) { ->whereHas('team', function ($q) use ($regionId, $teamId) {
if ($regionId) { if ($regionId) {
$q->where('regions_id', $regionId); $q->where('regions_id', $regionId);
} }
if ($teamId) { if ($teamId) {
$q->where('id', $teamId); // Hanya tim yang sama $q->where('id', $teamId); // Hanya tim yang sama
} }
}) })
->where('user_id', '!=', $user->id) ->where('user_id', '!=', $user->id)
->whereHas('user.roles', function ($query) { ->whereHas('user.roles', function ($query) {
// Filter hanya peran 'surveyor' atau 'surveyor-penilai' // Filter hanya peran 'surveyor' atau 'surveyor-penilai'
$query->whereIn('name', ['surveyor', 'surveyor-penilai']); $query->whereIn('name', ['surveyor', 'surveyor-penilai']);
}) })
->get(); ->get();
return view('lpj::activity.progres_activity.index', compact('teamsActivity')); return view('lpj::activity.progres_activity.index', compact('teamsActivity'));
} }
@@ -119,6 +119,10 @@ class ActivityController extends Controller
* Update the specified resource in storage. * Update the specified resource in storage.
*/public function dataForDatatables(Request $request) */public function dataForDatatables(Request $request)
{ {
$user = auth()->user();
// Check permissions // Check permissions
if (is_null($this->user) || !$this->user->can('debitur.view')) { if (is_null($this->user) || !$this->user->can('debitur.view')) {
// abort(403, 'Sorry! You are not allowed to view users.'); // abort(403, 'Sorry! You are not allowed to view users.');
@@ -170,7 +174,23 @@ class ActivityController extends Controller
$filteredRecords = $query->count(); $filteredRecords = $query->count();
// Get data // Get data
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
$data = null;
$userRole = $user->roles[0]->name ?? null;
if (in_array($userRole, ['surveyor', 'surveyor-penilai'])) {
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian',])
->whereHas('penilaian.userPenilai', function ($q) use ($user) {
$q->where('user_id', $user->id);
})
->get();
} else {
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])
->get();
}
// Calculate total pages // Calculate total pages
$pageCount = ceil($totalRecords / $request->get('size', 10)); $pageCount = ceil($totalRecords / $request->get('size', 10));

View File

@@ -225,58 +225,64 @@
$document = DokumenJaminan::find($jaminan); $document = DokumenJaminan::find($jaminan);
$document->update($validate); $document->update($validate);
// Get existing detail documents
$existingDetails = DetailDokumenJaminan::where('dokumen_jaminan_id', $document->id)->get()->keyBy('id');
if($request->jenis_legalitas_jaminan_id){ if($request->jenis_legalitas_jaminan_id){
foreach($request->jenis_legalitas_jaminan_id as $key => $value){ foreach($request->jenis_legalitas_jaminan_id as $key => $value){
if (isset($request->dokumen_jaminan[$key])) { $detailData = [
$file = $request->dokumen_jaminan[$key]; 'dokumen_jaminan_id' => $document->id,
if ($file) { 'jenis_legalitas_jaminan_id' => $value,
$file_name = $file->getClientOriginalName(); 'name' => $request->name[$key],
} 'keterangan' => $request->keterangan[$key],
];
if (isset($file_name)) { $dokumenJaminan = [];
$file->storeAs( if (isset($request->dokumen_jaminan[$key]) && is_array($request->dokumen_jaminan[$key])) {
'public/jaminan/' . $debitur->id . '/' . $document->id . '/', foreach($request->dokumen_jaminan[$key] as $file) {
$file_name, if ($file) {
); $file_name = $file->getClientOriginalName();
$file->storeAs(
$detail = [ 'public/jaminan/' . $debitur->id . '/' . $document->id . '/',
'dokumen_jaminan_id' => $document->id, $file_name
'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key],
'dokumen_jaminan' => 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name,
'name' => $request->name[$key],
'keterangan' => $request->keterangan[$key],
];
if (isset($request->detail_dokumen_jaminan_id[$key])) {
$detailDocument = DetailDokumenJaminan::find(
$request->detail_dokumen_jaminan_id[$key],
); );
$dokumenJaminan[] = 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name;
$detailDocument->update($detail);
$detailDocument->save();
} else {
$detailDocument = DetailDokumenJaminan::create($detail);
$detailDocument->save();
} }
} }
} else { }
$detail = [
'dokumen_jaminan_id' => $document->id,
'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key],
'name' => $request->name[$key],
'keterangan' => $request->keterangan[$key],
];
if (isset($request->detail_dokumen_jaminan_id[$key])) { if (!empty($dokumenJaminan)) {
$detailDocument = DetailDokumenJaminan::find( $detailData['dokumen_jaminan'] = json_encode($dokumenJaminan);
$request->detail_dokumen_jaminan_id[$key], }
);
$detailDocument->update($detail); if (isset($request->detail_dokumen_jaminan_id[$key])) {
$detailId = $request->detail_dokumen_jaminan_id[$key];
$detailDocument = $existingDetails->get($detailId);
if ($detailDocument) {
// Merge new files with existing ones
if (!empty($dokumenJaminan)) {
$existingFiles = json_decode($detailDocument->dokumen_jaminan, true) ?: [];
$mergedFiles = array_merge($existingFiles, $dokumenJaminan);
$detailData['dokumen_jaminan'] = json_encode($mergedFiles);
}
$detailDocument->update($detailData);
$existingDetails->forget($detailId);
} }
} else {
DetailDokumenJaminan::create($detailData);
} }
} }
} }
// Delete any remaining existing details that weren't updated
foreach ($existingDetails as $detail) {
$files = json_decode($detail->dokumen_jaminan, true) ?: [];
foreach ($files as $file) {
Storage::delete('public/' . $file);
}
$detail->delete();
}
DB::commit(); DB::commit();
return redirect()->route('debitur.jaminan.index', $id)->with( return redirect()->route('debitur.jaminan.index', $id)->with(
'success', 'success',
@@ -372,12 +378,16 @@
if ($zip->open($zipFilePath, ZipArchive::CREATE) === true) { if ($zip->open($zipFilePath, ZipArchive::CREATE) === true) {
foreach ($documents as $document) { foreach ($documents as $document) {
$filePath = storage_path('app/public/' . $document->dokumen_jaminan); $files = is_array(json_decode($document->dokumen_jaminan)) ? json_decode($document->dokumen_jaminan) : [$document->dokumen_jaminan];
if (file_exists($filePath)) {
$zip->addFile($filePath, basename($filePath)); foreach ($files as $file) {
} else { $filePath = storage_path('app/public/' . $file);
// Log or display an error message for missing files if (file_exists($filePath)) {
return redirect()->back()->with('error', 'File not found: ' . $filePath); $zip->addFile($filePath, basename($filePath));
} else {
// Log or display an error message for missing files
return redirect()->back()->with('error', 'File not found: ' . $filePath);
}
} }
} }
$zip->close(); $zip->close();
@@ -401,7 +411,8 @@
{ {
$dokumen = request()->get('dokumen'); $dokumen = request()->get('dokumen');
$document = DetailDokumenJaminan::find($dokumen); $document = DetailDokumenJaminan::find($dokumen);
return response()->download(storage_path('app/public/' . $document->dokumen_jaminan)); $file = is_array(json_decode($document->dokumen_jaminan)) ? json_decode($document->dokumen_jaminan) : [$document->dokumen_jaminan];
return response()->download(storage_path('app/public/' . $file[request()->get('index')]));
} }
public function legalitasJaminan($id) public function legalitasJaminan($id)
@@ -436,8 +447,8 @@
$existingLegalitas[] = [ $existingLegalitas[] = [
'id' => $detail->id, 'id' => $detail->id,
'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id, 'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id,
'name' => $detail->name, 'name' => $detail->jenisLegalitasJaminan->name,
'dokumen_jaminan' => $detail->dokumen_jaminan, 'dokumen_jaminan' => json_decode($detail->dokumen_jaminan) ?? $detail->dokumen_jaminan,
'custom_field' => $detail->jenisLegalitasJaminan->custom_field, 'custom_field' => $detail->jenisLegalitasJaminan->custom_field,
'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type, 'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type,
'details' => $detail->details, 'details' => $detail->details,

View File

@@ -67,7 +67,13 @@ class PenilaianController extends Controller
} else { } else {
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first(); $permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
$teams_ids[] = $validatedData['teams_id']; $teams_ids[] = $validatedData['teams_id'];
$user_ids[] = $validatedData['surveyor_id'];
if (isset($validatedData['penilai_surveyor_id'])) {
$user_ids[] = $validatedData['penilai_surveyor_id'];
} else {
$user_ids[] = $validatedData['surveyor_id'];
}
$roles[] = 'surveyor'; $roles[] = 'surveyor';
} }
@@ -89,7 +95,13 @@ class PenilaianController extends Controller
} else { } else {
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first(); $permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi)->first();
$teams_ids[] = $validatedData['teams_id']; $teams_ids[] = $validatedData['teams_id'];
$user_ids[] = $validatedData['penilai_id'];
if (isset($validatedData['penilai_surveyor_id'])) {
$user_ids[] = $validatedData['penilai_surveyor_id'];
}else {
$user_ids[] = $validatedData['penilai_id'];
}
$roles[] = 'penilai'; $roles[] = 'penilai';
} }
@@ -118,7 +130,7 @@ class PenilaianController extends Controller
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan'); return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
} catch (Exception $e) { } catch (Exception $e) {
DB::rollBack(); DB::rollBack();
return response()->json(array('error' => $e->getMessage())); return redirect()->route('penilaian.index')->with('error', $e->getMessage());
} }
} }
} }
@@ -170,7 +182,7 @@ class PenilaianController extends Controller
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan'); return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
} catch (Exception $e) { } catch (Exception $e) {
DB::rollBack(); DB::rollBack();
return response()->json(array('error' => $e->getMessage())); return redirect()->route('penilaian.index')->with('error', $e->getMessage());
} }
} }

View File

@@ -711,7 +711,8 @@ class SurveyorController extends Controller
$validate = $request->validated(); $validate = $request->validated();
if ($validate) { if ($validate) {
$type = $request->route('type'); try {
$type = $request->route('type');
$modelClass = $this->getModelClass($type); $modelClass = $this->getModelClass($type);
@@ -733,6 +734,14 @@ class SurveyorController extends Controller
return redirect() return redirect()
->route('basicdata.' . $type .'.index') ->route('basicdata.' . $type .'.index')
->with('success', 'created successfully'); ->with('success', 'created successfully');
} catch (Exeception $e) {
return response()->json(array('error' => $e->getMessage()), 400);
// return redirect()
// ->route('basicdata.' . $type .'.index')
// ->with('error', $th->getMessage());
}
} }
} }
@@ -940,7 +949,7 @@ class SurveyorController extends Controller
public function submitSurveyor(Request $request, $id) public function submitSurveyor(Request $request, $id)
{ {
$permohonan = Permohonan::find($id); $permohonan = Permohonan::find($id);
$permohonan->update([ $permohonan->update([
'status' => 'done', 'status' => 'done',
@@ -978,6 +987,7 @@ class SurveyorController extends Controller
'tingkat-keramaian' => TingkatKeramaian::class, 'tingkat-keramaian' => TingkatKeramaian::class,
'gol-mas-sekitar' => GolonganMasySekitar::class, 'gol-mas-sekitar' => GolonganMasySekitar::class,
'spek-kategori-bangunan' => SpekKategoritBangunan::class, 'spek-kategori-bangunan' => SpekKategoritBangunan::class,
'spek-bangunan' => SpekBangunan::class,
'lantai-unit' => Lantai::class, 'lantai-unit' => Lantai::class,
'view-unit' => ViewUnit::class, 'view-unit' => ViewUnit::class,
]; ];

View File

@@ -34,6 +34,7 @@ class TeamsController extends Controller
{ {
$regionTeam = Teams::pluck('regions_id')->toArray(); $regionTeam = Teams::pluck('regions_id')->toArray();
$regions = Regions::whereNotIn('id', $regionTeam)->get(); $regions = Regions::whereNotIn('id', $regionTeam)->get();
$userTeam = TeamsUsers::pluck('user_id')->toArray(); $userTeam = TeamsUsers::pluck('user_id')->toArray();
@@ -47,8 +48,6 @@ class TeamsController extends Controller
}); });
}); });
return view('lpj::teams.form', compact('regions', 'user')); return view('lpj::teams.form', compact('regions', 'user'));
} }
@@ -103,7 +102,7 @@ class TeamsController extends Controller
{ {
$teams = Teams::find($id); $teams = Teams::find($id);
$region = Regions::all(); $regions = Regions::all();
$usedUsers = TeamsUsers::where('teams_id', '!=', $id)->pluck('user_id')->toArray(); $usedUsers = TeamsUsers::where('teams_id', '!=', $id)->pluck('user_id')->toArray();
$usersWithRole = User::whereNotIn('id', $usedUsers) $usersWithRole = User::whereNotIn('id', $usedUsers)
->with('roles') ->with('roles')
@@ -119,7 +118,7 @@ class TeamsController extends Controller
// Ambil user yang sudah ada di tim ini // Ambil user yang sudah ada di tim ini
$selectedUsers = $teams->teamsUsers->pluck('user_id')->toArray(); $selectedUsers = $teams->teamsUsers->pluck('user_id')->toArray();
return view('lpj::teams.form', compact('teams', 'region', 'user', 'selectedUsers')); return view('lpj::teams.form', compact('teams', 'regions', 'user', 'selectedUsers'));
} }
/** /**

View File

@@ -33,14 +33,16 @@ class PenilaianRequest extends FormRequest
'tanggal_kunjungan' => 'required|max:255', 'tanggal_kunjungan' => 'required|max:255',
'status' => 'required|string', 'status' => 'required|string',
'nomor_registrasi' => 'required|string', 'nomor_registrasi' => 'required|string',
'surveyor_id' => 'nullable| required_without:penilai_surveyor_id',
'penilai_id' => 'nullable|required_without:penilai_surveyor_id', 'surveyor_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_region_id,penilai_id',
'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilai_id', 'penilai_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_region_id,surveyor_id',
'surveyor_region_id' => 'nullable|required_without:surveyor_id', 'penilai_surveyor_id' => 'nullable',
'penilai_region_id' => 'nullable|required_without:penilai_id', 'surveyor_region_id' => 'nullable|required_without_all:penilai_surveyor_id,penilai_region_id,penilai_id,surveyor_id',
'penilai_region_id' => 'nullable|required_without_all:penilai_surveyor_id,surveyor_region_id,penilai_id,surveyor_id',
'keterangan' => 'nullable', 'keterangan' => 'nullable',
]; ];
} }

View File

@@ -70,7 +70,8 @@ class SurveyorRequest extends FormRequest
return match ($action) { return match ($action) {
'spek-bangunan' => [ 'spek-bangunan' => [
'spek_kategori_bangunan_id' => [ 'spek_kategori_bangunan_id' => [
'required' 'required',
], ],
], ],
// Add more action specific rules here // Add more action specific rules here

View File

@@ -17,7 +17,7 @@ class Penilaian extends Model
*/ */
protected $table = 'penilaian'; protected $table = 'penilaian';
protected $fillable = [ protected $fillable = [
'jenis_penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi', 'jenis_penilaian_id', 'penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi',
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by' 'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
]; ];
@@ -47,6 +47,4 @@ class Penilaian extends Model
{ {
return $this->belongsTo(Permohonan::class, 'nomor_registrasi', 'nomor_registrasi'); return $this->belongsTo(Permohonan::class, 'nomor_registrasi', 'nomor_registrasi');
} }
} }

View File

@@ -29,7 +29,7 @@ class PenilaianTeam extends Model
public function penilaian(){ public function penilaian(){
return $this->belongsTo(Penilaian::class, 'penilaian_id', 'id'); return $this->hasMany(Penilaian::class, 'penilaian_id', 'id');
} }
protected static function newFactory(): PenilaianTeamFactory protected static function newFactory(): PenilaianTeamFactory

View File

@@ -69,16 +69,28 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="py-3 max-w-[100px]"> <td class="py-3 max-w-[100px] align-top" >
Dokumen Jaminan Dokumen Jaminan
</td> </td>
<td class="py-3 text-gray-700 text-2sm font-normal"> <td class="py-3 text-gray-700 text-2sm font-normal">
@if(isset($detail->dokumen_jaminan)) @if(isset($detail->dokumen_jaminan))
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo'])) @php
<a href="{{ route('debitur.jaminan.download',['id'=>$permohonan->debiture->id,'dokumen'=>$detail->id]) }}" class="badge badge-sm badge-outline mt-2 badge-info"><i class="ki-filled ki-cloud-download mr-2"></i> Download</a> $dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
) @endif @endphp
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($detail->dokumen_jaminan) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span> @foreach($dokumen_jaminan as $index => $dokumen)
@if(in_array(Auth::user()->roles[0]->name,['administrator','pemohon-eo']))
<a href="{{ route('debitur.jaminan.download', ['id' => $permohonan->debiture->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
class="badge badge-sm badge-outline mt-2 mr-2">
{{ basename($dokumen) }}
<i class="ki-filled ki-cloud-download"></i>
</a>
@endif
<span class="badge badge-sm badge-outline badge-warning mt-2" onclick="viewPDF('{{ Storage::url($dokumen_jaminan[$index]) }}')"><i class="ki-filled ki-eye mr-2"></i>Preview</span>
<br>
@endforeach
@endif @endif
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@@ -158,10 +158,25 @@
Dokumen Jaminan Dokumen Jaminan
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input class="file-input" type="file" name="dokumen_jaminan[]" value=""> <div class="flex flex-col w-full gap-2" id="file-container-{{$n}}">
<div class="flex items-center gap-2">
<input class="file-input" type="file" name="dokumen_jaminan[{{ $n }}][]" multiple>
<button type="button" class="btn btn-primary w-[100px] text-center" onclick="addFileInput({{ $n }})">Add More</button>
</div>
<div id="additional-files-{{ $n }}"></div>
</div>
@if(isset($detail->dokumen_jaminan)) @if(isset($detail->dokumen_jaminan))
<a href="{{ route('debitur.jaminan.download',['id'=>$debitur->id,'dokumen'=>$detail->id]) }}" class="badge badge-sm badge-outline mt-2">{{ basename($detail->dokumen_jaminan) }} @php
<i class="ki-filled ki-cloud-download"></i></a> $dokumen_jaminan = is_array(json_decode($detail->dokumen_jaminan)) ? json_decode($detail->dokumen_jaminan) : [$detail->dokumen_jaminan];
@endphp
@foreach($dokumen_jaminan as $index => $dokumen)
<a href="{{ route('debitur.jaminan.download', ['id' => $debitur->id, 'dokumen' => $detail->id, 'index' => $index]) }}"
class="badge badge-sm badge-outline mt-2 mr-2">
{{ basename($dokumen) }}
<i class="ki-filled ki-cloud-download"></i>
</a>
@endforeach
@endif @endif
</div> </div>
</div> </div>
@@ -444,7 +459,7 @@
<script> <script>
function getLegalitasJaminan() { function getLegalitasJaminan() {
var legalitasJaminan = document.getElementById("jenis_jaminan_id").value; var legalitasJaminan = document.getElementById("jenis_jaminan_id").value;
var documentId = "{{ $document->id ?? "0" }}"; // Assuming you have access to the debitur ID in your Blade template var documentId = "{{ $document->id ?? "0" }}";
var debiturId = "{{ $debitur->id }}"; var debiturId = "{{ $debitur->id }}";
var url = `/basic-data/jenis-jaminan/legalitas/${documentId}/${legalitasJaminan}`; var url = `/basic-data/jenis-jaminan/legalitas/${documentId}/${legalitasJaminan}`;
fetch(url, { fetch(url, {
@@ -465,63 +480,114 @@
doctainer.innerHTML = ""; doctainer.innerHTML = "";
data.forEach((item, index) => { data.forEach((item, index) => {
doctainer.innerHTML += ` doctainer.innerHTML += `
<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">
<label class="form-label max-w-56 font-bold"> <label class="form-label max-w-56 font-bold">
${index + 1}. ${item.name} ${index + 1}. ${item.name}
</label> </label>
<input type="hidden" name="jenis_legalitas_jaminan_id[]" value="${item.jenis_legalitas_jaminan_id}"> <input type="hidden" name="jenis_legalitas_jaminan_id[]" value="${item.jenis_legalitas_jaminan_id}">
${item.is_existing ? `<input type="hidden" name="detail_dokumen_jaminan_id[]" value="${item.id}">` : ''} ${item.is_existing ? `<input type="hidden" name="detail_dokumen_jaminan_id[]" value="${item.id}">` : ''}
</div> </div>
<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">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Nama Dokumen Nama Dokumen
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="name[]" value="${item.name || ''}" placeholder="Nama Dokumen"> <input class="input" type="text" name="name[]" value="${item.name || ''}" placeholder="Nama Dokumen">
</div> </div>
</div> </div>
<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">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Dokumen Jaminan Dokumen Jaminan
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full" id="file-container-${index}">
<input class="file-input" type="file" name="dokumen_jaminan[]" value=""> ${item.dokumen_jaminan ? renderExistingFiles(item.dokumen_jaminan, debiturId, item.id) : ''}
${item.dokumen_jaminan ? ` <div class="flex items-center gap-2 my-2 w-full">
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${item.id}" class="badge badge-sm badge-outline mt-2"> <input class="file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
${item.dokumen_jaminan.split('/').pop()} <button type="button" class="btn btn-primary w-[100px] text-center" onclick="addFileInput(${index})">Add File</button>
<i class="ki-filled ki-cloud-download"></i> </div>
</a> </div>
</div>
${item.custom_field ? `
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 capitalize">
${item.custom_field.replace(/_/g, " ")}
</label>
<div class="flex flex-wrap items-baseline w-full">
${getCustomFieldInput(item.custom_field_type, item.custom_field, item.details)}
</div>
</div>
` : ''} ` : ''}
</div>
</div>
${item.custom_field ? ` <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"> <label class="form-label max-w-56">
<label class="form-label max-w-56 capitalize"> Keterangan
${item.custom_field.replace(/_/g, " ")} </label>
</label> <div class="flex flex-wrap items-baseline w-full">
<div class="flex flex-wrap items-baseline w-full"> <textarea class="textarea" rows="3" name="keterangan[]">${item.keterangan || ''}</textarea>
${getCustomFieldInput(item.custom_field_type, item.custom_field, item.details)} </div>
</div> </div>
</div> `;
` : ''}
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Keterangan
</label>
<div class="flex flex-wrap items-baseline w-full">
<textarea class="textarea" rows="3" name="keterangan[]">${item.keterangan || ''}</textarea>
</div>
</div>
`;
}); });
}) })
.catch(error => console.error('Error:', error)); .catch(error => console.error('Error:', error));
} }
function renderExistingFiles(dokumenJaminan, debiturId, itemId) {
if (typeof dokumenJaminan === 'string') {
return `
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}" class="badge badge-sm badge-outline mt-2 mr-2">
${dokumenJaminan.split('/').pop()}
<i class="ki-filled ki-cloud-download"></i>
</a>
`;
} else if (Array.isArray(dokumenJaminan)) {
return dokumenJaminan.map(file => `
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${encodeURIComponent(file)}" class="badge badge-sm badge-outline mt-2 mr-2">
${file.split('/').pop()}
<i class="ki-filled ki-cloud-download"></i>
</a>
`).join('');
}
return '';
}
function addFileInput(index) {
const container = document.getElementById(`file-container-${index}`);
const newInput = document.createElement('div');
newInput.className = 'flex items-center gap-2 mb-2 w-full';
newInput.innerHTML = `
<input class="file-input" type="file" name="dokumen_jaminan[${index}][]" multiple>
<button type="button" class="btn btn-danger w-[100px] text-center" onclick="removeFileInput(this)">Remove</button>
`;
container.appendChild(newInput);
}
function removeFileInput(button) {
button.closest('.flex.items-center.gap-2.mb-2').remove();
}
function renderExistingFiles(dokumenJaminan, debiturId, itemId) {
if (typeof dokumenJaminan === 'string') {
return `
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}" class="badge badge-sm badge-outline mt-2">
${dokumenJaminan.split('/').pop()}
<i class="ki-filled ki-cloud-download"></i>
</a>
`;
} else if (Array.isArray(dokumenJaminan)) {
return dokumenJaminan.map(file => `
<a href="/debitur/${debiturId}/jaminan/download?dokumen=${itemId}&file=${file}" class="badge badge-sm badge-outline mt-2 mr-2">
${file.split('/').pop()}
<i class="ki-filled ki-cloud-download"></i>
</a>
`).join('');
}
return '';
}
function getCustomFieldInput(type, fieldName, value) { function getCustomFieldInput(type, fieldName, value) {
value = value ? JSON.parse(value)[fieldName] || '' : ''; value = value ? JSON.parse(value)[fieldName] || '' : '';
switch (type) { switch (type) {

View File

@@ -553,7 +553,7 @@
} }
}); });
document.getElementById('penilaian_id').addEventListener('change', function() { document.getElementById('penilai_id').addEventListener('change', function() {
const selectedValue = this.value; const selectedValue = this.value;
const penilaiRegion = document.getElementById('penilaiRegion'); const penilaiRegion = document.getElementById('penilaiRegion');

View File

@@ -0,0 +1,232 @@
{{-- @if ($analisaType == 'tanah_bangunan') --}}
<div class=" bg-white rounded-lg shadow-md overflow-hidden">
<div class="y-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisa Bangunan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Luas Tanah</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
<label class="form-label flex items-center gap-3 text-nowrap">
<input type="radio" class="radio" name="luas_tanah_bagunan" value="sesuai"
{{ old('luas_tanah_bagunan') == 'sesuai' ? 'checked' : '' }}>
<span class="ml-2">Sesuai</span>
</label>
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input type="radio" class="radio" name="luas_tanah_bagunan" value="tidak sesuai"
{{ old('luas_tanah_bagunan') == 'tidak sesuai' ? 'checked' : '' }}>
<span class="ml-2">Tidak Sesuai</span>
</label>
</div>
@error('luas_tanah_bagunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Jenis Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Jenis Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('jenis_bangunan') border-danger bg-danger-light @enderror"
name="jenis_bangunan">
<option value="">Select Jenis Bangunan</option>
@if (isset($jenisBangunan))
@foreach ($jenisBangunan as $item)
<option value="{{ $item->name }}"
{{ old('jenis_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->jenis_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('jenis_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Kondisi Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Kondisi Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('kondisi_bangunan') border-danger bg-danger-light @enderror"
name="kondisi_bangunan">
<option value="">Select Kondisi Bangunan</option>
@if (isset($kondisiBangunan))
@foreach ($kondisiBangunan as $item)
<option value="{{ $item->name }}"
{{ old('kondisi_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->kondisi_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('kondisi_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Sifat Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> Sifat Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('sifat_bangunan') border-danger bg-danger-light @enderror"
name="sifat_bangunan">
<option value="">Select Sifat Bangunan</option>
@if (isset($sifatBangunan))
@foreach ($sifatBangunan as $item)
<option value="{{ $item->name }}"
{{ old('sifat_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->sifat_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('sifat_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Spek Bangunan -->
<div class="gap-2.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Spek Bangunan</label>
<div class="flex flex-wrap items-baseline w-full" id="spek-bangunan-container">
<div class="spek-bangunan w-full gap-4">
<input type="hidden" name="nama_bagunan[]" value="Bangunan">
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2 w-full">
@if (@isset($spekKategoriBagunan))
@foreach ($spekKategoriBagunan as $item)
<div>
<label
class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('name') border-danger bg-danger-light @enderror"
name="name[]">
<option value="">Select {{ $item->name }}</option>
@foreach ($spekBangunan as $spek)
@if ($spek->spek_kategori_bangunan_id == $item->id)
<option value="{{ $spek->name }}"
{{ old('name') == $spek->name ? 'selected' : '' }}>
{{ $spek->name }}
</option>
@endif
@endforeach
</select>
@error('name')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
<button type="button"
class="mt-2 btn btn-danger btn-outline btn-xs delete-button">Hapus</button>
</div>
</div>
</div>
<div class="flex justify-end">
<button class="btn btn-xs btn-primary" type="button" id="addBagunan">
tambah bangunan
<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>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('sarana_pelengkap') border-danger bg-danger-light @enderror"
name="sarana_pelengkap">
<option value="">Select Posisi Kavling</option>
@if (isset($saranaPelengkap))
@foreach ($saranaPelengkap as $item)
<option value="{{ $item->name }}"
{{ old('sarana_pelengkap', isset($analisa) && optional($analisa->analisaTanahBangunan)->sarana_pelengkap) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('sarana_pelengkap')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- @endif --}}
@push('scripts')
<script>
const spekBangunanContainer = document.getElementById('spek-bangunan-container');
function updateDeleteButtonsVisibility() {
const allDeleteButtons = spekBangunanContainer.querySelectorAll('.delete-button');
// Only show the delete buttons if there are more than one form
allDeleteButtons.forEach(button => {
if (spekBangunanContainer.querySelectorAll('.spek-bangunan').length > 1) {
button.style.display = 'inline-block';
} else {
button.style.display = 'none';
}
});
}
document.getElementById('addBagunan').addEventListener('click', function() {
const newDiv = spekBangunanContainer.querySelector('.spek-bangunan').cloneNode(true);
// Clear the selected values of the cloned input fields
newDiv.querySelectorAll('select').forEach(select => {
select.value = '';
});
// Append the cloned div to the container
spekBangunanContainer.appendChild(newDiv);
// Add event listener to the delete button in the cloned div
newDiv.querySelector('.delete-button').addEventListener('click', function() {
spekBangunanContainer.removeChild(newDiv);
updateDeleteButtonsVisibility();
});
// Update delete buttons visibility
updateDeleteButtonsVisibility();
});
// Initial delete button visibility
updateDeleteButtonsVisibility();
// Add delete functionality to the initial form
spekBangunanContainer.querySelectorAll('.delete-button').forEach(button => {
button.addEventListener('click', function() {
const spekBangunan = this.closest('.spek-bangunan');
// Make sure not to delete the last remaining form
if (spekBangunanContainer.querySelectorAll('.spek-bangunan').length > 1) {
spekBangunan.remove();
updateDeleteButtonsVisibility();
}
});
});
</script>
@endpush

View File

@@ -168,21 +168,32 @@
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') { if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
$analisaType = 'unit'; $analisaType = 'unit';
} }
@endphp @endphp
<input type="hidden" name="action" value="{{ $analisaType }}"> <input type="hidden" name="action" value="{{ $analisaType }}">
<input type="hidden" name="type" value="{{ $analisaType }}"> <input type="hidden" name="type" value="{{ $analisaType }}">
@if ($analisaType == 'tanah_bangunan') @if ($analisaType == 'tanah_bangunan')
@include('lpj::surveyor.components.tanah-bangunan') @include('lpj::surveyor.components.tanah')
@elseif($analisaType == 'unit') @elseif($analisaType == 'unit')
@include('lpj::surveyor.components.apartemen-kantor') @include('lpj::surveyor.components.apartemen-kantor')
@elseif($analisaType == 'kendaraan') @elseif($analisaType == 'alat-berat')
@include('lpj::surveyor.components.alat-berat') @include('lpj::surveyor.components.alat-berat')
@elseif($analisaType == 'mesin')
@include('lpj::surveyor.components.mesin')
@elseif($analisaType == 'kapal')
@include('lpj::surveyor.components.kapal')
@elseif($analisaType == 'kendaraan')
@include('lpj::surveyor.components.kendaraan')
@endif @endif
@if($analisaType == 'tanah_bangunan')
@include('lpj::surveyor.components.bangunan')
@endif
<div class=" bg-white rounded-lg shadow-md overflow-hidden"> @if ($analisaType != 'mesin' && $analisaType != 'kapal')
<div class=" bg-white rounded-lg overflow-hidden">
<div class=" text-white py-4 px-6"> <div class=" text-white py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisis Lingkungan</h1> <h1 class="text-md font-medium text-gray-900">Analisis Lingkungan</h1>
</div> </div>
@@ -450,8 +461,9 @@
</div> </div>
</div> </div>
</div> </div>
@endif
<div class=" bg-white rounded-lg shadow-md overflow-hidden"> <div class=" bg-white rounded-lg overflow-hidden">
<div class=" py-4 px-6"> <div class=" py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisis Fakta</h1> <h1 class="text-md font-medium text-gray-900">Analisis Fakta</h1>
</div> </div>
@@ -476,6 +488,7 @@
</div> </div>
</div> </div>
@if ($analisaType != 'mesin' && $analisaType != 'kapal')
<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">
<label class="form-label max-w-56">Rute Menuju</label> <label class="form-label max-w-56">Rute Menuju</label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
@@ -543,11 +556,14 @@
@enderror @enderror
</div> </div>
</div> </div>
@endif
</div> </div>
</div> </div>
<!-- Informasi Tata Ruang -->
@if ($analisaType != 'mesin' && $analisaType != 'kapal')
<div class=""> <div class="">
<!-- Header --> <!-- Header -->
<div class="py-4 px-6"> <div class="py-4 px-6">
@@ -700,7 +716,7 @@
value="{{ old('lat', isset($analisa->analisaFakta) ? $analisa->analisaFakta->lat : '') }}"> value="{{ old('lat', isset($analisa->analisaFakta) ? $analisa->analisaFakta->lat : '') }}">
<input type="hidden" name="lng" id="lng" <input type="hidden" name="lng" id="lng"
value="{{ old('lng', isset($analisa->analisaFakta) ? $analisa->analisaFakta->lng : '') }}"> value="{{ old('lng', isset($analisa->analisaFakta) ? $analisa->analisaFakta->lng : '') }}">
<div class="bg-info border p-6 rounded-lg shadow-lg flex items-center justify-center" <div class=" border p-6 rounded-lg shadow-lg flex items-center justify-center"
style="height: 300px"> style="height: 300px">
<iframe id="mapFrame" frameborder="0" style="width: 100%; height: 100%;"></iframe> <iframe id="mapFrame" frameborder="0" style="width: 100%; height: 100%;"></iframe>
</div> </div>
@@ -742,6 +758,7 @@
</div> </div>
</div> </div>
</div> </div>
@endif
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px"> <div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
<button type="submit" class="btn btn-success"> <button type="submit" class="btn btn-success">

View File

@@ -0,0 +1,488 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Identitas Debitur</h1>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Hubungan Calon Debitur</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Lokasi Jaminan</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Nama Jalan', 'index' => 0],
['label' => 'Perumahan/Gang', 'index' => 1],
['label' => 'Blok/Nomor', 'index' => 2],
['label' => 'Desa/Kelurahan', 'index' => 3],
['label' => 'Kecamatan', 'index' => 4],
['label' => 'Kota/Kotamadya', 'index' => 5],
['label' => 'Provinsi', 'index' => 6]
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Data Data Jaminan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Jenis</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Jenis</option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Size</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Size</option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Kondisi</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Jenis</option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Klasifikasi</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Jenis</option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@php
$inputDataJaminan = [];
$inputDataJaminan = [
['label' => 'Nama Kapal', 'index' => 0],
['label' => 'Pemilik Kapal', 'index' => 1],
['label' => 'Bendera', 'index' => 2],
['label' => 'Nomor Tanda Selar', 'index' => 3],
['label' => 'Kapal', 'index' => 4],
['label' => 'Galangan', 'index' => 5],
['label' => 'Kapal/Shipyard', 'index' => 6],
['label' => 'Tahun Pembuatan', 'index' => 7],
['label' => 'Tahun Lanuncing', 'index' => 8],
['label' => 'DWT (ton)', 'index' => 9],
['label' => 'LWT (ton)', 'index' => 10],
['label' => 'Gross Tonnage (ton)', 'index' => 11],
['label' => 'Net Tonnage (ton)', 'index' => 12],
['label' => 'Tenaga Mesin (HP)', 'index' => 13],
['label' => 'LOA', 'index' => 14],
['label' => 'LBP', 'index' => 15],
['label' => 'Beam', 'index' => 16],
['label' => 'Depth', 'index' => 17],
['label' => 'Draft', 'index' => 18],
];
@endphp
@if (count($inputDataJaminan) > 0)
@foreach ($inputDataJaminan as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
<div class="flex justify-end" style="margin-top: 10px">
<button class="btn btn-xs btn-primary" type="button" id="addBagunan">
tambah mesin
<i class="ki-filled ki-plus"></i>
</button>
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Struktur Kapal</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Lambung Kapal', 'index' => 0],
['label' => 'Dek', 'index' => 1],
['label' => 'Struktur Rangka', 'index' => 2],
['label' => 'Palka', 'index' => 3],
['label' => 'Pondasi Mesin', 'index' => 4],
['label' => 'Area Mesin', 'index' => 5],
['label' => 'Cat dan Korosi', 'index' => 6],
['label' => 'Sistem Pengelasan', 'index' => 7]
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- Peralatan Keselamatan --}}
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Peralatan Keselamatan</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Sekoci/Lifeboat', 'index' => 0],
['label' => 'Jaket Pelampung', 'index' => 1],
['label' => 'Alat Pemadam', 'index' => 2],
['label' => 'Rambu Darurat', 'index' => 3],
['label' => 'Sistem Alarm', 'index' => 4],
['label' => 'Sistem Pencegah', 'index' => 5],
['label' => 'Kebaran', 'index' => 6],
['label' => 'Lampu Darurat', 'index' => 7]
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- Sistwm Navigasi dan Komunikasi --}}
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Sistem Navigasi dan Komunikasi</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Gps', 'index' => 0],
['label' => 'Radat', 'index' => 1],
['label' => 'Radio Komunikasi', 'index' => 2],
['label' => 'Lampu Navigasi', 'index' => 3],
['label' => 'Sistem Kendali otomatis', 'index' => 4],
['label' => 'Kompas', 'index' => 5],
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- Sistwm Mesin dan Penggerak Kapal --}}
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Sistem Mesin dan Penggerak Kapal</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Mesin Utama', 'index' => 0],
['label' => 'Mesin Bantu', 'index' => 1],
['label' => 'Pompa Pendingin', 'index' => 2],
['label' => 'Sistem Pelumasan', 'index' => 3],
['label' => 'Propeller', 'index' => 4],
['label' => 'Sistem Kelistrikan', 'index' => 5],
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- Sistwm kelistrikan dan Elektronik --}}
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Sistem Kelistrikan dan Elektronik</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Lampu Navigasi', 'index' => 0],
['label' => 'Sistem Penerangan', 'index' => 1],
['label' => 'Sistem Panel Distribusi', 'index' => 2],
['label' => 'Kabel dan Perangkat Pendukung', 'index' => 3],
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
{{-- Linkungan dan Kebersihan Kapal --}}
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Linkungan dan Kebersihan Kapal</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Kebersihan Dek Luar', 'index' => 0],
['label' => 'Tangki Limbah', 'index' => 1],
['label' => 'Sistem Pengelolaan Limbah', 'index' => 2],
['label' => 'Pengelolaan Air Ballast', 'index' => 3],
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,160 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Order Penilaian</h1>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Tanggal Survey</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="date" name="tanggal_survey" class="input" placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Identitas Debitur</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Nama Wakil Debitur</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input" placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Hubungan Calon Debitur</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input" placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Lokasi Jaminan</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Nama Jalan', 'index' => 0],
['label' => 'Perumahan/Gang', 'index' => 1],
['label' => 'Blok/Nomor', 'index' => 2],
['label' => 'Desa/Kelurahan', 'index' => 3],
['label' => 'Kecamatan', 'index' => 4],
['label' => 'Kota/Kotamadya', 'index' => 5],
['label' => 'Provinsi', 'index' => 6],
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Data Data Jaminan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">BPKB</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="tanggal_survey" class="input" placeholder="BPKP">
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">STNK</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="tanggal_survey" class="input" placeholder="STNK">
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi kendaraan sesuai dokument</label>
<div class="flex flex-wrap items-baseline w-full">
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@php
$inputDataJaminan = [];
$inputDataJaminan = [
['label' => 'Tipe/Model', 'index' => 0],
['label' => 'Merek', 'index' => 1],
['label' => 'Tahun Pembuatan', 'index' => 2],
['label' => 'Negara Pembuat', 'index' => 3],
['label' => 'Kondisi Mesin', 'index' => 4],
];
@endphp
@if (count($inputDataJaminan) > 0)
@foreach ($inputDataJaminan as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,133 @@
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Identitas Debitur</h1>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Hubungan Calon Debitur</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan Hubungan Calon Debitur">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Lokasi Jaminan</h1>
</div>
<div class="grid gap-5">
@php
$inputDataLoaksi = [];
$inputDataLoaksi = [
['label' => 'Nama Jalan', 'index' => 0],
['label' => 'Perumahan/Gang', 'index' => 1],
['label' => 'Blok/Nomor', 'index' => 2],
['label' => 'Desa/Kelurahan', 'index' => 3],
['label' => 'Kecamatan', 'index' => 4],
['label' => 'Kota/Kotamadya', 'index' => 5],
['label' => 'Provinsi', 'index' => 6]
];
@endphp
@if (count($inputDataLoaksi) > 0)
@foreach ($inputDataLoaksi as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
</div>
<div class=""max-w-4xl mx-auto bg-white rounded-lg shadow-md overflow-hidden">
<div class="py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Data Data Jaminan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Model</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect w-full @error('hadapMataAngin') border-danger bg-danger-light @enderror"
name="hadapMataAngin">
<option value="">Select Model Kendaraan </option>
@if (isset($arahMataAngin))
@foreach ($arahMataAngin as $item)
<option value="{{ $item->name }}"
{{ old('hadapMataAngin') == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('hadapMataAngin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@php
$inputDataJaminan = [];
$inputDataJaminan = [
['label' => 'Tipe/Model', 'index' => 0],
['label' => 'Merek', 'index' => 1],
['label' => 'Tahun Pembuatan', 'index' => 2],
['label' => 'Negara Pembuat', 'index' => 3],
['label' => 'Kondisi Mesin', 'index' => 4],
];
@endphp
@if (count($inputDataJaminan) > 0)
@foreach ($inputDataJaminan as $item)
<!-- Nomor Lambung -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">{{ $item['label'] }}</label>
<div class="flex flex-wrap items-baseline w-full">
<input type="text" name="bentuk_tanah" class="input"
placeholder="Masukkan {{ $item['label'] }}">
@error('bentuk_tanah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Deskripsi/Keterangan Lain Lain </label>
<div class="flex flex-wrap items-baseline w-full">
<textarea name="deskripsi" id="" class="textarea"></textarea>
@error('deskripsi')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="flex justify-end" style="margin-top: 10px">
<button class="btn btn-xs btn-primary" type="button" id="addBagunan">
tambah mesin
<i class="ki-filled ki-plus"></i>
</button>
</div>
</div>

View File

@@ -246,235 +246,3 @@
</div> </div>
</div> </div>
@if ($analisaType == 'tanah_bangunan')
<div class=" bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-blue-600 text-white py-4 px-6">
<h1 class="text-md font-medium text-gray-900">Analisa Bangunan</h1>
</div>
<div class="grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Luas Tanah</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
<label class="form-label flex items-center gap-3 text-nowrap">
<input type="radio" class="radio" name="luas_tanah_bagunan" value="sesuai"
{{ old('luas_tanah_bagunan') == 'sesuai' ? 'checked' : '' }}>
<span class="ml-2">Sesuai</span>
</label>
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input type="radio" class="radio" name="luas_tanah_bagunan" value="tidak sesuai"
{{ old('luas_tanah_bagunan') == 'tidak sesuai' ? 'checked' : '' }}>
<span class="ml-2">Tidak Sesuai</span>
</label>
</div>
@error('luas_tanah_bagunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Jenis Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Jenis Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('jenis_bangunan') border-danger bg-danger-light @enderror"
name="jenis_bangunan">
<option value="">Select Jenis Bangunan</option>
@if (isset($jenisBangunan))
@foreach ($jenisBangunan as $item)
<option value="{{ $item->name }}"
{{ old('jenis_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->jenis_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('jenis_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Kondisi Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Kondisi Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('kondisi_bangunan') border-danger bg-danger-light @enderror"
name="kondisi_bangunan">
<option value="">Select Kondisi Bangunan</option>
@if (isset($kondisiBangunan))
@foreach ($kondisiBangunan as $item)
<option value="{{ $item->name }}"
{{ old('kondisi_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->kondisi_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('kondisi_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Sifat Bangunan -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> Sifat Bangunan</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('sifat_bangunan') border-danger bg-danger-light @enderror"
name="sifat_bangunan">
<option value="">Select Sifat Bangunan</option>
@if (isset($sifatBangunan))
@foreach ($sifatBangunan as $item)
<option value="{{ $item->name }}"
{{ old('sifat_bangunan', isset($analisa) && optional($analisa->analisaTanahBangunan)->sifat_bangunan) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('sifat_bangunan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<!-- Spek Bangunan -->
<div class="gap-2.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Spek Bangunan</label>
<div class="flex flex-wrap items-baseline w-full" id="spek-bangunan-container">
<div class="spek-bangunan w-full gap-4">
<input type="hidden" name="nama_bagunan[]" value="Bangunan">
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2 w-full">
@if (@isset($spekKategoriBagunan))
@foreach ($spekKategoriBagunan as $item)
<div>
<label
class="form-label flex items-center gap-3 text-nowrap">{{ $item->name }}</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('name') border-danger bg-danger-light @enderror"
name="name[]">
<option value="">Select {{ $item->name }}</option>
@foreach ($spekBangunan as $spek)
@if ($spek->spek_kategori_bangunan_id == $item->id)
<option value="{{ $spek->name }}"
{{ old('name') == $spek->name ? 'selected' : '' }}>
{{ $spek->name }}
</option>
@endif
@endforeach
</select>
@error('name')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endforeach
@endif
</div>
<button type="button"
class="mt-2 btn btn-danger btn-outline btn-xs delete-button">Hapus</button>
</div>
</div>
</div>
<div class="flex justify-end">
<button class="btn btn-xs btn-primary" type="button" id="addBagunan">
tambah bangunan
<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>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('sarana_pelengkap') border-danger bg-danger-light @enderror"
name="sarana_pelengkap">
<option value="">Select Posisi Kavling</option>
@if (isset($saranaPelengkap))
@foreach ($saranaPelengkap as $item)
<option value="{{ $item->name }}"
{{ old('sarana_pelengkap', isset($analisa) && optional($analisa->analisaTanahBangunan)->sarana_pelengkap) == $item->name ? 'selected' : '' }}>{{ $item->name }}
</option>
@endforeach
@endif
</select>
@error('sarana_pelengkap')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
</div>
@endif
@push('scripts')
<script>
const spekBangunanContainer = document.getElementById('spek-bangunan-container');
function updateDeleteButtonsVisibility() {
const allDeleteButtons = spekBangunanContainer.querySelectorAll('.delete-button');
// Only show the delete buttons if there are more than one form
allDeleteButtons.forEach(button => {
if (spekBangunanContainer.querySelectorAll('.spek-bangunan').length > 1) {
button.style.display = 'inline-block';
} else {
button.style.display = 'none';
}
});
}
document.getElementById('addBagunan').addEventListener('click', function() {
const newDiv = spekBangunanContainer.querySelector('.spek-bangunan').cloneNode(true);
// Clear the selected values of the cloned input fields
newDiv.querySelectorAll('select').forEach(select => {
select.value = '';
});
// Append the cloned div to the container
spekBangunanContainer.appendChild(newDiv);
// Add event listener to the delete button in the cloned div
newDiv.querySelector('.delete-button').addEventListener('click', function() {
spekBangunanContainer.removeChild(newDiv);
updateDeleteButtonsVisibility();
});
// Update delete buttons visibility
updateDeleteButtonsVisibility();
});
// Initial delete button visibility
updateDeleteButtonsVisibility();
// Add delete functionality to the initial form
spekBangunanContainer.querySelectorAll('.delete-button').forEach(button => {
button.addEventListener('click', function() {
const spekBangunan = this.closest('.spek-bangunan');
// Make sure not to delete the last remaining form
if (spekBangunanContainer.querySelectorAll('.spek-bangunan').length > 1) {
spekBangunan.remove();
updateDeleteButtonsVisibility();
}
});
});
</script>
@endpush

View File

@@ -232,9 +232,6 @@
title: 'Action', title: 'Action',
render: (item, data) => ` render: (item, data) => `
<div class="flex flex-nowrap justify-center"> <div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-icon btn-clear btn-info" data-modal-toggle="#modal_revisi" >
<i class="ki-outline ki-notepad-edit"></i>
</a>
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="surveyor/${data.id}/show?form=inspeksi"> <a class="btn btn-sm btn-icon btn-clear btn-warning" href="surveyor/${data.id}/show?form=inspeksi">
<i class="ki-outline ki-eye"></i> <i class="ki-outline ki-eye"></i>
</a> </a>

View File

@@ -61,14 +61,14 @@
class="input tomselect w-full @error('regions_id') border-danger bg-danger-light @enderror" class="input tomselect w-full @error('regions_id') border-danger bg-danger-light @enderror"
name="regions_id"> name="regions_id">
<option value="">Select Region</option> <option value="">Select Region</option>
@if (isset($region)) @if (isset($regions))
@foreach ($region as $regions) @foreach ($regions as $region)
@if (isset($teams)) @if (isset($teams))
<option value="{{ $regions->id }}" <option value="{{ $region->id }}"
{{ $teams->regions_id == $regions->id ? 'selected' : '' }}> {{ $teams->regions_id == $region->id ? 'selected' : '' }}>
{{ $regions->name }}</option> {{ $region->name }}</option>
@else @else
<option value="{{ $regions->id }}">{{ $regions->name }}</option> <option value="{{ $region->id }}">{{ $region->name }}</option>
@endif @endif
@endforeach @endforeach
@endif @endif

View File

@@ -424,6 +424,7 @@ Route::middleware(['auth'])->group(function () {
Route::get('restore/{id}', [ActivityController::class, 'restore'])->name('restore'); Route::get('restore/{id}', [ActivityController::class, 'restore'])->name('restore');
Route::get('datatables', [ActivityController::class, 'dataForDatatables'])->name('datatables'); Route::get('datatables', [ActivityController::class, 'dataForDatatables'])->name('datatables');
Route::get('export', [ActivityController::class, 'export'])->name('export'); Route::get('export', [ActivityController::class, 'export'])->name('export');
Route::get('/', [ActivityController::class, 'index'])->name('index'); Route::get('/', [ActivityController::class, 'index'])->name('index');
Route::get('/{id}/show', [ActivityController::class, 'show'])->name('show'); Route::get('/{id}/show', [ActivityController::class, 'show'])->name('show');