From a43c65e4c25af4ea7942477a5c23decc404e1c42 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 14:50:29 +0700 Subject: [PATCH 01/33] feat(penilaian): tambahkan kolom jenis laporan pada tabel - Menambahkan kolom "Jenis Laporan" di tampilan otorisator. - Memperbarui controller untuk menyertakan data penilai. --- app/Http/Controllers/PenilaianController.php | 1 + .../views/penilaian/otorisator/index.blade.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/Http/Controllers/PenilaianController.php b/app/Http/Controllers/PenilaianController.php index 4160d59..a3da8f7 100644 --- a/app/Http/Controllers/PenilaianController.php +++ b/app/Http/Controllers/PenilaianController.php @@ -680,6 +680,7 @@ class PenilaianController extends Controller 'penilaian.userPenilai' => function ($q) { $q->where('role', 'penilai')->with(['user', 'team.regions'])->first(); }, + 'penilai', 'approveSo', 'approveEo', 'approveDd', diff --git a/resources/views/penilaian/otorisator/index.blade.php b/resources/views/penilaian/otorisator/index.blade.php index 713c5dc..bd0d821 100644 --- a/resources/views/penilaian/otorisator/index.blade.php +++ b/resources/views/penilaian/otorisator/index.blade.php @@ -66,6 +66,11 @@ + + Jenis Laporan + + + Status Bayar @@ -211,6 +216,15 @@ return ''; }, }, + jenis_laporan: { + title: 'Jenis laporan', + render: (item, data) => { + if(data.penilai.type_penilai){ + return `${data.penilai.type_penilai}`; + } + return ''; + }, + }, status_bayar: { title: 'Status Bayar', render: (item, data) => { From 32de93ef9f65f22bb1b8d82b61bb0f5b1f3ca354 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 15:54:52 +0700 Subject: [PATCH 02/33] feat(custom-field): tambahkan fitur custom field - Menambahkan model CustomField dengan atribut mass assignable. - Membuat request validation untuk custom field. - Menambahkan route dan breadcrumb untuk custom field. - Membuat migration untuk tabel custom_fields. - Menambahkan export functionality untuk custom field. - Membuat view untuk menambah dan mengedit custom field. --- app/Exports/CustomFieldExport.php | 49 ++++++ .../Controllers/CustomFieldController.php | 150 ++++++++++++++++++ app/Http/Requests/CustomFieldRequest.php | 33 ++++ app/Models/CustomField.php | 24 +++ ...1_30_082943_create_custom_fields_table.php | 34 ++++ module.json | 11 ++ .../views/custom_fields/create.blade.php | 67 ++++++++ resources/views/custom_fields/index.blade.php | 146 +++++++++++++++++ routes/breadcrumbs.php | 16 ++ routes/web.php | 13 +- 10 files changed, 542 insertions(+), 1 deletion(-) create mode 100644 app/Exports/CustomFieldExport.php create mode 100644 app/Http/Controllers/CustomFieldController.php create mode 100644 app/Http/Requests/CustomFieldRequest.php create mode 100644 app/Models/CustomField.php create mode 100644 database/migrations/2025_01_30_082943_create_custom_fields_table.php create mode 100644 resources/views/custom_fields/create.blade.php create mode 100644 resources/views/custom_fields/index.blade.php diff --git a/app/Exports/CustomFieldExport.php b/app/Exports/CustomFieldExport.php new file mode 100644 index 0000000..5158d70 --- /dev/null +++ b/app/Exports/CustomFieldExport.php @@ -0,0 +1,49 @@ +id, + $row->name, + $row->type, + $row->created_at, + $row->updated_at, + ]; + } + + public function headings(): array + { + return [ + 'ID', + 'Name', + 'Type', + 'Created At', + 'Updated At', + ]; + } + + public function columnFormats(): array + { + return [ + 'A' => NumberFormat::FORMAT_NUMBER, + 'D' => NumberFormat::FORMAT_DATE_DDMMYYYY, + 'E' => NumberFormat::FORMAT_DATE_DDMMYYYY, + ]; + } +} diff --git a/app/Http/Controllers/CustomFieldController.php b/app/Http/Controllers/CustomFieldController.php new file mode 100644 index 0000000..ad41ee9 --- /dev/null +++ b/app/Http/Controllers/CustomFieldController.php @@ -0,0 +1,150 @@ +validated(); + + if ($validate) { + try { + // Save to database + CustomField::create($validate); + return redirect() + ->route('basicdata.custom-field.index') + ->with('success', 'Custom Field created successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.custom-field.create') + ->with('error', $e->getMessage()); + } + } + } + + public function create() + { + return view('lpj::custom_fields.create'); + } + + public function edit($id) + { + $customField = CustomField::find($id); + return view('lpj::custom_fields.create', compact('customField')); + } + + public function update(CustomFieldRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Update in database + $customField = CustomField::find($id); + $customField->update($validate); + return redirect() + ->route('basicdata.custom-field.index') + ->with('success', 'Custom Field updated successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.custom-field.edit', $id) + ->with('error', 'Failed to update custom field'); + } + } + } + + public function destroy($id) + { + try { + // Delete from database + $customField = CustomField::find($id); + $customField->delete(); + + echo json_encode(['success' => true, 'message' => 'Custom Field deleted successfully']); + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete custom field']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('custom_fields.view')) { + //abort(403, 'Sorry! You are not allowed to view custom fields.'); + } + + // Retrieve data from the database + $query = CustomField::query(); + + // Apply search filter if provided + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('name', 'LIKE', "%$search%"); + $q->orWhere('type', 'LIKE', "%$search%"); + }); + } + + // Apply sorting if provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->get(); + + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } + + public function export() + { + return Excel::download(new CustomFieldExport, 'custom_fields.xlsx'); + } +} diff --git a/app/Http/Requests/CustomFieldRequest.php b/app/Http/Requests/CustomFieldRequest.php new file mode 100644 index 0000000..08c5740 --- /dev/null +++ b/app/Http/Requests/CustomFieldRequest.php @@ -0,0 +1,33 @@ + 'required|max:255', + 'type' => 'required|in:text,select,radio,checkbox', + ]; + } + + /** + * Determine if the user is authorized to make this request. + */ + public function authorize(): bool + { + return true; + } + + public function prepareValidationData($data){ + if(!$this->type){ + $this->merge(['type' => 'text']); + } + } +} diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php new file mode 100644 index 0000000..94c43be --- /dev/null +++ b/app/Models/CustomField.php @@ -0,0 +1,24 @@ +id(); + $table->string('name'); + $table->string('type'); + $table->timestamps(); + $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('custom_fields'); + } +}; diff --git a/module.json b/module.json index 4d52030..8eb0128 100644 --- a/module.json +++ b/module.json @@ -851,6 +851,17 @@ "administrator", "admin" ] + }, + { + "title": "Custom Field", + "path": "basicdata.custom-field", + "classes": "", + "attributes": [], + "permission": "", + "roles": [ + "administrator", + "admin" + ] } ] } diff --git a/resources/views/custom_fields/create.blade.php b/resources/views/custom_fields/create.blade.php new file mode 100644 index 0000000..31220b0 --- /dev/null +++ b/resources/views/custom_fields/create.blade.php @@ -0,0 +1,67 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
+ @if(isset($customField->id)) +
+ + @method('PUT') + @else + + @endif + @csrf +
+
+

+ {{ isset($customField->id) ? 'Edit' : 'Tambah' }} Custom Field +

+
+ Back +
+
+
+
+ +
+ + @error('name') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('type') + {{ $message }} + @enderror +
+
+
+ +
+
+
+
+
+@endsection diff --git a/resources/views/custom_fields/index.blade.php b/resources/views/custom_fields/index.blade.php new file mode 100644 index 0000000..b6b128c --- /dev/null +++ b/resources/views/custom_fields/index.blade.php @@ -0,0 +1,146 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render('basicdata.custom-field') }} +@endsection + +@section('content') +
+
+
+

+ Daftar Custom Field +

