update form apartemen dan foto
This commit is contained in:
@@ -94,7 +94,6 @@ class SurveyorController extends Controller
|
|||||||
$saranaPelengkap = SaranaPelengkap::all();
|
$saranaPelengkap = SaranaPelengkap::all();
|
||||||
$arahMataAngin = ArahMataAngin::all();
|
$arahMataAngin = ArahMataAngin::all();
|
||||||
|
|
||||||
$jenisJaminanIds = $permohonan->debiture->documents;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -104,7 +103,15 @@ class SurveyorController extends Controller
|
|||||||
->where('permohonan_id', $id)
|
->where('permohonan_id', $id)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
|
||||||
|
|
||||||
|
$jenisJaminanIds = $permohonan->debiture->documents->pluck('jenisJaminan.id')->toArray(); // Convert to array
|
||||||
|
|
||||||
|
$jaminanId = $jenisJaminanIds[0];
|
||||||
|
$inpeksi = Inspeksi::where('permohonan_id', $id)
|
||||||
|
->whereIn('jenis_jaminan_id', $jenisJaminanIds)
|
||||||
|
->first();
|
||||||
|
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$forminspeksi = json_decode($inpeksi->data_form, true);
|
$forminspeksi = json_decode($inpeksi->data_form, true);
|
||||||
$formFoto = json_decode($inpeksi->foto_form, true);
|
$formFoto = json_decode($inpeksi->foto_form, true);
|
||||||
@@ -139,6 +146,7 @@ class SurveyorController extends Controller
|
|||||||
'forminspeksi',
|
'forminspeksi',
|
||||||
'formDenah',
|
'formDenah',
|
||||||
'formFoto',
|
'formFoto',
|
||||||
|
'jaminanId'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -158,15 +166,15 @@ class SurveyorController extends Controller
|
|||||||
$action = $request->input('type');
|
$action = $request->input('type');
|
||||||
$rules = $this->getActionSpecificRules($data, $action, $request);
|
$rules = $this->getActionSpecificRules($data, $action, $request);
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->first();
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first();
|
||||||
|
if ($request->input('permohonan_id') == $inspeksi->permohonan_id && $request->input('jenis_jaminan_id') == $inspeksi->jenis_jaminan_id) {
|
||||||
if ($inspeksi) {
|
|
||||||
$inspeksi->update(['data_form' => json_encode($rules)]);
|
$inspeksi->update(['data_form' => json_encode($rules)]);
|
||||||
} else {
|
} else {
|
||||||
Inspeksi::create([
|
Inspeksi::create([
|
||||||
'permohonan_id' => $request->permohonan_id,
|
'permohonan_id' => $request->permohonan_id,
|
||||||
'data_form' => json_encode($rules),
|
'data_form' => json_encode($rules),
|
||||||
'name' => $request->type,
|
'name' => $request->type,
|
||||||
|
'jenis_jaminan_id' => $request->input('jenis_jaminan_id'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,8 +244,8 @@ class SurveyorController extends Controller
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->first();
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first();
|
||||||
if ($request->input('permohonan_id') == $inspeksi->permohonan_id) {
|
if ($request->input('permohonan_id') == $inspeksi->permohonan_id && $request->input('jenis_jaminan_id') == $inspeksi->jenis_jaminan_id) {
|
||||||
$inspeksi->update([
|
$inspeksi->update([
|
||||||
'denah_form' => json_encode($formatJsonDenah)
|
'denah_form' => json_encode($formatJsonDenah)
|
||||||
]);
|
]);
|
||||||
@@ -262,7 +270,6 @@ class SurveyorController extends Controller
|
|||||||
$validatedData = $request->validate([
|
$validatedData = $request->validate([
|
||||||
'permohonan_id' => 'required',
|
'permohonan_id' => 'required',
|
||||||
'jenis_jaminan_id' => 'required',
|
'jenis_jaminan_id' => 'required',
|
||||||
'analisa_type' => 'required|in:tanah_bangunan,unit',
|
|
||||||
'pendamping' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
'pendamping' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||||
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
'foto_objek.*' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||||
'name_objek.*' => 'required|string|max:255',
|
'name_objek.*' => 'required|string|max:255',
|
||||||
@@ -366,8 +373,8 @@ class SurveyorController extends Controller
|
|||||||
'pendamping' => $pendamping
|
'pendamping' => $pendamping
|
||||||
];
|
];
|
||||||
|
|
||||||
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->first();
|
$inspeksi = Inspeksi::where('permohonan_id', $request->input('permohonan_id'))->where('jenis_jaminan_id', $request->input('jenis_jaminan_id'))->first();
|
||||||
if ($request->input('permohonan_id') == $inspeksi->permohonan_id) {
|
if ($request->input('permohonan_id') == $inspeksi->permohonan_id && $request->input('jenis_jaminan_id') == $inspeksi->jenis_jaminan_id) {
|
||||||
$inspeksi->update([
|
$inspeksi->update([
|
||||||
'foto_form' => json_encode($formatFotojson)
|
'foto_form' => json_encode($formatFotojson)
|
||||||
]);
|
]);
|
||||||
@@ -384,7 +391,7 @@ class SurveyorController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitSurveyor($id)
|
public function submitSurveyor($id,$jaminanId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$cekButton = $this->checkButtonStatus($id)->getData();
|
$cekButton = $this->checkButtonStatus($id)->getData();
|
||||||
@@ -407,6 +414,7 @@ class SurveyorController extends Controller
|
|||||||
public function checkButtonStatus($id)
|
public function checkButtonStatus($id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
||||||
|
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
@@ -428,64 +436,64 @@ class SurveyorController extends Controller
|
|||||||
return response()->json(['buttonDisable' => true]);
|
return response()->json(['buttonDisable' => true]);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return response()->json(['error' => 'Something went wrong', 'message' => $e->getMessage()], 500);
|
return response()->json(['buttonDisable' => true]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function storeJadwal(Request $request)
|
public function storeJadwal(Request $request)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$validate = $request->validate([
|
$validate = $request->validate([
|
||||||
'id' => 'required',
|
'id' => 'required',
|
||||||
'waktu_penilaian' => 'required',
|
'waktu_penilaian' => 'required',
|
||||||
'deskripsi_penilaian' => 'required'
|
'deskripsi_penilaian' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// return response()->json([
|
// return response()->json([
|
||||||
// 'daa'=>$validate
|
// 'daa'=>$validate
|
||||||
// ]);
|
// ]);
|
||||||
$id = $request->input('id');
|
$id = $request->input('id');
|
||||||
$penilaian = Penilaian::findOrFail($id);
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
|
|
||||||
$penilaian->update([
|
$penilaian->update([
|
||||||
'waktu_penilaian' => $validate['waktu_penilaian'],
|
'waktu_penilaian' => $validate['waktu_penilaian'],
|
||||||
'deskripsi_penilaian' => $validate['deskripsi_penilaian'],
|
'deskripsi_penilaian' => $validate['deskripsi_penilaian'],
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('surveyor.index')
|
->route('surveyor.index')
|
||||||
->with('success', 'Jadwal berhasil dibuat.');
|
->with('success', 'Jadwal berhasil dibuat.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('surveyor.index')
|
->route('surveyor.index')
|
||||||
->with('error', 'Gagal membuat jadwal: ' . $e->getMessage());
|
->with('error', 'Gagal membuat jadwal: ' . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function storeAproved($id)
|
public function storeAproved($id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
$penilaian = Penilaian::findOrFail($id);
|
$penilaian = Penilaian::findOrFail($id);
|
||||||
|
|
||||||
$penilaian->update([
|
$penilaian->update([
|
||||||
'authorized_status' => 1,
|
'authorized_status' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('permohonan.index')
|
->route('permohonan.index')
|
||||||
->with('success', 'Jadwal berhasil di aprove.');
|
->with('success', 'Jadwal berhasil di aprove.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('permohonan.index')
|
->route('permohonan.index')
|
||||||
->with('error', 'Gagal membuat jadwal: ' . $e->getMessage());
|
->with('error', 'Gagal membuat jadwal: ' . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Form inspeksi.
|
* Form inspeksi.
|
||||||
*/
|
*/
|
||||||
@@ -534,7 +542,7 @@ public function storeAproved($id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||||
$forminspeksi = null;
|
$forminspeksi = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$forminspeksi = json_decode($inpeksi->data_form, true);
|
$forminspeksi = json_decode($inpeksi->data_form, true);
|
||||||
@@ -577,8 +585,7 @@ public function storeAproved($id)
|
|||||||
|
|
||||||
$denah = null;
|
$denah = null;
|
||||||
|
|
||||||
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
|
||||||
$formDenah = null;
|
$formDenah = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$formDenah = json_decode($inpeksi->denah_form, true);
|
$formDenah = json_decode($inpeksi->denah_form, true);
|
||||||
@@ -601,7 +608,8 @@ public function storeAproved($id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$inpeksi = Inspeksi::where('permohonan_id', $id)->first();
|
$inpeksi = Inspeksi::where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first();
|
||||||
|
|
||||||
$formFoto = null;
|
$formFoto = null;
|
||||||
if ($inpeksi) {
|
if ($inpeksi) {
|
||||||
$formFoto = json_decode($inpeksi->foto_form, true);
|
$formFoto = json_decode($inpeksi->foto_form, true);
|
||||||
@@ -1074,7 +1082,7 @@ public function storeAproved($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function getTanahData($data,$request): array
|
private function getTanahData($data, $request): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'luas_tanah' => $data['luas_tanah'] ?? null,
|
'luas_tanah' => $data['luas_tanah'] ?? null,
|
||||||
|
|||||||
@@ -14,7 +14,17 @@ class Inspeksi extends Model
|
|||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*/
|
*/
|
||||||
protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by'];
|
protected $fillable = ['data_form', 'foto_form', 'denah_form','permohonan_id', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_by', 'updated_by', 'deleted_by','jenis_jaminan_id'];
|
||||||
|
|
||||||
|
public function permohonan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Permohonan::class, 'permohonan_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jenis_jaminan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(JenisJaminan::class, 'jenis_jaminan_id');
|
||||||
|
}
|
||||||
|
|
||||||
// protected static function newFactory(): InspeksiFactory
|
// protected static function newFactory(): InspeksiFactory
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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('inspeksi', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('jenis_jaminan_id')->nullable()->after('permohonan_id');
|
||||||
|
$table->foreign('jenis_jaminan_id')->references('id')->on('jenis_jaminan')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('inspeksi', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('jenis_jaminan_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
<div class="flex flex-wrap items-baseline w-full">
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 mt-2">
|
<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">
|
<label class="form-label flex items-center gap-3 text-nowrap">
|
||||||
<input type="radio" class="radio" name="luas" value="sesuai"
|
<input type="radio" class="radio" name="luas_unit" value="sesuai"
|
||||||
{{ old('luas', isset($analisa) && optional($analisa)->luas) == 'sesuai' ? 'checked' : '' }}>
|
{{ old('luas', isset($analisa) && optional($analisa)->luas) == 'sesuai' ? 'checked' : '' }}>
|
||||||
<span class="ml-2">Sesuai</span>
|
<span class="ml-2">Sesuai</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
<label class="form-label flex items-center gap-2.5 text-nowrap">
|
||||||
<input type="radio" class="radio" name="luas" value="tidak sesuai"
|
<input type="radio" class="radio" name="luas_unit" value="tidak sesuai"
|
||||||
{{ old('luas', isset($analisa) && optional($analisa)->luas) == 'tidak sesuai' ? 'checked' : '' }}>
|
{{ old('luas', isset($analisa) && optional($analisa)->luas) == 'tidak sesuai' ? 'checked' : '' }}>
|
||||||
<span class="ml-2">Tidak Sesuai</span>
|
<span class="ml-2">Tidak Sesuai</span>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -89,24 +89,6 @@
|
|||||||
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
||||||
|
|
||||||
|
|
||||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
|
||||||
@if ($dokumen->jenisJaminan)
|
|
||||||
@php
|
|
||||||
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
|
||||||
@endphp
|
|
||||||
<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">
|
<div class="card bg-white rounded-lg shadow-md">
|
||||||
@@ -226,61 +208,110 @@
|
|||||||
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
<div class=" text-white py-4 px-6 flex items-center justify-between">
|
||||||
<h1 class="text-md font-medium text-gray-900">Objek Jaminan</h1>
|
<h1 class="text-md font-medium text-gray-900">Objek Jaminan</h1>
|
||||||
</div>
|
</div>
|
||||||
@php
|
|
||||||
$objekViews = [];
|
|
||||||
if ($analisaType === 'tanah_bangunan') {
|
|
||||||
$objekViews = [
|
|
||||||
['label' => 'Tampak Samping Kiri', 'index' => 0],
|
|
||||||
['label' => 'Tampak Samping Kanan', 'index' => 1],
|
|
||||||
['label' => 'Nomor Rumah/Unit', 'index' => 2],
|
|
||||||
];
|
|
||||||
} elseif ($analisaType === 'unit') {
|
|
||||||
$objekViews = [
|
|
||||||
['label' => 'Tampak Loby', 'index' => 0],
|
|
||||||
['label' => 'Tampak Lift', 'index' => 1],
|
|
||||||
['label' => 'Tampak Samping Kiri Unit', 'index' => 2],
|
|
||||||
['label' => 'Tampak Samping Kanan Unit', 'index' => 3],
|
|
||||||
['label' => 'Tampak Depan Unit', 'index' => 4],
|
|
||||||
['label' => 'Nomor Unit', 'index' => 5],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (count($objekViews) > 0)
|
|
||||||
@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>
|
|
||||||
<input type="hidden" class="form-control" name="name_objek[]"
|
|
||||||
value="{{ $view['label'] }}" />
|
|
||||||
<div class="w-full grid gap-5">
|
|
||||||
|
|
||||||
<img id="foto_object_jaminan_preview_{{ $view['index'] }}"
|
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||||
src="{{ isset($formFoto['object_jaminan'][$view['index']]['foto_object']) ? asset('storage/' . $formFoto['object_jaminan'][$view['index']]['foto_object']) : '' }}"
|
@if ($dokumen->jenisJaminan)
|
||||||
alt="{{ $view['label'] }}" class="mb-2 w-48 h-auto"
|
@php
|
||||||
onchange="previewImage(this, 'foto_object_jaminan_preview_{{ $view['index'] }}')" style="{{ isset($formFoto['foto_object']) ? '' : 'display: none;' }} width: 30rem;">
|
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
||||||
|
@endphp
|
||||||
|
@if (isset($formKategori) && $formKategori)
|
||||||
|
<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)
|
||||||
|
@if ($kategori === 'tanah' || $kategori === 'bangunan')
|
||||||
|
@php
|
||||||
|
$objekViews = [
|
||||||
|
['label' => 'Tampak Samping Kiri', 'index' => 0],
|
||||||
|
['label' => 'Tampak Samping Kanan', 'index' => 1],
|
||||||
|
['label' => 'Nomor Rumah/Unit', 'index' => 2],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
@elseif ($kategori === 'apartemen-kantor')
|
||||||
|
@php
|
||||||
|
$objekViews = [
|
||||||
|
['label' => 'Tampak Loby', 'index' => 0],
|
||||||
|
['label' => 'Tampak Lift', 'index' => 1],
|
||||||
|
['label' => 'Tampak Samping Kiri Unit', 'index' => 2],
|
||||||
|
['label' => 'Tampak Samping Kanan Unit', 'index' => 3],
|
||||||
|
['label' => 'Tampak Depan Unit', 'index' => 4],
|
||||||
|
['label' => 'Nomor Unit', 'index' => 5],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
@elseif ($kategori === 'kendaraan')
|
||||||
|
@php
|
||||||
|
$objekViews = [
|
||||||
|
['label' => 'Tampak Depan Objek', 'index' => 0],
|
||||||
|
['label' => 'Tampak Kanan Objek', 'index' => 1],
|
||||||
|
['label' => 'Tampak Samping Kiri Objek', 'index' => 2],
|
||||||
|
['label' => 'Tampak Belakang Objek', 'index' => 3],
|
||||||
|
['label' => 'Tampak Bagian Dalam', 'index' => 4],
|
||||||
|
['label' => 'Nomor Panel Instrument', 'index' => 5],
|
||||||
|
['label' => 'Tampak Odometer', 'index' => 6],
|
||||||
|
['label' => 'Tampak Aksesoris Tambahan', 'index' => 7],
|
||||||
|
['label' => 'Tampak Nomor Rangka', 'index' => 8],
|
||||||
|
['label' => 'Tampak Nomor Mesin', 'index' => 9],
|
||||||
|
['label' => 'Tampak Penilai dan Pendamping di lapangan', 'index' => 10],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
@elseif ($kategori === 'kapal')
|
||||||
|
@php
|
||||||
|
$objekViews = [
|
||||||
|
['label' => 'Tampak Depan', 'index' => 0],
|
||||||
|
['label' => 'Tampak Kanan', 'index' => 1],
|
||||||
|
['label' => 'Tampak Samping Kiri', 'index' => 2],
|
||||||
|
['label' => 'Tampak Belakang', 'index' => 3],
|
||||||
|
['label' => 'Tampak Bagian Dalam', 'index' => 4],
|
||||||
|
['label' => 'Nomor Panel Instrument', 'index' => 5],
|
||||||
|
['label' => 'Tampak Hours Meters', 'index' => 6],
|
||||||
|
['label' => 'Tampak Aksesoris Tambahan', 'index' => 7],
|
||||||
|
['label' => 'Tampak Nomor Rangka', 'index' => 8],
|
||||||
|
['label' => 'Tampak Nomor Mesin', 'index' => 9],
|
||||||
|
['label' => 'Tampak Penilai dan Pendamping di lapangan', 'index' => 10],
|
||||||
|
];
|
||||||
|
@endphp
|
||||||
|
@endif
|
||||||
|
|
||||||
<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">
|
|
||||||
<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($formFoto) && isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
@if (count($objekViews) > 0)
|
||||||
</div>
|
@foreach ($objekViews as $view)
|
||||||
</div>
|
<div class="flex flex-wrap gap-4 {{ !$loop->first ? 'mt-2' : '' }}">
|
||||||
<span class="alert text-danger text-sm"></span>
|
<div class="flex w-full gap-4">
|
||||||
</div>
|
<label class="form-label max-w-56"><span class="form-label">{{ $view['label'] }}</span>
|
||||||
@endforeach
|
</label>
|
||||||
@else
|
<input type="hidden" class="form-control" name="name_objek[]"
|
||||||
<div class="p-4">
|
value="{{ $view['label'] }}" />
|
||||||
<p class="text-gray-500">Tipe analisa tidak valid atau belum dipilih.</p>
|
<div class="w-full grid gap-5">
|
||||||
</div>
|
<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"
|
||||||
|
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">
|
||||||
|
<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($formFoto) && isset($formFoto['object_jaminan'][$view['index']]) ? str_replace($view['label'] . ': ', '', $formFoto['object_jaminan'][$view['index']]['deskripsi_objek']) : '' }}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="alert text-danger text-sm"></span>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
<div class="flex flex-wrap gap-4 w-full">
|
<div class="flex flex-wrap gap-4 w-full">
|
||||||
@@ -656,10 +687,10 @@
|
|||||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// if (response.success) {
|
if (response.success) {
|
||||||
// window.location.href =
|
window.location.href =
|
||||||
// '{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
'{{ route('surveyor.show', ['id' => $permohonan->id]) }}?form=foto';
|
||||||
// }
|
}
|
||||||
console.log(response);
|
console.log(response);
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
|
|||||||
@@ -30,27 +30,30 @@
|
|||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
<input type="hidden" name="permohonan_id" value="{{ $permohonan->id }}">
|
||||||
<input type="hidden" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
<input type="text
|
||||||
|
" name="jenis_jaminan_id" value="{{ request('jenis_jaminan') }}">
|
||||||
|
|
||||||
|
|
||||||
@foreach ($permohonan->debiture->documents as $dokumen)
|
@foreach ($permohonan->debiture->documents as $dokumen)
|
||||||
@if ($dokumen->jenisJaminan)
|
@if ($dokumen->jenisJaminan)
|
||||||
@php
|
@php
|
||||||
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
$formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true);
|
||||||
@endphp
|
@endphp
|
||||||
|
@if (isset($formKategori) && $formKategori)
|
||||||
<input type="hidden" name="action"
|
<input type="hidden" name="action"
|
||||||
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
||||||
<input type="hidden" name="type"
|
<input type="hidden" name="type"
|
||||||
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
value="{{ is_array($formKategori) ? implode(',', $formKategori) : $formKategori }}">
|
||||||
@if (is_array($formKategori))
|
@if (is_array($formKategori))
|
||||||
@foreach ($formKategori as $kategori)
|
@foreach ($formKategori as $kategori)
|
||||||
@include('lpj::surveyor.components.' . str_replace('-', '_', $kategori), [
|
@include('lpj::surveyor.components.' . str_replace('-', '-', $kategori), [
|
||||||
'dokumen' => $dokumen,
|
'dokumen' => $dokumen,
|
||||||
])
|
])
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
<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="button" class="btn btn-success" id="saveButton" onclick="submitData()">
|
<button type="button" class="btn btn-success" id="saveButton" onclick="submitData()">
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::get('/', [SurveyorController::class, 'index'])->name('index');
|
Route::get('/', [SurveyorController::class, 'index'])->name('index');
|
||||||
Route::get('{id}/show', [SurveyorController::class, 'show'])->name('show');
|
Route::get('{id}/show', [SurveyorController::class, 'show'])->name('show');
|
||||||
Route::post('store', [SurveyorController::class, 'store'])->name('store');
|
Route::post('store', [SurveyorController::class, 'store'])->name('store');
|
||||||
Route::post('storeDenah/{id}', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
|
Route::post('storeDenah', [SurveyorController::class, 'storeDenah'])->name('storeDenah');
|
||||||
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
|
Route::put('storeJadwal', [SurveyorController::class, 'storeJadwal'])->name('storeJadwal');
|
||||||
Route::get('storeAproved/{id}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
Route::get('storeAproved/{id}', [SurveyorController::class, 'storeAproved'])->name('storeAproved');
|
||||||
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
Route::post('storeFoto', [SurveyorController::class, 'storeFoto'])->name('storeFoto');
|
||||||
|
|||||||
Reference in New Issue
Block a user