From 4b0822540344acc2f944b248f1e4648b86651ff8 Mon Sep 17 00:00:00 2001 From: majid Date: Tue, 29 Oct 2024 14:22:25 +0700 Subject: [PATCH] update pemilihan team hanya surveyor atau penilai dan update form foto menggunakan camera --- app/Http/Controllers/ActivityController.php | 2 +- app/Http/Controllers/PenilaianController.php | 6 +- app/Http/Controllers/SurveyorController.php | 231 ++++++----- app/Http/Controllers/TeamsController.php | 39 +- app/Http/Requests/SurveyorRequest.php | 157 ++++++-- app/Models/GolonganMasySekitar.php | 4 +- app/Models/Lantai.php | 23 ++ app/Models/SpekBangunan.php | 2 +- app/Models/SpekKategoritBangunan.php | 2 +- app/Models/TingkatKeramaian.php | 1 + app/Models/ViewUnit.php | 23 ++ ...2024_10_16_153543_create_analisa_table.php | 1 + .../2024_10_16_153841_create_denah_table.php | 2 +- ...10_16_153902_create_foto_jaminan_table.php | 2 +- ...0_16_153918_create_objek_jaminan_table.php | 1 + ..._10_25_014340_create_lokasi_unit_table.php | 37 ++ ...24_10_25_014428_create_view_unit_table.php | 36 ++ module.json | 60 ++- .../activity/progres_activity/index.blade.php | 2 +- resources/views/penilaian/form.blade.php | 200 ++++++--- .../penilaian/otorisator/index.blade.php | 48 ++- .../views/penilaian/otorisator/show.blade.php | 30 +- .../surveyor/components/alat-berat.blade.php | 192 +++++++++ .../components/apartemen-kantor.blade.php | 14 +- .../views/surveyor/components/foto.blade.php | 379 ++++++++++++++++-- .../surveyor/components/inspeksi.blade.php | 164 ++++++-- .../components/tanah-bangunan.blade.php | 2 +- resources/views/surveyor/data/form.blade.php | 41 +- resources/views/surveyor/data/index.blade.php | 6 +- resources/views/surveyor/index.blade.php | 1 + resources/views/teams/form.blade.php | 1 + routes/breadcrumbs.php | 72 ++++ routes/web.php | 10 +- 33 files changed, 1477 insertions(+), 314 deletions(-) create mode 100644 app/Models/Lantai.php create mode 100644 app/Models/ViewUnit.php create mode 100644 database/migrations/2024_10_25_014340_create_lokasi_unit_table.php create mode 100644 database/migrations/2024_10_25_014428_create_view_unit_table.php create mode 100644 resources/views/surveyor/components/alat-berat.blade.php diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 496f1b4..74bb5f7 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -195,7 +195,7 @@ class ActivityController extends Controller public function dataTablesForActivity(Request $request, $id) { // Query Penilaian dengan relasi yang diperlukan - $query = Penilaian::with(['permohonan', 'permohonan.debiture', 'permohonan.tujuanPenilaian']) + $query = Penilaian::with(['permohonan', 'permohonan.debiture', 'permohonan.tujuanPenilaian', 'permohonan.debiture.documents.jenisJaminan']) ->where(function($q) use ($id) { $q->where('surveyor_id', $id) ->orWhere('penilaian_id', $id) diff --git a/app/Http/Controllers/PenilaianController.php b/app/Http/Controllers/PenilaianController.php index f273b0a..3ae9cde 100644 --- a/app/Http/Controllers/PenilaianController.php +++ b/app/Http/Controllers/PenilaianController.php @@ -222,7 +222,8 @@ class PenilaianController extends Controller - public function otorisator(Request $request){ + public function otorisator(Request $request) + { $type = $request->route('type'); $header = ''; @@ -248,7 +249,8 @@ class PenilaianController extends Controller return view('lpj::penilaian.otorisator.index', compact('header')); } - public function show($id){ + public function show($id) + { $permohonan = Permohonan::find($id); diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 36b9ae2..d4e30df 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -32,9 +32,14 @@ use Modules\Lpj\Models\Denah; use Modules\Lpj\Models\FotoJaminan; use Modules\Lpj\Models\Lingkungan; use Modules\Lpj\Models\LantaiUnit; +use Modules\Lpj\Models\Lantai; +use Modules\Lpj\Models\ViewUnit; use Modules\Lpj\Models\ObjekJaminan; use Modules\Lpj\Models\RuteJaminan; use Modules\Lpj\Models\AnalisaUnit; +use Modules\Lpj\Models\GolonganMasySekitar; +use Modules\Lpj\Models\TingkatKeramaian; +use Modules\Lpj\Models\LaluLintasLokasi; use Modules\Lpj\Models\SpekBagunanAnalisaDetail; use Modules\Lpj\Http\Requests\SurveyorRequest; use Modules\Lpj\Http\Requests\FormSurveyorRequest; @@ -552,6 +557,8 @@ class SurveyorController extends Controller { $permohonan = $this->getPermohonanJaminanId($id, $jaminanId); + + $branches = Branch::all(); $provinces = Province::all(); @@ -570,6 +577,11 @@ class SurveyorController extends Controller $spekBangunan = SpekBangunan::all(); $saranaPelengkap = SaranaPelengkap::all(); $arahMataAngin = ArahMataAngin::all(); + $lantai = Lantai::all(); + $viewUnit = ViewUnit::all(); + $golMasySekitar = GolonganMasySekitar::all(); + $tingkatKeramaian = TingkatKeramaian::all(); + $laluLintasLokasi = LaluLintasLokasi::all(); $analisa = Analisa::with('analisaTanahBangunan', 'analisaLingkungan', 'analisaFakta', 'jenisJaminan') @@ -597,6 +609,12 @@ class SurveyorController extends Controller 'spekBangunan', 'saranaPelengkap', 'arahMataAngin', + 'lantai', + 'viewUnit', + 'golMasySekitar', + 'tingkatKeramaian', + 'laluLintasLokasi' + )); } @@ -625,10 +643,6 @@ class SurveyorController extends Controller $provinces = Province::all(); $fotoJaminan = FotoJaminan::with(['objekJaminan', 'lantaiUnit' ,'ruteJaminan', 'lingkungan'])->where('permohonan_id', $id)->where('jenis_jaminan_id', $jaminanId)->first(); - - // return response()->json([ - // 'data' => $fotoJaminan, - // ]); return view('lpj::surveyor.components.foto', compact('permohonan', 'surveyor', 'branches', 'provinces', 'fotoJaminan')); } @@ -658,25 +672,18 @@ class SurveyorController extends Controller } + + + private function getHeader(string $type): array + { + return self::HEADERS[$type] ?? []; + } + public function data(Request $request) { $type = $request->route('type'); - - $headers = [ - 'bentuk-tanah' => ['Bentuk Tanah', 'bentuk-tanah'], - 'kontur-tanah' => ['Kontur Tanah', 'kontur-tanah'], - 'posisi-kavling' => ['Posisi Kavling', 'posisi-kavling'], - 'ketinggian-tanah' => ['Ketinggian Tanah', 'ketinggian-tanah'], - 'kondisi-fisik-tanah' => ['Kondisi Fisik Tanah', 'kondisi-fisik-tanah'], - 'jenis-bangunan' => ['Jenis Bangunan', 'jenis-bangunan'], - 'kondisi-bangunan' => ['Kondisi Bangunan', 'kondisi-bangunan'], - 'sifat-bangunan' => ['Sifat Bangunan', 'sifat-bangunan'], - 'sarana-pelengkap' => ['Sarana Pelengkap', 'sarana-pelengkap'], - ]; - - $header = $headers[$type] ?? ''; - + $header = $this->getHeader($request->route('type')); return view('lpj::surveyor.data.index', compact('header')); } @@ -684,21 +691,9 @@ class SurveyorController extends Controller public function createData($type) { - $headers = [ - 'bentuk-tanah' => ['Bentuk Tanah', 'bentuk-tanah'], - 'kontur-tanah' => ['Kontur Tanah', 'kontur-tanah'], - 'posisi-kavling' => ['Posisi Kavling', 'posisi-kavling'], - 'ketinggian-tanah' => ['Ketinggian Tanah', 'ketinggian-tanah'], - 'kondisi-fisik-tanah' => ['Kondisi Fisik Tanah', 'kondisi-fisik-tanah'], - 'jenis-bangunan' => ['Jenis Bangunan', 'jenis-bangunan'], - 'kondisi-bangunan' => ['Kondisi Bangunan', 'kondisi-bangunan'], - 'sifat-bangunan' => ['Sifat Bangunan', 'sifat-bangunan'], - 'sarana-pelengkap' => ['Sarana Pelengkap', 'sarana-pelengkap'], - ]; - - - $header = $headers[$type] ?? ''; - return view('lpj::surveyor.data.form', compact('header')); + $spekKategoriBagunan = SpekKategoritBangunan::all(); + $header = $this->getHeader($type); + return view('lpj::surveyor.data.form', compact('header','spekKategoriBagunan')); } @@ -710,30 +705,21 @@ class SurveyorController extends Controller $type = $request->route('type'); - $modelClasses = [ - 'bentuk-tanah' => BentukTanah::class, - 'kontur-tanah' => KonturTanah::class, - 'posisi-kavling' => PosisiKavling::class, - 'bentuk-tanah' => BentukTanah::class, - 'kontur-tanah' => KonturTanah::class, - 'posisi-kavling' => PosisiKavling::class, - 'ketinggian-tanah' => KetinggianTanah::class, - 'kondisi-fisik-tanah' => KondisiFisikTanah::class, - 'jenis-bangunan' => JenisBangunan::class, - 'kondisi-bangunan' => KondisiBangunan::class, - 'sifat-bangunan' => SifatBangunan::class, - 'sarana-pelengkap' => SaranaPelengkap::class, - ]; + $modelClass = $this->getModelClass($type); - if (!array_key_exists($type, $modelClasses)) { + if (!$modelClass) { return redirect() ->route('basicdata.'. $type .'.index') ->with('error', 'Invalid type specified.'); } - $modelClass = $modelClasses[$type]; - $data = $request->all(); - $data['status'] = true; + if($type == 'spek-bangunan') { + $validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id; + + } + + + $data = array_merge($validate, ['status' => true]); $modelClass::create($data); return redirect() @@ -757,6 +743,9 @@ class SurveyorController extends Controller 'spek-bangunan' => ['Spek Bangunan', 'spek-bangunan', SpekBangunan::class], 'spek-kategori-bangunan' => ['Spek Kategori Bangunan', 'spek-kategori-bangunan', SpekKategoritBangunan::class], 'sarana-pelengkap' => ['Sarana Pelengkap', 'sarana-pelengkap', SaranaPelengkap::class], + 'lantai-unit' => ['Lantai Unit', 'lantai-unit', Lantai::class], + 'view-unit' => ['View Unit', 'view-unit', ViewUnit::class], + 'gol-mas-sekitar' => ['Golongan Masyarakat Sekitar', 'gol-mas-sekitar', GolonganMasySekitar::class], ]; @@ -769,7 +758,13 @@ class SurveyorController extends Controller $header = $dataMap[$type] ?? ''; $model = $modelClass::findOrFail($id); - return view('lpj::surveyor.data.form', compact('header', 'model')); + if ($type == 'spek-bangunan') { + $spekKategoriBagunan = SpekKategoritBangunan::all(); + + } + + + return view('lpj::surveyor.data.form', compact('header', 'model','spekKategoriBagunan')); } @@ -777,26 +772,22 @@ class SurveyorController extends Controller { $validate = $request->validated(); if ($validate) { - $modelClasses = [ - 'bentuk-tanah' => BentukTanah::class, - 'kontur-tanah' => KonturTanah::class, - 'posisi-kavling' => PosisiKavling::class, - 'ketinggian-tanah' => KetinggianTanah::class, - 'kondisi-fisik-tanah' => KondisiFisikTanah::class, - 'jenis-bangunan' => JenisBangunan::class, - 'kondisi-bangunan' => KondisiBangunan::class, - 'sifat-bangunan' => SifatBangunan::class, - 'sarana-pelengkap' => SaranaPelengkap::class, + $modelClass = $this->getModelClass($type); - ]; + if($type == 'spek-bangunan') { + $validate['spek_kategori_bagunan_id'] = $request->spek_kategori_bagunan_id; + + } // Check if the provided type exists in the modelClasses - if (!array_key_exists($type, $modelClasses)) { + if (!$modelClass) { return redirect() ->route('basicdata.' . $type . '.index') ->with('error', 'Invalid type specified.'); } - $modelClass = $modelClasses[$type]; + + + $model = $modelClass::findOrFail($id); $model->update($validate); @@ -817,8 +808,6 @@ class SurveyorController extends Controller //abort(403, 'Sorry! You are not allowed to view users.'); } - // Retrieve data from the database - $models = [ 'Bentuk Tanah' => BentukTanah::class, 'Kontur Tanah' => KonturTanah::class, @@ -828,9 +817,14 @@ class SurveyorController extends Controller 'Jenis Bangunan' => JenisBangunan::class, 'Kondisi Bangunan' => KondisiBangunan::class, 'Sifat Bangunan' => SifatBangunan::class, - // 'Spek Kategori Bangunan' => SpekKategoritBangunan::class, - // 'Spek Bangunan' => SpekBangunan::class, + 'Spek Kategori Bangunan' => SpekKategoritBangunan::class, + 'Spek Bangunan' => SpekBangunan::class, 'Sarana Pelengkap' => SaranaPelengkap::class, + 'Lalu Lintas Depan Lokasi' => LaluLintasLokasi::class, + 'Tingkat Keramaian' => TingkatKeramaian::class, + 'Golongan Masyarakat Sekitar' => GolonganMasySekitar::class, + 'Lantai Unit' => Lantai::class, + 'View Unit' => ViewUnit::class, ]; @@ -840,8 +834,6 @@ class SurveyorController extends Controller throw new InvalidArgumentException("Invalid type: $type"); } - - // Apply search filter if provided if ($request->has('search') && !empty($request->get('search'))) { $search = $request->get('search'); $query->where(function ($q) use ($search) { @@ -897,24 +889,13 @@ class SurveyorController extends Controller { try { - $modelClasses = [ - 'bentuk-tanah' => BentukTanah::class, - 'kontur-tanah' => KonturTanah::class, - 'posisi-kavling' => PosisiKavling::class, - 'ketinggian-tanah' => KetinggianTanah::class, - 'kondisi-fisik-tanah' => KondisiFisikTanah::class, - 'jenis-bangunan' => JenisBangunan::class, - 'kondisi-bangunan' => KondisiBangunan::class, - 'sifat-bangunan' => SifatBangunan::class, - 'sarana-pelengkap' => SaranaPelengkap::class, - ]; + $modelClass = $this->getModelClass($type); - - if (!array_key_exists($type, $modelClasses)) { + if (!$modelClass) { return response()->json(['success' => false, 'message' => 'Invalid type specified.'], 400); } - $modelClass = $modelClasses[$type]; + $model = $modelClass::findOrFail($id); $model->delete(); @@ -948,6 +929,47 @@ class SurveyorController extends Controller ->findOrFail($id); } + public function submitSurveyor(Request $request, $id) + { + $permohonan = Permohonan::find($id); + $permohonan->update([ + 'status' => 'done', + ]); + return redirect() + ->route('surveyor.index') + ->with('success', 'form surveyor submitted successfully'); + + } + + + private function getModelClass(string $type): ?string + { + return $this->modelClasses[$type] ?? null; + } + + + + private $modelClasses = [ + 'bentuk-tanah' => BentukTanah::class, + 'kontur-tanah' => KonturTanah::class, + 'posisi-kavling' => PosisiKavling::class, + 'ketinggian-tanah' => KetinggianTanah::class, + 'kondisi-fisik-tanah' => KondisiFisikTanah::class, + 'jenis-bangunan' => JenisBangunan::class, + 'kondisi-bangunan' => KondisiBangunan::class, + 'sifat-bangunan' => SifatBangunan::class, + 'sarana-pelengkap' => SaranaPelengkap::class, + 'lalu-lintas-lokasi' => LaluLintasLokasi::class, + 'tingkat-keramaian' => TingkatKeramaian::class, + 'gol-mas-sekitar' => GolonganMasySekitar::class, + 'spek-kategori-bangunan' => SpekKategoritBangunan::class, + 'lantai-unit' => Lantai::class, + 'view-unit' => ViewUnit::class, + ]; + + + + private function getCommonData() { return [ @@ -964,21 +986,34 @@ class SurveyorController extends Controller 'spekKategoriBangunan' => SpekKategoritBangunan::all(), 'spekBangunan' => SpekBangunan::all(), 'saranaPelengkap' => SaranaPelengkap::all(), - 'arahMataAngin' => ArahMataAngin::all() + 'arahMataAngin' => ArahMataAngin::all(), + 'lantai' => Lantai::all(), + 'viewUnit' => ViewUnit::all(), + 'golMasySekitar' => GolonganMasySekitar::all(), + 'tingkatKeramaian' => TingkatKeramaian::all(), + 'laluLintasLokasi' => LaluLintasLokasi::all(), + ]; } - public function submitSurveyor(Request $request, $id) - { - $permohonan = Permohonan::find($id); - $permohonan->update([ - 'status' => 'done', - ]); - return redirect() - ->route('surveyor.index') - ->with('success', 'form surveyor submitted successfully'); - - } + private const HEADERS = [ + 'bentuk-tanah' => ['Bentuk Tanah', 'bentuk-tanah'], + 'kontur-tanah' => ['Kontur Tanah', 'kontur-tanah'], + 'posisi-kavling' => ['Posisi Kavling', 'posisi-kavling'], + 'ketinggian-tanah' => ['Ketinggian Tanah', 'ketinggian-tanah'], + 'kondisi-fisik-tanah' => ['Kondisi Fisik Tanah', 'kondisi-fisik-tanah'], + 'jenis-bangunan' => ['Jenis Bangunan', 'jenis-bangunan'], + 'kondisi-bangunan' => ['Kondisi Bangunan', 'kondisi-bangunan'], + 'sifat-bangunan' => ['Sifat Bangunan', 'sifat-bangunan'], + 'sarana-pelengkap' => ['Sarana Pelengkap', 'sarana-pelengkap'], + 'lalu-lintas-lokasi' => ['Lalu Lintas Depan Lokasi', 'lalu-lintas-lokasi'], + 'tingkat-keramaian' => ['Tingkat Keramaian', 'tingkat-keramaian'], + 'gol-mas-sekitar' => ['Golongan Masyarakat Sekitar', 'gol-mas-sekitar'], + 'spek-kategori-bangunan' => ['Spek Kategori Bangunan', 'spek-kategori-bangunan'], + 'spek-bangunan' => ['Spek Bangunan', 'spek-bangunan'], + 'lantai-unit' => ['Lantai Unit', 'lantai-unit'], + 'view-unit' => ['View Unit', 'view-unit'], + ]; } diff --git a/app/Http/Controllers/TeamsController.php b/app/Http/Controllers/TeamsController.php index e360132..a6eb9ca 100644 --- a/app/Http/Controllers/TeamsController.php +++ b/app/Http/Controllers/TeamsController.php @@ -31,20 +31,26 @@ class TeamsController extends Controller * Show the form for creating a new resource. */ public function create() - { +{ - // cek region apakah sudah ada di tabel teams - $regionTeam = Teams::pluck('regions_id')->toArray(); - $region = Regions::whereNotIn('id', $regionTeam)->get(); + $regionTeam = Teams::pluck('regions_id')->toArray(); + $regions = Regions::whereNotIn('id', $regionTeam)->get(); - // cek user apakah sudah ada di tabel teams_users - $userTeam = TeamsUsers::pluck('user_id')->toArray(); - $user = User::whereNotIn('id', $userTeam) - ->with('roles') - ->get(); + $userTeam = TeamsUsers::pluck('user_id')->toArray(); + $usersWithRole = User::whereNotIn('id', $userTeam) + ->with('roles') // Eager load roles + ->get(); - return view('lpj::teams.form', compact('region', 'user')); - } + $user = $usersWithRole->filter(function ($user) { + return $user->roles->contains(function ($role) { + return $role->name === 'surveyor' || $role->name === 'surveyor-penilai'; + }); + }); + + + + return view('lpj::teams.form', compact('regions', 'user')); +} /** * Store a newly created resource in storage. @@ -97,12 +103,19 @@ class TeamsController extends Controller { $teams = Teams::find($id); - $region = Regions::all(); $usedUsers = TeamsUsers::where('teams_id', '!=', $id)->pluck('user_id')->toArray(); - $user = User::whereNotIn('id', $usedUsers) + $usersWithRole = User::whereNotIn('id', $usedUsers) ->with('roles') ->get(); + + + $user = $usersWithRole->filter(function ($user) { + return $user->roles->contains(function ($role) { + return $role->name === 'surveyor' || $role->name === 'surveyor-penilai'; + }); + }); + // Ambil user yang sudah ada di tim ini $selectedUsers = $teams->teamsUsers->pluck('user_id')->toArray(); diff --git a/app/Http/Requests/SurveyorRequest.php b/app/Http/Requests/SurveyorRequest.php index b986f8e..7fbb8b7 100644 --- a/app/Http/Requests/SurveyorRequest.php +++ b/app/Http/Requests/SurveyorRequest.php @@ -4,62 +4,137 @@ namespace Modules\Lpj\Http\Requests; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Validation\Rule; + class SurveyorRequest extends FormRequest { /** - * Get the validation rules that apply to the request. + * Table mapping for different actionszz */ - public function rules() - : array - { - - $action = $this->input('action'); - - $uniqueTable = [ - 'bentuk-tanah' => 'bentuk_tanah', - 'kontur-tanah' => 'kontur_tanah', - 'posisi-kavling' => 'posisi_kavling', - 'ketinggian-tanah' => 'ketinggian_tanah', - 'kondisi-fisik-tanah' => 'kondisi_fisik_tanah', - 'kondisi-bangunan' => 'kondisi_bangunan', - 'jenis-bangunan' => 'jenis_bangunan', - 'sifat-bangunan' => 'sifat_bangunan', - 'sarana-pelengkap' => 'sarana_pelengkap', - 'lalu_lintas_lokasi' => 'lalu_lintas_lokasi', - 'tingkat-keramaian' => 'tingkat_keramaian', - ]; - - - - $rules = [ - 'name' => 'required|max:255', - - ]; - - $id = $this->route('id'); - - if ($this->method() == 'PUT' || $this->method() == 'PATCH') { - $rules['code'] = 'required|max:50|unique:' . $uniqueTable[$action] . ',code,' . $id; - } else { - - $rules['code'] = 'required|max:50|unique:' . $uniqueTable[$action] . ',code'; - } - return $rules; - } + private const TABLE_MAPPING = [ + 'bentuk-tanah' => 'bentuk_tanah', + 'kontur-tanah' => 'kontur_tanah', + 'posisi-kavling' => 'posisi_kavling', + 'ketinggian-tanah' => 'ketinggian_tanah', + 'kondisi-fisik-tanah' => 'kondisi_fisik_tanah', + 'kondisi-bangunan' => 'kondisi_bangunan', + 'jenis-bangunan' => 'jenis_bangunan', + 'sifat-bangunan' => 'sifat_bangunan', + 'sarana-pelengkap' => 'sarana_pelengkap', + 'lalu-lintas-lokasi' => 'lalu_lintas_lokasi', + 'tingkat-keramaian' => 'tingkat_keramaian', + 'gol-mas-sekitar' => 'gol_mas_sekitar', + 'spek-kategori-bangunan' => 'spek_kategori_bangunan', + 'spek-bangunan' => 'spek_bangunan', + 'lantai-unit' => 'lantai', + 'view-unit' => 'view_unit', + ]; /** * Determine if the user is authorized to make this request. */ - public function authorize() - : bool + public function authorize(): bool { return true; } - protected function prepareForValidation() + /** + * Get the validation rules that apply to the request. + */ + public function rules(): array + { + return array_merge( + $this->getBaseRules(), + $this->getActionSpecificRules(), + $this->getCodeValidationRules() + ); + } + + /** + * Get base validation rules + */ + private function getBaseRules(): array + { + return [ + 'name' => 'required|max:255', + ]; + } + + /** + * Get action specific validation rules + */ + private function getActionSpecificRules(): array + { + $action = $this->input('action'); + + return match ($action) { + 'spek-bangunan' => [ + 'spek_kategori_bangunan_id' => [ + 'required' + ], + ], + // Add more action specific rules here + default => [], + }; + } + + /** + * Get code validation rules + */ + private function getCodeValidationRules(): array + { + $action = $this->input('action'); + $table = self::TABLE_MAPPING[$action] ?? null; + + if (!$table) { + return []; + } + + $rules = ['required', 'max:50']; + + if ($this->isMethod('PUT') || $this->isMethod('PATCH')) { + $rules[] = Rule::unique($table, 'code')->ignore($this->route('id')); + } else { + $rules[] = Rule::unique($table, 'code'); + } + + return ['code' => $rules]; + } + + /** + * Prepare the data for validation. + */ + protected function prepareForValidation(): void { $this->merge([ 'status' => true, ]); } + + /** + * Get custom messages for validator errors. + */ + public function messages(): array + { + return [ + 'name.required' => 'Nama harus diisi', + 'name.max' => 'Nama tidak boleh lebih dari 255 karakter', + 'code.required' => 'Kode harus diisi', + 'code.max' => 'Kode tidak boleh lebih dari 50 karakter', + 'code.unique' => 'Kode sudah digunakan', + 'spek_kategori_bangunan_id.required' => 'Kategori bangunan harus dipilih', + ]; + } + + /** + * Get custom attributes for validator errors. + */ + public function attributes(): array + { + return [ + 'name' => 'Nama', + 'code' => 'Kode', + 'spek_kategori_bangunan_id' => 'Kategori Bangunan', + ]; + } } diff --git a/app/Models/GolonganMasySekitar.php b/app/Models/GolonganMasySekitar.php index 5140710..a4d1f9a 100644 --- a/app/Models/GolonganMasySekitar.php +++ b/app/Models/GolonganMasySekitar.php @@ -10,10 +10,12 @@ class GolonganMasySekitar extends Model { use HasFactory; + protected $table = 'gol_mas_sekitar'; /** * The attributes that are mass assignable. */ - protected $fillable = []; + protected $fillable = ['code', 'name', 'status']; + protected static function newFactory(): GolonganMasySekitarFactory { diff --git a/app/Models/Lantai.php b/app/Models/Lantai.php new file mode 100644 index 0000000..3330df1 --- /dev/null +++ b/app/Models/Lantai.php @@ -0,0 +1,23 @@ +unsignedBigInteger('permohonan_id'); $table->foreign('permohonan_id')->references('id')->on('permohonan'); $table->string('luas'); + $table->unsignedBigInteger('jenis_jaminan_id'); $table->char('authorized_status', 1)->nullable(); $table->timestamp('authorized_at')->nullable(); $table->unsignedBigInteger('authorized_by')->nullable(); diff --git a/database/migrations/2024_10_16_153841_create_denah_table.php b/database/migrations/2024_10_16_153841_create_denah_table.php index 308a7ad..71475ff 100644 --- a/database/migrations/2024_10_16_153841_create_denah_table.php +++ b/database/migrations/2024_10_16_153841_create_denah_table.php @@ -18,7 +18,7 @@ return new class () extends Migration { $table->string('foto_denah'); $table->string('luas'); - + $table->unsignedBigInteger('jenis_jaminan_id'); $table->char('authorized_status', 1)->nullable(); $table->timestamp('authorized_at')->nullable(); $table->unsignedBigInteger('authorized_by')->nullable(); diff --git a/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php b/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php index f0e1000..3c7f514 100644 --- a/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php +++ b/database/migrations/2024_10_16_153902_create_foto_jaminan_table.php @@ -16,7 +16,7 @@ return new class () extends Migration { $table->foreign('permohonan_id')->references('id')->on('permohonan'); $table->string('pendamping'); - + $table->unsignedBigInteger('jenis_jaminan_id'); $table->char('authorized_status', 1)->nullable(); $table->timestamp('authorized_at')->nullable(); $table->unsignedBigInteger('authorized_by')->nullable(); diff --git a/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php b/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php index b55f7eb..3d02a38 100644 --- a/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php +++ b/database/migrations/2024_10_16_153918_create_objek_jaminan_table.php @@ -19,6 +19,7 @@ return new class () extends Migration { $table->string('name'); $table->string('foto_objek'); + $table->unsignedBigInteger('jenis_jaminan_id'); $table->char('authorized_status', 1)->nullable(); $table->timestamp('authorized_at')->nullable(); $table->unsignedBigInteger('authorized_by')->nullable(); diff --git a/database/migrations/2024_10_25_014340_create_lokasi_unit_table.php b/database/migrations/2024_10_25_014340_create_lokasi_unit_table.php new file mode 100644 index 0000000..cc51e6d --- /dev/null +++ b/database/migrations/2024_10_25_014340_create_lokasi_unit_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('lokasi_unit'); + } +}; diff --git a/database/migrations/2024_10_25_014428_create_view_unit_table.php b/database/migrations/2024_10_25_014428_create_view_unit_table.php new file mode 100644 index 0000000..5a99cfe --- /dev/null +++ b/database/migrations/2024_10_25_014428_create_view_unit_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('code')->unique()->index(); + $table->string('name'); + $table->boolean('status')->default(true); + $table->char('authorized_status', 1)->nullable(); + $table->timestamps(); + $table->timestamp('authorized_at')->nullable(); + $table->unsignedBigInteger('authorized_by')->nullable(); + $table->softDeletes(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('view_unit'); + } +}; diff --git a/module.json b/module.json index 427bfca..ed66671 100644 --- a/module.json +++ b/module.json @@ -344,7 +344,7 @@ "roles": ["administrator", "admin"] }, { - "title": "Bentuk Tanah", + "title": "Bentuk", "path": "basicdata.bentuk-tanah", "classes": "", "attributes": [], @@ -415,8 +415,66 @@ "attributes": [], "permission": "", "roles": ["surveyor"] + }, + + { + "title": "Lalu Lintas Sekitar", + "path": "basicdata.lalu-lintas-lokasi", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "Tingkat Keramaian", + "path": "basicdata.tingkat-keramaian", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "Masyarakat Sekitar", + "path": "basicdata.gol-mas-sekitar", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "Lantai Unit", + "path": "basicdata.lantai-unit", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "View unit", + "path": "basicdata.view-unit", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "Spesifikasi Bangunan", + "path": "basicdata.spek-bangunan", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] + }, + { + "title": "Kategori Speksikasi Bangunan", + "path": "basicdata.spek-kategori-bangunan", + "classes": "", + "attributes": [], + "permission": "", + "roles": ["surveyor"] } + ] } ], diff --git a/resources/views/activity/progres_activity/index.blade.php b/resources/views/activity/progres_activity/index.blade.php index 7f824da..67942a7 100644 --- a/resources/views/activity/progres_activity/index.blade.php +++ b/resources/views/activity/progres_activity/index.blade.php @@ -180,7 +180,7 @@ }, jenis_asset: { title: 'Jenis Asset', - render: (item, data) => `${data.jenis_asset || ''}`, + render: (item, data) => `${data.permohonan.debiture.documents.map(d => d.jenis_jaminan.name) || ''}`, }, jenis_report: { title: 'Jenis Report', diff --git a/resources/views/penilaian/form.blade.php b/resources/views/penilaian/form.blade.php index 07e7061..8ac5c47 100644 --- a/resources/views/penilaian/form.blade.php +++ b/resources/views/penilaian/form.blade.php @@ -280,15 +280,14 @@ +
- + + type="text" value="{{ $jenisPenilaian->name }}" readonly> @error('jenis_penilaian_id') {{ $message }} @enderror @@ -300,9 +299,7 @@ Tim Penilai yang di tunjuk
- + @error('teams_id') @@ -311,62 +308,115 @@
+
- +
+ +
- @error('surveyor_id') + @error('surveyor_selection') {{ $message }} @enderror
- -
- -
- - @error('penilaian_id') - {{ $message }} - @enderror + -
- -
- - @error('penilai_surveyor_id') - {{ $message }} - @enderror + + -
- -
- -
- - -
@@ -473,8 +516,51 @@
@endsection @push('scripts') - + + + + +@endpush diff --git a/resources/views/surveyor/components/alat-berat.blade.php b/resources/views/surveyor/components/alat-berat.blade.php new file mode 100644 index 0000000..c010e38 --- /dev/null +++ b/resources/views/surveyor/components/alat-berat.blade.php @@ -0,0 +1,192 @@ + + +
+ + +
+

Identitas Debitur

+
+
+ +
+ + + @error('bentuk_tanah') + {{ $message }} + @enderror +
+
+ +
+

Lokasi Jaminan

+
+
+ @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) + +
+ +
+ + + @error('bentuk_tanah') + {{ $message }} + @enderror +
+
+ @endforeach + @endif +
+
+ + +
+
+