+ +
+
+
+ + + + + + + + + +
+ + + Custom Field + + + Type + + Action
+
+ +
+
+
+@endsection + +@push('scripts') + + +@endpush + diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index a0ec3d2..63dc265 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -9,6 +9,22 @@ }); } + Breadcrumbs::for('basicdata.custom-field', function (BreadcrumbTrail $trail) { + $trail->parent('basicdata'); + $trail->push('Custom Field', route('basicdata.custom-field.index')); + }); + + Breadcrumbs::for('basicdata.custom-field.create', function (BreadcrumbTrail $trail) { + $trail->parent('basicdata.custom-field'); + $trail->push('Tambah Custom Field', route('basicdata.custom-field.create')); + }); + + Breadcrumbs::for('basicdata.custom-field.edit', function (BreadcrumbTrail $trail) { + $trail->parent('basicdata.custom-field'); + $trail->push('Edit Custom Field'); + }); + + Breadcrumbs::for('basicdata.jenis-fasilitas-kredit', function (BreadcrumbTrail $trail) { $trail->parent('basicdata'); $trail->push('Jenis Fasilitas Kredit', route('basicdata.jenis-fasilitas-kredit.index')); diff --git a/routes/web.php b/routes/web.php index 5714df6..0b96766 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,7 +3,8 @@ use Illuminate\Support\Facades\Route; use Modules\Lpj\Http\Controllers\ActivityController; use Modules\Lpj\Http\Controllers\ArahMataAnginController; -use Modules\Lpj\Http\Controllers\DebitureController; + use Modules\Lpj\Http\Controllers\CustomFieldController; + use Modules\Lpj\Http\Controllers\DebitureController; use Modules\Lpj\Http\Controllers\DokumenJaminanController; use Modules\Lpj\Http\Controllers\HubunganPemilikJaminanController; use Modules\Lpj\Http\Controllers\HubunganPenghuniJaminanController; @@ -51,6 +52,16 @@ Route::middleware(['auth'])->group(function () { Route::get('api/check-penawaran/{nomor_registrasi}', [TenderController::class, 'checkPenawaranExistence']); Route::name('basicdata.')->prefix('basic-data')->group(function () { + + Route::name('custom-field.')->prefix('custom-field')->group(function () { + Route::get('restore/{id}', [CustomFieldController::class, 'restore'])->name('restore'); + Route::get('datatables', [CustomFieldController::class, 'dataForDatatables'])->name( + 'datatables', + ); + Route::get('export', [CustomFieldController::class, 'export'])->name('export'); + }); + Route::resource('custom-field', CustomFieldController::class); + Route::name('jenis-fasilitas-kredit.')->prefix('jenis-fasilitas-kredit')->group(function () { Route::get('restore/{id}', [JenisFasilitasKreditController::class, 'restore'])->name('restore'); Route::get('datatables', [JenisFasilitasKreditController::class, 'dataForDatatables'])->name( From 18cbb0bbc5e2c63317ea8e02963d174096477053 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 16:14:48 +0700 Subject: [PATCH 03/33] feat(custom-field): tambahkan kolom label dan urutan prioritas - Menambahkan kolom 'label' pada tabel custom_fields. - Menambahkan kolom 'urutan_prioritas' pada tabel custom_fields. - Memperbarui model CustomField untuk menyertakan kolom baru. - Memperbarui form input untuk label dan urutan prioritas di tampilan create dan index. - Menambahkan validasi untuk label dan urutan prioritas di CustomFieldRequest. --- .../Controllers/CustomFieldController.php | 271 +++++++++--------- app/Http/Requests/CustomFieldRequest.php | 25 ++ app/Models/CustomField.php | 4 +- ...rutan_prioritas_to_custom_fields_table.php | 28 ++ ...91021_add_label_to_custom_fields_table.php | 28 ++ .../views/custom_fields/create.blade.php | 22 ++ resources/views/custom_fields/index.blade.php | 9 +- 7 files changed, 251 insertions(+), 136 deletions(-) create mode 100644 database/migrations/2025_01_30_085835_add_urutan_prioritas_to_custom_fields_table.php create mode 100644 database/migrations/2025_01_30_091021_add_label_to_custom_fields_table.php diff --git a/app/Http/Controllers/CustomFieldController.php b/app/Http/Controllers/CustomFieldController.php index ad41ee9..b42ab89 100644 --- a/app/Http/Controllers/CustomFieldController.php +++ b/app/Http/Controllers/CustomFieldController.php @@ -1,150 +1,153 @@ validated(); + public function index() + { + return view('lpj::custom_fields.index'); + } - if ($validate) { - try { - // Save to database - CustomField::create($validate); - return redirect() - ->route('basicdata.custom-field.index') - ->with('success', 'Custom Field created successfully'); - } catch (Exception $e) { - return redirect() - ->route('basicdata.custom-field.create') - ->with('error', $e->getMessage()); + public function store(CustomFieldRequest $request) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Save to database + CustomField::create($validate); + return redirect() + ->route('basicdata.custom-field.index') + ->with('success', 'Custom Field created successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.custom-field.create') + ->with('error', $e->getMessage()); + } } } - } - public function create() - { - return view('lpj::custom_fields.create'); - } - - public function edit($id) - { - $customField = CustomField::find($id); - return view('lpj::custom_fields.create', compact('customField')); - } - - public function update(CustomFieldRequest $request, $id) - { - $validate = $request->validated(); - - if ($validate) { - try { - // Update in database - $customField = CustomField::find($id); - $customField->update($validate); - return redirect() - ->route('basicdata.custom-field.index') - ->with('success', 'Custom Field updated successfully'); - } catch (Exception $e) { - return redirect() - ->route('basicdata.custom-field.edit', $id) - ->with('error', 'Failed to update custom field'); - } + public function create() + { + $urutan_prioritas = CustomField::max('urutan_prioritas')+1; + return view('lpj::custom_fields.create', compact('urutan_prioritas')); } - } - public function destroy($id) - { - try { - // Delete from database + public function edit($id) + { $customField = CustomField::find($id); - $customField->delete(); + $urutan_prioritas = $customField->urutan_prioritas ?? CustomField::max('urutan_prioritas')+1; + return view('lpj::custom_fields.create', compact('customField', 'urutan_prioritas' )); + } - echo json_encode(['success' => true, 'message' => 'Custom Field deleted successfully']); - } catch (Exception $e) { - echo json_encode(['success' => false, 'message' => 'Failed to delete custom field']); + public function update(CustomFieldRequest $request, $id) + { + $validate = $request->validated(); + + if ($validate) { + try { + // Update in database + $customField = CustomField::find($id); + $customField->update($validate); + return redirect() + ->route('basicdata.custom-field.index') + ->with('success', 'Custom Field updated successfully'); + } catch (Exception $e) { + return redirect() + ->route('basicdata.custom-field.edit', $id) + ->with('error', 'Failed to update custom field'); + } + } + } + + public function destroy($id) + { + try { + // Delete from database + $customField = CustomField::find($id); + $customField->delete(); + + echo json_encode(['success' => true, 'message' => 'Custom Field deleted successfully']); + } catch (Exception $e) { + echo json_encode(['success' => false, 'message' => 'Failed to delete custom field']); + } + } + + public function dataForDatatables(Request $request) + { + if (is_null($this->user) || !$this->user->can('custom_fields.view')) { + //abort(403, 'Sorry! You are not allowed to view custom fields.'); + } + + // Retrieve data from the database + $query = CustomField::query(); + + // Apply search filter if provided + if ($request->has('search') && !empty($request->get('search'))) { + $search = $request->get('search'); + $query->where(function ($q) use ($search) { + $q->where('name', 'LIKE', "%$search%"); + $q->orWhere('label', 'LIKE', "%$search%"); + $q->orWhere('type', 'LIKE', "%$search%"); + }); + } + + // Apply sorting if provided + if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { + $order = $request->get('sortOrder'); + $column = $request->get('sortField'); + $query->orderBy($column, $order); + } + + // Get the total count of records + $totalRecords = $query->count(); + + // Apply pagination if provided + if ($request->has('page') && $request->has('size')) { + $page = $request->get('page'); + $size = $request->get('size'); + $offset = ($page - 1) * $size; // Calculate the offset + + $query->skip($offset)->take($size); + } + + // Get the filtered count of records + $filteredRecords = $query->count(); + + // Get the data for the current page + $data = $query->get(); + + // Calculate the page count + $pageCount = ceil($totalRecords / $request->get('size')); + + // Calculate the current page number + $currentPage = 0 + 1; + + // Return the response data as a JSON object + return response()->json([ + 'draw' => $request->get('draw'), + 'recordsTotal' => $totalRecords, + 'recordsFiltered' => $filteredRecords, + 'pageCount' => $pageCount, + 'page' => $currentPage, + 'totalCount' => $totalRecords, + 'data' => $data, + ]); + } + + public function export() + { + return Excel::download(new CustomFieldExport, 'custom_fields.xlsx'); } } - - public function dataForDatatables(Request $request) - { - if (is_null($this->user) || !$this->user->can('custom_fields.view')) { - //abort(403, 'Sorry! You are not allowed to view custom fields.'); - } - - // Retrieve data from the database - $query = CustomField::query(); - - // Apply search filter if provided - if ($request->has('search') && !empty($request->get('search'))) { - $search = $request->get('search'); - $query->where(function ($q) use ($search) { - $q->where('name', 'LIKE', "%$search%"); - $q->orWhere('type', 'LIKE', "%$search%"); - }); - } - - // Apply sorting if provided - if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) { - $order = $request->get('sortOrder'); - $column = $request->get('sortField'); - $query->orderBy($column, $order); - } - - // Get the total count of records - $totalRecords = $query->count(); - - // Apply pagination if provided - if ($request->has('page') && $request->has('size')) { - $page = $request->get('page'); - $size = $request->get('size'); - $offset = ($page - 1) * $size; // Calculate the offset - - $query->skip($offset)->take($size); - } - - // Get the filtered count of records - $filteredRecords = $query->count(); - - // Get the data for the current page - $data = $query->get(); - - // Calculate the page count - $pageCount = ceil($totalRecords / $request->get('size')); - - // Calculate the current page number - $currentPage = 0 + 1; - - // Return the response data as a JSON object - return response()->json([ - 'draw' => $request->get('draw'), - 'recordsTotal' => $totalRecords, - 'recordsFiltered' => $filteredRecords, - 'pageCount' => $pageCount, - 'page' => $currentPage, - 'totalCount' => $totalRecords, - 'data' => $data, - ]); - } - - public function export() - { - return Excel::download(new CustomFieldExport, 'custom_fields.xlsx'); - } -} diff --git a/app/Http/Requests/CustomFieldRequest.php b/app/Http/Requests/CustomFieldRequest.php index 08c5740..0cf1cf8 100644 --- a/app/Http/Requests/CustomFieldRequest.php +++ b/app/Http/Requests/CustomFieldRequest.php @@ -3,6 +3,8 @@ namespace Modules\Lpj\Http\Requests; use Illuminate\Foundation\Http\FormRequest; +use Modules\Lpj\Models\customField; +use Illuminate\Validation\Rule; class CustomFieldRequest extends FormRequest { @@ -14,6 +16,12 @@ class CustomFieldRequest extends FormRequest return [ 'name' => 'required|max:255', 'type' => 'required|in:text,select,radio,checkbox', + 'label' => 'nullable|max:255', + 'urutan_prioritas' => [ + 'nullable', + 'integer', + Rule::unique('custom_fields')->ignore($this->route('custom_field')), + ], ]; } @@ -29,5 +37,22 @@ class CustomFieldRequest extends FormRequest if(!$this->type){ $this->merge(['type' => 'text']); } + + if (!$this->urutan_prioritas) { + $maxPrioritas = CustomField::max('urutan_prioritas') ?? 0; + $this->merge(['urutan_prioritas' => $maxPrioritas + 1]); + } + } + + /** + * Get custom messages for validator errors. + * + * @return array + */ + public function messages() + { + return [ + 'urutan_prioritas.unique' => 'Urutan prioritas sudah digunakan. Silakan pilih nomor lain.', + ]; } } diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php index 94c43be..8efcd66 100644 --- a/app/Models/CustomField.php +++ b/app/Models/CustomField.php @@ -14,7 +14,9 @@ class customField extends Base */ protected $fillable = [ 'name', - 'type' + 'type', + 'urutan_prioritas', + 'label' ]; // protected static function newFactory(): CustomFieldFactory diff --git a/database/migrations/2025_01_30_085835_add_urutan_prioritas_to_custom_fields_table.php b/database/migrations/2025_01_30_085835_add_urutan_prioritas_to_custom_fields_table.php new file mode 100644 index 0000000..f4250e3 --- /dev/null +++ b/database/migrations/2025_01_30_085835_add_urutan_prioritas_to_custom_fields_table.php @@ -0,0 +1,28 @@ +integer('urutan_prioritas')->nullable()->after('type'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('custom_fields', function (Blueprint $table) { + $table->dropColumn('urutan_prioritas'); + }); + } +}; diff --git a/database/migrations/2025_01_30_091021_add_label_to_custom_fields_table.php b/database/migrations/2025_01_30_091021_add_label_to_custom_fields_table.php new file mode 100644 index 0000000..39f8b30 --- /dev/null +++ b/database/migrations/2025_01_30_091021_add_label_to_custom_fields_table.php @@ -0,0 +1,28 @@ +string('label')->nullable()->after('name'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('custom_fields', function (Blueprint $table) { + $table->dropColumn('label'); + }); + } +}; diff --git a/resources/views/custom_fields/create.blade.php b/resources/views/custom_fields/create.blade.php index 31220b0..448cdb2 100644 --- a/resources/views/custom_fields/create.blade.php +++ b/resources/views/custom_fields/create.blade.php @@ -39,6 +39,17 @@ @enderror +
+ +
+ + @error('label') + {{ $message }} + @enderror +
+
+
+ +
+ + @error('urutan_prioritas') + {{ $message }} + @enderror +
+
-
- - - + +
+ +
+ + + @endsection From 92d0aff9f8cfbdb0ffe798b9dd5875827febfcd6 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 20:49:34 +0700 Subject: [PATCH 05/33] feat(custom-field): tambahkan fungsi untuk mendapatkan custom field - Menambahkan fungsi getCustomField untuk mengambil custom field berdasarkan ID atau nama. - Memperbarui penggunaan model customField di file Lpj.php. --- app/Helpers/Lpj.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Helpers/Lpj.php b/app/Helpers/Lpj.php index 6a778a0..56da2f3 100644 --- a/app/Helpers/Lpj.php +++ b/app/Helpers/Lpj.php @@ -2,7 +2,8 @@ use Carbon\Carbon; use Illuminate\Support\Facades\DB; -use Modules\Lpj\Models\HolidayCalendar; + use Modules\Lpj\Models\customField; + use Modules\Lpj\Models\HolidayCalendar; use Modules\Lpj\Models\PenawaranDetailTender; use Modules\Lpj\Models\PenawaranTender; use Modules\Lpj\Models\Penilaian; @@ -359,3 +360,16 @@ function getNomorLaporan($permohonanId, $documentId){ ])->first(); return $laporan->nomor_laporan ?? null; } + +function getCustomField($param){ + if(is_numeric($param)){ + $field = CustomField::find($param); + } else { + $field = CustomField::where(['name' => $param])->first(); + } + if($field){ + return $field; + } else { + return null; + } +} From b9d6e5a95ba9c20a1a764c9aee140b4e5711f2fc Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 20:50:00 +0700 Subject: [PATCH 06/33] feat(dokumen-jaminan): perbaiki pengambilan custom field - Memperbaiki pengambilan custom field pada dokumen jaminan. - Mengubah logika untuk mendapatkan custom field berdasarkan ID yang benar. - Menambahkan pengambilan custom fields yang terkait dengan jenis legalitas jaminan. --- .../Controllers/DokumenJaminanController.php | 12 +- .../debitur/components/dokumen.blade.php | 122 ++++++++---------- 2 files changed, 64 insertions(+), 70 deletions(-) diff --git a/app/Http/Controllers/DokumenJaminanController.php b/app/Http/Controllers/DokumenJaminanController.php index 78a11c2..f272eaa 100644 --- a/app/Http/Controllers/DokumenJaminanController.php +++ b/app/Http/Controllers/DokumenJaminanController.php @@ -14,6 +14,7 @@ use Modules\Location\Models\Province; use Modules\Location\Models\Village; use Modules\Lpj\Http\Requests\DokumenJaminanRequest; + use Modules\Lpj\Models\customField; use Modules\Lpj\Models\Debiture; use Modules\Lpj\Models\DetailDokumenJaminan; use Modules\Lpj\Models\DokumenJaminan; @@ -88,7 +89,7 @@ 'jenis_legalitas_jaminan_id' => $value, 'name' => $request->name[$key], 'keterangan' => $request->keterangan[$key], - 'details' => isset($request->custom_field[$key]) ? json_encode($request->custom_field[$key]) : '' + 'details' => isset($request->custom_field[$value]) ? json_encode($request->custom_field[$value]) : '' ]; $dokumenJaminan = []; @@ -247,7 +248,7 @@ 'jenis_legalitas_jaminan_id' => $value, 'name' => $request->name[$key], 'keterangan' => $request->keterangan[$key], - 'details' => isset($request->custom_field[$key]) ? json_encode($request->custom_field[$key]) : '' + 'details' => isset($request->custom_field[$value]) ? json_encode($request->custom_field[$value]) : '' ]; $dokumenJaminan = []; @@ -496,6 +497,12 @@ foreach ($document->detail as $detail) { // Only include existing legalitas if its id is in the new set if (in_array($detail->jenis_legalitas_jaminan_id, $newLegalitasIds)) { + $customFields = []; + if($detail->jenisLegalitasJaminan->custom_fields) { + $customFields = CustomField::whereIn('id', $detail->jenisLegalitasJaminan->custom_fields) + ->get(); + } + $existingLegalitas[] = [ 'id' => $detail->id, 'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id, @@ -507,6 +514,7 @@ $detail->dokumen_nomor, ) ?? $detail->dokumen_nomor, 'custom_field' => $detail->jenisLegalitasJaminan->custom_field, + 'custom_fields' => $customFields, 'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type, 'details' => $detail->details, 'keterangan' => $detail->keterangan, diff --git a/resources/views/debitur/components/dokumen.blade.php b/resources/views/debitur/components/dokumen.blade.php index ed7805f..80cd597 100644 --- a/resources/views/debitur/components/dokumen.blade.php +++ b/resources/views/debitur/components/dokumen.blade.php @@ -16,16 +16,16 @@

-
- -
-

- {{ $permohonan->nomor_registrasi ?? "-" }} -

-
+
+ +
+

+ {{ $permohonan->nomor_registrasi ?? "-" }} +

+
@if($detail->details) - @if($detail->jenisLegalitasJaminan->custom_field) - @php $custom_field = json_decode($detail->details,true) @endphp -
- -
- + @if($detail->jenisLegalitasJaminan->custom_fields) + @php $custom_field = json_decode($detail->details) @endphp + {{ $custom_field->luas_tanah }} + @foreach($custom_field as $key => $value) +
+ +
+ +
-
+ @endforeach @endif - @else - @if($detail->jenisLegalitasJaminan->custom_field) -
- -
- @if($detail->jenisLegalitasJaminan->custom_field_type === "text") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "number") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "date") - - @elseif($detail->jenisLegalitasJaminan->custom_field_type === "textarea") - - @else - - @endif + @if($detail->jenisLegalitasJaminan->custom_fields) + @foreach($detail->jenisLegalitasJaminan->custom_fields as $key) +
+ +
+ +
-
+ @endforeach @endif @endif @@ -393,25 +387,17 @@
- @if($item->custom_field) -
- -
- @if($item->custom_field_type === "text") - - @elseif($item->custom_field_type === "number") - - @elseif($item->custom_field_type === "date") - - @elseif($item->custom_field_type === "textarea") - - @else - - @endif + @if($item->custom_fields) + @foreach($item->custom_fields as $field) +
+ +
+ +
-
+ @endforeach @endif
@@ -437,13 +423,13 @@ @push('scripts') {{--Pemilik Jaminan--}} From cae62db0dfe31072adabde5b7677c137c004f81c Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 20:50:16 +0700 Subject: [PATCH 07/33] fix(penawaran): perbaiki pengambilan luas tanah dan luas bangunan - Sederhanakan kondisi untuk memeriksa dan mengambil nilai luas tanah dan luas bangunan. - Ganti penggunaan notasi objek dengan notasi akses langsung untuk meningkatkan keterbacaan. - Hapus kondisi yang tidak perlu untuk meningkatkan efisiensi kode. --- .../views/penawaran/kirimEmail.blade.php | 178 +++++++++--------- .../views/penawaran/kirimEmailKJPP.blade.php | 14 +- .../views/penawaran/surat_tender.blade.php | 18 +- .../penawaran/surat_tender_download.blade.php | 14 +- .../penawaran/surat_tender_kjpp.blade.php | 22 +-- .../surat_tender_kjpp_download.blade.php | 176 +++++++++-------- 6 files changed, 196 insertions(+), 226 deletions(-) diff --git a/resources/views/penawaran/kirimEmail.blade.php b/resources/views/penawaran/kirimEmail.blade.php index fa42b41..a4238b4 100644 --- a/resources/views/penawaran/kirimEmail.blade.php +++ b/resources/views/penawaran/kirimEmail.blade.php @@ -56,8 +56,8 @@ -
- Dear +
+ Dear @php $allPeople = []; @@ -76,7 +76,7 @@ } } } - } catch (\Exception $e) { + } catch (Exception $e) { // Handle invalid JSON silently } } @@ -85,104 +85,100 @@ $allPeople = array_filter($allPeople); $totalPeople = count($allPeople); @endphp - @if ($totalPeople > 0) - @foreach ($allPeople as $index => $person) - {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} - @endforeach - @else - Tidak Ada - @endif + @if ($totalPeople > 0) + @foreach ($allPeople as $index => $person) + {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} + @endforeach + @else + Tidak Ada + @endif -
- Mohon untuk dibuatkan proposal jasa appraisal atas nama {{ $permohonan->debiture->name }}, tujuan penilaian untuk {{ $penawaran->tujuanPenilaianKJPP->name }}, laporan dalam bentuk {{ $penawaran->jenisLaporan->name }}, dengan data-data sebagai berikut: -
+
+ Mohon untuk dibuatkan proposal jasa appraisal atas nama {{ $permohonan->debiture->name }}, tujuan penilaian untuk {{ $penawaran->tujuanPenilaianKJPP->name }}, laporan dalam bentuk {{ $penawaran->jenisLaporan->name }}, dengan data-data sebagai berikut: +
-
- Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) - {{ $document->jenisJaminan->name }} - @endforeach - Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) - {{ $document->address }}, Kel. @foreach ($villages as $village) - {{ $village->name }} - @endforeach, Kec. @foreach ($districts as $district) - {{ $district->name }} - @endforeach,@foreach ($cities as $city) - {{ ucwords(strtolower($city->name)) }} - @endforeach,@foreach ($provinces as $province) - {{ $province->name }} - @endforeach - @endforeach - - - Luas Tanah / Luas Bangunan: - @php - $luas_tanah = null; - $luas_bangunan = null; - @endphp - - @foreach ($permohonan->debiture->documents as $document) - @foreach ($document->detail as $detail) - @php - $details = json_decode($detail->details); - @endphp - - @if (is_object($details)) - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) - @php - $luas_tanah = $details->{'luas_tanah'}; - @endphp - @endif - - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) - @php - $luas_bangunan = $details->{'luas_bangunan'}; - @endphp - @endif - @endif +
+ Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) + {{ $document->jenisJaminan->name }} + @endforeach + Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) + {{ $document->address }}, Kel. @foreach ($villages as $village) + {{ $village->name }} + @endforeach, Kec. @foreach ($districts as $district) + {{ $district->name }} + @endforeach,@foreach ($cities as $city) + {{ ucwords(strtolower($city->name)) }} + @endforeach,@foreach ($provinces as $province) + {{ $province->name }} @endforeach @endforeach + - @if ($luas_tanah !== null && $luas_bangunan !== null) - {{ $luas_tanah }} m2 / {{ $luas_bangunan }} m2 - @elseif ($luas_tanah !== null) - {{ $luas_tanah }} m2 - @elseif ($luas_bangunan !== null) - {{ $luas_bangunan }} m2 - @endif -
+ Luas Tanah / Luas Bangunan: + @php + $luas_tanah = null; + $luas_bangunan = null; + @endphp -
- Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi.
- Mohon proposal dapat saya terima segera, sebelum {{ formatTanggalIndonesia($penawaran->end_date, true) }} -
+ @foreach ($permohonan->debiture->documents as $document) + @foreach ($document->detail as $detail) + @php + $details = json_decode($detail->details); + @endphp -
- Best Regards,
- {{ $permohonan->user->name }} -

