Merge branch 'staging' into feature/senior-officer

This commit is contained in:
majid
2025-01-30 21:44:06 +07:00
27 changed files with 1097 additions and 394 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace Modules\Lpj\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Modules\Lpj\Models\CustomField;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class CustomFieldExport implements WithColumnFormatting, WithHeadings, FromCollection, WithMapping
{
public function collection()
{
return CustomField::all();
}
public function map($row): array
{
return [
$row->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,
];
}
}

View File

@@ -2,7 +2,8 @@
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Support\Facades\DB; 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\PenawaranDetailTender;
use Modules\Lpj\Models\PenawaranTender; use Modules\Lpj\Models\PenawaranTender;
use Modules\Lpj\Models\Penilaian; use Modules\Lpj\Models\Penilaian;
@@ -359,3 +360,16 @@ function getNomorLaporan($permohonanId, $documentId){
])->first(); ])->first();
return $laporan->nomor_laporan ?? null; 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;
}
}

View File

@@ -0,0 +1,153 @@
<?php
namespace Modules\Lpj\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Exports\CustomFieldExport;
use Modules\Lpj\Http\Requests\CustomFieldRequest;
use Modules\Lpj\Models\CustomField;
class CustomFieldController extends Controller
{
public $user;
public function index()
{
return view('lpj::custom_fields.index');
}
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()
{
$urutan_prioritas = CustomField::max('urutan_prioritas')+1;
return view('lpj::custom_fields.create', compact('urutan_prioritas'));
}
public function edit($id)
{
$customField = CustomField::find($id);
$urutan_prioritas = $customField->urutan_prioritas ?? CustomField::max('urutan_prioritas')+1;
return view('lpj::custom_fields.create', compact('customField', 'urutan_prioritas' ));
}
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');
}
}

View File