Data Data Jaminan

+
+
+
+ +
+ + + @error('hadapMataAngin') + {{ $message }} + @enderror +
+
+ + @php + $inputDataJaminan = []; + + $inputDataJaminan = [ + ['label' => 'Nomor Lambung', 'index' => 0], + ['label' => 'Model Unit', 'index' => 1], + ['label' => 'Tahun Pembuatan', 'index' => 2], + ['label' => 'Merk', 'index' => 3], + ['label' => 'Negara Pembuat', 'index' => 4], + ['label' => 'Tahun Pembelian', 'index' => 5], + ['label' => 'Nomor Faktur/Invoice', 'index' => 6], + ['label' => 'Nomor Kontrak Pembelian', 'index' => 7], + ['label' => 'Nama Pemilik', 'index' => 8], + ['label' => 'Alamaat Pemilik', 'index' => 9], + ['label' => 'Nomor Asuransi', 'index' => 10], + ['label' => 'Nomor Rangka', 'index' => 11], + ['label' => 'Nomor Mesin', 'index' => 12], + ['label' => 'Hour Mesin', 'index' => 13], + ['label' => 'Overhaul Mesin', 'index' => 14], + ]; + + @endphp + + @if (count($inputDataJaminan) > 0) + @foreach ($inputDataJaminan as $item) + +
+ +
+ + + @error('bentuk_tanah') + {{ $message }} + @enderror +
+
+ @endforeach + @endif +
+
+ + + +
+
+