- {{ $permohonan->user->name }} -

-
+ @if (is_object($details)) + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)) + ) + @php + $luas_tanah = $details->luas_tanah; + @endphp + @endif - + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)) + ) + @php + $luas_bangunan = $details->luas_bangunan; + @endphp + @endif + @endif + @endforeach + @endforeach + + @if ($luas_tanah !== null && $luas_bangunan !== null) + {{ $luas_tanah }} m2 / {{ $luas_bangunan }} m2 + @elseif ($luas_tanah !== null) + {{ $luas_tanah }} m2 + @elseif ($luas_bangunan !== null) + {{ $luas_bangunan }} m2 + @endif
+ +
+ Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi.
+ Mohon proposal dapat saya terima segera, sebelum {{ formatTanggalIndonesia($penawaran->end_date, true) }} +
+ +
+ Best Regards,
+ {{ $permohonan->user->name }} +

+ {{ $permohonan->user->name }} +

+
+ + +
diff --git a/resources/views/penawaran/kirimEmailKJPP.blade.php b/resources/views/penawaran/kirimEmailKJPP.blade.php index e9e1981..33ca36a 100644 --- a/resources/views/penawaran/kirimEmailKJPP.blade.php +++ b/resources/views/penawaran/kirimEmailKJPP.blade.php @@ -133,21 +133,15 @@ @endphp @if (is_object($details)) - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))) @php - $luas_tanah = $details->{'luas_tanah'}; + $luas_tanah = $details->luas_tanah; @endphp @endif - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))) @php - $luas_bangunan = $details->{'luas_bangunan'}; + $luas_bangunan = $details->luas_bangunan; @endphp @endif @endif diff --git a/resources/views/penawaran/surat_tender.blade.php b/resources/views/penawaran/surat_tender.blade.php index 7b8f5f0..ae704d6 100644 --- a/resources/views/penawaran/surat_tender.blade.php +++ b/resources/views/penawaran/surat_tender.blade.php @@ -116,21 +116,15 @@ @endphp @if (is_object($details)) - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) - @php - $luas_tanah = $details->{'luas_tanah'}; - @endphp + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))) + @php + $luas_tanah = $details->luas_tanah; + @endphp @endif - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))) @php - $luas_bangunan = $details->{'luas_bangunan'}; + $luas_bangunan = $details->luas_bangunan; @endphp @endif @endif diff --git a/resources/views/penawaran/surat_tender_download.blade.php b/resources/views/penawaran/surat_tender_download.blade.php index dcf640c..800ebcb 100644 --- a/resources/views/penawaran/surat_tender_download.blade.php +++ b/resources/views/penawaran/surat_tender_download.blade.php @@ -131,21 +131,15 @@ @endphp @if (is_object($details)) - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))) @php - $luas_tanah = $details->{'luas_tanah'}; + $luas_tanah = $details->luas_tanah; @endphp @endif - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))) @php - $luas_bangunan = $details->{'luas_bangunan'}; + $luas_bangunan = $details->luas_bangunan; @endphp @endif @endif diff --git a/resources/views/penawaran/surat_tender_kjpp.blade.php b/resources/views/penawaran/surat_tender_kjpp.blade.php index 8edc180..4370fa8 100644 --- a/resources/views/penawaran/surat_tender_kjpp.blade.php +++ b/resources/views/penawaran/surat_tender_kjpp.blade.php @@ -13,7 +13,7 @@
+ class="btn btn-xs btn-light"> pdfDownload jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)) + ) @php - $luas_tanah = $details->{'luas_tanah'}; + $luas_tanah = $details->luas_tanah; @endphp @endif - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)) + ) @php - $luas_bangunan = $details->{'luas_bangunan'}; + $luas_bangunan = $details->luas_bangunan; @endphp @endif @endif @@ -152,7 +148,7 @@

Best Regards,

{{ $permohonan->user->name }} + alt="{{ $permohonan->user->name }}" width="200" class="signature">

{{ $permohonan->user->name }}

diff --git a/resources/views/penawaran/surat_tender_kjpp_download.blade.php b/resources/views/penawaran/surat_tender_kjpp_download.blade.php index bfd1806..81f1981 100644 --- a/resources/views/penawaran/surat_tender_kjpp_download.blade.php +++ b/resources/views/penawaran/surat_tender_kjpp_download.blade.php @@ -56,8 +56,8 @@ -
- Dear +
+ Dear @php $allPeople = []; @@ -87,104 +87,100 @@ $allPeople = array_filter(array_unique($allPeople)); $totalPeople = count($allPeople); @endphp - @if ($totalPeople > 0) - @foreach ($allPeople as $index => $person) - {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} - @endforeach - @else - Tidak Ada - @endif + @if ($totalPeople > 0) + @foreach ($allPeople as $index => $person) + {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} + @endforeach + @else + Tidak Ada + @endif -
- Mohon untuk dibuatkan proposal jasa appraisal atas nama {{ $permohonan->debiture->name }}, tujuan penilaian untuk {{ $penawaran->tujuanPenilaianKJPP->name }}, laporan dalam bentuk {{ $penawaran->jenisLaporan->name }}, dengan data-data sebagai berikut: -
+
+ Mohon untuk dibuatkan proposal jasa appraisal atas nama {{ $permohonan->debiture->name }}, tujuan penilaian untuk {{ $penawaran->tujuanPenilaianKJPP->name }}, laporan dalam bentuk {{ $penawaran->jenisLaporan->name }}, dengan data-data sebagai berikut: +
-
- Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) - {{ $document->jenisJaminan->name }} - @endforeach - Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) - {{ $document->address }}, Kel. @foreach ($villages as $village) - {{ $village->name }} - @endforeach, Kec. @foreach ($districts as $district) - {{ $district->name }} - @endforeach,@foreach ($cities as $city) - {{ ucwords(strtolower($city->name)) }} - @endforeach,@foreach ($provinces as $province) - {{ $province->name }} - @endforeach - @endforeach - - - Luas Tanah / Luas Bangunan: - @php - $luas_tanah = null; - $luas_bangunan = null; - @endphp - - @foreach ($permohonan->debiture->documents as $document) - @foreach ($document->detail as $detail) - @php - $details = json_decode($detail->details); - @endphp - - @if (is_object($details)) - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && - isset($details->{'luas_tanah'}) && - is_numeric($details->{'luas_tanah'})) - @php - $luas_tanah = $details->{'luas_tanah'}; - @endphp - @endif - - @if ( - $detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && - isset($details->{'luas_bangunan'}) && - is_numeric($details->{'luas_bangunan'})) - @php - $luas_bangunan = $details->{'luas_bangunan'}; - @endphp - @endif - @endif +
+ Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) + {{ $document->jenisJaminan->name }} + @endforeach + Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) + {{ $document->address }}, Kel. @foreach ($villages as $village) + {{ $village->name }} + @endforeach, Kec. @foreach ($districts as $district) + {{ $district->name }} + @endforeach,@foreach ($cities as $city) + {{ ucwords(strtolower($city->name)) }} + @endforeach,@foreach ($provinces as $province) + {{ $province->name }} @endforeach @endforeach + - @if ($luas_tanah !== null && $luas_bangunan !== null) - {{ $luas_tanah }} m2 / {{ $luas_bangunan }} m2 - @elseif ($luas_tanah !== null) - {{ $luas_tanah }} m2 - @elseif ($luas_bangunan !== null) - {{ $luas_bangunan }} m2 - @endif -
+ Luas Tanah / Luas Bangunan: + @php + $luas_tanah = null; + $luas_bangunan = null; + @endphp -
- Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi.
- Mohon proposal dapat saya terima segera, sebelum {{ formatTanggalIndonesia($penawaran->end_date, true) }} -
+ @foreach ($permohonan->debiture->documents as $document) + @foreach ($document->detail as $detail) + @php + $details = json_decode($detail->details); + @endphp -
- Best Regards,
- {{ $permohonan->user->name }} -

- {{ $permohonan->user->name }} -

-
+ @if (is_object($details)) + @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)) + ) + @php + $luas_tanah = $details->luas_tanah; + @endphp + @endif - + @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)) + ) + @php + $luas_bangunan = $details->luas_bangunan; + @endphp + @endif + @endif + @endforeach + @endforeach + + @if ($luas_tanah !== null && $luas_bangunan !== null) + {{ $luas_tanah }} m2 / {{ $luas_bangunan }} m2 + @elseif ($luas_tanah !== null) + {{ $luas_tanah }} m2 + @elseif ($luas_bangunan !== null) + {{ $luas_bangunan }} m2 + @endif
+ +
+ Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi.
+ Mohon proposal dapat saya terima segera, sebelum {{ formatTanggalIndonesia($penawaran->end_date, true) }} +
+ +
+ Best Regards,
+ {{ $permohonan->user->name }} +

+ {{ $permohonan->user->name }} +

