Mengubah tampilan show KJPP dan Create/Edit KJPP
This commit is contained in:
@@ -62,6 +62,9 @@ class KJPPController extends Controller
|
||||
Storage::copy('public/test/default.pdf', 'public/uploads_pdf/' . $filename);
|
||||
}
|
||||
|
||||
$validated['ijin_usaha_id'] = json_encode($request->input('ijin_usaha_id'));
|
||||
$validated['jenis_aset_id'] = json_encode($request->input('jenis_aset_id'));
|
||||
|
||||
// Tambahkan nama file ke data yang divalidasi
|
||||
$validated['attachment'] = $filename;
|
||||
|
||||
|
||||
@@ -32,8 +32,10 @@ class KJPPRequest extends FormRequest
|
||||
'nomor_hp_pic_admin' => 'required|numeric|digits_between:10,15',
|
||||
'nama_pic_marketing' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'nomor_hp_pic_marketing' => 'required|numeric|digits_between:10,15',
|
||||
'ijin_usaha_id' => 'nullable',
|
||||
'jenis_aset_id' => 'nullable',
|
||||
'ijin_usaha_id' => 'required|array',
|
||||
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
|
||||
'jenis_aset_id' => 'required|array',
|
||||
'jenis_aset_id.*' => 'exists:jenis_jaminan,code',
|
||||
'attachment' => 'nullable|mimes:pdf|max:1024'
|
||||
];
|
||||
|
||||
@@ -54,14 +56,6 @@ class KJPPRequest extends FormRequest
|
||||
return true;
|
||||
}
|
||||
|
||||
public function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'ijin_usaha_id' => json_encode($this->ijin_usaha_id),
|
||||
'jenis_aset_id' => json_encode($this->jenis_aset_id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
@@ -106,6 +100,10 @@ class KJPPRequest extends FormRequest
|
||||
'nomor_hp_pic_marketing.required' => 'Nomor HP PIC Marketing Wajib diisi!',
|
||||
'nomor_hp_pic_marketing.numeric' => 'Nomor HP PIC Marketing harus berupa angka!',
|
||||
'nomor_hp_pic_marketing.digits_between' => 'Nomor HP PIC Marketing minimum 10 digit dan maksimum 15 digit!',
|
||||
'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!',
|
||||
'ijin_usaha_id.min' => 'Ijin Usaha Wajib diisi minimal satu atau lebih!',
|
||||
'jenis_aset_id.required' => 'Jenis Aset Wajib diisi!',
|
||||
'jenis_aset_id.min' => 'Jenis Aset Wajib diisi minimal satu atau lebih!',
|
||||
'attachment.mimes' => 'Attachment harus berformat pdf!',
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
|
||||
30
database/migrations/2024_09_30_021444_update_kjpp_table.php
Normal file
30
database/migrations/2024_09_30_021444_update_kjpp_table.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('kjpp', function (Blueprint $table) {
|
||||
$table->string('ijin_usaha_id')->change();
|
||||
$table->string('jenis_aset_id')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('kjpp', function (Blueprint $table) {
|
||||
$table->string('ijin_usaha_id')->nullable()->change();
|
||||
$table->string('jenis_aset_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Jenis Kantor</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select class="input tomselect @error('jenis_kantor') border-danger @enderror"
|
||||
<select id="jenis_kantor" class="select w-full @error('jenis_kantor') border-danger @enderror"
|
||||
name="jenis_kantor">
|
||||
<option value="">Pilih Jenis Kantor</option>
|
||||
@if (isset($branch))
|
||||
@@ -78,7 +78,8 @@
|
||||
</div>
|
||||
<label class="form-label max-w-56">Nomor Ijin Usaha</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select class="input tomselect @error('nomor_ijin_usaha') border-danger @enderror"
|
||||
<select id="nomor_ijin_usaha"
|
||||
class="select w-full @error('nomor_ijin_usaha') border-danger @enderror"
|
||||
name="nomor_ijin_usaha">
|
||||
<option value="">Pilih Nomor Ijin Usaha</option>
|
||||
@if (isset($ijin_usaha))
|
||||
@@ -357,11 +358,11 @@
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@error('ijin_usaha_id')
|
||||
<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">
|
||||
Pengalaman (Jenis Aset)
|
||||
@@ -378,6 +379,9 @@
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('jenis_aset_id')
|
||||
<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">
|
||||
|
||||
@@ -149,45 +149,49 @@
|
||||
Ijin Usaha
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select name="ijin_usaha_id[]" multiple="multiple" class="input tomselect w-full" disabled>
|
||||
<option value="">Pilih Ijin Usaha</option>
|
||||
@foreach ($ijin_usahas as $row)
|
||||
@if (isset($kjpp->ijin_usaha_id))
|
||||
<option value="{{ $row->code }}"
|
||||
{{ in_array($row->code, old('ijin_usaha_id', json_decode($kjpp->ijin_usaha_id, true))) ? 'selected' : '' }}>
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $row->code }}"
|
||||
{{ in_array($row->code, old('ijin_usaha_id', [])) ? 'selected' : '' }}>
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
<div class="flex flex-row space-x-4 text-gray-600 font-medium text-sm gap-1">
|
||||
@foreach (json_decode($kjpp->ijin_usaha_id, true) as $ijin_code)
|
||||
@php
|
||||
$ijin_usaha = $ijin_usahas->firstWhere('code', $ijin_code);
|
||||
@endphp
|
||||
@if ($ijin_usaha)
|
||||
<div
|
||||
class="flex flex-row space-x-4 text-white font-medium text-sm badge badge-dark dark-mode:badge dark-mode:text-gray-600">
|
||||
{{ $ijin_usaha->name }}
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@else
|
||||
<div class="flex flex-row space-x-4 text-white font-medium text-sm dark-mode:text-gray-600">No
|
||||
business license
|
||||
selected.</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">
|
||||
Pengalaman (Jenis Aset)
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select name="jenis_aset_id[]" multiple="multiple" class="input tomselect w-full" disabled>
|
||||
<option value="">Pilih Jenis Aset</option>
|
||||
@foreach ($jenis_jaminan as $row)
|
||||
<div class="flex flex-wrap items-baseline w-full gap-1">
|
||||
@if (isset($kjpp->jenis_aset_id))
|
||||
<option value="{{ $row->code }}"
|
||||
{{ in_array($row->code, old('jenis_aset_id', json_decode($kjpp->jenis_aset_id, true))) ? 'selected' : '' }}>
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
@else
|
||||
<option value="{{ $row->code }}"
|
||||
{{ in_array($row->code, old('jenis_aset_id', [])) ? 'selected' : '' }}>
|
||||
{{ $row->name }}
|
||||
</option>
|
||||
@foreach (json_decode($kjpp->jenis_aset_id, true) as $aset_code)
|
||||
@php
|
||||
$jenis_aset = $jenis_jaminan->firstWhere('code', $aset_code);
|
||||
@endphp
|
||||
@if ($jenis_aset)
|
||||
<span
|
||||
class="flex flex-row space-x-4 text-white font-medium text-sm badge badge-dark dark-mode:badge dark-mode:text-gray-600">
|
||||
{{ $jenis_aset->name }}
|
||||
</span>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<span class="flex flex-row space-x-4 text-white font-medium text-sm dark-mode:text-gray-600">
|
||||
No asset type selected.
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
|
||||
Reference in New Issue
Block a user