update form data surveyor

This commit is contained in:
majid
2024-11-13 22:12:51 +07:00
parent 8e9e5e4843
commit 947cccfeac
21 changed files with 1518 additions and 1510 deletions

View File

@@ -171,6 +171,10 @@
// Get the total count of records
$totalRecords = $query->count();
$size = $request->get('size', 10);
if ($size == 0) {
$size = 10;
}
// Apply pagination if provided
if ($request->has('page') && $request->has('size')) {
@@ -185,13 +189,13 @@
$filteredRecords = $query->count();
// Get the data for the current page
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian','penilaian'])->get();
// Calculate the page count
$pageCount = ceil($totalRecords / $request->get('size'));
$pageCount = ceil($totalRecords / $size);
// Calculate the current page number
$currentPage = 0 + 1;
$currentPage = max(1, $request->get('page', 1));
// Return the response data as a JSON object
return response()->json([

File diff suppressed because it is too large Load Diff

View File

@@ -19,75 +19,50 @@ class FormSurveyorRequest extends FormRequest
*/
public function rules(): array
{
$commonRules = $this->getBangunanRules();
$actionSpecificRules = $this->getActionSpecificRules();
return array_merge($commonRules, $actionSpecificRules);
return $actionSpecificRules;
}
/**
* Get common rules that apply to all actions.
*/
private function getCommonRules(): array
{
return [
'fakta_positif' => 'nullable|array',
'fakta_negatif' => 'nullable|array',
'rute_menuju' => 'nullable',
'batas_batas' => 'nullable|array',
'kondisi_linkungan' => 'nullable|array',
'kondisi_lain_bangunan' => 'nullable|array',
'informasi_dokument' => 'nullable',
'peruntukan' => 'nullable',
'kdb' => 'nullable',
'kdh' => 'nullable',
'gsb' => 'nullable',
'max_lantai' => 'nullable',
'klb' => 'nullable',
'gss' => 'nullable',
'pelebaran_jalan' => 'nullable',
'nama_petugas' => 'nullable',
'lat' => 'nullable|numeric',
'lng' => 'nullable|numeric',
'foto_gistaru' => 'nullable',
'foto_bhumi' => 'nullable',
'foto_argis_region' => 'nullable',
'foto_tempat' => 'nullable',
'keterangan' => 'nullable',
];
}
/**
* Get rules specific to the action.
*/
private function getActionSpecificRules(): array
{
$action = $this->input('action');
$pisah = explode(',', $action);
switch ($action) {
case 'tanah':
return $this->getTanahRules();
case 'unit':
return $this->getUnitRules();
case 'kapal':
return $this->getUnitRules();
case 'kendaraan':
return $this->getUnitRules();
case 'mesin':
return $this->getUnitRules();
case 'bangunan':
return $this->getTanahBangunanRules();
case 'tanah_bangunan':
return array_merge($this->getAssetDescriptionRules(),$this->getTanahRules(), $this->getBangunanRules(), $this->getLinkunganRules(), $this->getCommonRules());
$allRules = [
'tanah' => $this->getTanahRules(),
'bangunan' => $this->getBangunanRules(),
'kapal' => $this->getKapalRules(),
'kendaraan' => $this->getKendaraanRules(),
'mesin' => $this->getMesinRules(),
'pesawat' => $this->getLinkunganRules(),
'alat-berat' => $this->getLinkunganRules(),
'apartemen-kantor' => $this->getUnitRules(),
'lingkungan' => $this->getLinkunganRules(),
'fakta' => $this->getCommonRules(),
];
case 'alat-berat':
return $this->getUnitRules();
default:
return [];
$rules = [];
$hasAssetDescriptionRules = false;
foreach ($pisah as $act) {
if (isset($allRules[$act])) {
$rules = array_merge($rules, $allRules[$act]);
if ($act == 'tanah' || $act == 'bangunan') {
$hasAssetDescriptionRules = true;
}
}
}
if ($hasAssetDescriptionRules) {
$rules = array_merge($rules, $this->getAssetDescriptionRules());
}
return $rules;
}
/**
* Get rules specific to tanah action.
*/
@@ -164,7 +139,7 @@ class FormSurveyorRequest extends FormRequest
'jarak_cbd_point' => 'nullable',
'nama_cbd_point' => 'nullable',
'lebar_perkerasan_jalan' => 'nullable',
'perkerasan_jalan' => 'nullable',
'perkerasan_jalan.*' => 'nullable',
'lalu_lintas' => 'nullable',
'gol_mas_sekitar' => 'nullable',
'tingkat_keramaian' => 'nullable',
@@ -223,7 +198,7 @@ class FormSurveyorRequest extends FormRequest
private function getAssetDescriptionRules(): array
{
{
return [
'permohonan_id' => 'required',
'type' => 'required',
@@ -240,7 +215,40 @@ class FormSurveyorRequest extends FormRequest
'kordinat_lng' => 'nullable',
'kordinat_lat' => 'nullable',
];
}
}
/**
* Get common rules that apply to all actions.
*/
private function getCommonRules(): array
{
return [
'fakta_positif' => 'nullable|array',
'fakta_negatif' => 'nullable|array',
'rute_menuju' => 'nullable',
'batas_batas' => 'nullable|array',
'kondisi_lingkungan' => 'nullable|array',
'kondisi_lain_bangunan' => 'nullable|array',
'informasi_dokument' => 'nullable',
'peruntukan' => 'nullable',
'kdb' => 'nullable',
'kdh' => 'nullable',
'gsb' => 'nullable',
'max_lantai' => 'nullable',
'klb' => 'nullable',
'gss' => 'nullable',
'pelebaran_jalan' => 'nullable',
'nama_petugas' => 'nullable',
'lat' => 'nullable|numeric',
'lng' => 'nullable|numeric',
'foto_gistaru' => 'nullable',
'foto_bhumi' => 'nullable',
'foto_argis_region' => 'nullable',
'foto_tempat' => 'nullable',
'keterangan' => 'nullable',
];
}
}

View File

@@ -19,6 +19,7 @@
'name' => 'required|max:255',
'slug' => 'required|max:255',
'jenis_legalitas_jaminan_id' => 'nullable',
'form_kategori.*' => 'required',
];
}

View File

@@ -5,5 +5,5 @@ namespace Modules\Lpj\Models;
class JenisJaminan extends Base
{
protected $table = 'jenis_jaminan';
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id'];
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id', 'form_kategori'];
}

View File

@@ -19,7 +19,7 @@ class Penilaian extends Model
protected $fillable = [
'jenis_penilaian_id', 'penilaian_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi',
'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','waktu_penilaian', 'deskripsi_penilaian'
];
public function jenis_penilaian()

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('jenis_jaminan', function (Blueprint $table) {
$table->json('form_kategori')->after('slug')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('jenis_jaminan', function (Blueprint $table) {
$table->dropColumn('form_kategori');
});
}
};

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('penilaian', function (Blueprint $table) {
$table->datetime('waktu_penilaian')->nullable();
$table->text('deskripsi_penilaian')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('penilaian', function (Blueprint $table) {
$table->dropColumn('waktu_penilaian');
$table->dropColumn('deskripsi_penilaian');
});
}
};

View File

@@ -66,6 +66,28 @@
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Form Kategori</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('form_kategori') border-danger bg-danger-light @enderror select2"
name="form_kategori[]" multiple="multiple">
<option value="">Pilih Form</option>
@foreach (['tanah', 'bangunan', 'kapal', 'kendaraan', 'mesin', 'pesawat', 'alat-berat', 'apartemen-kantor','lingkungan', 'fakta'] as $item)
<option value="{{ $item }}"
@if (isset($jenisJaminan->form_kategori) && in_array($item, json_decode($jenisJaminan->form_kategori, true))) {{ 'selected' }} @endif>
{{ $item }}
</option>
@endforeach
</select>
@error('form_kategori')
<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">
Jenis Legalitas Jaminan

View File

@@ -162,7 +162,7 @@
debitur_id: {
title: 'Debitur',
render: (item, data) => {
if(data.debiture) {
if (data.debiture) {
return `${data.debiture.name}`;
}
return "-";
@@ -183,13 +183,25 @@
actions: {
title: 'Actions',
render: (item, data) => {
var actionHtml = `
<div class="flex flex-nowrap justify-center gap-1.5">`;
if(data.status !== 'order'){
actionHtml += `<a class="btn btn-sm btn-outline btn-success" href="permohonan/${data.id}">
<i class="ki-filled ki-document"></i>
</a>`;
let actionHtml = `<div class="flex flex-nowrap justify-center gap-1.5">`;
if (data && data.penilaian && data.penilaian.waktu_penilaian !== null && data.status !==
'done') {
actionHtml += `
<a class="btn btn-sm btn-outline btn-primary" href="surveyor/storeAproved/${data.penilaian.id}">
<i class="ki-filled ki-calendar-edit"></i>
</a>
`;
}
if (data.status !== 'order') {
actionHtml += `
<a class="btn btn-sm btn-outline btn-success" href="permohonan/${data.id}">
<i class="ki-filled ki-document"></i>
</a>
`;
}
actionHtml += `
<a class="btn btn-sm btn-outline btn-info" href="permohonan/${data.id}/edit">
<i class="ki-outline ki-notepad-edit"></i>
@@ -214,3 +226,4 @@
});
</script>
@endpush

View File

@@ -1,4 +1,3 @@
<div class="card w-full bg-white rounded-lg shadow-md overflow-hidden">
<div class="card-body">
<div class="">
@@ -34,10 +33,8 @@
@foreach ($jenisBangunan as $item)
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="jenis_bangunan[]" type="checkbox"
value="{{ $item->name }}" {{
old('jenis_bangunan') == $item->name || isset($forminspeksi['jenis_bangunan']) == $item->name ? 'checked' : ''
}}/>
value="{{ $item->name }}"
{{ old('jenis_bangunan') == $item->name || isset($forminspeksi['jenis_bangunan']) == $item->name ? 'checked' : '' }} />
{{ $item->name }}
</label>
@if (strcasecmp($item->name, 'lainnya') == 0)
@@ -47,8 +44,8 @@
value="{{ $item->name }}" />
{{ $item->name }}
</label>
<input type="text" name="jenis_bangunan" class="input mt-2" id="bentukTanahInput"
placeholder="Masukkan Jenis Bangunan...">
<input type="text" name="jenis_bangunan" class="input mt-2"
id="bentukTanahInput" placeholder="Masukkan Jenis Bangunan...">
</div>
@endif
@endforeach
@@ -69,18 +66,20 @@
@foreach ($kondisiBangunan as $item)
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="kondisi_bangunan[]" type="checkbox"
value="{{ $item->name }}" {{ in_array($item->name, old('kondisi_bangunan', $forminspeksi['kondisi_bangunan'] ?? [])) ? 'checked' : '' }} />
value="{{ $item->name }}"
{{ in_array($item->name, old('kondisi_bangunan', $forminspeksi['kondisi_bangunan'] ?? [])) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@if (strcasecmp($item->name, 'lainnya') == 0)
<div class="flex items-center">
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="kondisi_bangunan[]" type="checkbox"
value="{{ $item->name }}" {{ in_array($item->name, old('kondisi_bangunan', $forminspeksi['kondisi_bangunan'] ?? [])) ? 'checked' : '' }} />
value="{{ $item->name }}"
{{ in_array($item->name, old('kondisi_bangunan', $forminspeksi['kondisi_bangunan'] ?? [])) ? 'checked' : '' }} />
{{ $item->name }}
</label>
<input type="text" name="kondisi_bangunan_lainnya" class="input mt-2" id="bentukTanahInput"
placeholder="Masukkan Kondisi Bangunan..."
<input type="text" name="kondisi_bangunan_lainnya" class="input mt-2"
id="bentukTanahInput" placeholder="Masukkan Kondisi Bangunan..."
value="{{ old('kondisi_bangunan_lainnya', $forminspeksi['kondisi_bangunan_lainnya'] ?? '') }}">
</div>
@endif
@@ -101,11 +100,12 @@
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
<input class="checkbox" name="sifat_bangunan[]" type="checkbox"
value="{{ $item->name }}" {{ in_array($item->name, old('sifat_bangunan', $forminspeksi['sifat_bangunan'] ?? [])) ? 'checked' : '' }} />
value="{{ $item->name }}"
{{ in_array($item->name, old('sifat_bangunan', $forminspeksi['sifat_bangunan'] ?? [])) ? 'checked' : '' }} />
{{ $item->name }}
</label>
<input type="text" name="sifat_bangunan_input[]" class="input w-full" id="sifat_bangunan"
placeholder="Masukkan {{ $item->name }}..."
<input type="text" name="sifat_bangunan_input[]" class="input w-full"
id="sifat_bangunan" placeholder="Masukkan {{ $item->name }}..."
value="{{ old('sifat_bangunan_input.' . $loop->index, $forminspeksi['sifat_bangunan_input'][$loop->index] ?? '') }}">
</div>
@endforeach
@@ -128,7 +128,8 @@
@if (@isset($spekKategoriBagunan))
@foreach ($spekKategoriBagunan 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">
@@ -136,7 +137,8 @@
@foreach ($spekBangunan as $spek)
@if ($spek->spek_kategori_bangunan_id == $item->id)
<label class="form-label flex items-center gap-2.5">
<input class="checkbox" name="spek_bangunan_{{ $item->name }}[]"
<input class="checkbox"
name="spek_bangunan_{{ $item->name }}[]"
type="checkbox" value="{{ $spek->name }}" />
{{ $spek->name }}
</label>
@@ -144,7 +146,8 @@
@endforeach
</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
@@ -175,11 +178,12 @@
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 gap-2.5" style="width: 500px">
<input class="checkbox" name="sarana_pelengkap[]" type="checkbox"
value="{{ $item->name }}" {{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
value="{{ $item->name }}"
{{ in_array($item->name, old('sarana_pelengkap', $forminspeksi['sarana_pelengkap'] ?? [])) ? 'checked' : '' }} />
{{ $item->name }}
</label>
<input type="text" name="sarana_pelengkap_input[]" class="input w-full" id="bentukTanahInput"
placeholder="Masukkan {{ $item->name }}..."
<input type="text" name="sarana_pelengkap_input[]" class="input w-full"
id="bentukTanahInput" placeholder="Masukkan {{ $item->name }}..."
value="{{ old('sarana_pelengkap_input.' . $loop->index, $forminspeksi['sarana_pelengkap_input'][$loop->index] ?? '') }}">
</div>
@endforeach
@@ -188,8 +192,9 @@
<em id="error-sarana_pelengkap" class="alert text-danger text-sm"></em>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
const spekBangunanContainer = document.getElementById('spek-bangunan-container');

View File

@@ -1,122 +1,5 @@
<div class="grid grid-cols-1 lg:grid-cols-2 gap-5 lg:gap-7.5">
@foreach ($permohonan->debiture->documents as $dokumen)
@php
$jenisAnalisa = null;
$perbandingan = null;
if (request()->has('form') && request('form') === 'denah' && isset($denah)) {
$denahIds = [];
$permohonaDenahId = [];
foreach ($denah as $item) {
$denahIds[] = $item->jenis_jaminan_id;
$permohonaDenahId[] = $item->permohonan_id;
}
$perbandingan =
in_array($dokumen->jenisJaminan->id, $denahIds) && in_array($permohonan->id, $permohonaDenahId);
} elseif (request()->has('form') && request('form') === 'foto' && isset($fotojaminan)) {
$fotoIds = [];
$permohonanFotoId = [];
foreach ($fotojaminan as $item) {
$fotoIds[] = $item->jenis_jaminan_id;
$permohonanFotoId[] = $item->permohonan_id;
}
} elseif (request()->has('form') && request('form') === 'inspeksi' && isset($analisa)) {
$jenisIds = [];
foreach ($analisa as $item) {
$jenisIds[] = $item->jenis_jaminan_id;
}
}
@endphp
@if ($perbandingan)
<div class="card flex flex-col gap-5 p-5 lg:p-7.5">
<div class="flex items-center flex-wrap justify-between gap-1">
<div class="flex items-center gap-2.5">
<div class="relative size-[44px] shrink-0">
<svg class="w-full h-full stroke-primary-clarity fill-primary-light" fill="none"
height="48" viewBox="0 0 44 48" width="44" xmlns="http://www.w3.org/2000/svg">
<path
d="M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506 18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937 39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z"
fill=""></path>
<path
d="M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506 18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937 39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z"
stroke=""></path>
</svg>
<div class="absolute leading-none left-2/4 top-2/4 -translate-y-2/4 -translate-x-2/4">
<i class="ki-filled ki-add-files text-1.5xl text-primary"></i>
</div>
</div>
</div>
<div class="menu inline-flex" data-menu="true">
<div class="flex flex-nowrap justify-center gap-1.5">
@php
$formTypes = [
'denah' => [
'model' => $denah,
'route' => 'surveyor.denah',
'update' => 'update-denah',
],
'foto' => [
'model' => $fotojaminan,
'route' => 'surveyor.foto',
'update' => 'update-foto',
],
'inspeksi' => [
'model' => $analisa,
'route' => 'surveyor.inspeksi',
'update' => 'update-inspeksi',
],
];
$currentForm = request('form');
$formConfig = $formTypes[$currentForm] ?? null;
@endphp
@if ($formConfig && isset($formConfig['model']))
<a href="{{ route($formConfig['route'], ['id' => $permohonan->id, 'jaminanId' => $dokumen->jenisJaminan->id]) }}?form={{ $formConfig['update'] }}&{{ $currentForm }}={{ $permohonan->id }}&jenis_jaminan={{ $dokumen->jenisJaminan->id }}"
class="btn btn-sm btn-icon btn-outline btn-info">
<i class="ki-outline ki-notepad-edit"></i>
</a>
@endif
{{-- <a class="delete btn btn-sm btn-icon btn-outline btn-danger">
<i class="ki-outline ki-trash"></i>
</a> --}}
</div>
</div>
</div>
<div class="grid">
{{-- Display your analisa data here --}}
<div class="flex items-center justify-between flex-wrap mb-3.5 gap-2"><span
class="text-2xs text-gray-600uppercase">Tipe Analisa</span>
<p class="text-2xs text-gray-600 text-right max-w-[250px]">
{{-- {{ $analisa->type }} --}}
</p>
</div>
{{-- Add more fields as needed --}}
{{-- @endif
@if ($analisa->analisaLingkungan) --}}
<div class="border-t border-gray-300 border-dashed"></div>
<div class="flex items-start justify-between flex-wrap my-2.5 gap-2">
<span class="text-2xs text-gray-600 uppercase">Analisa Lingkungan</span>
<p class="text-2xs text-gray-600 text-right max-w-[250px]">
{{-- Display relevant analisaLingkungan data --}}
</p>
</div>
{{-- @endif --}}
{{-- @if ($analisa->analisaFakta) --}}
<div class="border-t border-gray-300 border-dashed"></div>
<div class="flex items-start justify-between flex-wrap my-2.5 gap-2">
<span class="text-2xs text-gray-600 uppercase">Analisa Fakta</span>
<p class="text-2xs text-gray-600 text-right max-w-[250px]">{{-- Display relevant analisaFakta data --}}
</p>
</div>
{{-- @endif --}}
</div>
</div>
@else
@if (request()->has('form') && request('form') === 'denah')
<a class="card border-2 border-dashed border-brand-clarity bg-center bg-[length:600px] bg-no-repeat add-new-bg"
href="{{ route('surveyor.denah', ['id' => $permohonan->id, 'jaminanId' => $dokumen->jenisJaminan->id]) }}?form=create-denah&denah={{ $permohonan->id }}&jenis_jaminan={{ $dokumen->jenisJaminan->id }}">
@@ -148,16 +31,44 @@
</div>
<div class="flex flex-col text-center">
<span class="text-lg font-semibold text-gray-900 hover:text-primary-active mb-px">
Tambah {{ request('form') }}
@php
$formType = request()->input('form');
$formData = null;
$formAction = 'Tambah';
@endphp
@if ($formType === 'inspeksi')
@php
$formData = $forminspeksi ?? null;
@endphp
@elseif ($formType === 'foto')
@php
$formData = $formFoto ?? null;
@endphp
@elseif ($formType === 'denah')
@php
$formData = $formDenah ?? null;
@endphp
@endif
@if ($formData)
@php
$formAction = 'Update';
@endphp
@endif
{{ $formAction }}
{{ request('form') }}
</span>
<span class="text-2sm font-normal text-gray-600">
Inspeksi {{ $dokumen->jenisJaminan->name ?? '' }}
{{ $dokumen->jenisJaminan->name ?? '' }}
</span>
</div>
</div>
</div>
</a>
@endif
@endforeach
</div>

View File

@@ -23,7 +23,8 @@
@foreach ($permohonan->debiture->documents as $dokumen)
<div class="accordion-item [&:not(:last-child)]:border-b border-b-gray-200"
data-accordion-item="true" id="accordion_1_item_1">
<button class="accordion-toggle py-4 group mx-8" data-accordion-toggle="#accoordion_detail_jaminan_{{ $loop->index }}">
<button class="accordion-toggle py-4 group mx-8"
data-accordion-toggle="#accoordion_detail_jaminan_{{ $loop->index }}">
<span class="text-base text-gray-900 font-medium">
Jaminan {{ $loop->index + 1 }}
</span>
@@ -117,9 +118,8 @@
<div class="card">
<div class="card-body">
<form
action="{{ isset($debitur->id) ? route('debitur.update', $debitur->id) : route('surveyor.storeDenah') }}"
method="POST" class="grid gap-5" enctype="multipart/form-data">
<form id="formDenah" method="POST" class="grid gap-5" enctype="multipart/form-data">
@if (isset($debitur->id))
<input type="hidden" name="id" value="{{ $debitur->id }}">
@method('PUT')
@@ -138,14 +138,23 @@
<label class="form-label max-w-56">
<span class="form-label">Upload Denah</span>
</label>
<div class="w-full grid gap-5">
<img id="foto_denah"
src="{{ isset($formFoto['foto_denah']) ? asset('storage/' . old('foto_denah', $formFoto['foto_denah'])) : '#' }}"
alt="Gambar foto_denah" style="width: 30rem;">
<div class="input-group w-full flex gap-2">
<input type="file"
value="{{ old('foto_denah', isset($denah->foto_denah) ? $denah->foto_denah : '') }}"
name="foto_denah" class="file-input file-input-bordered w-full " accept="image/*">
value="{{ old('foto_denah', isset($formDenah['foto_denah']) ? $formDenah['foto_denah'] : '') }}"
name="foto_denah" class="file-input file-input-bordered w-full "
accept="image/*">
</div>
</div>
@error('foto_denah')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<em id="error-foto_denah" class="alert text-danger text-sm"></em>
</div>
</div>
@@ -160,7 +169,7 @@
<span class="form-label">Masukkan total luas tanah</span>
</label>
<input type="text" name="luas" class="input w-full "
value="{{ old('luas', isset($denah->luas) ? $denah->luas : '') }}">
value="{{ old('luas', isset($formDenah['luas']) ? $formDenah['luas'] : '') }}">
</div>
</div>
@@ -170,15 +179,70 @@
</div>
</div>
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
<button type="submit" class="btn btn-success">
Save
<button type="button" class="btn btn-success" id="saveButton" onclick="submitDenah()">
<span id="saveButtonText">Save</span>
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
id="saveButtonSpinner">
<span class="visually-hidden">Loading...</span>
</div>
</button>
</div>
</form>
</div>
</div>
</div>
@endsection
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
function submitDenah() {
const formElement = $('#formDenah')[0];
const formData = new FormData(formElement);
// Disable the button and show the spinner
$('#saveButton').prop('disabled', true);
$('#saveButtonText').hide();
$('#saveButtonSpinner').show();
$.ajax({
url: '{{ route('surveyor.storeDenah') }}',
type: 'POST',
data: formData,
processData: false,
contentType: false,
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
success: function(response) {
if (response.success) {
window.location.href =
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=denah';
}
console.log(response);
},
error: function(xhr, status, error) {
let errors = xhr.responseJSON?.errors;
$('.alert').text('');
if (errors) {
$.each(errors, function(key, value) {
$(`#error-${key}`).text(value[0]);
});
}
console.error('Terjadi error:', error); // Menampilkan pesan error di konsol
console.log('Status:', status);
console.log('Response:', xhr.responseText);
console.log(errors);
},
complete: function() {
// Re-enable the button and hide the spinner
$('#saveButton').prop('disabled', false);
$('#saveButtonText').show();
$('#saveButtonSpinner').hide();
}
});
}
</script>
@endpush