Kondisi Objek Jaminan

+
+
+
+ +
+ + + @error('hadapMataAngin') + {{ $message }} + @enderror +
+
+ + @php + $kondisiObjeck = []; + + $kondisiObjeck = [ + ['label' => 'Mesin dan Panel Instrument', 'index' => 0], + ['label' => 'Fungsi mesin dan panel instrument', 'index' => 1], + ['label' => 'Interior (jok, dll)', 'index' => 2], + ['label' => 'Rangka dan Karoseri', 'index' => 3], + ['label' => 'Ban', 'index' => 4], + ['label' => 'Velg', 'index' => 5], + ['label' => 'Air Conditioner', 'index' => 6], + ['label' => 'Aksesoris Tambahan lainnya', 'index' => 7], + ['label' => 'LCD', 'index' => 8], + ['label' => 'Perlengkapan Keamanan', 'index' => 9], + ['label' => 'Asuransi', 'index' => 10], + ]; + + @endphp + + @if (count($kondisiObjeck) > 0) + @foreach ($kondisiObjeck as $item) + +
+ +
+ + + @error('bentuk_tanah') + {{ $message }} + @enderror +
+
+ @endforeach + @endif +
+
diff --git a/resources/views/surveyor/components/apartemen-kantor.blade.php b/resources/views/surveyor/components/apartemen-kantor.blade.php index 05e0adb..28cb7e8 100644 --- a/resources/views/surveyor/components/apartemen-kantor.blade.php +++ b/resources/views/surveyor/components/apartemen-kantor.blade.php @@ -1,5 +1,5 @@
-
+