@@ -14,6 +14,7 @@
use Modules\Location\Models\Province; use Modules\Location\Models\Province;
use Modules\Location\Models\Village; use Modules\Location\Models\Village;
use Modules\Lpj\Http\Requests\DokumenJaminanRequest; use Modules\Lpj\Http\Requests\DokumenJaminanRequest;
use Modules\Lpj\Models\CustomField;
use Modules\Lpj\Models\Debiture; use Modules\Lpj\Models\Debiture;
use Modules\Lpj\Models\DetailDokumenJaminan; use Modules\Lpj\Models\DetailDokumenJaminan;
use Modules\Lpj\Models\DokumenJaminan; use Modules\Lpj\Models\DokumenJaminan;
@@ -88,7 +89,7 @@
'jenis_legalitas_jaminan_id' => $value, 'jenis_legalitas_jaminan_id' => $value,
'name' => $request->name[$key], 'name' => $request->name[$key],
'keterangan' => $request->keterangan[$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 = []; $dokumenJaminan = [];
@@ -247,7 +248,7 @@
'jenis_legalitas_jaminan_id' => $value, 'jenis_legalitas_jaminan_id' => $value,
'name' => $request->name[$key], 'name' => $request->name[$key],
'keterangan' => $request->keterangan[$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 = []; $dokumenJaminan = [];
@@ -496,6 +497,12 @@
foreach ($document->detail as $detail) { foreach ($document->detail as $detail) {
// Only include existing legalitas if its id is in the new set // Only include existing legalitas if its id is in the new set
if (in_array($detail->jenis_legalitas_jaminan_id, $newLegalitasIds)) { 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[] = [ $existingLegalitas[] = [
'id' => $detail->id, 'id' => $detail->id,
'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id, 'jenis_legalitas_jaminan_id' => $detail->jenis_legalitas_jaminan_id,
@@ -507,6 +514,7 @@
$detail->dokumen_nomor, $detail->dokumen_nomor,
) ?? $detail->dokumen_nomor, ) ?? $detail->dokumen_nomor,
'custom_field' => $detail->jenisLegalitasJaminan->custom_field, 'custom_field' => $detail->jenisLegalitasJaminan->custom_field,
'custom_fields' => $customFields,
'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type, 'custom_field_type' => $detail->jenisLegalitasJaminan->custom_field_type,
'details' => $detail->details, 'details' => $detail->details,
'keterangan' => $detail->keterangan, 'keterangan' => $detail->keterangan,

View File

@@ -8,6 +8,7 @@
use Maatwebsite\Excel\Facades\Excel; use Maatwebsite\Excel\Facades\Excel;
use Modules\Lpj\Exports\JenisLegalitasJaminanExport; use Modules\Lpj\Exports\JenisLegalitasJaminanExport;
use Modules\Lpj\Http\Requests\JenisLegalitasJaminanRequest; use Modules\Lpj\Http\Requests\JenisLegalitasJaminanRequest;
use Modules\Lpj\Models\CustomField;
use Modules\Lpj\Models\JenisLegalitasJaminan; use Modules\Lpj\Models\JenisLegalitasJaminan;
class JenisLegalitasJaminanController extends Controller class JenisLegalitasJaminanController extends Controller
@@ -40,13 +41,15 @@
public function create() public function create()
{ {
return view('lpj::jenis_legalitas_jaminan.create'); $customFields = CustomField::orderBy('urutan_prioritas', 'asc')->get();
return view('lpj::jenis_legalitas_jaminan.create',compact('customFields'));
} }
public function edit($id) public function edit($id)
{ {
$jenisLegalitasJaminan = JenisLegalitasJaminan::find($id); $jenisLegalitasJaminan = JenisLegalitasJaminan::find($id);
return view('lpj::jenis_legalitas_jaminan.create', compact('jenisLegalitasJaminan')); $customFields = CustomField::orderBy('urutan_prioritas', 'asc')->get();
return view('lpj::jenis_legalitas_jaminan.create', compact('jenisLegalitasJaminan', 'customFields'));
} }
public function update(JenisLegalitasJaminanRequest $request, $id) public function update(JenisLegalitasJaminanRequest $request, $id)

View File

@@ -0,0 +1,58 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Modules\Lpj\Models\CustomField;
use Illuminate\Validation\Rule;
class CustomFieldRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
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')),
],
];
}
/**
* 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']);
}
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.',
];
}
}

View File

@@ -20,6 +20,8 @@
'slug' => 'required|max:255', 'slug' => 'required|max:255',
'custom_field' => 'nullable|max:255', 'custom_field' => 'nullable|max:255',
'custom_field_type' => 'nullable|max:255', 'custom_field_type' => 'nullable|max:255',
'custom_fields' => 'nullable|array',
'custom_fields.*' => 'required|string|max:255',
]; ];
} }
@@ -46,5 +48,10 @@
'slug' => Str::slug($this->name), 'slug' => Str::slug($this->name),
]); ]);
} }
// Ensure custom_fields is always an array
if (!is_array($this->custom_fields)) {
$this->merge(['custom_fields' => []]);
}
} }
} }

View File

@@ -0,0 +1,26 @@
<?php
namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// use Modules\Lpj\Database\Factories\CustomFieldFactory;
class CustomField extends Base
{
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'type',
'urutan_prioritas',
'label'
];
// protected static function newFactory(): CustomFieldFactory
// {
// // return CustomFieldFactory::new();
// }
}

View File

@@ -7,5 +7,14 @@
class JenisLegalitasJaminan extends Base class JenisLegalitasJaminan extends Base
{ {
protected $table = 'jenis_legalitas_jaminan'; protected $table = 'jenis_legalitas_jaminan';
protected $fillable = ['code', 'name','slug','custom_field','custom_field_type']; protected $fillable = ['code', 'name','slug','custom_field','custom_field_type','custom_fields'];
protected $casts = [
'custom_fields' => 'array',
];
public function customFields()
{
return $this->hasMany(CustomField::class);
}
} }

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('custom_fields', function (Blueprint $table) {
$table->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');
}
};

View File

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

View File

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

View File

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

View File

@@ -851,6 +851,17 @@
"administrator", "administrator",
"admin" "admin"
] ]
},
{
"title": "Custom Field",
"path": "basicdata.custom-field",
"classes": "",
"attributes": [],
"permission": "",
"roles": [
"administrator",
"admin"
]
} }
] ]
} }

View File

@@ -0,0 +1,89 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@extends('layouts.main')
@section('breadcrumbs')
{{ Breadcrumbs::render(request()->route()->getName()) }}
@endsection
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@if(isset($customField->id))
<form action="{{ route('basicdata.custom-field.update', $customField->id) }}" method="POST">
<input type="hidden" name="id" value="{{ $customField->id }}">
@method('PUT')
@else
<form method="POST" action="{{ route('basicdata.custom-field.store') }}">
@endif
@csrf
<div class="card border border-agi-100 pb-2.5">
<div class="card-header bg-agi-50" id="basic_settings">
<h3 class="card-title">
{{ isset($customField->id) ? 'Edit' : 'Tambah' }} Custom Field
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('basicdata.custom-field.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
</div>
</div>
<div class="card-body grid gap-5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Name
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('name') border-danger bg-danger-light @enderror" type="text" name="name" value="{{ $customField->name ?? '' }}">
@error('name')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Label
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('label') border-danger bg-danger-light @enderror" type="text" name="label" value="{{ $customField->label ?? '' }}">
@error('label')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Type
</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input @error('type') border-danger bg-danger-light @enderror" name="type">
<option value="text" {{ (isset($customField->type) && $customField->type == 'text') ? 'selected' : '' }}>Text</option>
<option value="radio" {{ (isset($customField->type) && $customField->type == 'radio') ? 'selected' : '' }}>Radio</option>
<option value="number" {{ (isset($customField->type) && $customField->type == 'select') ? 'selected' : '' }}>Select</option>
<option value="option" {{ (isset($customField->type) && $customField->type == 'checkbox') ? 'selected' : '' }}>Checkbox</option>
</select>
@error('type')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Urutan Prioritas
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('urutan_prioritas') border-danger bg-danger-light @enderror" type="number" name="urutan_prioritas" value="{{ $customField->urutan_prioritas ?? $urutan_prioritas }}">
@error('urutan_prioritas')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex justify-end">
<button type="submit" class="btn btn-primary">
Save
</button>
</div>
</div>
</div>
</form>
</div>
@endsection

View File

@@ -0,0 +1,153 @@
@extends('layouts.main')
@section('breadcrumbs')
{{ Breadcrumbs::render('basicdata.custom-field') }}
@endsection
@section('content')
<div class="grid">
<div class="card border border-agi-100 card-grid min-w-full" data-datatable="false" data-datatable-page-size="10" data-datatable-state-save="false" id="custom-field-table" data-api-url="{{ route('basicdata.custom-field.datatables') }}">
<div class="card-header bg-agi-50 py-5 flex-wrap">
<h3 class="card-title">
Daftar Custom Field
</h3>
<div class="flex flex-wrap gap-2 lg:gap-5">
<div class="flex">
<label class="input input-sm"> <i class="ki-filled ki-magnifier"> </i>
<input placeholder="Search Custom Field" id="search" type="text" value="">
</label>
</div>
<div class="flex flex-wrap gap-2.5">
<div class="h-[24px] border border-r-gray-200"></div>
<a class="btn btn-sm btn-light" href="{{ route('basicdata.custom-field.export') }}"> Export to Excel </a>
<a class="btn btn-sm btn-primary" href="{{ route('basicdata.custom-field.create') }}"> Tambah Custom Field </a>
</div>
</div>
</div>
<div class="card-body">
<div class="scrollable-x-auto">
<table class="table table-auto table-border align-middle text-gray-700 font-medium text-sm" data-datatable-table="true">
<thead>
<tr>
<th class="w-14">
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox"/>
</th>
<th class="min-w-[250px]" data-datatable-column="name">
<span class="sort"> <span class="sort-label"> Custom Field </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="type">
<span class="sort"> <span class="sort-label"> Type </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="urutan_prioritas">
<span class="sort"> <span class="sort-label"> Urutan Prioritas </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[50px] text-center" data-datatable-column="actions">Action</th>
</tr>
</thead>
</table>
</div>
<div class="card-footer justify-center md:justify-between flex-col md:flex-row gap-3 text-gray-600 text-2sm font-medium">
<div class="flex items-center gap-2">
Show
<select class="select select-sm w-16" data-datatable-size="true" name="perpage"> </select> per page
</div>
<div class="flex items-center gap-4">
<span data-datatable-info="true"> </span>
<div class="pagination" data-datatable-pagination="true">
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function deleteData(data) {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
});
$.ajax(`basic-data/custom-field/${data}`, {
type: 'DELETE'
}).then((response) => {
swal.fire('Deleted!', 'User has been deleted.', 'success').then(() => {
window.location.reload();
});
}).catch((error) => {
console.error('Error:', error);
Swal.fire('Error!', 'An error occurred while deleting the file.', 'error');
});
}
})
}
</script>
<script type="module">
const element = document.querySelector('#custom-field-table');
const searchInput = document.getElementById('search');
const apiUrl = element.getAttribute('data-api-url');
const dataTableOptions = {
apiEndpoint: apiUrl,
pageSize: 5,
columns: {
select: {
render: (item, data, context) => {
const checkbox = document.createElement('input');
checkbox.className = 'checkbox checkbox-sm';
checkbox.type = 'checkbox';
checkbox.value = data.id.toString();
checkbox.setAttribute('data-datatable-row-check', 'true');
return checkbox.outerHTML.trim();
},
},
label: {
title: 'Custom Field',
},
type: {
title: 'Type',
},
urutan_prioritas: {
title: 'Urutan Prioritas',
},
actions: {
title: 'Status',
render: (item, data) => {
return `<div class="flex flex-nowrap justify-center">
<a class="btn btn-sm btn-icon btn-clear btn-info" href="basic-data/custom-field/${data.id}/edit">
<i class="ki-outline ki-notepad-edit"></i>
</a>
<a onclick="deleteData(${data.id})" class="delete btn btn-sm btn-icon btn-clear btn-danger">
<i class="ki-outline ki-trash"></i>
</a>
</div>`;
},
}
},
};
let dataTable = new KTDataTable(element, dataTableOptions);
// Custom search functionality
searchInput.addEventListener('input', function () {
const searchValue = this.value.trim();
dataTable.search(searchValue, true);
});
</script>
@endpush

View File

@@ -16,16 +16,16 @@
</p> </p>
</div> </div>
</div> </div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Nomor Permohonan Nomor Permohonan
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<p class="text-base text-gray-700 font-bold"> <p class="text-base text-gray-700 font-bold">
{{ $permohonan->nomor_registrasi ?? "-" }} {{ $permohonan->nomor_registrasi ?? "-" }}
</p> </p>
</div>
</div> </div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Pemilik Jaminan Pemilik Jaminan
@@ -314,38 +314,30 @@
</div> </div>
@if($detail->details) @if($detail->details)
@if($detail->jenisLegalitasJaminan->custom_field) @if($detail->jenisLegalitasJaminan->custom_fields)
@php $custom_field = json_decode($detail->details,true) @endphp @foreach($detail->jenisLegalitasJaminan->custom_fields as $key)
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 capitalize"> <label class="form-label max-w-56 capitalize">
{{ str_replace('_',' ',$detail->jenisLegalitasJaminan->custom_field) }} {{ getCustomField($key)->label ?? "" }}
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" value="{{ $custom_field[$detail->jenisLegalitasJaminan->custom_field] ?? '' }}"> <input class="input" type="text" name="custom_field[{{$detail->jenisLegalitasJaminan->id}}][{{getCustomField($key)->name}}]" value="{{ json_decode($detail->details)->{getCustomField($key)->name} ?? '' }}">
</div>
</div> </div>
</div> @endforeach
@endif @endif
@else @else
@if($detail->jenisLegalitasJaminan->custom_field) @if($detail->jenisLegalitasJaminan->custom_fields)
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> @foreach($detail->jenisLegalitasJaminan->custom_fields as $key)
<label class="form-label max-w-56 capitalize"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
{{ str_replace('_',' ',$detail->jenisLegalitasJaminan->custom_field) }} <label class="form-label max-w-56 capitalize">
</label> {{ getCustomField($key)->label }}
<div class="flex flex-wrap items-baseline w-full"> </label>
@if($detail->jenisLegalitasJaminan->custom_field_type === "text") <div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2"> <input class="input" type="text" name="custom_field[{{$detail->jenisLegalitasJaminan->id}}][{{getCustomField($key)->name}}]" placeholder="...">
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "number") </div>
<input class="input" type="number" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "date")
<input class="input" type="date" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
@elseif($detail->jenisLegalitasJaminan->custom_field_type === "textarea")
<textarea class="textarea" rows="3" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2"></textarea>
@else
<input class="input" type="text" name="custom_field[][{{$detail->jenisLegalitasJaminan->custom_field}}]" placeholder="... M2">
@endif
</div> </div>
</div> @endforeach
@endif @endif
@endif @endif
@@ -393,25 +385,17 @@
</div> </div>
</div> </div>
@if($item->custom_field) @if($item->custom_fields)
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> @foreach($item->custom_fields as $field)
<label class="form-label max-w-56 capitalize"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
{{ str_replace('_',' ',$item->custom_field) }} <label class="form-label max-w-56 capitalize">
</label> {{ getCustomField($field)->label }}
<div class="flex flex-wrap items-baseline w-full"> </label>
@if($item->custom_field_type === "text") <div class="flex flex-wrap items-baseline w-full">
<input class="input" type="text" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2"> <input class="input" type="text" name="custom_field[{{$item->id}}][{{getCustomField($field)->name}}]" placeholder="...">
@elseif($item->custom_field_type === "number") </div>
<input class="input" type="number" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
@elseif($item->custom_field_type === "date")
<input class="input" type="date" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
@elseif($item->custom_field_type === "textarea")
<textarea class="textarea" rows="3" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2"></textarea>
@else
<input class="input" type="text" name="custom_field[][{{$item->custom_field}}]" placeholder="... M2">
@endif
</div> </div>
</div> @endforeach
@endif @endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
@@ -437,13 +421,13 @@
@push('scripts') @push('scripts')
{{--Pemilik Jaminan--}} {{--Pemilik Jaminan--}}
<script> <script>
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function () {
const namaSertifikatDiv = document.getElementById("nama_sertifikat"); const namaSertifikatDiv = document.getElementById("nama_sertifikat");
// Function to add delete event listeners to existing buttons // Function to add delete event listeners to existing buttons
function addDeleteListeners() { function addDeleteListeners() {
document.querySelectorAll(".delete-button").forEach(button => { document.querySelectorAll(".delete-button").forEach(button => {
button.addEventListener("click", function() { button.addEventListener("click", function () {
this.closest(".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5").remove(); this.closest(".flex.items-baseline.flex-wrap.lg\\:flex-nowrap.gap-2\\.5.mb-5").remove();
}); });
}); });
@@ -452,7 +436,7 @@
// Add delete listeners to existing buttons // Add delete listeners to existing buttons
addDeleteListeners(); addDeleteListeners();
document.getElementById("tambah_sertifikat").addEventListener("click", function() { document.getElementById("tambah_sertifikat").addEventListener("click", function () {
const newDiv = document.createElement("div"); const newDiv = document.createElement("div");
newDiv.className = "flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5"; newDiv.className = "flex items-baseline flex-wrap lg:flex-nowrap gap-2.5 mb-5";
newDiv.innerHTML = ` newDiv.innerHTML = `
@@ -547,16 +531,16 @@
</div> </div>
</div> </div>
${item.custom_field ? ` ${item.custom_fields && item.custom_fields.length > 0 ? item.custom_fields.map(field => `
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56 capitalize"> <label class="form-label max-w-56 capitalize">
${item.custom_field.replace(/_/g, " ")} ${field.label}
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
${getCustomFieldInput(item.custom_field_type, item.custom_field, item.details)} ${getCustomFieldInput(field.type, field.name, item.details, item.id)}
</div> </div>
</div> </div>
` : ""} `).join('') : ""}
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
@@ -637,19 +621,19 @@
return dokumenNomor; return dokumenNomor;
} }
function getCustomFieldInput(type, fieldName, value) { function getCustomFieldInput(type, fieldName, value, itemId) {
value = value ? JSON.parse(value)[fieldName] || "" : ""; value = value ? JSON.parse(value)[fieldName] || "" : "";
switch (type) { switch (type) {
case "text": case "text":
return `<input class="input" type="text" name="custom_field[][${fieldName}]" value="${value}">`; return `<input class="input" type="text" name="custom_field[${itemId}][${fieldName}]" value="${value}">`;
case "number": case "number":
return `<input class="input" type="number" name="custom_field[][${fieldName}]" value="${value}">`; return `<input class="input" type="number" name="custom_field[${itemId}][${fieldName}]" value="${value}">`;
case "date": case "date":
return `<input class="input" type="date" name="custom_field[][${fieldName}]" value="${value}">`; return `<input class="input" type="date" name="custom_field[${itemId}][${fieldName}]" value="${value}">`;
case "textarea": case "textarea":
return `<textarea class="textarea" rows="3" name="custom_field[][${fieldName}]">${value}</textarea>`; return `<textarea class="textarea" rows="3" name="custom_field[${itemId}][${fieldName}]">${value}</textarea>`;
default: default:
return `<input class="input" type="text" name="custom_field[][${fieldName}]" value="${value}">`; return `<input class="input" type="text" name="custom_field[${itemId}][${fieldName}]" value="${value}">`;
} }
} }
</script> </script>

View File

@@ -92,28 +92,28 @@
@enderror @enderror
</div> </div>
</div> </div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <label class="form-label max-w-56">
<label class="form-label max-w-56"> Jenis Legalitas Jaminan
Jenis Legalitas Jaminan </label>
</label> <div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5"> @foreach ($jenisLegalitasJaminan as $row)
@foreach ($jenisLegalitasJaminan as $row) <label class="switch">
<label class="switch"> @if ( isset($jenisJaminan) && !empty(json_decode($jenisJaminan->jenis_legalitas_jaminan_id, true)))
@if ( isset($jenisJaminan) && !empty(json_decode($jenisJaminan->jenis_legalitas_jaminan_id, true))) <input type="checkbox" @if (in_array($row->code, json_decode($jenisJaminan->jenis_legalitas_jaminan_id, true))) {{ 'checked' }} @endif
<input type="checkbox" @if (in_array($row->code, json_decode($jenisJaminan->jenis_legalitas_jaminan_id, true))) {{ 'checked' }} @endif
value="{{ $row->code }}" name="jenis_legalitas_jaminan_id[]" /> value="{{ $row->code }}" name="jenis_legalitas_jaminan_id[]" />
@else @else
<input type="checkbox" value="{{ $row->code }}" <input type="checkbox" value="{{ $row->code }}"
name="jenis_legalitas_jaminan_id[]" /> name="jenis_legalitas_jaminan_id[]" />
@endif @endif
<span class="switch-label"> <span class="switch-label">
{{ $row->name }} {{ $row->name }}
</span> </span>
</label> </label>
@endforeach @endforeach
</div>
</div> </div>
</div>
<div class="flex justify-end"> <div class="flex justify-end">
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
Save Save

View File

@@ -10,83 +10,107 @@
<form action="{{ route('basicdata.jenis-legalitas-jaminan.update', $jenisLegalitasJaminan->id) }}" method="POST"> <form action="{{ route('basicdata.jenis-legalitas-jaminan.update', $jenisLegalitasJaminan->id) }}" method="POST">
<input type="hidden" name="id" value="{{ $jenisLegalitasJaminan->id }}"> <input type="hidden" name="id" value="{{ $jenisLegalitasJaminan->id }}">
@method('PUT') @method('PUT')
@else @else
<form method="POST" action="{{ route('basicdata.jenis-legalitas-jaminan.store') }}"> <form method="POST" action="{{ route('basicdata.jenis-legalitas-jaminan.store') }}">
@endif @endif
@csrf @csrf
<div class="card border border-agi-100 pb-2.5"> <div class="card border border-agi-100 pb-2.5">
<div class="card-header bg-agi-50" id="basic_settings"> <div class="card-header bg-agi-50" id="basic_settings">
<h3 class="card-title"> <h3 class="card-title">
{{ isset($jenisLegalitasJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Legalitas Jaminan {{ isset($jenisLegalitasJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Legalitas Jaminan
</h3> </h3>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<a href="{{ route('basicdata.jenis-legalitas-jaminan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a> <a href="{{ route('basicdata.jenis-legalitas-jaminan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
</div> </div>
</div> </div>
<div class="card-body grid gap-5"> <div class="card-body grid gap-5">
@if(isset($jenisLegalitasJaminan->id)) @if(isset($jenisLegalitasJaminan->id))
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Code Code
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input readonly class="input border-warning bg-warning-light @error('code') border-danger bg-danger-light @enderror" type="text" name="code" value="{{ $jenisLegalitasJaminan->code ?? '' }}"> <input readonly class="input border-warning bg-warning-light @error('code') border-danger bg-danger-light @enderror" type="text" name="code" value="{{ $jenisLegalitasJaminan->code ?? '' }}">
@error('code') @error('code')
<em class="alert text-danger text-sm">{{ $message }}</em> <em class="alert text-danger text-sm">{{ $message }}</em>
@enderror @enderror
</div> </div>
</div> </div>
@endif @endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Name Name
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input class="input @error('name') border-danger bg-danger-light @enderror" type="text" name="name" value="{{ $jenisLegalitasJaminan->name ?? '' }}"> <input class="input @error('name') border-danger bg-danger-light @enderror" type="text" name="name" value="{{ $jenisLegalitasJaminan->name ?? '' }}">
@error('name') @error('name')
<em class="alert text-danger text-sm">{{ $message }}</em> <em class="alert text-danger text-sm">{{ $message }}</em>
@enderror @enderror
</div> </div>
</div> </div>
<!-- Tambahkan inputan custom_field --> <!-- Tambahkan inputan custom_field -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Custom Field Custom Field
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<input class="input @error('custom_field') border-danger bg-danger-light @enderror" type="text" name="custom_field" value="{{ $jenisLegalitasJaminan->custom_field ?? '' }}"> <input class="input @error('custom_field') border-danger bg-danger-light @enderror" type="text" name="custom_field" value="{{ $jenisLegalitasJaminan->custom_field ?? '' }}">
@error('custom_field') @error('custom_field')
<em class="alert text-danger text-sm">{{ $message }}</em> <em class="alert text-danger text-sm">{{ $message }}</em>
@enderror @enderror
</div> </div>
</div> </div>
<!-- Tambahkan inputan custom_field_type --> <!-- Tambahkan inputan custom_field_type -->
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5"> <div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56"> <label class="form-label max-w-56">
Custom Field Type Custom Field Type
</label> </label>
<div class="flex flex-wrap items-baseline w-full"> <div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect @error('custom_field_type') border-danger bg-danger-light @enderror" name="custom_field_type"> <select class="input tomselect @error('custom_field_type') border-danger bg-danger-light @enderror" name="custom_field_type">
<option value="">Pilih Tipe</option> <option value="">Pilih Tipe</option>
<option value="text" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'text') ? 'selected' : '' }}>Text</option> <option value="text" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'text') ? 'selected' : '' }}>Text</option>
<option value="number" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'number') ? 'selected' : '' }}>Number</option> <option value="number" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'number') ? 'selected' : '' }}>Number</option>
<option value="date" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'date') ? 'selected' : '' }}>Date</option> <option value="date" {{ (isset($jenisLegalitasJaminan) && $jenisLegalitasJaminan->custom_field_type == 'date') ? 'selected' : '' }}>Date</option>
</select> </select>
@error('custom_field_type') @error('custom_field_type')
<em class="alert text-danger text-sm">{{ $message }}</em> <em class="alert text-danger text-sm">{{ $message }}</em>
@enderror @enderror
</div> </div>
</div> </div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Custom Fields
</label>
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
@foreach($customFields as $customField)
<label class="switch">
@if ( isset($jenisLegalitasJaminan) && !empty($jenisLegalitasJaminan->custom_fields))
<input type="checkbox" @if (in_array($customField->id, $jenisLegalitasJaminan->custom_fields))
{{ 'checked' }}
@endif
value="{{ $customField->id }}" name="custom_fields[]"/>
@else
<input type="checkbox" value="{{ $customField->id }}"
name="custom_fields[]"/>
@endif
<span class="switch-label">
{{ $customField->urutan_prioritas.'. '.$customField->label }}
</span>
</label>
@endforeach
</div>
</div>
<div class="flex justify-end">
<button type="submit" class="btn btn-primary"> <div class="flex justify-end">
Save <button type="submit" class="btn btn-primary">
</button> Save
</div> </button>
</div> </div>
</div> </div>
</form> </div>
</form>
</div> </div>
@endsection @endsection

View File

@@ -56,8 +56,8 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
Dear <span class="important"> Dear <span class="important">
@php @php
$allPeople = []; $allPeople = [];
@@ -76,7 +76,7 @@
} }
} }
} }
} catch (\Exception $e) { } catch (Exception $e) {
// Handle invalid JSON silently // Handle invalid JSON silently
} }
} }
@@ -85,104 +85,100 @@
$allPeople = array_filter($allPeople); $allPeople = array_filter($allPeople);
$totalPeople = count($allPeople); $totalPeople = count($allPeople);
@endphp @endphp
@if ($totalPeople > 0) @if ($totalPeople > 0)
@foreach ($allPeople as $index => $person) @foreach ($allPeople as $index => $person)
{{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }}
@endforeach @endforeach
@else @else
Tidak Ada Tidak Ada
@endif @endif
</span> </span>
<div class="content"> <div class="content">
Mohon untuk dibuatkan proposal jasa appraisal atas nama <span Mohon untuk dibuatkan proposal jasa appraisal atas nama <span
class="important">{{ $permohonan->debiture->name }}</span>, tujuan penilaian untuk <span class="important">{{ $permohonan->debiture->name }}</span>, tujuan penilaian untuk <span
class="important">{{ $penawaran->tujuanPenilaianKJPP->name }}</span>, laporan dalam bentuk <span class="important">{{ $penawaran->tujuanPenilaianKJPP->name }}</span>, laporan dalam bentuk <span
class="important">{{ $penawaran->jenisLaporan->name }}</span>, dengan data-data sebagai berikut: class="important">{{ $penawaran->jenisLaporan->name }}</span>, dengan data-data sebagai berikut:
</div> </div>
<div class="content-max"> <div class="content-max">
Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) Aset Jaminan: @foreach ($permohonan->debiture->documents as $document)
{{ $document->jenisJaminan->name }} {{ $document->jenisJaminan->name }}
@endforeach @endforeach
<span class="flex-wrap">Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) <span class="flex-wrap">Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document)
{{ $document->address }}, Kel. @foreach ($villages as $village) {{ $document->address }}, Kel. @foreach ($villages as $village)
{{ $village->name }} {{ $village->name }}
@endforeach, Kec. @foreach ($districts as $district) @endforeach, Kec. @foreach ($districts as $district)
{{ $district->name }} {{ $district->name }}
@endforeach,@foreach ($cities as $city) @endforeach,@foreach ($cities as $city)
{{ ucwords(strtolower($city->name)) }} {{ ucwords(strtolower($city->name)) }}
@endforeach,@foreach ($provinces as $province) @endforeach,@foreach ($provinces as $province)
{{ $province->name }} {{ $province->name }}
@endforeach
@endforeach
</span>
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
@endforeach @endforeach
@endforeach @endforeach
</span>
@if ($luas_tanah !== null && $luas_bangunan !== null) Luas Tanah / Luas Bangunan:
{{ $luas_tanah }} m<sup>2</sup> / {{ $luas_bangunan }} m<sup>2</sup> @php
@elseif ($luas_tanah !== null) $luas_tanah = null;
{{ $luas_tanah }} m<sup>2</sup> $luas_bangunan = null;
@elseif ($luas_bangunan !== null) @endphp
{{ $luas_bangunan }} m<sup>2</sup>
@endif
</div>
<div class="content"> @foreach ($permohonan->debiture->documents as $document)
Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi. <br /> @foreach ($document->detail as $detail)
Mohon proposal dapat saya terima segera, sebelum <span @php
class="important">{{ formatTanggalIndonesia($penawaran->end_date, true) }}</span> $details = json_decode($detail->details);
</div> @endphp
<div class="signature"> @if (is_object($details))
Best Regards,<br /> @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))
<img src="{{ asset('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}" )
alt="{{ $permohonan->user->name }}" width="200"> @php
<p> $luas_tanah = $details->luas_tanah;
{{ $permohonan->user->name }} @endphp
</p> @endif
</div>
<div class="footer"> @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))
PT. Bank Artha Graha Internasional, Tbk.<br> )
Gedung Bank Artha Graha, Lantai 3<br> @php
Jl. Kwitang Raya No 24-26, Jakarta Pusat - 10420.<br> $luas_bangunan = $details->luas_bangunan;
Telp. 021 - 3903040 (H) @endphp
</div> @endif
@endif
@endforeach
@endforeach
@if ($luas_tanah !== null && $luas_bangunan !== null)
{{ $luas_tanah }} m<sup>2</sup> / {{ $luas_bangunan }} m<sup>2</sup>
@elseif ($luas_tanah !== null)
{{ $luas_tanah }} m<sup>2</sup>
@elseif ($luas_bangunan !== null)
{{ $luas_bangunan }} m<sup>2</sup>
@endif
</div> </div>
<div class="content">
Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi. <br/>
Mohon proposal dapat saya terima segera, sebelum <span
class="important">{{ formatTanggalIndonesia($penawaran->end_date, true) }}</span>
</div>
<div class="signature">
Best Regards,<br/>
<img src="{{ asset('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}"
alt="{{ $permohonan->user->name }}" width="200">
<p>
{{ $permohonan->user->name }}
</p>
</div>
<div class="footer">
PT. Bank Artha Graha Internasional, Tbk.<br>
Gedung Bank Artha Graha, Lantai 3<br>
Jl. Kwitang Raya No 24-26, Jakarta Pusat - 10420.<br>
Telp. 021 - 3903040 (H)
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -133,21 +133,15 @@
@endphp @endphp
@if (is_object($details)) @if (is_object($details))
@if ( @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' &&
isset($details->{'luas_tanah'}) &&
is_numeric($details->{'luas_tanah'}))
@php @php
$luas_tanah = $details->{'luas_tanah'}; $luas_tanah = $details->luas_tanah;
@endphp @endphp
@endif @endif
@if ( @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' &&
isset($details->{'luas_bangunan'}) &&
is_numeric($details->{'luas_bangunan'}))
@php @php
$luas_bangunan = $details->{'luas_bangunan'}; $luas_bangunan = $details->luas_bangunan;
@endphp @endphp
@endif @endif
@endif @endif

View File

@@ -116,21 +116,15 @@
@endphp @endphp
@if (is_object($details)) @if (is_object($details))
@if ( @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && @php
isset($details->{'luas_tanah'}) && $luas_tanah = $details->luas_tanah;
is_numeric($details->{'luas_tanah'})) @endphp
@php
$luas_tanah = $details->{'luas_tanah'};
@endphp
@endif @endif
@if ( @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' &&
isset($details->{'luas_bangunan'}) &&
is_numeric($details->{'luas_bangunan'}))
@php @php
$luas_bangunan = $details->{'luas_bangunan'}; $luas_bangunan = $details->luas_bangunan;
@endphp @endphp
@endif @endif
@endif @endif

View File

@@ -131,21 +131,15 @@
@endphp @endphp
@if (is_object($details)) @if (is_object($details))
@if ( @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' &&
isset($details->{'luas_tanah'}) &&
is_numeric($details->{'luas_tanah'}))
@php @php
$luas_tanah = $details->{'luas_tanah'}; $luas_tanah = $details->luas_tanah;
@endphp @endphp
@endif @endif
@if ( @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan)))
$detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' &&
isset($details->{'luas_bangunan'}) &&
is_numeric($details->{'luas_bangunan'}))
@php @php
$luas_bangunan = $details->{'luas_bangunan'}; $luas_bangunan = $details->luas_bangunan;
@endphp @endphp
@endif @endif
@endif @endif

View File

@@ -13,7 +13,7 @@
</h3> </h3>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<a href="{{ route('tender.penawaran.downloadSuratTenderKJPP', ['noreg' => $noreg, 'id' => $id]) }}" <a href="{{ route('tender.penawaran.downloadSuratTenderKJPP', ['noreg' => $noreg, 'id' => $id]) }}"
class="btn btn-xs btn-light"> class="btn btn-xs btn-light">
<img src="{{ asset('img/pdf.png') }}" width="25" alt="pdf" class="pdf"></img>Download <img src="{{ asset('img/pdf.png') }}" width="25" alt="pdf" class="pdf"></img>Download
</a> </a>
<a href="{{ route('tender.penawaran.showKirimEmail', $noreg) }}" class="btn btn-xs btn-info"><i <a href="{{ route('tender.penawaran.showKirimEmail', $noreg) }}" class="btn btn-xs btn-info"><i
@@ -42,7 +42,7 @@
} }
} }
} }
} catch (\Exception $e) { } catch (Exception $e) {
// Handle invalid JSON silently // Handle invalid JSON silently
} }
} }
@@ -114,21 +114,17 @@
@endphp @endphp
@if (is_object($details)) @if (is_object($details))
@if ( @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))
$detail->jenisLegalitasJaminan->custom_field === 'luas_tanah' && )
isset($details->{'luas_tanah'}) &&
is_numeric($details->{'luas_tanah'}))
@php @php
$luas_tanah = $details->{'luas_tanah'}; $luas_tanah = $details->luas_tanah;
@endphp @endphp
@endif @endif
@if ( @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))
$detail->jenisLegalitasJaminan->custom_field === 'luas_bangunan' && )
isset($details->{'luas_bangunan'}) &&
is_numeric($details->{'luas_bangunan'}))
@php @php
$luas_bangunan = $details->{'luas_bangunan'}; $luas_bangunan = $details->luas_bangunan;
@endphp @endphp
@endif @endif
@endif @endif
@@ -152,7 +148,7 @@
<p>Best Regards, <p>Best Regards,
<div class="font-bold"> <div class="font-bold">
<img src="{{ asset('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}" <img src="{{ asset('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}"
alt="{{ $permohonan->user->name }}" width="200" class="signature"> alt="{{ $permohonan->user->name }}" width="200" class="signature">
<p> <p>
{{ $permohonan->user->name }} {{ $permohonan->user->name }}
</p> </p>

View File

@@ -56,8 +56,8 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
Dear <span class="important"> Dear <span class="important">
@php @php
$allPeople = []; $allPeople = [];
@@ -87,104 +87,100 @@
$allPeople = array_filter(array_unique($allPeople)); $allPeople = array_filter(array_unique($allPeople));
$totalPeople = count($allPeople); $totalPeople = count($allPeople);
@endphp @endphp
@if ($totalPeople > 0) @if ($totalPeople > 0)
@foreach ($allPeople as $index => $person) @foreach ($allPeople as $index => $person)
{{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }} {{ $person }}{{ $index === $totalPeople - 2 ? ' dan ' : ($index < $totalPeople - 2 ? ' , ' : '') }}
@endforeach @endforeach
@else @else
Tidak Ada Tidak Ada
@endif @endif
</span> </span>
<div class="content"> <div class="content">
Mohon untuk dibuatkan proposal jasa appraisal atas nama <span Mohon untuk dibuatkan proposal jasa appraisal atas nama <span
class="important">{{ $permohonan->debiture->name }}</span>, tujuan penilaian untuk <span class="important">{{ $permohonan->debiture->name }}</span>, tujuan penilaian untuk <span
class="important">{{ $penawaran->tujuanPenilaianKJPP->name }}</span>, laporan dalam bentuk <span class="important">{{ $penawaran->tujuanPenilaianKJPP->name }}</span>, laporan dalam bentuk <span
class="important">{{ $penawaran->jenisLaporan->name }}</span>, dengan data-data sebagai berikut: class="important">{{ $penawaran->jenisLaporan->name }}</span>, dengan data-data sebagai berikut:
</div> </div>
<div class="content-max"> <div class="content-max">
Aset Jaminan: @foreach ($permohonan->debiture->documents as $document) Aset Jaminan: @foreach ($permohonan->debiture->documents as $document)
{{ $document->jenisJaminan->name }} {{ $document->jenisJaminan->name }}
@endforeach @endforeach
<span class="flex-wrap">Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document) <span class="flex-wrap">Lokasi Jaminan: @foreach ($permohonan->debiture->documents as $document)
{{ $document->address }}, Kel. @foreach ($villages as $village) {{ $document->address }}, Kel. @foreach ($villages as $village)
{{ $village->name }} {{ $village->name }}
@endforeach, Kec. @foreach ($districts as $district) @endforeach, Kec. @foreach ($districts as $district)
{{ $district->name }} {{ $district->name }}
@endforeach,@foreach ($cities as $city) @endforeach,@foreach ($cities as $city)
{{ ucwords(strtolower($city->name)) }} {{ ucwords(strtolower($city->name)) }}
@endforeach,@foreach ($provinces as $province) @endforeach,@foreach ($provinces as $province)
{{ $province->name }} {{ $province->name }}
@endforeach
@endforeach
</span>
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
@endforeach @endforeach
@endforeach @endforeach
</span>
@if ($luas_tanah !== null && $luas_bangunan !== null) Luas Tanah / Luas Bangunan:
{{ $luas_tanah }} m<sup>2</sup> / {{ $luas_bangunan }} m<sup>2</sup> @php
@elseif ($luas_tanah !== null) $luas_tanah = null;
{{ $luas_tanah }} m<sup>2</sup> $luas_bangunan = null;
@elseif ($luas_bangunan !== null) @endphp
{{ $luas_bangunan }} m<sup>2</sup>
@endif
</div>
<div class="content"> @foreach ($permohonan->debiture->documents as $document)
Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi. <br /> @foreach ($document->detail as $detail)
Mohon proposal dapat saya terima segera, sebelum <span @php
class="important">{{ formatTanggalIndonesia($penawaran->end_date, true) }}</span> $details = json_decode($detail->details);
</div> @endphp
<div class="signature"> @if (is_object($details))
Best Regards,<br /> @if(isset($details->luas_tanah) && is_numeric($details->luas_tanah))
<img src="{{ public_path('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}" )
alt="{{ $permohonan->user->name }}" width="200"> @php
<p> $luas_tanah = $details->luas_tanah;
{{ $permohonan->user->name }} @endphp
</p> @endif
</div>
<div class="footer"> @if(isset($details->luas_bangunan) && is_numeric($details->luas_bangunan))
PT. Bank Artha Graha Internasional, Tbk.<br> )
Gedung Bank Artha Graha, Lantai 3<br> @php
Jl. Kwitang Raya No 24-26, Jakarta Pusat - 10420.<br> $luas_bangunan = $details->luas_bangunan;
Telp. 021 - 3903040 (H) @endphp
</div> @endif
@endif
@endforeach
@endforeach
@if ($luas_tanah !== null && $luas_bangunan !== null)
{{ $luas_tanah }} m<sup>2</sup> / {{ $luas_bangunan }} m<sup>2</sup>
@elseif ($luas_tanah !== null)
{{ $luas_tanah }} m<sup>2</sup>
@elseif ($luas_bangunan !== null)
{{ $luas_bangunan }} m<sup>2</sup>
@endif
</div> </div>
<div class="content">
Harap proposal dibuat dengan harga yang minimal sehingga tidak perlu tawar menawar lagi. <br/>
Mohon proposal dapat saya terima segera, sebelum <span
class="important">{{ formatTanggalIndonesia($penawaran->end_date, true) }}</span>
</div>
<div class="signature">
Best Regards,<br/>
<img src="{{ public_path('storage/signatures/' . $permohonan->user->id . '/' . $permohonan->user->sign) }}"
alt="{{ $permohonan->user->name }}" width="200">
<p>
{{ $permohonan->user->name }}
</p>
</div>
<div class="footer">
PT. Bank Artha Graha Internasional, Tbk.<br>
Gedung Bank Artha Graha, Lantai 3<br>
Jl. Kwitang Raya No 24-26, Jakarta Pusat - 10420.<br>
Telp. 021 - 3903040 (H)
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -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) { Breadcrumbs::for('basicdata.jenis-fasilitas-kredit', function (BreadcrumbTrail $trail) {
$trail->parent('basicdata'); $trail->parent('basicdata');
$trail->push('Jenis Fasilitas Kredit', route('basicdata.jenis-fasilitas-kredit.index')); $trail->push('Jenis Fasilitas Kredit', route('basicdata.jenis-fasilitas-kredit.index'));

View File

@@ -3,7 +3,8 @@
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use Modules\Lpj\Http\Controllers\ActivityController; use Modules\Lpj\Http\Controllers\ActivityController;
use Modules\Lpj\Http\Controllers\ArahMataAnginController; 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\DokumenJaminanController;
use Modules\Lpj\Http\Controllers\HubunganPemilikJaminanController; use Modules\Lpj\Http\Controllers\HubunganPemilikJaminanController;
use Modules\Lpj\Http\Controllers\HubunganPenghuniJaminanController; 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::get('api/check-penawaran/{nomor_registrasi}', [TenderController::class, 'checkPenawaranExistence']);
Route::name('basicdata.')->prefix('basic-data')->group(function () { 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::name('jenis-fasilitas-kredit.')->prefix('jenis-fasilitas-kredit')->group(function () {
Route::get('restore/{id}', [JenisFasilitasKreditController::class, 'restore'])->name('restore'); Route::get('restore/{id}', [JenisFasilitasKreditController::class, 'restore'])->name('restore');
Route::get('datatables', [JenisFasilitasKreditController::class, 'dataForDatatables'])->name( Route::get('datatables', [JenisFasilitasKreditController::class, 'dataForDatatables'])->name(