View File

@@ -28,7 +28,7 @@
</button>
</div>
@if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat')
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Rute Menuju</label>
<div class="flex flex-wrap items-baseline w-full">
@@ -84,9 +84,9 @@
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Kondisi lain terkait lingkungan</label>
<div class="flex flex-wrap items-baseline w-full">
<textarea class="textarea mt-2" name="kondisi_linkungan[]" rows="3">{{ old('kondisi_linkungan.0', $forminspeksi['kondisi_linkungan'][0] ?? '') }}</textarea>
<textarea class="textarea mt-2" name="kondisi_lingkungan[]" rows="3">{{ old('kondisi_lingkungan.0', $forminspeksi['kondisi_lingkungan'][0] ?? '') }}</textarea>
<em id="error-kondisi_linkungan" class="alert text-danger text-sm"></em>
<em id="error-kondisi_lingkungan" class="alert text-danger text-sm"></em>
</div>
<button class="btn btn-primary btn-sm mt-5 ">
@@ -121,14 +121,14 @@
<i class="ki-outline ki-plus"></i>
</button>
</div>
@endif
</div>
</div>
</div>
<!-- Informasi Tata Ruang -->
@if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat')
<div class="card w-full bg-white">
<div class="card-body">
<div class="py-4">
@@ -315,6 +315,7 @@
<div class="w-full">
<input id="foto_tempat" type="file" name="foto_tempat"
class="file-input file-input-bordered w-full" accept="image/*"
onchange="previewImage(this, 'argis-region-preview')">
<img id="argis-region-preview"
@@ -335,7 +336,7 @@
</div>
</div>
</div>
@endif
<script>
function previewImage(input, previewId) {
if (input.files && input.files[0]) {

View File

@@ -83,48 +83,30 @@
{{-- <div class="card">
<div class="card-body"> --}}
<form id="formFoto" method="POST" class="grid gap-5" enctype="multipart/form-data">
@if (isset($fotoJaminan->id))
<input type="hidden" name="id" value="{{ $fotoJaminan->id }}">
@method('PUT')
@endif
@csrf
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
@foreach ($permohonan->debiture->documents as $dokumen)
@if ($dokumen->jenisJaminan)
@php
$data = [
'tanah' => 'Tanah',
'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang',
'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan',
'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)',
'tanah_bangunan' => 'Mall',
];
$analisaType = 'tanah';
if (isset($analisa->id)) {
$analisaType = $analisa->type ?? 'unknown';
} else {
foreach ($data as $key => $value) {
if (
isset($jenisJaminanData) &&
trim(strtolower($jenisJaminanData)) === trim(strtolower($value))
) {
$analisaType = $key;
break;
}
}
}
if ($analisaType === 'tanah') {
$analisaType = 'tanah_bangunan';
}
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
$analisaType = 'unit';
}
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
@endphp
<input type="hidden" name="analisa_type" value="{{ $analisaType }}">
<input type="hidden" name="action"
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
<input type="hidden" name="type"
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
@if (is_array($formKategori))
@foreach ($formKategori as $kategori)
@include('lpj::surveyor.components.' . str_replace('-', '_', $kategori), [
'dokumen' => $dokumen,
])
@endforeach
@endif
@endif
@endforeach
<div class="card bg-white rounded-lg shadow-md">
@@ -136,57 +118,57 @@
</button>
</div>
@if (isset($fotoJaminan))
@foreach ($fotoJaminan->ruteJaminan as $item)
@if (isset($item->foto_rute))
<img src="{{ asset('storage/' . old('foto_rute', $item->foto_rute)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
@if (isset($formFoto['rute_menuju_lokasi']))
@foreach ($formFoto['rute_menuju_lokasi'] as $index => $photo)
<div id="inputContainerRute" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4 mb-4">
<div class="flex w-full items-center justify-center gap-4 mb-4"
id="photoContainer-{{ $index }}">
<label class="form-label max-w-56">
<span class="form-label">Foto Rute Menuju Lokasi</span>
</label>
<div class="w-full grid gap-5">
<div class="input-group w-full flex flex-col gap-2">
<img id="foto_rute-preview-{{ $index }}"
src="{{ asset('storage/' . $photo['foto_rute']) }}"
alt="Foto Rute {{ $index }}" class="mt-2 h-auto"
style="display: block; width: 30rem;">
<div class="input-group w-full flex gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
<input id="inputRute" type="file" name="foto_rute[]"
<div class="input-group w-full gap-2">
<input class="name_rute" type="hidden" name="name_rute[]"
value="rute_{{ $index }}">
<input id="inputRute-{{ $index }}" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
capture="camera"
onchange="previewImage(this, 'foto_rute-preview-{{ $index }}')">
<button type="button" id="btnCamera-{{ $index }}" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
</div>
<!-- Delete button to remove photo -->
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
onclick="deletePhoto('{{ $index }}')">
<i class="ki-filled ki-trash"></i>
</button>
</div>
</div>
@error('foto_rute.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
@error('name_rute.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
</div>
@endforeach
</div>
@else
<div id="inputContainerRute" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4 mb-4">
<label class="form-label max-w-56">
<span class="form-label">Foto Rute Menuju Lokasi</span>
</label>
<div class="input-group w-full flex gap-2">
<div class="input-group w-full flex flex-col gap-2">
<img id="foto_rute-preview" src="" alt="Foto Rute" class="mt-2 h-auto"
style="display: none; width: 30rem;">
<div class="input-group w-full gap-2">
<input class="name_rute" type="hidden" name="name_rute[]" value="rute">
{{-- <img id="foto_rute-preview" src="" alt="Foto Argis Region"
class="mt-2 max-w-full h-auto" style="display: none;"> --}}
<input id="inputRute" type="file" name="foto_rute[]"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
onchange="previewImage(this, 'foto_rute-preview')">
@@ -195,31 +177,27 @@
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;"
id="btnDelete">
<i class="ki-filled ki-trash"></i>
</button>
</div>
@error('foto_rute.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
@error('name_rute.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
<span class="alert text-danger text-sm"></span>
</div>
@endif
<div id="inputContainerRute" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4 mb-4">
<label class="form-label max-w-56">
<span class="form-label">Foto Gerbang & Nama Perumahan</span>
</label>
<div class="input-group w-full flex gap-2">
<div class="input-group w-full flex flex-col gap-2">
<input class="name_gerbang" type="hidden" name="name_gerbang" value="rute">
{{-- <img id="foto_gerbang-preview" src="" alt="Foto Gerbong"
class="mt-2 max-w-full h-auto" style="display: none;"> --}}
<img id="foto_gerbang-preview"
src="{{ isset($formFoto['gerbang']) ? asset('storage/' . $formFoto['gerbang']) : '' }}"
alt="Foto Gerbong" class="mt-2 max-w-full h-auto"
style="{{ isset($formFoto['gerbang']) ? '' : 'display: none;' }} width: 30rem;">
<div class="input-group w-full flex gap-2">
<input id="inputRute" type="file" name="foto_gerbang"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera"
onchange="previewImage(this, 'foto_gerbang-preview')">
@@ -229,11 +207,11 @@
</button>
</div>
</div>
</div>
<span class="alert text-danger text-sm"></span>
</div>
<div id="ruteLainnya" style="margin-top: 10px">
</div>
<button type="button" class="btn btn-primary btn-sm" id="btnAddMore" style="margin-top: 10px">
@@ -272,36 +250,30 @@
@foreach ($objekViews as $view)
<div class="flex flex-wrap gap-4 {{ !$loop->first ? 'mt-2' : '' }}">
<div class="flex w-full gap-4">
<label class="form-label max-w-56"><span
class="form-label">{{ $view['label'] }}</span>
<label class="form-label max-w-56"><span class="form-label">{{ $view['label'] }}</span>
</label>
<input type="hidden" class="form-control" name="name_objek[]"
value="{{ $view['label'] }}" />
<div class="w-full grid gap-5">
@if (isset($fotoJaminan) && isset($fotoJaminan->objekJaminan[$view['index']]))
<img src="{{ asset('storage/' . $fotoJaminan->objekJaminan[$view['index']]->foto_objek) }}"
<img id="foto_object_jaminan_preview_{{ $view['index'] }}"
src="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_object']) ? asset('storage/' . $formFoto['object_jaminan'][$view['index']]['foto_object']) : '' }}"
alt="{{ $view['label'] }}" class="mb-2 w-48 h-auto"
style="width: 12rem;">
@endif
onchange="previewImage(this, 'foto_object_jaminan_preview_{{ $view['index'] }}')" style="{{ isset($formFoto['foto_object']) ? '' : 'display: none;' }} width: 30rem;">
<div class="input-group w-full flex gap-2">
<input type="file" name="foto_objek[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($fotoJaminan) && isset($fotoJaminan->objekJaminan[$view['index']]) ? str_replace($view['label'] . ': ', '', $fotoJaminan->objekJaminan[$view['index']]->name_objek) : '' }}</textarea>
<textarea name="deskripsi_objek[]" class="textarea" rows="3" placeholder="Deskripsi">{{ isset($formFoto) && isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
</div>
</div>
@error('foto_objek.' . $view['index'])
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
@error('name_objek.' . $view['index'])
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
<span class="alert text-danger text-sm"></span>
</div>
@endforeach
@else
@@ -322,21 +294,17 @@
</button>
</div>
@if (isset($fotoJaminan))
@foreach ($fotoJaminan->lantaiUnit as $item)
@if (isset($formFoto['foto_lantai_unit']))
@foreach ($formFoto['foto_lantai_unit'] as $item)
<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>
</label>
<div class="w-full grid gap-5">
@if (isset($fotoJaminan))
<img src="{{ asset('storage/' . old('foto_lantai_unit', $item->foto_lantai_unit)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<img src="{{ asset('storage/' . old('foto_lantai_unit', $item['foto_lantai_unit'])) }}"
alt="Gambar Pendamping" style="width: 30rem;">
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"
@@ -356,8 +324,6 @@
@endforeach
@else
<div id="inputContainerLantai" class="w-full">
<div class="flex w-full items-center justify-center gap-4">
<label class="form-label max-w-56">
@@ -366,15 +332,14 @@
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lantai_unit[]" value="lantai">
<input id="inputLantai" type="file" name="foto_lantai_unit[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;"
id="btnDelete">
<i class="ki-filled ki-trash"></i>
</button>
</div>
@@ -386,12 +351,17 @@
<div id="inputContainerBasement" class="w-full" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4">
<label class="form-label max-w-56">
<span class="form-label">Basement</span>
</label>
<div class="input-group w-full flex gap-2">
<div class="input-group w-full flex flex-col gap-2">
<input type="hidden" name="name_basement" value="basement">
<img id="basement"
src="{{ isset($formFoto['basement']) ? asset('storage/' . old('basement', $formFoto['basement'])) : '#' }}"
alt="Gambar basement" style="width: 30rem;" onerror="this.style.display='none';"
onchange="previewImage(this, 'basement')">
<div class="input-group w-full flex gap-2">
<input id="inputLantai" type="file" name="foto_basement"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
@@ -399,6 +369,7 @@
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;"
id="btnDelete">
<i class="ki-filled ki-trash"></i>
@@ -428,8 +399,6 @@
<div class="card bg-white rounded-lg shadow-md">
<div class="card-body">
<div class=" text-white py-4 px-6 flex items-center justify-between">
<h1 class="text-md font-medium text-gray-900">Lingkungan</h1>
<button id="btnLingkungan" type="button" class="btn btn-primary btn-sm">
@@ -437,40 +406,34 @@
</button>
</div>
@if (isset($fotoJaminan))
@foreach ($fotoJaminan->lingkungan as $item)
@if (isset($formFoto['lingkungan']))
@foreach ($formFoto['lingkungan'] as $item)
<div id="inputContainerLingkungan" style="margin-top: 10px">
<div class="flex w-full items-center justify-center gap-4 mb-4">
<label class="form-label max-w-56">
<span class="form-label">Lingkungan</span>
</label>
<div class="w-full grid gap-5">
@if (isset($fotoJaminan))
<img src="{{ asset('storage/' . old('foto_lingkungan', $item->foto_lingkungan)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<img src="{{ asset('storage/' . old('foto_lingkungan', $item['foto_lingkungan'])) }}"
alt="Gambar Pendamping" style="width: 30rem;">
<div class="input-group w-full flex gap-2">
<input type="hidden" name="name_lingkungan[]" value="lingkungan">
<input id="inputLingkungan" type="file" name="foto_lingkungan[]"
class="file-input file-input-bordered w-full" accept="image/*"
capture="camera">
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">
<button type="button" id="btnCamera" class="btn btn-light"
data-modal-toggle="#cameraModal">
<i class="ki-outline ki-abstract-33"></i> Camera
</button>
</div>
<button type="button" class="btn btn-danger btn-sm delete-btn"
style="display: none;" id="btnDelete">
<button type="button" class="btn btn-danger btn-sm delete-btn" style="display: none;"
id="btnDelete">
<i class="ki-filled ki-trash"></i>
</button>
</div>
</div>
@error('foto_lingkungan.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
@error('name_lingkungan.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
<span class="alert text-danger text-sm"></span>
</div>
@endforeach
@else
@@ -495,12 +458,7 @@
<i class="ki-filled ki-trash"></i>
</button>
</div>
@error('foto_lingkungan.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
@error('name_lingkungan.*')
<span class="alert text-danger text-sm">{{ $message }}</span>
@enderror
<span class="alert text-danger text-sm"></span>
</div>
@endif
</div>
@@ -520,10 +478,13 @@
<span class="form-label">Pendamping</span>
</label>
<div class="w-full grid gap-5">
@if (isset($fotoJaminan))
<img src="{{ asset('storage/' . old('pendamping', $fotoJaminan->pendamping)) }}"
alt="Gambar Pendamping" style="width: 12rem;">
@endif
<img id="pendamping"
src="{{ isset($formFoto['pendamping']) ? asset('storage/' . old('pendamping', $formFoto['pendamping'])) : '#' }}"
alt="Gambar Pendamping" style="width: 30rem;" onerror="this.style.display='none';"
onchange="previewImage(this, 'pendamping')">
<div class="input-group w-full flex gap-2">
<input id="inputPendamping" type="file" name="pendamping"
class="file-input file-input-bordered w-full" accept="image/*" capture="camera">

View File

@@ -10,7 +10,7 @@
<div class="card min-w-full">
<div class="card-header">
<h3 class="card-title">
Data Jaminan
Form Inspeksi
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('surveyor.show', ['id' => request('inspeksi')]) }}?form=inspeksi"
@@ -19,107 +19,6 @@
</a>
</div>
</div>
@php
$jenisJaminanData = null;
@endphp
<div data-accordion="true">
@foreach ($permohonan->debiture->documents as $dokumen)
@php
$jenisJaminanData = $dokumen->jenisJaminan->name ?? '';
@endphp
<div class="accordion-item [&:not(:last-child)]:border-b border-b-gray-200"
data-accordion-item="true" id="accordion_1_item_1">
<button class="accordion-toggle py-4 group mx-8"
data-accordion-toggle="#accordion_detail_jaminan_{{ $loop->index }}">
<span class="text-base text-gray-900 font-medium">
Jaminan {{ $loop->index + 1 }}
</span>
<i class="ki-outline ki-plus text-gray-600 text-2sm accordion-active:hidden block">
</i>
<i class="ki-outline ki-minus text-gray-600 text-2sm accordion-active:block hidden">
</i>
</button>
<div class="accordion-content hidden" id="accordion_detail_jaminan_{{ $loop->index }}">
<div class="card-body lg:py-7.5 grid grid-cols-2">
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Pemilik Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Jenis Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->jenisJaminan->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Hubungan Pemilik Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->hubungan_pemilik->name ?? '' }}
</span>
</div>
<div class="mb-5">
<h3 class="text-md font-medium text-gray-900">
Alamat Pemilik Jaminan:
</h3>
<span class="text-2sm text-gray-700">
{{ $dokumen->pemilik->address ?? '' }},
<br> {{ $dokumen->pemilik->village->name ?? '' }},
{{ $dokumen->pemilik->district->name ?? '' }},
{{ $dokumen->pemilik->city->name ?? '' }},
{{ $dokumen->pemilik->province->name ?? '' }} -
{{ $dokumen->pemilik->village->postal_code ?? '' }}
</span>
</div>
</div>
<div class="card-table scrollable-x-auto pb-3">
<table class="table align-middle text-sm text-gray-500">
@foreach ($dokumen->detail as $detail)
<tr>
<td class="py-2 text-gray-600 font-normal max-w-[100px]">
{{ $loop->index + 1 }}. {{ $detail->jenisLegalitasJaminan->name }}
</td>
<td class="py-2 text-gray-800 font-normaltext-sm">
{{ $detail->name ?? '' }}
</td>
</tr>
<tr>
<td class="py-3 max-w-[100px]">
Dokumen Jaminan
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
@if (isset($detail->dokumen_jaminan))
<a href="{{ route('debitur.jaminan.download', ['id' => $permohonan->debiture->id, 'dokumen' => $detail->id]) }}"
class="badge badge-sm badge-outline mt-2">{{ basename($detail->dokumen_jaminan) }}
<i class="ki-filled ki-cloud-download"></i></a>
@endif
</td>
</tr>
<tr>
<td class="py-3 max-w-[100px]">
Keterangan
</td>
<td class="py-3 text-gray-700 text-2sm font-normal">
{{ $detail->keterangan ?? '' }}
</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
@@ -128,82 +27,36 @@
{{-- <div class="card">
<div class="card-body"> --}}
<form id="formInspeksi" method="POST" enctype="multipart/form-data" class="grid gap-5">
@if (isset($analisa->id))
<input type="hidden" name="id" value="{{ $analisa->id }}">
@method('PUT')
@endif
@csrf
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
@foreach ($permohonan->debiture->documents as $dokumen)
@if ($dokumen->jenisJaminan)
@php
$analisaType = 'unknown';
$data = [
'tanah' => 'Tanah',
'unit_rumah' => 'Rumah Tinggal / Ruko (Unit) / Apartemen (Unit) / Gudang',
'tanah_bangunan' => 'Kawasan Industrial / Komersil / Residensial - Perumahan',
'unit_gedung' => 'Gedung Apartement / Kantor / Condotel (Strata Title)',
'tanah_bangunan' => 'Mall',
];
if (isset($analisa->id)) {
$analisaType = $analisa->type;
} else {
foreach ($data as $key => $value) {
if (
isset($jenisJaminanData) &&
trim(strtolower($jenisJaminanData)) === trim(strtolower($value))
) {
$analisaType = $key;
break;
}
}
}
if ($analisaType === 'tanah') {
$analisaType = 'tanah_bangunan';
}
if ($analisaType === 'unit_rumah' || $analisaType === 'unit_gedung') {
$analisaType = 'unit';
}
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
@endphp
<input type="hidden" name="action" value="{{ $analisaType }}">
<input type="hidden" name="type" value="{{ $analisaType }}">
@if ($analisaType == 'tanah_bangunan')
@include('lpj::surveyor.components.tanah')
@elseif($analisaType == 'unit')
@include('lpj::surveyor.components.apartemen-kantor')
@elseif($analisaType == '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')
@elseif($analisaType == 'pesawat')
@include('lpj::surveyor.components.pesawat')
<input type="hidden" name="action"
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
<input type="hidden" name="type"
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
@if (is_array($formKategori))
@foreach ($formKategori as $kategori)
@include('lpj::surveyor.components.' . str_replace('-', '_', $kategori), [
'dokumen' => $dokumen,
])
@endforeach
@endif
@if ($analisaType == 'tanah_bangunan')
@include('lpj::surveyor.components.bangunan')
@endif
@if ($analisaType != 'mesin' && $analisaType != 'kapal' && $analisaType != 'kendaraan' && $analisaType != 'pesawat')
@include('lpj::surveyor.components.lingkungan')
@endif
@include('lpj::surveyor.components.fakta')
@endforeach
<div class="flex justify-end gap-2" style="margin-right: 20px; margin-top: 20px">
<button type="button" class="btn btn-success" id="saveButton" onclick="submitData()">
<span id="saveButtonText">Save</span>
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;" id="saveButtonSpinner">
<div class="spinner-border spinner-border-sm text-light" role="status" style="display: none;"
id="saveButtonSpinner">
<span class="visually-hidden">Loading...</span>
</div>
</button>
@@ -212,7 +65,6 @@
{{-- </div>
</div> --}}
</div>
@endsection
@push('scripts')
<script>

View File

@@ -48,7 +48,9 @@
@if (isset($perkerasanJalan))
@foreach ($perkerasanJalan as $item)
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="perkerasan_jalan" type="checkbox" value="{{ $item->name }}" />
<input class="checkbox" name="perkerasan_jalan[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, isset($forminspeksi['perkerasan_jalan']) ? $forminspeksi['perkerasan_jalan'] : []) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -68,7 +70,9 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="lalu_lintas[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, explode(',', old('lalu_lintas', $forminspeksi['lalu_lintas'] ?? ''))) ? 'checked' : '' }} />
{{ isset($forminspeksi['lalu_lintas']) && in_array($item->name, explode(',', is_array(old('lalu_lintas', $forminspeksi['lalu_lintas'] ?? '')) ? implode(',', old('lalu_lintas', $forminspeksi['lalu_lintas'] ?? '')) : old('lalu_lintas', $forminspeksi['lalu_lintas'] ?? ''))) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -87,7 +91,8 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="gol_mas_sekitar[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, explode(',', old('gol_mas_sekitar', $forminspeksi['gol_mas_sekitar'] ?? ''))) ? 'checked' : '' }} />
{{ isset($forminspeksi['gol_mas_sekitar']) && in_array($item->name, explode(',', is_array(old('gol_mas_sekitar', $forminspeksi['gol_mas_sekitar'] ?? '')) ? implode(',', old('gol_mas_sekitar', $forminspeksi['gol_mas_sekitar'] ?? '')) : old('gol_mas_sekitar', $forminspeksi['gol_mas_sekitar'] ?? ''))) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -107,7 +112,8 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="tingkat_keramaian[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, explode(',', old('tingkat_keramaian', $forminspeksi['tingkat_keramaian'] ?? ''))) ? 'checked' : '' }} />
{{ isset($forminspeksi['tingkat_keramaian']) && in_array($item->name, explode(',', is_array(old('tingkat_keramaian', $forminspeksi['tingkat_keramaian'] ?? '')) ? implode(',', old('tingkat_keramaian', $forminspeksi['tingkat_keramaian'] ?? '')) : old('tingkat_keramaian', $forminspeksi['tingkat_keramaian'] ?? ''))) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -127,7 +133,8 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="terletak_diarea[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, explode(',', old('terletak_diarea', $forminspeksi['terletak_diarea'] ?? ''))) ? 'checked' : '' }} />
{{ isset($forminspeksi['terletak_diarea']) && in_array($item->name, explode(',', is_array(old('terletak_diarea', $forminspeksi['terletak_diarea'] ?? '')) ? implode(',', old('terletak_diarea', $forminspeksi['terletak_diarea'] ?? '')) : old('terletak_diarea', $forminspeksi['terletak_diarea'] ?? ''))) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -220,7 +227,7 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="merupakan_daerah[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, explode(',', old('merupakan_daerah', $forminspeksi['merupakan_daerah'] ?? []))) ? 'checked' : '' }} />
{{ in_array($item->name, isset($forminspeksi['merupakan_daerah']) ? $forminspeksi['merupakan_daerah'] : []) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach
@@ -255,7 +262,15 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="fasilitas_dekat_object[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, $selectedFasilitas) ? 'checked' : '' }} />
{{ in_array(
$item->name,
is_array(old('fasilitas_dekat_object', $forminspeksi['fasilitas_dekat_object'] ?? ''))
? old('fasilitas_dekat_object', $forminspeksi['fasilitas_dekat_object'] ?? [])
: explode(',', old('fasilitas_dekat_object', $forminspeksi['fasilitas_dekat_object'] ?? '')),
)
? 'checked'
: '' }} />
{{ $item->name }}
</label>
@endforeach

View File

@@ -135,7 +135,7 @@
<label class="form-label flex items-center gap-2.5 text-nowrap">
<input class="checkbox" name="kontur_tanah[]" type="checkbox"
value="{{ $item->name }}"
{{ in_array($item->name, old('kontur_tanah', $forminspeksi['kontur_tanah'] ?? [])) ? 'checked' : '' }} />
{{ in_array($item->name, old('kontur_tanah', isset($forminspeksi['kontur_tanah']) ? $forminspeksi['kontur_tanah'] : [])) ? 'checked' : '' }} />
{{ $item->name }}
</label>
@endforeach

View File

@@ -92,23 +92,75 @@
@endIf
</div>
@if (request()->has('form') && request('form') !== 'data-pembanding')
<div class="card-footer">
<form action="{{ route('surveyor.submitSurveyor', $surveyor ) }}" method="POST">
@csrf
@method('PUT')
<button type="submit" class="btn btn-primary " {{ $buttonDisable ? 'disabled' : '' }}>
<div class="card-footer ">
<div class="flex gap-5">
<button type="button" id="btnProses" class="btn btn-success">
Proses
</button>
<button type="button" id="btnSubmit" class="btn btn-primary">
Submit
</button>
</form>
</div>
@endif
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
checkButtonStatus();
document.getElementById('btnProses').addEventListener('click', onProses);
document.getElementById('btnSubmit').addEventListener('click', onSubmit);
});
function checkButtonStatus() {
$.ajax({
url: "{{ route('surveyor.checkButtonStatus', ['id' => $surveyor]) }}",
type: "GET",
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
success: function(response) {
if (response.buttonDisable) {
$('#btnProses, #btnSubmit').prop('disabled', true);
} else {
$('#btnProses, #btnSubmit').prop('disabled', false);
}
},
error: function(xhr, status, error) {
console.log('Error checking button status:', error, status, xhr);
}
});
}
function onProses() {
return alert('Are you sure you want to submit?');
}
function onSubmit() {
$.ajax({
url: "{{ route('surveyor.submitSurveyor', ['id' => $surveyor]) }}",
type: "GET",
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
},
success: function(response) {
if (response.success) {
window.location.href = "{{ route('surveyor.index') }}";
}
},
error: function(xhr, status, error) {
console.log('Error checking button status:', error, status, xhr);
}
});
}
$('.card-title a').on('click', function(e) {
e.preventDefault();
var url = $(this).attr('href');

View File

@@ -4,8 +4,7 @@
{{ Breadcrumbs::render('surveyor') }}
@endsection
@section('content')
@push('styles')
@push('styles')
<style>
.modal {
@@ -19,7 +18,7 @@
transform: translate(-50%, -50%);
}
</style>
@endpush
@endpush
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
<div class="card pb-2.5">
@@ -113,70 +112,20 @@
</div>
</div>
<div class="modal fade" data-modal="true" id="modal_revisi" data-backdrop="static" data-keyboard="false">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Kunjungan</h3>
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
<i class="ki-outline ki-cross"></i>
</button>
</div>
<div class="modal-body">
<form
action=""
method="POST" enctype="multipart/form-data" id="revisiForm">
@csrf
@method('PUT')
<input type="hidden" name="action" value="revisi">
{{-- <input type="hidden" name="nomor_registrasi"
value="{{ $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi }}"> --}}
<div class="pl-1 grid gap-2.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Tanggal Kunjungan</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('tanggal_kunjungan') border-danger bg-danger-light @enderror"
type="datetime-local" name="tanggal_kunjungan"
value="">
@error('tanggal_kunjungan')
<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">Catatan</label>
<div class="flex flex-wrap items-baseline w-full">
<textarea id="keterangan" class="textarea @error('keterangan') border-danger bg-danger-light @enderror"
rows="3" name="keterangan"></textarea>
@error('keterangan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="modal-footer justify-end mt-2">
<div class="flex gap-4">
<button type="button" class="btn btn-light" data-modal-dismiss="true">Cancel</button>
<button id="btnSubmit" type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="module">
<script>
function jadwal(id){
document.getElementById('ids').value = id ;
}
</script>
<script type="module">
const element = document.querySelector('#permohonan-table');
const searchInput = document.getElementById('search');
const statusFilter = document.getElementById('status-filter'); // Dropdown filter element
const statusFilter = document.getElementById('status-filter');
const apiUrl = element.getAttribute('data-api-url');
const dataTableOptions = {
apiEndpoint: apiUrl,
@@ -184,8 +133,7 @@
order: [{
column: 'nomor_registrasi',
dir: 'asc'
} // Default order by 'nomor_registrasi' ascending
],
}], // Default order by 'nomor_registrasi' ascending
columns: {
select: {
render: (item, data, context) => {
@@ -202,12 +150,7 @@
},
tanggal_permohonan: {
title: 'Tanggal Assigned',
// render: (item, data) => {
// const createdAt = convertDate(data.penilaian.created_at);
// return createdAt;
// },
},
user_id: {
title: 'User Pemohon',
render: (item, data) => `${data.user.name}`,
@@ -230,14 +173,26 @@
},
actions: {
title: 'Action',
render: (item, data) => `
<div class="flex flex-nowrap justify-center">
render: (item, data) => {
let actionHtml = '';
if (data.penilaian.waktu_penilaian == null && data.penilaian.authorized_status == null) {
actionHtml += `
<a class="btn btn-sm btn-icon btn-clear btn-primary" data-modal-toggle="#modal_jadwal" onclick="jadwal(${data.penilaian.id})">
<i class="ki-filled ki-calendar-edit"></i>
</a>
`;
} else {
actionHtml += `
<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>
</a>
</div>`,
`;
}
return actionHtml;
}
}
}
},
};
let dataTable = new KTDataTable(element, dataTableOptions);
@@ -258,7 +213,58 @@
const month = String(createdAt.getMonth() + 1).padStart(2, '0');
const year = createdAt.getFullYear();
return `${day}-${month}-${year}`;
}
</script>
</script>
@endpush
<div class="modal fade" data-modal="true" id="modal_jadwal" data-backdrop="static" data-keyboard="false">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title">Kunjungan</h3>
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
<i class="ki-outline ki-cross"></i>
</button>
</div>
<div class="modal-body">
<form action="{{ route('surveyor.storeJadwal')}}" method="POST" enctype="multipart/form-data" id="revisiForm">
@method('put')
@csrf
<input id="ids" type="text" name="id">
<div class="pl-1 grid gap-2.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">Tanggal Kunjungan</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('waktu_penilaian') border-danger bg-danger-light @enderror"
type="datetime-local" name="waktu_penilaian" value="">
@error('waktu_penilaian')
<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">Catatan</label>
<div class="flex flex-wrap items-baseline w-full">
<textarea id="deskripsi_penilaian" class="textarea @error('deskripsi_penilaian') border-danger bg-danger-light @enderror"
rows="3" name="deskripsi_penilaian"></textarea>
@error('deskripsi_penilaian')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="modal-footer justify-end mt-2">
<div class="flex gap-4">
<button type="button" class="btn btn-light" data-modal-dismiss="true">Cancel</button>
<button id="btnSubmit" type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@@ -460,14 +460,18 @@ Route::middleware(['auth'])->group(function () {
Route::get('/', [SurveyorController::class, 'index'])->name('index');
Route::get('{id}/show', [SurveyorController::class, 'show'])->name('show');
Route::post('store', [SurveyorController::class, 'store'])->name('store');
Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
Route::post('storeDenah/{id}', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
Route::get('storeAproved/{id}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
Route::get('checkButtonStatus/{id}', [SurveyorController::class, 'checkButtonStatus'])->name('checkButtonStatus');
Route::get('datatables', [SurveyorController::class, 'dataForDatatables'])->name('datatables');
Route::get('inspeksi/{id}/{jaminanId}', [SurveyorController::class, 'formInspeksi'])->name('inspeksi');
Route::get('denah/{id}/{jaminanId}', [SurveyorController::class, 'denah'])->name('denah');
Route::get('foto/{id}/{jaminanId}', [SurveyorController::class, 'foto'])->name('foto');
Route::get('data-pembanding/{id}', [SurveyorController::class, 'dataPembanding'])->name('data-pembanding');
Route::put('submitSurveyor/{id}', [SurveyorController::class, 'submitSurveyor'])->name('submitSurveyor');
Route::get('submitSurveyor/{id}', [SurveyorController::class, 'submitSurveyor'])->name('submitSurveyor');
});
Route::name('penilai.')->prefix('penilai')->group(function () {