+
+ + +
From ad3d3e900d5dd52fa9c950933f6878f9d8a464db Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Thu, 30 Jan 2025 20:50:32 +0700 Subject: [PATCH 08/33] feat(jenis-legalitas-jaminan): perbaiki tampilan checkbox untuk jenis legalitas jaminan - Memperbaiki struktur HTML untuk bagian jenis legalitas jaminan. - Mengoptimalkan penggunaan checkbox dengan penataan ulang kode. - Menjaga fungsionalitas checkbox tetap utuh saat menyimpan data. --- .../views/jenis_jaminan/create.blade.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/views/jenis_jaminan/create.blade.php b/resources/views/jenis_jaminan/create.blade.php index c206f7a..173c692 100644 --- a/resources/views/jenis_jaminan/create.blade.php +++ b/resources/views/jenis_jaminan/create.blade.php @@ -92,28 +92,28 @@ @enderror
- -
- -
- @foreach ($jenisLegalitasJaminan as $row) -
+
- -
- +
+ + * Masukkan Angka Saja +
@@ -795,6 +807,10 @@
- diff --git a/resources/views/penilai/components/informasi-pembanding.blade.php b/resources/views/penilai/components/informasi-pembanding.blade.php index 3245888..8b0b252 100644 --- a/resources/views/penilai/components/informasi-pembanding.blade.php +++ b/resources/views/penilai/components/informasi-pembanding.blade.php @@ -28,37 +28,39 @@
- +
- {{ $item['harga_diskon'] }} + Rp. {{ $item['harga_diskon'] }}
- {{ $item['harga'] }} + Rp. {{ $item['harga'] }}
- {{ $item['harga'] }} + Rp. {{ $item['harga'] }}
- {{ $item['luas_tanah'] }} + {{ $item['luas_tanah'] }} + m2
- {{ $item['luas_bangunan'] }} + {{ $item['luas_bangunan'] }} + m2
diff --git a/resources/views/surveyor/components/inspeksi.blade.php b/resources/views/surveyor/components/inspeksi.blade.php index 99014f2..9683b77 100644 --- a/resources/views/surveyor/components/inspeksi.blade.php +++ b/resources/views/surveyor/components/inspeksi.blade.php @@ -81,7 +81,7 @@ diff --git a/resources/views/surveyor/js/utils.blade.php b/resources/views/surveyor/js/utils.blade.php index 3c5c55b..c0b19f8 100644 --- a/resources/views/surveyor/js/utils.blade.php +++ b/resources/views/surveyor/js/utils.blade.php @@ -336,4 +336,174 @@ }); }); } + + function updateAnalisa(params) { + const inputMap = { + jenis_asset: 'jenis_asset_tidak_sesuai', + analisa_tanah: 'analisa_tanah_tidak_sesuai', + analisa_unit: 'analisa_luas_unit_tidak_sesuai', + analisa_bangunan: 'analisa_bangunan_tidak_sesuai', + }; + + // Pastikan elemen ID ada di inputMap + if (!inputMap[params]) { + console.error('Parameter tidak valid:', params); + return; + } + + // Ambil nilai berdasarkan parameter + const inputValue = document.getElementById(inputMap[params]).value; + const data = { + [params === 'jenis_asset' ? 'jenis_asset' : params.replace('analisa_', 'luas_')]: inputValue, + types: params + }; + + $.ajax({ + url: '{{ route('surveyor.update_analisa', ['id' => $permohonan->id]) }}', + type: 'POST', + data: data, + headers: { + 'X-CSRF-TOKEN': '{{ csrf_token() }}' + }, + success: function(response) { + console.log(response); + if (response.success) { + // window.location.href = + // '{{ route('surveyor.show', ['id' => $permohonan->id]) }}'; + toastrSuccessBuild(response.message); + } + }, + error: function(xhr, status, error) { + console.error('Terjadi error:', error); + console.log('Status:', status); + console.log('Response:', xhr.responseText); + if (xhr.responseJSON.message) { + toastrErrorBuild(xhr.responseJSON.message); + } else { + toastrErrorBuild('Terjadi kesalahan'); + } + } + }); + } + + function updateAlamatFields(status) { + // Ambil elemen formulir + const addressForm = document.getElementById('alamat_form'); + const inputs = addressForm.querySelectorAll('input, select'); + const addressInput = document.getElementById('address'); + + if (status === 'sesuai') { + addressInput.value = "{{ $dokumen->address ?? '' }}"; + inputs.forEach(element => { + if (element.tagName === 'INPUT') { + element.setAttribute('readonly', true); + } else if (element.tagName === 'SELECT') { + element.setAttribute('disabled', true); + element.classList.add('disabled-input') + } + }); + + addressForm.style.display = 'grid'; + addressForm.disabled = true; + addressForm.classList.add('disabled-input') + + + } else if (status === 'tidak sesuai') { + addressForm.style.display = 'grid'; + + addressForm.removeAttribute('disabled'); + addressForm.classList.remove('disabled-input') + const formInspeksi = @json($forminspeksi ?? ''); + const addressInput = document.getElementById('address'); + + if (formInspeksi && formInspeksi.asset && formInspeksi.asset.alamat) { + if (formInspeksi.asset.alamat['tidak sesuai'] && formInspeksi.asset.alamat['tidak sesuai'].address) { + addressInput.value = formInspeksi.asset.alamat['tidak sesuai'].address; + } else if (formInspeksi.asset.alamat['sesuai'] && formInspeksi.asset.alamat['sesuai'].address) { + addressInput.value = formInspeksi.asset.alamat['sesuai'].address; + } else { + addressInput.value = ""; + } + } + + inputs.forEach(element => { + if (element.tagName === 'INPUT') { + element.removeAttribute('readonly'); + } else if (element.tagName === 'SELECT') { + element.removeAttribute('disabled'); + element.classList.remove('disabled-input') + } + }); + } + } + + function toggleFieldVisibility(fieldName, inputId, visibleValues = []) { + const selectedValue = $(`[name="${fieldName}"]:checked`).val(); + const inputField = $(`#${inputId}`); + + if (visibleValues.includes(selectedValue)) { + inputField.show(); + } else { + inputField.hide().val(''); + } + } + + + function toggleCheckboxVisibility(fieldName, inputId, visibleValues = []) { + const selectedValues = $(`[name="${fieldName}[]"]:checked`) + .map(function() { + return $(this).val().toLowerCase(); // Konversi nilai ke huruf kecil + }) + .get(); + + const inputField = $(`#${inputId}`); + + // Cek apakah salah satu nilai yang dipilih cocok dengan visibleValues + const shouldShow = visibleValues.some(value => selectedValues.includes(value.toLowerCase())); + + if (shouldShow) { + inputField.show(); + } else { + inputField.hide().val(''); + } + } + + + function toggleMultipleFields(fieldName, mappings) { + // Ambil semua nilai checkbox yang dicentang + const selectedValues = $(`[name="${fieldName}[]"]:checked`) + .map(function() { + return $(this).val().toLowerCase(); // Konversi nilai ke huruf kecil + }) + .get(); + + // Iterasi melalui setiap mapping + for (const [key, inputId] of Object.entries(mappings)) { + const inputField = $(`#${inputId}`); + + // Tampilkan input jika nilai yang relevan dipilih + if (selectedValues.includes(key.toLowerCase())) { + inputField.show(); + } else { + inputField.hide().val(''); // Sembunyikan dan reset nilai + } + } + } + + + function toggleAlamatVisibility(idSesuai, idTidakSesuai, selectedValue) { + // Ambil elemen berdasarkan ID + const alamatSesuai = document.getElementById(idSesuai); + const alamatTidakSesuai = document.getElementById(idTidakSesuai); + + // Periksa nilai yang dipilih dan tampilkan elemen yang sesuai + if (selectedValue === 'sesuai') { + alamatSesuai.style.display = 'grid'; // Tampilkan "Alamat Sesuai" + alamatTidakSesuai.style.display = 'none'; // Sembunyikan "Alamat Tidak Sesuai" + } else if (selectedValue === 'tidak sesuai') { + alamatSesuai.style.display = 'none'; // Sembunyikan "Alamat Sesuai" + alamatTidakSesuai.style.display = 'grid'; // Tampilkan "Alamat Tidak Sesuai" + } + } + From d5311a944d018b2d6c54afbd6a2788bee4155623 Mon Sep 17 00:00:00 2001 From: majid Date: Fri, 31 Jan 2025 02:32:55 +0700 Subject: [PATCH 14/33] feat(print-out): hasil inspeksi surveyor --- app/Http/Controllers/ActivityController.php | 54 ++- app/Http/Controllers/SurveyorController.php | 80 ++-- app/Http/Requests/FormSurveyorRequest.php | 1 - module.json | 5 +- resources/views/activity/index.blade.php | 110 +++-- .../views/component/detail-jaminan.blade.php | 4 +- resources/views/penilai/show.blade.php | 4 +- .../surveyor/components/card-tambah.blade.php | 31 +- .../surveyor/components/header.blade.php | 11 +- .../surveyor/components/informasi.blade.php | 87 ++-- .../surveyor/components/inspeksi.blade.php | 6 +- .../components/print-out/bangunan.blade.php | 69 ++- .../components/print-out/informasi.blade.php | 140 ++++++ .../components/print-out/lingkungan.blade.php | 245 ++++++++++ .../components/print-out/main.blade.php | 439 ++--------------- .../components/print-out/rap.blade.php | 448 ++++++++++++++++++ 16 files changed, 1155 insertions(+), 579 deletions(-) create mode 100644 resources/views/surveyor/components/print-out/informasi.blade.php create mode 100644 resources/views/surveyor/components/print-out/lingkungan.blade.php create mode 100644 resources/views/surveyor/components/print-out/rap.blade.php diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 1510f63..adde98d 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -244,6 +244,15 @@ class ActivityController extends Controller // abort(403, 'Sorry! You are not allowed to view users.'); } + $userRole = $user->roles->pluck('name')->first(); + $regionId = null; + + // If user is senior-officer, get their regionId + if ($userRole === 'senior-officer') { + $userTeam = TeamsUsers::with('team')->firstWhere('user_id', $user->id); + $regionId = $userTeam?->team->regions_id; + } + // Retrieve data from the database $query = Permohonan::query(); @@ -289,22 +298,39 @@ class ActivityController extends Controller // Get filtered count $filteredRecords = $query->count(); - // Get data - - $data = null; - $userRole = $user->roles[0]->name ?? null; - - if (in_array($userRole, ['surveyor', 'surveyor-penilai'])) { - $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian']) - ->whereHas('penilaian.userPenilai', function ($q) use ($user) { - $q->where('user_id', $user->id); - }) - ->get(); - } else { - $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian']) - ->get(); + // Filter by region if user is senior-officer + if ($regionId) { + $query->whereHas('region', function ($q) use ($regionId) { + $q->where('region_id', $regionId); + }); } + // Filter for specific roles + if (in_array($userRole, ['surveyor', 'surveyor-penilai'])) { + $query->whereHas('penilaian.userPenilai', function ($q) use ($user) { + $q->where('user_id', $user->id); + }); + } + + $totalRecords = $query->count(); + + // Pagination + if ($request->has('page') && $request->has('size')) { + $page = (int) $request->get('page', 1); + $size = (int) $request->get('size', 10); + $offset = ($page - 1) * $size; + $query->skip($offset)->take($size); + } + + // Get filtered count + $filteredRecords = $query->count(); + + // Get data with necessary relationships + $data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian', 'penilaian', 'dokumenjaminan'])->get(); + + // Calculate total pages + $pageCount = ceil($totalRecords / $request->get('size', 10)); + diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index f71e327..4e8ca97 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -2407,7 +2407,7 @@ class SurveyorController extends Controller $data['hub_cadeb_penghuni'] => ($data['hub_cadeb_penghuni'] == 'sesuai') ? $data['hub_cadeb_penghuni_sesuai'] : $data['hub_penghuni_tidak_sesuai'] ], 'pihak_bank' => $data['pihak_bank'] ?? null, - 'nomor_nib' => $data['nomor_nib'] ?? null, + 'kordinat_lng' => $data['kordinat_lng'] ?? null, 'kordinat_lat' => $data['kordinat_lat'] ?? null, ] @@ -3265,33 +3265,33 @@ class SurveyorController extends Controller if ($checkKesesuaian) { // Mengecek apakah status kesesuaian adalah 'sesuai' $isSesuai = ($data[$fieldName] ?? '') === 'sesuai'; - + // Menggunakan key berdasarkan status kesesuaian $result = [ $isSesuai ? 'sesuai' : 'tidak_sesuai' => $data[$fieldName] ?? null ]; - + // Tambahkan field ekstra jika ada if ($extraField) { $result[$extraField] = $data["{$fieldName}_{$extraField}"] ?? null; } - + return $result; } - + // Jika tidak melakukan pengecekan kesesuaian, hanya ambil data berdasarkan fieldName $result = [ $fieldName => $data[$fieldName] ?? null, ]; - + // Jika ada extra field, tambahkan ke result if ($extraField) { $result[$extraField] = $data["{$fieldName}_{$extraField}"] ?? null; } - + return $result; } - + public function export(string $type) { @@ -3332,12 +3332,13 @@ class SurveyorController extends Controller ->where('dokument_id', $request->input('document_id')) ->first(); - if (!$inspeksi) { - return response()->json([ - 'success' => false, - 'message' => 'Data inspeksi tidak ditemukan' - ], 404); - } + if (!$inspeksi) { + $inspeksi = new Inspeksi(); + $inspeksi->permohonan_id = $request->input('permohonan_id'); + $inspeksi->dokument_id = $request->input('document_id'); + $inspeksi->data_form = json_encode([]); // Inisialisasi data_form kosong + $inspeksi->save(); + } // Decode data form yang ada $dataForm = json_decode($inspeksi->data_form, true) ?: []; @@ -3493,36 +3494,43 @@ class SurveyorController extends Controller public function print_out_inspeksi($permohonan_id, $dokument_id, $jenis_jaminan_id) { - $permohonan = $this->getPermohonanJaminanId( - $permohonan_id, - $dokument_id, - $jenis_jaminan_id - ); + // Ambil data permohonan dan data umum + $permohonan = $this->getPermohonanJaminanId($permohonan_id, $dokument_id, $jenis_jaminan_id); $basicData = $this->getCommonData(); + + // Ambil data inspeksi $inspeksi = Inspeksi::where('permohonan_id', $permohonan_id) ->where('dokument_id', $dokument_id) ->first(); - - $forminspeksi = null; - - if ($inspeksi) { - $forminspeksi = json_decode($inspeksi->data_form, true); + + if (!$inspeksi) { + // Redirect jika inspeksi tidak ditemukan + return redirect()->back()->with('error', 'Data inspeksi tidak ditemukan.'); } - - // Cek jika forminspeksi kosong + + // Decode data form inspeksi + $forminspeksi = json_decode($inspeksi->data_form, true); + if (!$forminspeksi) { - // Redirect kembali dengan pesan error - return redirect()->back()->with('error', 'Silahkan isi terlebih dahulu form inspeksi'); + // Redirect jika data form inspeksi kosong + return redirect()->back()->with('error', 'Silahkan isi terlebih dahulu form inspeksi.'); } - - - $pdf = PDF::loadView('lpj::surveyor.components.print-out.main', compact( - 'permohonan', - 'basicData', - 'forminspeksi', - )); + + // Pilih template PDF berdasarkan nama inspeksi + $templateView = strtolower($inspeksi->name) === 'rap' + ? 'lpj::surveyor.components.print-out.main' + : 'lpj::surveyor.components.print-out.main'; + + // Generate PDF + $pdf = PDF::loadView($templateView, compact('permohonan', 'basicData', 'forminspeksi')); $pdf->setPaper('A4', 'portrait'); - return $pdf->download('Laporan_data.pdf'); + + // Tentukan nama file PDF + $namaDebiture = $permohonan->debiture->name . '-' . $permohonan->nomor_registrasi; + $fileName = 'inspeksi-' . $namaDebiture . '-data.pdf'; + + return $pdf->download($fileName); } + } diff --git a/app/Http/Requests/FormSurveyorRequest.php b/app/Http/Requests/FormSurveyorRequest.php index e29b5cd..8d6ff65 100644 --- a/app/Http/Requests/FormSurveyorRequest.php +++ b/app/Http/Requests/FormSurveyorRequest.php @@ -570,7 +570,6 @@ class FormSurveyorRequest extends FormRequest 'dokument_id' => 'required', 'type' => 'required', 'nomor_registrasi' => 'required', - 'nomor_nib' => 'nullable', 'debitur_perwakilan' => 'required|array', 'jenis_asset_name' => 'nullable|', 'jenis_asset' => 'required', diff --git a/module.json b/module.json index 8eb0128..37e7ebd 100644 --- a/module.json +++ b/module.json @@ -302,7 +302,10 @@ "pemohon-ao", "pemohon-eo", "admin", - "surveyor" + "surveyor", + "senior-officer", + "EO Appraisal", + "DD Appraisal" ] }, { diff --git a/resources/views/activity/index.blade.php b/resources/views/activity/index.blade.php index 798fe44..eda029b 100644 --- a/resources/views/activity/index.blade.php +++ b/resources/views/activity/index.blade.php @@ -4,46 +4,45 @@ {{ Breadcrumbs::render('activity') }} @endsection @section('content') -@push('styles') - - -@endpush + .dropdowns-content a:hover { + background-color: #f1f1f1; + } + + @endpush
@@ -230,7 +229,8 @@ tujuan_penilaian_id: { title: 'Tujuan Penilaian', render: (item, data) => { - return data.tujuan_penilaian && data.tujuan_penilaian.name ? `${data.tujuan_penilaian.name}` : '-'; + return data.tujuan_penilaian && data.tujuan_penilaian.name ? + `${data.tujuan_penilaian.name}` : '-'; }, }, status: { @@ -260,18 +260,34 @@ return `${data.status}`; }, }, - actions: { - title: 'Action', - render: (item, data) => ` -
- - - -
`, - + title: 'Action', + render: (item, data) => { + const status = data.status; // Anggap status berada di dalam objek data + const dokumenjaminan = data.dokumenjaminan || []; + + return ` +
+ + + + ${ + ['survey', 'done', 'proses-laporan', 'laporan', 'paparan'].includes(status) ? + dokumenjaminan.map(dokumen => { + return ` + + + + `; + }).join('') : '' } - }, +
+ `; + }, +}, + } + + }; let dataTable = new KTDataTable(element, dataTableOptions); @@ -318,7 +334,5 @@ const allChecked = Array.from(statusCheckboxes).every(cb => cb.checked); selectAllCheckbox.checked = allChecked; } - - @endpush diff --git a/resources/views/component/detail-jaminan.blade.php b/resources/views/component/detail-jaminan.blade.php index fde419a..f7af1dc 100644 --- a/resources/views/component/detail-jaminan.blade.php +++ b/resources/views/component/detail-jaminan.blade.php @@ -185,8 +185,8 @@
@endif
- @foreach ($permohonan->debiture->documents as $dokumen) -
documents as $dokumen) +
- @foreach ($permohonan->debiture->documents as $dokumen) + @foreach ($permohonan->documents as $dokumen)
@@ -155,7 +155,7 @@ Jenis Jaminan

- @foreach ($permohonan->debiture->documents as $document) + @foreach ($permohonan->documents as $document) {{ $document->jenisjaminan->name }} @endforeach

diff --git a/resources/views/surveyor/components/card-tambah.blade.php b/resources/views/surveyor/components/card-tambah.blade.php index 3e3d694..6116d9d 100644 --- a/resources/views/surveyor/components/card-tambah.blade.php +++ b/resources/views/surveyor/components/card-tambah.blade.php @@ -1,10 +1,9 @@
- - - - @foreach ($permohonan->debiture->documents as $dokumen) + @foreach ($permohonan->documents as $dokumen) @php + $jaminanId = $dokumen->id; + $currentInspeksi = $inspeksiData[$jaminanId] ?? null; $tanahBangunanTypes = ['KAPAL', 'PESAWAT', 'KENDARAAN', 'ALAT BERAT', 'MESIN']; @@ -15,8 +14,7 @@ 'url' => route('surveyor.inspeksi', [ 'id' => $permohonan->id, - ]) . - "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", + ]) . "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", 'show' => true, 'icon' => !empty($currentInspeksi['data_form']), ], @@ -29,8 +27,7 @@ 'url' => route('surveyor.denah', [ 'id' => $permohonan->id, - ]) . - "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", + ]) . "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", 'show' => true, 'icon' => !empty($currentInspeksi['denah_form']), ]; @@ -42,8 +39,7 @@ 'url' => route('surveyor.foto', [ 'id' => $permohonan->id, - ]) . - "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", + ]) . "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", 'show' => true, 'icon' => !empty($currentInspeksi['foto_form']), ], @@ -52,8 +48,7 @@ 'url' => route('surveyor.data-pembanding', [ 'id' => $permohonan->id, - ]) . - "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", + ]) . "?dokument={$jaminanId}&jenis_jaminan={$dokumen->jenisJaminan->id}", 'show' => true, 'icon' => !empty($currentInspeksi['data_pembanding']), ], @@ -103,8 +98,10 @@
-
- +
+
@@ -125,8 +122,10 @@
-
- +
+
diff --git a/resources/views/surveyor/components/header.blade.php b/resources/views/surveyor/components/header.blade.php index 00206b1..c6a0e88 100644 --- a/resources/views/surveyor/components/header.blade.php +++ b/resources/views/surveyor/components/header.blade.php @@ -260,6 +260,7 @@
+

Status

@@ -267,14 +268,6 @@
@include('lpj::component.detail-jaminan', ['status' => true]) -
- -
- -
-
-

Hubungan cadeb/debitur dengan Pemilik Jaminan

@@ -284,7 +277,7 @@
- @foreach ($permohonan->debiture->documents as $dokumen) + @foreach ($permohonan->documents as $dokumen) @php $hubCadebPemilik = $dokumen->pemilik->hubungan_pemilik->name ?? 'N/A'; @endphp diff --git a/resources/views/surveyor/components/informasi.blade.php b/resources/views/surveyor/components/informasi.blade.php index 20bd3a7..fa9c821 100644 --- a/resources/views/surveyor/components/informasi.blade.php +++ b/resources/views/surveyor/components/informasi.blade.php @@ -90,9 +90,7 @@ 'index' => 8, 'value' => old( 'nama_petugas', - isset($forminspeksi['fakta']['nama_petugas']) - ? $forminspeksi['fakta']['nama_petugas'] - : '', + isset($forminspeksi['fakta']['nama_petugas']) ? $forminspeksi['fakta']['nama_petugas'] : '', ), ], ]; @@ -104,9 +102,9 @@
+ placeholder="Masukkan {{ $item['label'] }}" value="{{ $item['value'] }}"> @error($item['name']) - + @enderror
@@ -122,19 +120,19 @@
+ class="file-input file-input-bordered w-full" + accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" + onchange="previewImage(this, 'gistaru-preview')"> Foto Bhumi + src="{{ asset('storage/' . (isset($forminspeksi['foto_gistaru']) ? $forminspeksi['foto_gistaru'] : '')) }}" + alt="Foto Bhumi" class="mt-2 max-w-full h-auto" + style="{{ isset($forminspeksi['foto_gistaru']) ? '' : 'display: none;' }} max-width: 30rem;" />
+ target="_blank"> Gistaru
@@ -150,13 +148,13 @@ + class="file-input file-input-bordered w-full " + accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" + onchange="previewImage(this, 'bhumi-preview')"> Foto Bhumi + src="{{ asset('storage/' . (isset($forminspeksi['foto_bhumi']) ? $forminspeksi['foto_bhumi'] : '')) }}" + alt="Foto Bhumi" class="mt-2 max-w-full h-auto" + style="{{ isset($forminspeksi['foto_bhumi']) ? ' ' : 'display: none;' }} max-width: 30rem;" />
Bhumi @@ -173,16 +171,16 @@
+ class="file-input file-input-bordered w-full" + accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" + onchange="previewImage(this, 'argis-region-preview')"> Foto Argis Region + src="{{ asset('storage/' . (isset($forminspeksi['foto_argis_region']) ? $forminspeksi['foto_argis_region'] : '')) }}" + alt="Foto Argis Region" class="mt-2 max-w-full h-auto" + style="{{ isset($forminspeksi['foto_argis_region']) ? '' : 'display: none;' }} max-width: 30rem;">
+ target="_blank"> {{ $link_url_region->regions->name_url }} @@ -197,27 +195,29 @@
+ class="file-input file-input-bordered w-full" + accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff,.tif,.webp,.svg" + onchange="previewImage(this, 'foto_tempat-preview')">
- @if($forminspeksi) - @if(is_array($forminspeksi['foto_tempat'])) - @if(count($forminspeksi['foto_tempat']) > 0) - Foto Tempat - @endif - @else + @if ($forminspeksi) + @php + $fotoTempat = $forminspeksi['foto_tempat'] ?? null; + @endphp + + @if (is_array($fotoTempat) && count($fotoTempat) > 0) Foto Tempat + src="{{ isset($forminspeksi['foto_tempat']) ? asset('storage/' . (is_array($forminspeksi['foto_tempat']) ? $forminspeksi['foto_tempat'][0] : $forminspeksi['foto_tempat'])) : '' }}" + alt="Foto Tempat" class="mt-2 max-w-full h-auto" + style="{{ isset($forminspeksi['foto_tempat']) ? '' : 'display: none;' }} +@else +Foto Tempat @endif @endif
@@ -236,7 +236,7 @@
@@ -244,8 +244,7 @@ @else
- @@ -253,7 +252,7 @@ @endif
diff --git a/resources/views/surveyor/components/inspeksi.blade.php b/resources/views/surveyor/components/inspeksi.blade.php index 9683b77..e6d140a 100644 --- a/resources/views/surveyor/components/inspeksi.blade.php +++ b/resources/views/surveyor/components/inspeksi.blade.php @@ -20,7 +20,7 @@ @include('lpj::surveyor.components.header') @include('lpj::surveyor.components.rap') @else - @foreach ($permohonan->debiture->documents as $dokumen) + @foreach ($permohonan->documents as $dokumen) @if ($dokumen->jenisJaminan) @php $formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true); @@ -304,7 +304,7 @@ const datas = @json($forminspeksi ?? ''); }); - + function submitData() { @@ -383,7 +383,7 @@ const datas = @json($forminspeksi ?? ''); - + diff --git a/resources/views/surveyor/components/print-out/bangunan.blade.php b/resources/views/surveyor/components/print-out/bangunan.blade.php index 0bb3752..0cd52fb 100644 --- a/resources/views/surveyor/components/print-out/bangunan.blade.php +++ b/resources/views/surveyor/components/print-out/bangunan.blade.php @@ -2,13 +2,10 @@ @php - $cekLuasBangunan = isset( - $forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai'], - ) + $cekLuasBangunan = isset($forminspeksi['bangunan']['luas_tanah_bagunan']['tidak sesuai']) ? 'tidak sesuai' : 'sesuai'; - $luasBangunan = - $forminspeksi['bangunan']['luas_tanah_bagunan'][$cekLuasBangunan] ?? null; + $luasBangunan = $forminspeksi['bangunan']['luas_tanah_bagunan'][$cekLuasBangunan] ?? null; @endphp Luas Tanah Bangunan {{ $luasBangunan }} @@ -91,3 +88,65 @@ @endif + + +@if (isset($forminspeksi['bangunan']['spesifikasi_bangunan']) && count($forminspeksi['bangunan']['spesifikasi_bangunan']) > 0) + @foreach ($forminspeksi['bangunan']['spesifikasi_bangunan'] as $bangunanIndex => $bangunan) + + Spesifikasi Bangunan {{ $bangunanIndex + 1 }} + + @if (isset($basicData['spekKategoriBangunan'])) + @foreach ($basicData['spekKategoriBangunan'] as $index => $spesifikasi) + + {{ $spesifikasi->name }} + + + @if (isset($basicData['spekBangunan'])) + @php $count = 0; @endphp + + @foreach ($basicData['spekBangunan'] as $kategori) + @if ($kategori->spek_kategori_bangunan_id == $spesifikasi->id) + @php + $selectedValues = []; + if (isset($bangunan['spek_kategori_bangunan'][$spesifikasi->name])) { + $selectedValues = array_values($bangunan['spek_kategori_bangunan'][$spesifikasi->name]); + } + $lainnyaValue = $bangunan['spek_kategori_bangunan'][$spesifikasi->name]['lainnya'] ?? ''; + @endphp + + + + @php $count++; @endphp + + @if ($count % 3 == 0) + + + @endif + @endif + @endforeach + + @endif +
+ +
+ + + @endforeach + @endif + @endforeach +@endif + + diff --git a/resources/views/surveyor/components/print-out/informasi.blade.php b/resources/views/surveyor/components/print-out/informasi.blade.php new file mode 100644 index 0000000..4fa2c57 --- /dev/null +++ b/resources/views/surveyor/components/print-out/informasi.blade.php @@ -0,0 +1,140 @@ + + + G + + + KESIMPULAN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 1 KESIMPULAN PENILAI +
Faktor Positif + @isset($forminspeksi['fakta']['fakta_positif']) + + @foreach ($forminspeksi['fakta']['fakta_positif'] as $key => $item) + + + + @endforeach +
{!! nl2br(e($item)) !!}
+ @endisset +
Faktor Negatif + @php + $faktaNegatif = $forminspeksi['fakta']['fakta_negatif'] ?? []; + $faktaNegatifFiltered = is_array($faktaNegatif) + ? array_filter($faktaNegatif, function ($item) { + return !empty(trim($item)); + }) + : []; + @endphp + + @if (!empty($faktaNegatifFiltered)) + + @foreach ($faktaNegatifFiltered as $key => $item) + + + + @endforeach +
{!! nl2br(e($item)) !!}
+ @else +

Tidak ada faktor negatif yang teridentifikasi.

+ @endif +
Lain - lain : + @foreach ($forminspeksi['fakta']['keterangan'] ?? [] as $keterangan) +

{!! nl2br(e($keterangan)) !!}

+ @endforeach +

{{ $forminspeksi['fakta']['rute_menuju'] ?? '' }}

+ + @foreach ($forminspeksi['fakta']['informasi_dokument'] ?? [] as $informasi) +

{!! nl2br(e($informasi)) !!}

+ @endforeach + + @foreach ($forminspeksi['fakta']['kondisi_lingkungan'] ?? [] as $kondisi) +

{!! nl2br(e($kondisi)) !!}

+ @endforeach + + @foreach ($forminspeksi['fakta']['batas_batas_input'] ?? [] as $arah => $batas) + @if ($batas) +

- {{ $arah }} : {{ $batas }}

+ @endif + @endforeach + + @foreach ($forminspeksi['fakta']['kondisi_lain_bangunan'] ?? [] as $kondisiLain) +

{!! nl2br(e($kondisiLain)) !!}

+ @endforeach +
+ 2 CATATAN YANG PERLU DI PERHATIKAN +
+ + @foreach ($forminspeksi['fakta']['keterangan'] ?? [] as $keterangan) + + + + @endforeach +
+

{!! nl2br(e($keterangan)) !!}

+
+
+ 3 DINAS TATA KOTA +
+ @php + $informasi = [ + 'peruntukan', + 'kdb', + 'kdh', + 'gsb', + 'max_lantai', + 'klb', + 'gss', + 'pelebaran_jalan', + 'nama_petugas', + ]; + @endphp + + @foreach ($informasi as $key) + @if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-') +

- {{ ucfirst(str_replace('_', ' ', $key)) }}: + {{ $forminspeksi['fakta'][$key] }}

+ @endif + @endforeach +
+ + diff --git a/resources/views/surveyor/components/print-out/lingkungan.blade.php b/resources/views/surveyor/components/print-out/lingkungan.blade.php new file mode 100644 index 0000000..f67e381 --- /dev/null +++ b/resources/views/surveyor/components/print-out/lingkungan.blade.php @@ -0,0 +1,245 @@ + + + F + + + SARANA PELENGKAP DAN LINKUNGAN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Jarak Jalan Utama{{ $forminspeksi['lingkungan']['jarak_jalan_utama'] ?? 'Tidak Diketahui' }}
Jalan Lingkungan{{ $forminspeksi['lingkungan']['jarak_jalan_utama'] ?? 'Tidak Diketahui' }}
Jarak CBD Point{{ $forminspeksi['lingkungan']['jarak_cbd_point'] ?? 'Tidak Diketahui' }}
Nama CBD Point{{ $forminspeksi['lingkungan']['nama_cbd_point'] ?? 'Tidak Diketahui' }}
Lebar Perkerasan Jalan{{ $forminspeksi['lingkungan']['lebar_perkerasan_jalan'] ?? 'Tidak Diketahui' }}
Sarana Pelengkap + @if (isset($basicData['saranaPelengkap'])) + + + @foreach ($basicData['saranaPelengkap'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+ @endif +
Lapisan Perkerasan Jalan + @if (isset($basicData['perkerasanJalan'])) + + + @foreach ($basicData['perkerasanJalan'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
Lapisan Perkerasan Jalan + @if (isset($basicData['laluLintasLokasi'])) + + + @foreach ($basicData['laluLintasLokasi'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
Golongan Masyarakat Sekitar + @if (isset($basicData['golMasySekitar'])) + + + @foreach ($basicData['golMasySekitar'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
Terletak di Daerah + @if (isset($basicData['terletakDiArea'])) + + + @foreach ($basicData['terletakDiArea'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
Disekitar Lokasi +
+ + +
+
Merupakan Daerah + @if (isset($basicData['merupakanDaerah'])) + + + @foreach ($basicData['merupakanDaerah'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
Fasilitas Umum Dekat Lokasi + @if (isset($basicData['fasilitasObjek'])) + + + @foreach ($basicData['fasilitasObjek'] as $index => $item) + @if ($index % 3 == 0 && $index > 0) + + + @endif + + @endforeach + +
+ +
+@endif +
+ + diff --git a/resources/views/surveyor/components/print-out/main.blade.php b/resources/views/surveyor/components/print-out/main.blade.php index a850e76..dab1ccd 100644 --- a/resources/views/surveyor/components/print-out/main.blade.php +++ b/resources/views/surveyor/components/print-out/main.blade.php @@ -554,290 +554,50 @@ + @if (strtolower($permohonan->tujuanPenilaian->name) == 'rap') + @include('lpj::surveyor.components.print-out.rap') + @else + + + E + + + ANALISA {{ $data }} + + - - - E - - - ANALISA {{ $data }} - - + + - - + + - - - @foreach ($permohonan->debiture->documents as $dokumen) - @if ($dokumen->jenisJaminan) - @php - $formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true); - @endphp - @if (isset($formKategori) && $formKategori) + @foreach ($permohonan->debiture->documents as $dokumen) + @if ($dokumen->jenisJaminan) @php - $kategoriArray = is_array($formKategori) ? $formKategori : [$formKategori]; - $kategoriUnik = array_unique($kategoriArray); + $formKategori = json_decode($dokumen->jenisJaminan->form_kategori, true); @endphp - @endif - - @foreach ($kategoriUnik as $kategori) - {{-- Tampilkan komponen sesuai kategori jika file komponen ada --}} - @includeIf('lpj::surveyor.components.print-out.' . str_replace('-', '-', $kategori), [ - 'dokumen' => $dokumen, - ]) - @endforeach - @endif - @endforeach - - - - - - - F - - - SARANA PELENGKAP DAN LINKUNGAN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Jarak Jalan Utama{{ $forminspeksi['lingkungan']['jarak_jalan_utama'] ?? 'Tidak Diketahui' }}
Jalan Lingkungan{{ $forminspeksi['lingkungan']['jarak_jalan_utama'] ?? 'Tidak Diketahui' }}
Jarak CBD Point{{ $forminspeksi['lingkungan']['jarak_cbd_point'] ?? 'Tidak Diketahui' }}
Nama CBD Point{{ $forminspeksi['lingkungan']['nama_cbd_point'] ?? 'Tidak Diketahui' }}
Lebar Perkerasan Jalan{{ $forminspeksi['lingkungan']['lebar_perkerasan_jalan'] ?? 'Tidak Diketahui' }}
Sarana Pelengkap - @if (isset($basicData['saranaPelengkap'])) - - - @foreach ($basicData['saranaPelengkap'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - + @if (isset($formKategori) && $formKategori) + @php + $kategoriArray = is_array($formKategori) ? $formKategori : [$formKategori]; + $kategoriUnik = array_unique($kategoriArray); + @endphp @endif - - @endforeach - -
- -
- @endif -
Lapisan Perkerasan Jalan - @if (isset($basicData['perkerasanJalan'])) - - - @foreach ($basicData['perkerasanJalan'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
Lapisan Perkerasan Jalan - @if (isset($basicData['laluLintasLokasi'])) - - - @foreach ($basicData['laluLintasLokasi'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
Golongan Masyarakat Sekitar - @if (isset($basicData['golMasySekitar'])) - - - @foreach ($basicData['golMasySekitar'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
Terletak di Daerah - @if (isset($basicData['terletakDiArea'])) - - - @foreach ($basicData['terletakDiArea'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
Disekitar Lokasi -
- - -
-
Merupakan Daerah - @if (isset($basicData['merupakanDaerah'])) - - - @foreach ($basicData['merupakanDaerah'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
Fasilitas Umum Dekat Lokasi - @if (isset($basicData['fasilitasObjek'])) - - - @foreach ($basicData['fasilitasObjek'] as $index => $item) - @if ($index % 3 == 0 && $index > 0) - - - @endif - - @endforeach - -
- -
- @endif -
- - + @endforeach + + + @endIf {{-- @@ -848,128 +608,6 @@ --}} - - - - - G - - - KESIMPULAN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 1 KESIMPULAN PENILAI -
Faktor Positif - @isset($forminspeksi['fakta']['fakta_positif']) - - @foreach ($forminspeksi['fakta']['fakta_positif'] as $key => $item) - - - - @endforeach -
{!! nl2br(e($item)) !!}
- @endisset -
Faktor Negatif - @php - $faktaNegatif = $forminspeksi['fakta']['fakta_negatif'] ?? []; - $faktaNegatifFiltered = is_array($faktaNegatif) - ? array_filter($faktaNegatif, function ($item) { - return !empty(trim($item)); - }) - : []; - @endphp - - @if (!empty($faktaNegatifFiltered)) - - @foreach ($faktaNegatifFiltered as $key => $item) - - - - @endforeach -
{!! nl2br(e($item)) !!}
- @else -

Tidak ada faktor negatif yang teridentifikasi.

- @endif -
- 2 CATATAN YANG PERLU DI PERHATIKAN -
- @php - $keterangan = $forminspeksi['fakta']['keterangan'] ?? ''; - if (is_array($keterangan)) { - $keterangan = implode(', ', array_filter($keterangan)); - } - @endphp - - @if (!empty($keterangan)) - - - - -
{{ $keterangan }}
- @endif -
- 3 DINAS TATA KOTA -
- @php - $informasi = [ - 'peruntukan', - 'kdb', - 'kdh', - 'gsb', - 'max_lantai', - 'klb', - 'gss', - 'pelebaran_jalan', - 'nama_petugas', - ]; - @endphp - - @foreach ($informasi as $key) - @if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-') -

- {{ ucfirst(str_replace('_', ' ', $key)) }}: - {{ $forminspeksi['fakta'][$key] }}

- @endif - @endforeach -
- - - - @@ -1062,6 +700,11 @@ Cabang : {{ $permohonan->debiture->branch->name ?? '' }} + diff --git a/resources/views/surveyor/components/print-out/rap.blade.php b/resources/views/surveyor/components/print-out/rap.blade.php new file mode 100644 index 0000000..80ccc22 --- /dev/null +++ b/resources/views/surveyor/components/print-out/rap.blade.php @@ -0,0 +1,448 @@ + + + E + + + PERIZINAN + + + + + + + + + @if (isset($forminspeksi['perizinan']) && is_array($forminspeksi['perizinan']) && count($forminspeksi['perizinan']) > 0) + @foreach ($forminspeksi['perizinan'] as $perizinan) + + + + + + @endforeach + @endif + + @if (isset($forminspeksi['brosur_price_list']) && count($forminspeksi['brosur_price_list']) > 0) + @foreach ($forminspeksi['brosur_price_list'] as $perizinan) + + + + + + @endforeach + @endif + +
Perizinan:{{ $perizinan['perizinan'] }}
Brosur & Pricelist:{{ $perizinan['jenis'] }}
+ + + + + + F + + + DESKRIPSI DEVELOPER + + + + + + + + + + + + + + + + + @isset($forminspeksi['lainnya_developer']) + @foreach ($forminspeksi['lainnya_developer'] as $item) + + + + @endforeach + @endisset +
{!! nl2br(e($forminspeksi['pengalaman_developer'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['developer_anggota'] ?? 'Data tidak tersedia')) !!}
+ {!! nl2br(e($item)) !!} +
+ + + + + G + + + KONDISI, LINGKUNGAN DAN PROGRESS PEMBANGUNAN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @isset($forminspeksi['lainnya_kondisi']) + @foreach ($forminspeksi['lainnya_kondisi'] as $item) + + + + @endforeach + @endisset +
{!! nl2br(e($forminspeksi['kapan_mulai_dibangun'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['kondisi_perumahan'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['progres_pembangunan'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['kontraktor'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['lingkungan_sekitar'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['komplek_disekitar'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['pusat_keramaian'] ?? 'Data tidak tersedia')) !!}
{!! nl2br(e($forminspeksi['transportasi_umum'] ?? 'Data tidak tersedia')) !!}
+ {!! nl2br(e($item)) !!} +
+ + + + +@isset($forminspeksi['partisi']) + + + H + + + PARTISI BANGUNAN + + + + + + + + + + @if (is_array($forminspeksi['partisi'])) + @foreach ($forminspeksi['partisi'] as $key => $item) + @if (is_array($item)) + + + + + + + @endif + @endforeach + @endif +
+ {{ $item['nama'] ?? '' }} +
+ {{ $item['value'] ?? '' }} +
+ + +@endisset + +@isset($forminspeksi['jumlah_unit']) + + + I + + + JUMLAH UNIT, BLOK, TYPE DAN LUAS BANGUNAN + + + + + + + + + + @foreach ($forminspeksi['jumlah_unit'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + + +@endisset +@isset($forminspeksi['batas_batas_perumahan']) + + + J + + + BATAS-BATAS PERUMAHAN + + + + + + + + + @foreach ($forminspeksi['batas_batas_perumahan'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + +@endisset + +@isset($forminspeksi['fasus_fasum']) + + + J + + + FASOS/FASUM + + + + + + + + + @foreach ($forminspeksi['fasus_fasum'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + +@endisset +@isset($forminspeksi['progres_penjualan']) + + + K + + + PROGRES PENJUALAN SAAT INI + + + + + + + + + @foreach ($forminspeksi['progres_penjualan'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + +@endisset +@isset($forminspeksi['harga_unit']) + + + + L + + + HARGA UNIT + + + + + + + + + @foreach ($forminspeksi['harga_unit'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + +@endisset +@isset($forminspeksi['target_market']) + + + M + + + TARGET MARKET + + + + + + + + + @foreach ($forminspeksi['target_market'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + +@endisset +@isset($forminspeksi['kerjasama_dengan_bank']) + + + N + + + KERJASAMA DENGAN BANK LAIN + + + + + + + + + @foreach ($forminspeksi['kerjasama_dengan_bank'] as $item) + + + + @endforeach +
+ {!! nl2br(e($item)) !!} +
+ + + +@endisset +@isset($forminspeksi['rute_menuju_lokasi']) + + + O + + + RUTE MENUJU LOKASI + + + + + + + + + + + + +
+ {{ $forminspeksi['rute_menuju_lokasi'] ?? '' }} +
+ + + +@endisset +@if (isset($forminspeksi['fakta']) && is_array($forminspeksi['fakta'])) + + + P + + + ATURAN TATA KOTA + + + + + + + + + @php + $informasi = [ + 'peruntukan', + 'kdb', + 'kdh', + 'gsb', + 'max_lantai', + 'klb', + 'gss', + 'pelebaran_jalan', + 'nama_petugas', + ]; + @endphp + + @if (isset($forminspeksi['fakta']) && is_array($forminspeksi['fakta'])) + @foreach ($informasi as $key) + @if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-') +

- {{ ucfirst(str_replace('_', ' ', $key)) }}: + {{ $forminspeksi['fakta'][$key] }}

+ @endif + @endforeach + @endif +
+ + + +@endif + +@isset($forminspeksi['fakta']['keterangan']) + + + + P + + + CATATAN LAINNYA + + + + + + + + + @foreach ($forminspeksi['fakta']['keterangan'] ?? [] as $keterangan) + + + + @endforeach +
+

{!! nl2br(e($keterangan)) !!}

+
+ + + +@endisset From 9bdbd77f73cd76781aee2f50ff90d4821465aa1d Mon Sep 17 00:00:00 2001 From: majid Date: Fri, 31 Jan 2025 13:56:53 +0700 Subject: [PATCH 15/33] fix(surveyor): update key dokument jaminan --- app/Http/Controllers/SurveyorController.php | 136 +++++++++++--------- 1 file changed, 78 insertions(+), 58 deletions(-) diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index 4e8ca97..f54f9e7 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -2017,7 +2017,7 @@ class SurveyorController extends Controller private function updateDetails($permohonan, $key, $newValue) { - $document = $permohonan->debiture->documents->first(); + $document = $permohonan->documents->first(); if (!$document) { throw new \Exception("Document not found"); @@ -2031,18 +2031,18 @@ class SurveyorController extends Controller $datas = json_decode($detailsUpdate->details, true) ?? []; - if (is_numeric($newValue)) { - $newValue = [$key => $newValue]; + if (!is_scalar($newValue)) { + throw new \InvalidArgumentException("New value must be a scalar (string/number)"); } - if (!is_array($newValue)) { - throw new \InvalidArgumentException("'{$key}' must be an array or valid JSON string"); - } - - foreach ($newValue as $subKey => $value) { - $datas[$subKey] = $value; // Update atau tambahkan key baru + // Update nilai berdasarkan kunci + if (array_key_exists($key, $datas)) { + $datas[$key] = $newValue; + } else { + throw new \Exception("Key '{$key}' not found in details"); } + // Simpan kembali ke database $detailsUpdate->update([ 'details' => json_encode($datas), ]); @@ -2414,19 +2414,41 @@ class SurveyorController extends Controller ]; } + private function updateFormData(array &$dataForm, array $data, $inspeksi, string $section, string $key, string $sesuaiKey, string $tidakSesuaiKey): void + { + if (isset($dataForm[$section][$key])) { + $dataForm[$section][$key] = []; // Reset data + + if ($data[$key] == 'sesuai') { + $dataForm[$section][$key]['sesuai'] = $data[$sesuaiKey] ?? null; + } elseif ($data[$key] == 'tidak sesuai') { + $dataForm[$section][$key]['tidak sesuai'] = $data[$tidakSesuaiKey] ?? null; + } + + if ($inspeksi) { + $inspeksi->data_form = json_encode($dataForm); + $inspeksi->save(); + } + } else { + $data[$key] = $this->getFieldData($data, $key, true); + } + } private function getTanahData(array $data): array { + + $inspeksi = Inspeksi::where('permohonan_id', $data['permohonan_id'])->where('dokument_id', $data['dokument_id'])->first(); + + // Decode data_form dari inspeksi + $dataForm = $inspeksi ? json_decode($inspeksi->data_form, true) : []; + $this->updateFormData($dataForm, $data, $inspeksi, 'tanah', 'luas_tanah', 'luas_tanah_sesuai', 'luas_tanah_tidak_sesuai'); + $this->updateFormData($dataForm, $data, $inspeksi, 'tanah', 'hadap_mata_angin', 'hadap_mata_angin_sesuai', 'hadap_mata_angin_tidak_sesuai'); + // dd($dataForm); + return [ 'tanah' => [ - 'luas_tanah' => $this->getFieldData( - $data, - 'luas_tanah', - true - ), - 'hadap_mata_angin' => [ - $data['hadap_mata_angin'] => $data['hadap_mata_angin'] == 'sesuai' ? $data['hadap_mata_angin_sesuai'] : $data['hadap_mata_angin_tidak_sesuai'] ?? null - ], + 'luas_tanah' => $dataForm['tanah']['luas_tanah'] ?? $data['luas_tanah'], + 'hadap_mata_angin' => $dataForm['tanah']['hadap_mata_angin'] ?? $data['hadap_mata_angin'], 'bentuk_tanah' => $this->getFieldData( $data, 'bentuk_tanah', @@ -2499,14 +2521,16 @@ class SurveyorController extends Controller } } + $inspeksi = Inspeksi::where('permohonan_id', $data['permohonan_id'])->where('dokument_id', $data['dokument_id'])->first(); + + // Decode data_form dari inspeksi + $dataForm = $inspeksi ? json_decode($inspeksi->data_form, true) : []; + $this->updateFormData($dataForm, $data, $inspeksi, 'bangunan', 'luas_tanah_bagunan', 'luas_tanah_bagunan_sesuai', 'luas_tanah_bagunan_tidak_sesuai'); + return [ 'bangunan' => [ - 'luas_tanah_bagunan' => $this->getFieldData( - $data, - 'luas_tanah_bagunan', - true - ), + 'luas_tanah_bagunan' => $dataForm['bangunan']['luas_tanah_bagunan'] ?? $data['luas_tanah_bagunan'], 'jenis_bangunan' => $data['jenis_bangunan'] ?? null, 'kondisi_bangunan' => $data['kondisi_bangunan'] ?? null, 'sifat_bangunan' => $data['sifat_bangunan'] ?? null, @@ -3181,6 +3205,7 @@ class SurveyorController extends Controller private function getUnitData($data, $request): array { + return [ 'action' => $data['action'] ?? null, 'luas_unit' => $this->getFieldData( @@ -3262,37 +3287,32 @@ class SurveyorController extends Controller bool $checkKesesuaian = false, ?string $extraField = null ): array { + $result = []; + if ($checkKesesuaian) { - // Mengecek apakah status kesesuaian adalah 'sesuai' $isSesuai = ($data[$fieldName] ?? '') === 'sesuai'; + $fieldKey = $isSesuai ? "{$fieldName}_sesuai" : "{$fieldName}_tidak_sesuai"; - // Menggunakan key berdasarkan status kesesuaian - $result = [ - $isSesuai ? 'sesuai' : 'tidak_sesuai' => $data[$fieldName] ?? null - ]; + // Hanya simpan key yang dipilih + if ($isSesuai) { + $result['sesuai'] = $data[$fieldKey] ?? null; + } else { + $result['tidak sesuai'] = $data[$fieldKey] ?? null; + } + } else { + $result[$fieldName] = $data[$fieldName] ?? null; - // Tambahkan field ekstra jika ada if ($extraField) { $result[$extraField] = $data["{$fieldName}_{$extraField}"] ?? null; } - - return $result; } - // Jika tidak melakukan pengecekan kesesuaian, hanya ambil data berdasarkan fieldName - $result = [ - $fieldName => $data[$fieldName] ?? null, - ]; - - // Jika ada extra field, tambahkan ke result - if ($extraField) { - $result[$extraField] = $data["{$fieldName}_{$extraField}"] ?? null; - } - - return $result; + // Hapus key dengan nilai null untuk memastikan hanya key yang valid yang disimpan + return array_filter($result, fn ($value) => $value !== null); } + public function export(string $type) { $modelClass = $this->getModelClass($type); @@ -3332,13 +3352,13 @@ class SurveyorController extends Controller ->where('dokument_id', $request->input('document_id')) ->first(); - if (!$inspeksi) { - $inspeksi = new Inspeksi(); - $inspeksi->permohonan_id = $request->input('permohonan_id'); - $inspeksi->dokument_id = $request->input('document_id'); - $inspeksi->data_form = json_encode([]); // Inisialisasi data_form kosong - $inspeksi->save(); - } + if (!$inspeksi) { + $inspeksi = new Inspeksi(); + $inspeksi->permohonan_id = $request->input('permohonan_id'); + $inspeksi->dokument_id = $request->input('document_id'); + $inspeksi->data_form = json_encode([]); // Inisialisasi data_form kosong + $inspeksi->save(); + } // Decode data form yang ada $dataForm = json_decode($inspeksi->data_form, true) ?: []; @@ -3497,40 +3517,40 @@ class SurveyorController extends Controller // Ambil data permohonan dan data umum $permohonan = $this->getPermohonanJaminanId($permohonan_id, $dokument_id, $jenis_jaminan_id); $basicData = $this->getCommonData(); - + // Ambil data inspeksi $inspeksi = Inspeksi::where('permohonan_id', $permohonan_id) ->where('dokument_id', $dokument_id) ->first(); - + if (!$inspeksi) { // Redirect jika inspeksi tidak ditemukan return redirect()->back()->with('error', 'Data inspeksi tidak ditemukan.'); } - + // Decode data form inspeksi $forminspeksi = json_decode($inspeksi->data_form, true); - + if (!$forminspeksi) { // Redirect jika data form inspeksi kosong return redirect()->back()->with('error', 'Silahkan isi terlebih dahulu form inspeksi.'); } - + // Pilih template PDF berdasarkan nama inspeksi $templateView = strtolower($inspeksi->name) === 'rap' ? 'lpj::surveyor.components.print-out.main' - : 'lpj::surveyor.components.print-out.main'; - + : 'lpj::surveyor.components.print-out.main'; + // Generate PDF $pdf = PDF::loadView($templateView, compact('permohonan', 'basicData', 'forminspeksi')); $pdf->setPaper('A4', 'portrait'); - + // Tentukan nama file PDF $namaDebiture = $permohonan->debiture->name . '-' . $permohonan->nomor_registrasi; $fileName = 'inspeksi-' . $namaDebiture . '-data.pdf'; - + return $pdf->download($fileName); } - + } From 561bf7237e5016c3c8b65d3d6d24f635ad1636d8 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 13:16:55 +0700 Subject: [PATCH 16/33] feat(tender): tambahkan informasi pengguna pada email penawaran - Menambahkan parameter pengguna pada konstruktor SendPenawaranKJPPTenderJob. - Mengupdate pengambilan data pengguna di TenderController. - Memperbarui tampilan email untuk menampilkan tanda tangan dan nama pengguna yang benar. --- app/Http/Controllers/TenderController.php | 6 ++++-- app/Jobs/SendPenawaranKJPPTenderJob.php | 8 ++++++-- resources/views/penawaran/kirimEmailKJPP.blade.php | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php index e6822a0..2044356 100644 --- a/app/Http/Controllers/TenderController.php +++ b/app/Http/Controllers/TenderController.php @@ -929,7 +929,8 @@ class TenderController extends Controller 'villages' => $villages, 'districts' => $districts, 'cities' => $cities, - 'provinces' => $provinces + 'provinces' => $provinces, + 'user' => $this->user, ])->render(); SendPenawaranKJPPTenderJob::dispatch( @@ -940,7 +941,8 @@ class TenderController extends Controller $villages, $districts, $cities, - $provinces + $provinces, + $user ); try { diff --git a/app/Jobs/SendPenawaranKJPPTenderJob.php b/app/Jobs/SendPenawaranKJPPTenderJob.php index 52045a2..d4debea 100644 --- a/app/Jobs/SendPenawaranKJPPTenderJob.php +++ b/app/Jobs/SendPenawaranKJPPTenderJob.php @@ -22,11 +22,12 @@ class SendPenawaranKJPPTenderJob implements ShouldQueue protected $districts; protected $cities; protected $provinces; + protected $user; /** * Create a new job instance. */ - public function __construct($kjpps, $dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces) + public function __construct($kjpps, $dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces, $user) { $this->kjpps = $kjpps; $this->dp1 = $dp1; // Simpan keseluruhan array dp1, bukan dp1[0] @@ -36,6 +37,7 @@ class SendPenawaranKJPPTenderJob implements ShouldQueue $this->districts = $districts; $this->cities = $cities; $this->provinces = $provinces; + $this->user = $user; } /** @@ -50,7 +52,8 @@ class SendPenawaranKJPPTenderJob implements ShouldQueue $this->villages, $this->districts, $this->cities, - $this->provinces + $this->provinces, + $this->user // Kirim user ke email sebagai cc dan bcc ); $email->with([ @@ -61,6 +64,7 @@ class SendPenawaranKJPPTenderJob implements ShouldQueue 'districts' => $this->districts, 'cities' => $this->cities, 'provinces' => $this->provinces, + 'user' => $this->user // Kirim user ke email sebagai cc dan bcc ]); $send = Mail::to($this->kjpps)->send($email); diff --git a/resources/views/penawaran/kirimEmailKJPP.blade.php b/resources/views/penawaran/kirimEmailKJPP.blade.php index 33ca36a..c60b6be 100644 --- a/resources/views/penawaran/kirimEmailKJPP.blade.php +++ b/resources/views/penawaran/kirimEmailKJPP.blade.php @@ -165,10 +165,10 @@
Best Regards,
- {{ $permohonan->user->name }} + {{ $user->name }}

- {{ $permohonan->user->name }} + {{ $user->name }}

From 7e5d336469cb15486ae1dccae47243ea3d4212c6 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 13:20:33 +0700 Subject: [PATCH 17/33] feat(email): tambahkan informasi pengguna pada email penawaran - Menambahkan parameter user pada konstruktor SendPenawaranKJPPEmail. - Mengupdate data yang dikirimkan ke view untuk menyertakan informasi pengguna sebagai cc dan bcc. - Menggunakan auth()->user() untuk mendapatkan informasi pengguna yang sedang login di TenderController. --- app/Emails/SendPenawaranKJPPEmail.php | 4 +++- app/Http/Controllers/TenderController.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Emails/SendPenawaranKJPPEmail.php b/app/Emails/SendPenawaranKJPPEmail.php index c779b90..17ab761 100644 --- a/app/Emails/SendPenawaranKJPPEmail.php +++ b/app/Emails/SendPenawaranKJPPEmail.php @@ -23,7 +23,7 @@ class SendPenawaranKJPPEmail extends Mailable /** * Create a new message instance. */ - public function __construct($dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces) + public function __construct($dp1, $penawaran, $permohonan, $villages, $districts, $cities, $provinces, $user) { // Assign data yang diterima ke properti $this->dp1 = $dp1; @@ -33,6 +33,7 @@ class SendPenawaranKJPPEmail extends Mailable $this->districts = $districts; $this->cities = $cities; $this->provinces = $provinces; + $this->user = $user; // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc } /** @@ -50,6 +51,7 @@ class SendPenawaranKJPPEmail extends Mailable 'districts' => $this->districts, 'cities' => $this->cities, 'provinces' => $this->provinces, + 'user' => $this->user // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc ]); } } diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php index 2044356..691522c 100644 --- a/app/Http/Controllers/TenderController.php +++ b/app/Http/Controllers/TenderController.php @@ -930,7 +930,7 @@ class TenderController extends Controller 'districts' => $districts, 'cities' => $cities, 'provinces' => $provinces, - 'user' => $this->user, + 'user' => auth()->user(), ])->render(); SendPenawaranKJPPTenderJob::dispatch( From 108c30e4e1d95070040f4a1c3ee786744570375d Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 13:22:03 +0700 Subject: [PATCH 18/33] feat(email): tambahkan informasi pengguna pada email penawaran - Menambahkan properti user ke dalam data yang dikirimkan ke view. - Memungkinkan pengiriman informasi pengguna sebagai cc dan bcc. --- app/Emails/SendPenawaranKJPPEmail.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Emails/SendPenawaranKJPPEmail.php b/app/Emails/SendPenawaranKJPPEmail.php index 17ab761..f305489 100644 --- a/app/Emails/SendPenawaranKJPPEmail.php +++ b/app/Emails/SendPenawaranKJPPEmail.php @@ -19,6 +19,7 @@ class SendPenawaranKJPPEmail extends Mailable public $districts; public $cities; public $provinces; + public $user; // Tambahkan user ke data yang dikirimkan ke view, sebagai cc dan bcc /** * Create a new message instance. From 9e6ae1f5ada54b94a4243302aef1788628129391 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 13:23:23 +0700 Subject: [PATCH 19/33] fix(tender): perbaiki pengambilan informasi pengguna - Mengubah cara pengambilan informasi pengguna untuk meningkatkan konsistensi. - Menggunakan variabel $user untuk menyimpan informasi pengguna yang terautentikasi. --- app/Http/Controllers/TenderController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php index 691522c..ccd83c8 100644 --- a/app/Http/Controllers/TenderController.php +++ b/app/Http/Controllers/TenderController.php @@ -918,6 +918,7 @@ class TenderController extends Controller $districts = District::where('code', $district_permohonan)->get(); $cities = City::where('code', $city_permohonan)->get(); $provinces = Province::where('code', $province_permohonan)->get(); + $user = auth()->user(); $subject = 'Send Penawaran K J P P Email'; @@ -930,7 +931,7 @@ class TenderController extends Controller 'districts' => $districts, 'cities' => $cities, 'provinces' => $provinces, - 'user' => auth()->user(), + 'user' => $user, ])->render(); SendPenawaranKJPPTenderJob::dispatch( From a7cd063be921829822f34e3f2ece21c85949b86c Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 13:28:07 +0700 Subject: [PATCH 20/33] feat(tender): tambahkan informasi pengguna pada email penawaran - Mengambil informasi pengguna yang sedang login. - Menyimpan informasi pengguna dalam job pengiriman email. - Mengupdate tampilan email untuk menampilkan informasi pengguna. --- app/Http/Controllers/TenderController.php | 7 +++++-- app/Jobs/SendPenawaranTenderJob.php | 5 ++++- resources/views/penawaran/kirimEmail.blade.php | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/TenderController.php b/app/Http/Controllers/TenderController.php index ccd83c8..2a7de01 100644 --- a/app/Http/Controllers/TenderController.php +++ b/app/Http/Controllers/TenderController.php @@ -724,6 +724,7 @@ class TenderController extends Controller $districts = District::where('code', $district_permohonan)->get(); $cities = City::where('code', $city_permohonan)->get(); $provinces = Province::where('code', $province_permohonan)->get(); + $user = auth::user(); $subject = 'Send Penawaran Email'; @@ -734,7 +735,8 @@ class TenderController extends Controller 'villages' => $villages, 'districts' => $districts, 'cities' => $cities, - 'provinces' => $provinces + 'provinces' => $provinces, + 'user' => $user, ])->render(); // Dispatch job untuk mengirim email @@ -745,7 +747,8 @@ class TenderController extends Controller $villages, $districts, $cities, - $provinces + $provinces, + $user ); try { diff --git a/app/Jobs/SendPenawaranTenderJob.php b/app/Jobs/SendPenawaranTenderJob.php index 6a37f6c..7c5c685 100644 --- a/app/Jobs/SendPenawaranTenderJob.php +++ b/app/Jobs/SendPenawaranTenderJob.php @@ -21,11 +21,12 @@ class SendPenawaranTenderJob implements ShouldQueue protected $districts; protected $cities; protected $provinces; + protected $user; // Tidak perlu array [0] lagi /** * Create a new job instance. */ - public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces) + public function __construct($kjpps, $penawaran, $permohonan, $villages, $districts, $cities, $provinces,$user) { $this->kjpps = $kjpps; $this->penawaran = $penawaran; @@ -34,6 +35,7 @@ class SendPenawaranTenderJob implements ShouldQueue $this->districts = $districts; $this->cities = $cities; $this->provinces = $provinces; + $this->user = $user; // Simpan user yang dikirim email ke properti } /** @@ -49,6 +51,7 @@ class SendPenawaranTenderJob implements ShouldQueue 'districts' => $this->districts, 'cities' => $this->cities, 'provinces' => $this->provinces, + 'user' => $this->user // Kirim user ke email ke properti sebagai additional data ]); Mail::to($this->kjpps)->send($email); diff --git a/resources/views/penawaran/kirimEmail.blade.php b/resources/views/penawaran/kirimEmail.blade.php index a4238b4..c6ff33d 100644 --- a/resources/views/penawaran/kirimEmail.blade.php +++ b/resources/views/penawaran/kirimEmail.blade.php @@ -165,10 +165,10 @@
Best Regards,
- {{ $permohonan->user->name }} + {{ $user->name }}

- {{ $permohonan->user->name }} + {{ $user->name }}

From d6e1586b4bac8cca0fb4bfaac09a64e503755103 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 3 Feb 2025 14:04:55 +0700 Subject: [PATCH 21/33] feat(dokumen_jaminan): tambahkan custom fields pada legalitas jaminan - Menambahkan pengambilan custom fields jika tersedia pada legalitas jaminan. - Memastikan custom fields disertakan dalam data legalitas baru yang dibuat. --- app/Http/Controllers/DokumenJaminanController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/DokumenJaminanController.php b/app/Http/Controllers/DokumenJaminanController.php index e86f22a..f4966ce 100644 --- a/app/Http/Controllers/DokumenJaminanController.php +++ b/app/Http/Controllers/DokumenJaminanController.php @@ -527,6 +527,11 @@ foreach ($newLegalitasJaminan as $legalitas) { if (!Collection::make($existingLegalitas)->contains('jenis_legalitas_jaminan_id', $legalitas->id)) { + $customFields = []; + if($legalitas->custom_fields) { + $customFields = CustomField::whereIn('id', $legalitas->custom_fields)->get(); + } + $newLegalitas[] = [ 'id' => null, 'jenis_legalitas_jaminan_id' => $legalitas->id, @@ -535,6 +540,7 @@ 'dokumen_nomor' => null, 'custom_field' => $legalitas->custom_field, 'custom_field_type' => $legalitas->custom_field_type, + 'custom_fields' => $customFields, 'details' => null, 'keterangan' => null, 'is_existing' => false, From a200c1ec52a10c459075e54011bc0af198543c5c Mon Sep 17 00:00:00 2001 From: majid Date: Tue, 4 Feb 2025 08:45:52 +0700 Subject: [PATCH 22/33] penambahan kirim email, dan perbaikan print out --- app/Emails/SendJadwalKunjunganEmail.php | 63 ++ app/Http/Controllers/PenilaiController.php | 74 ++- app/Http/Controllers/SurveyorController.php | 33 +- .../views/emails/jadwal-kunjungan.blade.php | 118 ++++ .../penilai/components/call-report.blade.php | 596 ++++++++++++++++++ .../components/informasi-pembanding.blade.php | 8 +- .../components/print-out-sederhana.blade.php | 83 ++- .../components/print-out-standard.blade.php | 175 +++-- .../penilai/components/print-resume.blade.php | 6 +- resources/views/penilai/show.blade.php | 35 + .../views/penilaian/otorisator/show.blade.php | 2 +- .../surveyor/components/inspeksi.blade.php | 44 +- resources/views/surveyor/index.blade.php | 55 +- routes/breadcrumbs.php | 5 + routes/web.php | 1 + 15 files changed, 1181 insertions(+), 117 deletions(-) create mode 100644 app/Emails/SendJadwalKunjunganEmail.php create mode 100644 resources/views/emails/jadwal-kunjungan.blade.php create mode 100644 resources/views/penilai/components/call-report.blade.php diff --git a/app/Emails/SendJadwalKunjunganEmail.php b/app/Emails/SendJadwalKunjunganEmail.php new file mode 100644 index 0000000..879934a --- /dev/null +++ b/app/Emails/SendJadwalKunjunganEmail.php @@ -0,0 +1,63 @@ +id = $emailData['emailData']['id']; + $this->waktu_penilaian = $emailData['emailData']['waktu_penilaian']; + $this->deskripsi_penilaian = $emailData['emailData']['deskripsi_penilaian']; + } + + /** + * Build the message. + * + * @return $this + */ + public function build() + { + return $this->subject('Jadwal Kunjungan Penilaian Resmi') + ->view('lpj::emails.jadwal-kunjungan'); + } +} diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index fb8409d..53110ae 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -385,6 +385,77 @@ class PenilaiController extends Controller } + public function call_report(Request $request) + { + + $permohonanId = $request->query('permohonanId'); + $documentId = $request->query('documentId'); + $inspeksiId = $request->query('inspeksiId'); + $jaminanId = $request->query('jaminanId'); + $provinces = Province::all(); + $permohonan = $this->surveyorController->getPermohonanJaminanId($permohonanId, $documentId, $jaminanId); + // $nomorLaporan = $this->generateNoLaporan($permohonan, $documentId, 'rap'); + // $basicData = $this->surveyorController->getCommonData(); + // $inspeksi = Inspeksi::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); + // Penilai::updateOrCreate( + // [ + // 'permohonan_id' => $permohonanId, + // 'dokument_id' => $documentId, + // 'inspeksi_id' => $inspeksiId, + // ], + // [ + // 'type_penilai' => 'call-report', + // ] + // ); + + // $resume = Penilai::where('permohonan_id', $permohonanId)->where('dokument_id', $documentId)->first(); + + // $lpjData = null; + // $rap = null; + // $forminspeksi = null; + // if ($resume) { + // $forminspeksi = json_decode($inspeksi->data_form, true); + // $rap = json_decode($resume->rap, true); + // } + // Default: gunakan data dari debitur + // $debitur = Debiture::find($permohonan->debiture_id); + + // $provinceCode = $debitur->province_code; + // $cityCode = $debitur->city_code; + // $districtCode = $debitur->district_code; + + // $cekAlamat = $forminspeksi['asset']['alamat']['tidak sesuai'] ?? null; + + // if ($cekAlamat) { + // $provinceCode = $cekAlamat['province_code'] ?? $provinceCode; + // $cityCode = $cekAlamat['city_code'] ?? $cityCode; + // $districtCode = $cekAlamat['district_code'] ?? $districtCode; + // } + + // $cities = City::where('province_code', $provinceCode)->get(); + // $districts = District::where('city_code', $cityCode)->get(); + // $villages = Village::where('district_code', $districtCode)->get(); + + // if ($forminspeksi) { + // if (isset($forminspeksi['alamat']['sesuai']['province_code'])) { + // $cities = City::where('province_code', $forminspeksi['alamat']['sesuai']['province_code'])->get(); + // } + + // if (isset($forminspeksi['alamat']['sesuai']['city_code'])) { + // $districts = District::where('city_code', $forminspeksi['alamat']['sesuai']['city_code'])->get(); + // } + + // if (isset($forminspeksi['alamat']['sesuai']['district_code'])) { + // $villages = Village::where('district_code', $forminspeksi['alamat']['sesuai']['district_code'])->get(); + // } + // } + + // return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities', + // 'districts', + // 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat')); + return view('lpj::penilai.components.call-report', compact('permohonan')); + } + /** * Remove the specified resource from storage. */ @@ -1022,7 +1093,8 @@ class PenilaiController extends Controller 'standard' => 'penilai.components.print-out-standard', 'resume' => 'penilai.components.print-resume', 'memo' => 'penilai.components.print-memo', - 'rap' => 'penilai.components.print-out-rap' + 'rap' => 'penilai.components.print-out-rap', + 'call-report' => 'penilai.components.print-out-call-report' ]; return $viewMap[$tipe] ?? 'penilai.components.print-resume'; } diff --git a/app/Http/Controllers/SurveyorController.php b/app/Http/Controllers/SurveyorController.php index f54f9e7..c1dd217 100644 --- a/app/Http/Controllers/SurveyorController.php +++ b/app/Http/Controllers/SurveyorController.php @@ -14,6 +14,8 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; use Barryvdh\DomPDF\Facade\Pdf; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Carbon; +use Illuminate\Support\Facades\Mail; use Illuminate\Http\Response; use Modules\Lpj\Models\Debiture; use Modules\Lpj\Models\Permohonan; @@ -77,16 +79,15 @@ use Modules\Lpj\Models\LaluLintasLokasi; use Modules\Lpj\Models\SpekBagunanAnalisaDetail; use Modules\Lpj\Http\Requests\SurveyorRequest; use Modules\Lpj\Http\Requests\FormSurveyorRequest; -use Modules\Lpj\Emails\SendEmail; -use Illuminate\Support\Facades\Mail; +use Modules\Lpj\Emails\SendJadwalKunjunganEmail; class SurveyorController extends Controller { public $user; - /** - * Display a listing of the resource. - */ + + + public function index() { return view('lpj::surveyor.index'); @@ -899,8 +900,6 @@ class SurveyorController extends Controller } - - public function checkButtonStatus($id) { try { @@ -969,24 +968,24 @@ class SurveyorController extends Controller 'deskripsi_penilaian' => 'required' ]); - // $user = ['user' => 'rustammajid76@gmail.com']; + $penilaian = Penilaian::findOrFail($validate['id']); - // $emailData = [ - // 'email' => 'rustammajid76@gmail.com', - // 'subject' => 'Test', - // 'emailData' => '

Hello, World!

This is the email content. Waktu Penilaian:

' - // ]; + $emailData = [ + 'email' => $penilaian->permohonan->user->email, + 'subject' => 'Jadwal Kunjungan', + 'emailData' => $validate, - // $this->sendMessage($emailData, $user); + ]; - $id = $request->input('id'); - $penilaian = Penilaian::findOrFail($id); + Mail::to($emailData['email'])->send(new SendJadwalKunjunganEmail($emailData, $penilaian->permohonan->nomor_resitrasi, $penilaian->permohonan->debiture)); - if ($validate['waktu_penilaian'] <= $penilaian->tanggal_kunjungan) { + + if (Carbon::parse($validate['waktu_penilaian']) <= Carbon::parse($penilaian->tanggal_kunjungan)) { return redirect() ->route('surveyor.index') ->with('error', 'Waktu penilaian harus lebih besar dari tanggal assign.'); } + $penilaian->update([ 'waktu_penilaian' => $validate['waktu_penilaian'], 'deskripsi_penilaian' => $validate['deskripsi_penilaian'], diff --git a/resources/views/emails/jadwal-kunjungan.blade.php b/resources/views/emails/jadwal-kunjungan.blade.php new file mode 100644 index 0000000..42dd5e2 --- /dev/null +++ b/resources/views/emails/jadwal-kunjungan.blade.php @@ -0,0 +1,118 @@ + + + + + + Jadwal Kunjungan + + + + + + diff --git a/resources/views/penilai/components/call-report.blade.php b/resources/views/penilai/components/call-report.blade.php new file mode 100644 index 0000000..d06671d --- /dev/null +++ b/resources/views/penilai/components/call-report.blade.php @@ -0,0 +1,596 @@ +@extends('layouts.main') + +@section('breadcrumbs') + {{ Breadcrumbs::render(request()->route()->getName()) }} +@endsection + +@section('content') +
+ @php + $senior_officer = null; + if ($permohonan->debiture && $permohonan->debiture->documents) { + foreach ($permohonan->debiture->documents as $dokumen) { + $penilai = $permohonan->penilaian->userPenilai->where('role', 'penilai')->first(); + $teams = $permohonan->region->teams; + + if ($teams) { + foreach ($teams as $team) { + $team_users = $team->teamsUsers; + // print_r($team_users); + if ($team_users) { + foreach ($team_users as $team_user) { + $user = $team_user->user; + + if ($user && $user->hasRole('senior-officer')) { + $senior_officer = $user; + break 3; + } + } + } + } + } + } + } + + @endphp +
+ @csrf + + + + + + @include('lpj::assetsku.includenya') + {{-- @include('lpj::surveyor.components.header') + @include('lpj::surveyor.components.callReport') --}} + +
+
+

+ CALL Report +

+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ {{-- 250109828129/ --}} + +
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+
+

Menindak lanjuti permintaan + {{$permohonan->tujuanPenilaian->name ?? ''}}, BAG CABang {{ $permohonan->branch->name }} + disampaikan hal sebagai berikut: +

+
+
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ + +
+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+
+ + +
+
+
+ + +
+
+

Penilaian ke lokasi objek telah dilakukan oleh : +

+
+
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+
+
+
+
+ +
+
+

+ Informasi yang didapatkan sebagai berikut : +

+
+
+
+ +
+ @if (!empty($callReport['fakta']['fakta_positif'])) + @foreach ($callReport['fakta']['fakta_positif'] as $index => $positif) +
+ + +
+ @endforeach + @else +
+ + +
+ @endif + +
+
+ +
+ +
+ @if (!empty($callReport['fakta']['fakta_negatif'])) + @foreach ($callReport['fakta']['fakta_negatif'] as $index => $negatif) +
+ + +
+ @endforeach + @else +
+ + + +
+ @endif + +
+
+
+
+ +
+ + @if (Auth::user()->hasAnyRole(['senior-officer', 'EO Appraisal', 'DD Appraisal'])) + + LAMPIRAN FOTO DAN DOKUMEN + + + Print + + @endif +
+
+
+@endsection +@push('scripts') + {{-- --}} + @include('lpj::surveyor.js.utils') +@endpush diff --git a/resources/views/penilai/components/informasi-pembanding.blade.php b/resources/views/penilai/components/informasi-pembanding.blade.php index 8b0b252..c2f3feb 100644 --- a/resources/views/penilai/components/informasi-pembanding.blade.php +++ b/resources/views/penilai/components/informasi-pembanding.blade.php @@ -30,21 +30,21 @@
- Rp. {{ $item['harga_diskon'] }} + Rp. {{ $item['harga'] }}
- +
- Rp. {{ $item['harga'] }} + {{ $item['telepon'] }}
- Rp. {{ $item['harga'] }} + {{ $item['penawaran'] }}
diff --git a/resources/views/penilai/components/print-out-sederhana.blade.php b/resources/views/penilai/components/print-out-sederhana.blade.php index 543d18b..7386d9f 100644 --- a/resources/views/penilai/components/print-out-sederhana.blade.php +++ b/resources/views/penilai/components/print-out-sederhana.blade.php @@ -862,9 +862,31 @@ D. ASURANSI + @if (!empty($lpjData['asuransi_luas_bangunan'])) + + + + + + + + + + + + + + + + +
Luas BangunanHargaNilai Pasar Wajar (Rp)
{{ $lpjData['asuransi_luas_bangunan'] ?? '' }}{{ formatRupiah($lpjData['asuransi_nilai_1']) ?? '' }}{{ formatRupiah($lpjData['asuransi_nilai_2']) ?? '' }}
+ + + @else Tidak Ada + @endif @@ -1035,7 +1057,7 @@
@@ -1068,6 +1090,65 @@ @endisset + + + + + + + + + + @if (!empty($forminspeksi['fakta']['keterangan'])) + + + + + @endif
- G. CATATAN YANG PERLU DI PERHATIKAN + G. ANALISA FAKTA
Batas batas + @foreach ($forminspeksi['fakta']['batas_batas_input'] ?? [] as $arah => $batas) + @if ($batas) +

- {{ $arah }} : {{ $batas }}

+ @endif + @endforeach +
Informasi Dinas Tata Ruang + + @php + $informasi = [ + 'peruntukan', + 'kdb', + 'kdh', + 'gsb', + 'max_lantai', + 'klb', + 'gss', + 'pelebaran_jalan', + 'nama_petugas', + ]; + @endphp + + @foreach ($informasi as $key) + @if (isset($forminspeksi['fakta'][$key]) && $forminspeksi['fakta'][$key] !== '-') +

- {{ ucfirst(str_replace('_', ' ', $key)) }}: + {{ $forminspeksi['fakta'][$key] }}

+ @endif + @endforeach + +
Catatan yang Perlu Diperhatikan + @php + $keterangan = $forminspeksi['fakta']['keterangan'] ?? ''; + if (is_array($keterangan)) { + $keterangan = implode(', ', array_filter($keterangan)); + } + @endphp + + @if (!empty($keterangan)) + + + + +
{{ $keterangan }}
+ @endif +
diff --git a/resources/views/penilai/components/print-out-standard.blade.php b/resources/views/penilai/components/print-out-standard.blade.php index c48e2eb..b0e0525 100644 --- a/resources/views/penilai/components/print-out-standard.blade.php +++ b/resources/views/penilai/components/print-out-standard.blade.php @@ -9,11 +9,11 @@ Laporan Penilai jaminan + .list-decimal li { + margin-bottom: 0.5rem; + } + @include('lpj::assetsku.includenya')
@@ -34,25 +33,33 @@
  1. PENILAIAN INI DIBUAT BERDASARKAN ATURAN YANG BERLAKU DI SUBDIT APPRAISAL
  2. -
  3. LAPORAN INI DIBUAT BERDASARKAN DATA FOTOCOPY DOKUMEN YANG DITERIMA PENILAI DENGAN ASUMSI BAHWA DATA TERSEBUT SESUAI DENGAN DOKUMEN ASLINYA
  4. -
  5. PENILAI TIDAK MELAKUKAN PEMBUKTIAN LEBIH RINCI ATAU PENGAKUAN TERTULIS DARI PIHAK YANG DITEMUI SAAT PENILAIAN, ATAS INFORMASI YANG DIBERIKAN SECARA LISAN SEHUBUNGAN DENGAN IDENTITAS DIRI DAN HUBUNGAN DI ANTARA PIHAK TERKAIT SAAT MELAKUKAN INSPEKSI OBJEK YANG DINILAI
  6. -
  7. LAPORAN INI DIGUNAKAN HANYA UNTUK KEPENTINGAN INTERNAL DAN DILARANG MENYEBARKAN KEPADA PIHAK KETIGA
  8. +
  9. LAPORAN INI DIBUAT BERDASARKAN DATA FOTOCOPY DOKUMEN YANG DITERIMA PENILAI DENGAN ASUMSI BAHWA DATA + TERSEBUT SESUAI DENGAN DOKUMEN ASLINYA
  10. +
  11. PENILAI TIDAK MELAKUKAN PEMBUKTIAN LEBIH RINCI ATAU PENGAKUAN TERTULIS DARI PIHAK YANG DITEMUI SAAT + PENILAIAN, ATAS INFORMASI YANG DIBERIKAN SECARA LISAN SEHUBUNGAN DENGAN IDENTITAS DIRI DAN HUBUNGAN + DI ANTARA PIHAK TERKAIT SAAT MELAKUKAN INSPEKSI OBJEK YANG DINILAI
  12. +
  13. LAPORAN INI DIGUNAKAN HANYA UNTUK KEPENTINGAN INTERNAL DAN DILARANG MENYEBARKAN KEPADA PIHAK KETIGA +
diff --git a/resources/views/penilai/components/memo.blade.php b/resources/views/penilai/components/memo.blade.php index 71cee50..8f87ac2 100644 --- a/resources/views/penilai/components/memo.blade.php +++ b/resources/views/penilai/components/memo.blade.php @@ -281,7 +281,8 @@ {{-- @include('lpj::penilai.components.foto-lampiran') --}} From 165042db38db8cc7e23f688c8315b614d521af48 Mon Sep 17 00:00:00 2001 From: majid Date: Tue, 4 Feb 2025 13:33:16 +0700 Subject: [PATCH 25/33] fix(print-out): perbaikan foto --- app/Http/Controllers/PenilaiController.php | 29 +++-- .../penilai/components/foto-jaminan.blade.php | 114 +++++++++++++++--- .../penilai/components/print-memo.blade.php | 14 +-- .../components/print-out-sederhana.blade.php | 19 ++- .../components/print-out-standard.blade.php | 17 ++- 5 files changed, 143 insertions(+), 50 deletions(-) diff --git a/app/Http/Controllers/PenilaiController.php b/app/Http/Controllers/PenilaiController.php index fe60a89..29ff6fd 100644 --- a/app/Http/Controllers/PenilaiController.php +++ b/app/Http/Controllers/PenilaiController.php @@ -248,7 +248,7 @@ class PenilaiController extends Controller public function edit($id) { $permohonan = Permohonan::with('debiture')->find($id); - return view('lpj::penilai.edit',compact('permohonan')); + return view('lpj::penilai.edit', compact('permohonan')); } @@ -272,7 +272,7 @@ class PenilaiController extends Controller ] ); - if($request->hasFile('file_paparan')) { + if ($request->hasFile('file_paparan')) { $file = $request->file('file_paparan'); $path = $file->store('public/file_paparan'); @@ -282,10 +282,10 @@ class PenilaiController extends Controller } return redirect() - ->route('penilai.show',['id'=>$id])->with('success', 'diperbarui ke status paparan dan dikirim ke So untuk proses lebih lanjut.'); + ->route('penilai.show', ['id' => $id])->with('success', 'diperbarui ke status paparan dan dikirim ke So untuk proses lebih lanjut.'); } catch (\Exception $e) { - return redirect()->route('penilai.show',['id'=>$id])->with('error', 'Terjadi kesalahan saat memproses permohonan.'); + return redirect()->route('penilai.show', ['id' => $id])->with('error', 'Terjadi kesalahan saat memproses permohonan.'); } } @@ -379,9 +379,18 @@ class PenilaiController extends Controller } } - return view('lpj::penilai.components.rap-penilai', compact('permohonan', 'rap', 'provinces', 'cities', + return view('lpj::penilai.components.rap-penilai', compact( + 'permohonan', + 'rap', + 'provinces', + 'cities', 'districts', - 'villages','forminspeksi', 'nomorLaporan', 'basicData','cekAlamat')); + 'villages', + 'forminspeksi', + 'nomorLaporan', + 'basicData', + 'cekAlamat' + )); } @@ -453,7 +462,7 @@ class PenilaiController extends Controller // return view('lpj::penilai.components.call-report', compact('permohonan', 'rap', 'provinces', 'cities', // 'districts', // 'villages','forminspeksi', 'noLpRAP', 'basicData','cekAlamat')); - return view('lpj::penilai.components.call-report', compact('permohonan')); + return view('lpj::penilai.components.call-report', compact('permohonan')); } /** @@ -1052,8 +1061,12 @@ class PenilaiController extends Controller 'rap' )); // return $pdf; + $cleanNomorLaporan = str_replace(['/', '\\'], '-', $nomorLaporan); $pdf->setPaper('A4', 'portrait'); - return $pdf->stream(); + return response($pdf->output(), 200) + ->header('Content-Type', 'application/pdf') + ->header('Content-Disposition', 'inline; filename="Laporan_' . $tipeLaporan . '_' .$permohonan->debiture->name . '_' . $cleanNomorLaporan .'.pdf"'); + // return $pdf->stream(); } else { // $pdf = view('lpj::' . $viewLaporan, compact( $pdf = PDF::loadView('lpj::' . $viewLaporan, compact( diff --git a/resources/views/penilai/components/foto-jaminan.blade.php b/resources/views/penilai/components/foto-jaminan.blade.php index 1f29d95..dd9e8a6 100644 --- a/resources/views/penilai/components/foto-jaminan.blade.php +++ b/resources/views/penilai/components/foto-jaminan.blade.php @@ -9,7 +9,7 @@ 'foto_rute_lainnya' => [ 'key' => 'name_rute_lainnya', 'name_prefix' => '', - 'nested' => false, + 'nested' => true, ], 'foto_lingkungan' => [ 'key' => 'foto_lingkungan', @@ -36,33 +36,91 @@ $hasPhotos = false; @endphp - + @foreach ($photoSections as $sectionKey => $sectionConfig) @if ($sectionKey === 'single_photos')
+ @php $counter = 0; @endphp @foreach ($sectionConfig as $photoKey => $photoName) @if (isset($formFoto[$photoKey]) && !empty($formFoto[$photoKey])) @php $imagePath = storage_path('app/public/' . $formFoto[$photoKey]); $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif

{{ $photoName }} @@ -71,6 +129,10 @@ {{ $photoName }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endif @endforeach
@@ -83,11 +145,15 @@ @if ($sectionConfig['nested']) @if (isset($sectionData[$sectionConfig['key']][0]))
+ @php $counter = 0; @endphp @foreach ($sectionData[$sectionConfig['key']][0] as $index => $item) @php $imagePath = storage_path('app/public/' . $item['path']); $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif

{{ $sectionConfig['name_prefix'] @@ -98,11 +164,16 @@ {{ $item['path'] }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endforeach
@endif @else
+ @php $counter = 0; @endphp @foreach ($sectionData as $index => $item) @php $name = $item[$sectionConfig['key']] ?? ''; @@ -116,6 +187,9 @@ @if (!empty($name) || !empty($photoPath)) @php $hasPhotos = true; @endphp + @if ($counter % 2 == 0) +
+ @endif
@if (!empty($name))

@@ -126,6 +200,10 @@ {{ $name ?: 'Foto' }} @endif

+ @if ($counter % 2 == 1 || $loop->last) +
+ @endif + @php $counter++; @endphp @endif @endforeach
diff --git a/resources/views/penilai/components/print-memo.blade.php b/resources/views/penilai/components/print-memo.blade.php index 6448c1e..248905a 100644 --- a/resources/views/penilai/components/print-memo.blade.php +++ b/resources/views/penilai/components/print-memo.blade.php @@ -92,17 +92,7 @@ border: 1px solid #000; } - .photo-item { - text-align: center; - margin-bottom: 20px; - } - .photo-image { - max-width: 80%; - height: auto; - display: block; - margin: 0 auto; - } @@ -421,8 +411,8 @@ -