Analisa Unit

@@ -104,8 +104,8 @@ class="input tomselect w-full @error('lantai') border-danger bg-danger-light @enderror" name="lantai"> - @if (isset($posisiKavling)) - @foreach ($posisiKavling as $item) + @if (isset($lantai)) + @foreach ($lantai as $item) @endforeach @endif @@ -126,8 +126,8 @@ class="input tomselect w-full @error('view') border-danger bg-danger-light @enderror" name="view"> - @if (isset($kondisiFisikTanah)) - @foreach ($kondisiFisikTanah as $item) + @if (isset($viewUnit)) + @foreach ($viewUnit as $item) @endforeach @endif @@ -146,8 +146,8 @@ class="input tomselect w-full @error('bentuk_unit') border-danger bg-danger-light @enderror" name="bentuk_unit"> - @if (isset($kondisiFisikTanah)) - @foreach ($kondisiFisikTanah as $item) + @if (isset($bentukTanah)) + @foreach ($bentukTanah as $item) @endforeach @endif diff --git a/resources/views/surveyor/components/foto.blade.php b/resources/views/surveyor/components/foto.blade.php index 4ca2845..b31698f 100644 --- a/resources/views/surveyor/components/foto.blade.php +++ b/resources/views/surveyor/components/foto.blade.php @@ -5,6 +5,7 @@ @endsection --}} @section('content') +
@@ -120,7 +121,6 @@
-
+ +

Rute Menuju Lokasi

@@ -177,25 +179,33 @@ @if (isset($fotoJaminan)) @foreach ($fotoJaminan->ruteJaminan as $item) - + @if (isset($item->foto_rute)) + Gambar Pendamping + @endif
- @if (isset($item->foto_rute)) - Gambar Pendamping - @endif - - - -
+ +
+ + + +
+ + +
@error('foto_rute.*') {{ $message }} @@ -211,9 +221,17 @@ - - + +
+ + + +
+
+
@@ -289,7 +314,7 @@
-
+
@@ -336,10 +361,16 @@ - - +
+ + + +
+
+
+ +
+
+ + + + + @endsection @push('scripts') + + +