Membuat Fitur Menu KJPP part 1

This commit is contained in:
2024-09-24 11:51:53 +07:00
parent 8e73269f76
commit 8b4dd34b51
6 changed files with 575 additions and 85 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\IjinUsaha;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
{
public function collection()
{
return IjinUsaha::all();
}
public function map($row): array
{
return [
$row->id,
$row->code,
$row->name,
$row->jenis_kantor,
$row->created_at
];
}
public function headings(): array
{
return [
'ID',
'Code',
'Name',
'Jenis Kantor / Cabang',
'Created At'
];
}
public function columnFormats(): array
{
return [
'A' => NumberFormat::FORMAT_NUMBER,
'B' => NumberFormat::FORMAT_NUMBER,
'E' => NumberFormat::FORMAT_DATE_DATETIME
];
}
}

View File

@@ -2,15 +2,21 @@
namespace Modules\Lpj\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Lpj\Http\Requests\KJPPRequest;
use Modules\Lpj\Models\Branch;
use Modules\Lpj\Models\IjinUsaha;
use Modules\Lpj\Models\JenisJaminan;
use Modules\Lpj\Models\KJPP;
use Illuminate\Http\Response;
use Modules\Lpj\Models\Branch;
use Modules\Location\Models\City;
use Modules\Lpj\Models\IjinUsaha;
use Modules\Lpj\Exports\KJPPExport;
use App\Http\Controllers\Controller;
use Maatwebsite\Excel\Facades\Excel;
use Modules\Location\Models\District;
use Modules\Lpj\Models\JenisJaminan;
use Modules\Location\Models\Province;
use Modules\Location\Models\Village;
use Modules\Lpj\Http\Requests\KJPPRequest;
use Throwable;
class KJPPController extends Controller
{
@@ -31,8 +37,9 @@ class KJPPController extends Controller
$branch = Branch::all();
$ijin_usaha = IjinUsaha::all();
$jenis_aset = JenisJaminan::all();
$provinces = Province::all();
return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset'));
return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset', 'provinces'));
}
/**
@@ -44,14 +51,19 @@ class KJPPController extends Controller
if ($validate) {
try {
$file = $request->file('attachment');
$filename = time() . '.' . $file->getClientOriginalExtension();
$file->storeAs('uploads_pdf', $filename, 'public');
KJPP::create($validate);
return redirect()
->route('basicdata.kjpp.index')
->with('success', 'Ijin Usaha created successfully');
} catch (Exception $e) {
} catch (Throwable $e) {
return redirect()
->route('basicdata.kjpp.create')
->with('error', 'Failed to create ijin Usaha');
->with('error', 'Failed to create ijin Usaha: ' . $e);
}
}
}
@@ -75,7 +87,7 @@ class KJPPController extends Controller
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
public function update(KJPP $request, $id)
{
//
}
@@ -152,6 +164,6 @@ class KJPPController extends Controller
public function export()
{
// return Excel::download(new CurrencyExport, 'currency.xlsx');
return Excel::download(new KJPPExport, 'currency.xlsx');
}
}

View File

@@ -3,6 +3,7 @@
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use daengdeni\LaravelIdGenerator\IdGenerator;
class KJPPRequest extends FormRequest
{
@@ -13,7 +14,27 @@ class KJPPRequest extends FormRequest
{
$rules = [
'name' => 'required|string|not_regex:/^\d+$/|max:255',
'jenis_kantor' => 'required'
'jenis_kantor' => 'required',
'nomor_ijin_usaha' => 'required',
'province_code' => 'required',
'city_code' => 'required',
'district_code' => 'required',
'village_code' => 'required',
'address' => 'required',
'postal_code' => 'required|numeric',
'nomor_telepon_kantor' => 'required|numeric|digits_between:8,15',
'email_kantor' => 'required|email',
'nama_pimpinan' => 'required|string|not_regex:/^\d+$/|max:255',
'nomor_hp_pimpinan' => 'required|numeric|digits_between:10,15',
'nama_pic_reviewer' => 'required|string|not_regex:/^\d+$/|max:255',
'nomor_hp_pic_reviewer' => 'required|numeric|digits_between:10,15',
'nama_pic_admin' => 'required|string|not_regex:/^\d+$/|max:255',
'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|exists:ijin_usaha,id',
'jenis_aset_id' => 'nullable|exists:jenis_jaminan,id',
'attachment' => 'required|mimes:pdf|max:1024'
];
if ($this->method() == 'PUT') {
@@ -33,16 +54,70 @@ class KJPPRequest extends FormRequest
return true;
}
public function prepareForValidation(): void
{
if ($this->method() == 'POST') {
$this->merge([
'code' => IdGenerator::generate(
['table' => 'ijin_usaha', 'length' => 5, 'prefix' => 'IU', 'field' => 'code'],
['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'],
)
]);
}
$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 [
'code.required' => 'Kode KJPP harus diisi!',
'code.required' => 'Kode KJPP Wajib diisi!',
'code.max' => 'Kode KJPP maksimal 255 huruf!',
'code.unique' => 'Kode KJPP tidak boleh sama!',
'name.required' => 'Nama KJPP harus diisi!',
'name.required' => 'Nama KJPP Wajib diisi!',
'name.not_regex' => 'Nama KJPP harus berupa huruf!',
'name.max' => 'Nama KJPP maksimal 255 huruf!',
'jenis_kantor.required' => 'Jenis Kantor harus diisi!'
'jenis_kantor.required' => 'Jenis Kantor Wajib diisi!',
'nomor_ijin_usaha.required' => 'Nomor Ijin Usaha Wajib diisi!',
'nomor_ijin_usaha.max' => 'Nomor Ijin Usaha maksimal 255 huruf!',
'province_code.required' => 'Provinsi Wajib diisi!',
'city_code.required' => 'Kota / Kabupaten Wajib diisi!',
'district_code.required' => 'Kecamatan Wajib diisi!',
'village_code.required' => 'Kelurahan Wajib diisi!',
'postal_code.required' => 'Kode Pos Wajib diisi!',
'postal_code.numeric' => 'Kode Pos harus berupa angka!',
'address.required' => 'Alamat Kantor Wajib diisi!',
'nomor_telepon_kantor.required' => 'Nomor Telepon Kantor Wajib diisi!',
'nomor_telepon_kantor.numeric' => 'Nomor Telepon Kantor harus berupa angka!',
'nomor_telepon_kantor.digits_between' => 'Nomor Telepon Kantor minimum 8 digit dan maksimum 15 digit!',
'email_kantor.required' => 'Email Kantor Wajib diisi!',
'email_kantor.email' => 'Email Kantor tidak valid!',
'nama_pimpinan.required' => 'Nama Pimpinan Wajib diisi!',
'nama_pimpinan.not_regex' => 'Nama Pimpinan harus berupa huruf!',
'nomor_hp_pimpinan.required' => 'Nomor HP Pimpinan Wajib diisi!',
'nomor_hp_pimpinan.numeric' => 'Nomor HP Pimpinan harus berupa angka!',
'nomor_hp_pimpinan.digits_between' => 'Nomor HP Pimpinan minimum 10 digit dan maksimum 15 digit!',
'nama_pic_reviewer.required' => 'Nama PIC Reviewer Wajib diisi!',
'nama_pic_reviewer.not_regex' => 'Nama PIC Reviewer harus berupa huruf!',
'nomor_hp_pic_reviewer.required' => 'Nomor HP PIC Reviewer Wajib diisi!',
'nomor_hp_pic_reviewer.numeric' => 'Nomor HP PIC Reviewer harus berupa angka!',
'nomor_hp_pic_reviewer.digits_between' => 'Nomor HP PIC Reviewer minimum 10 digit dan maksimum 15 digit!',
'nama_pic_admin.required' => 'Nama PIC Admin Wajib diisi!',
'nama_pic_admin.not_regex' => 'Nama PIC Admin harus berupa huruf!',
'nomor_hp_pic_admin.required' => 'Nomor HP PIC Admin Wajib diisi!',
'nomor_hp_pic_admin.numeric' => 'Nomor HP PIC Admin harus berupa angka!',
'nomor_hp_pic_admin.digits_between' => 'Nomor HP PIC Admin minimum 10 digit dan maksimum 15 digit!',
'nama_pic_marketing.required' => 'Nama PIC Marketing Wajib diisi!',
'nama_pic_marketing.not_regex' => 'Nama PIC Marketing harus berupa huruf!',
'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!',
'attachment.required' => 'Attachment Wajib diisi!',
'attachment.mimes' => 'Attachment harus berformat pdf!',
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
];
}
}

View File

@@ -16,7 +16,31 @@ class KJPP extends Model
/**
* The attributes that are mass assignable.
*/
protected $guarded = ['id'];
protected $fillable = [
'code',
'name',
'jenis_kantor',
'nomor_ijin_usaha',
'province_code',
'city_code',
'district_code',
'village_code',
'address',
'postal_code',
'nomor_telepon_kantor',
'email_kantor',
'nama_pimpinan',
'nomor_hp_pimpinan',
'nama_pic_reviewer',
'nomor_hp_pic_reviewer',
'nama_pic_admin',
'nomor_hp_pic_admin',
'nama_pic_marketing',
'nomor_hp_pic_marketing',
'ijin_usaha_id',
'jenis_aset_id',
'attachment'
];
// relasi ke branch
public function branch()

View File

@@ -25,6 +25,7 @@ return new class extends Migration
$table->string('postal_code');
$table->string('nomor_telepon_kantor');
$table->string('email_kantor');
$table->string('nama_pimpinan');
$table->string('nomor_hp_pimpinan');
$table->string('nama_pic_reviewer');
$table->string('nomor_hp_pic_reviewer');
@@ -32,8 +33,8 @@ return new class extends Migration
$table->string('nomor_hp_pic_admin');
$table->string('nama_pic_marketing');
$table->string('nomor_hp_pic_marketing');
$table->foreignId('ijin_usaha_id')->constrained()->onDelete('cascade');
$table->foreignId('jenis_aset_id')->constrained()->onDelete('cascade');
$table->string('ijin_usaha_id')->nullable();
$table->string('jenis_aset_id')->nullable();
$table->string('attachment');
$table->boolean('status')->default(true)->nullable();
$table->char('authorized_status', 1)->nullable();

View File

@@ -6,76 +6,405 @@
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@if (isset($kjpp->id))
<form action="{{ route('kjpp.update', $kjpp->id) }}" method="POST">
<form action="{{ isset($kjpp->id) ? route('basicdata.kjpp.update', $kjpp->id) : route('basicdata.kjpp.store') }}"
method="POST" enctype="multipart/form-data">
@if (isset($kjpp->id))
<input type="hidden" name="id" value="{{ $kjpp->id }}">
@method('PUT')
@else
<form method="POST" action="{{ route('basicdata.kjpp.store') }}">
@endif
@csrf
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
{{ isset($kjpp->id) ? 'Edit' : 'Tambah' }} KJPP
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('basicdata.kjpp.index') }}" class="btn btn-xs btn-info"><i
class="ki-filled ki-exit-left"></i>
Back</a>
@endif
@csrf
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
{{ isset($kjpp->id) ? 'Edit' : 'Tambah' }} KJPP
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('basicdata.kjpp.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">
Nomor KJPP
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('code') border-danger @enderror" type="text" name="code"
value="{{ $kjpp->code ?? old('code') }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nama KJPP
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('name') border-danger @enderror" type="text" name="name"
value="{{ $kjpp->name ?? old('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">Jenis Kantor / Cabang</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect @error('jenis_kantor') border-danger @enderror"
name="jenis_kantor">
<option value="">Pilih Jenis Kantor / Cabang</option>
@if (isset($branch))
@if (isset($kjpp))
@foreach ($branch as $branches)
<option value="{{ $branches->name }}"
{{ old('jenis_kantor', $branches->name) == $branches->name ? 'selected' : '' }}>
{{ $branches->name }}
</option>
@endforeach
@else
@foreach ($branch as $branches)
<option value="{{ $branches->name }}"
{{ old('jenis_kantor') == $branches->name ? 'selected' : '' }}>
{{ $branches->name }}
</option>
@endforeach
@endif
@endif
</select>
@error('jenis_kantor')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</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"
name="nomor_ijin_usaha">
<option value="">Pilih Nomor Ijin Usaha</option>
@if (isset($ijin_usaha))
@if (isset($kjpp))
@foreach ($ijin_usaha as $branches)
<option value="{{ $branches->code }}"
{{ old('nomor_ijin_usaha', $branches->code) == $branches->code ? 'selected' : '' }}>
{{ $branches->code }}
</option>
@endforeach
@else
@foreach ($ijin_usaha as $branches)
<option value="{{ $branches->code }}"
{{ old('nomor_ijin_usaha') == $branches->code ? 'selected' : '' }}>
{{ $branches->code }}
</option>
@endforeach
@endif
@endif
</select>
@error('nomor_ijin_usaha')
<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">
Alamat Kantor
</label>
<div class="flex flex-wrap items-baseline w-full">
<div class="flex flex-col lg:flex-row gap-2 w-full">
<div class="flex flex-wrap items-baseline w-full">
<select id="province_code" name="province_code"
class="select w-full @error('province_code') border-danger @enderror">
<option value="">Pilih Provinsi</option>
@foreach ($provinces as $province)
@if (isset($kjpp))
<option value="{{ $province->code }}"
{{ old('province_code', $kjpp->province_code) == $province->code ? 'selected' : '' }}>
{{ $province->name }}
</option>
@else
<option value="{{ $province->code }}"
{{ old('province_code') == $province->code ? 'selected' : '' }}>
{{ $province->name }}
</option>
@endif
@endforeach
</select>
@error('province_code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<div class="flex flex-wrap items-baseline w-full">
<select id="city_code" name="city_code"
class="select w-full @error('city_code') border-danger @enderror">
<option value="">Pilih Kota / Kabupaten</option>
@if (isset($cities))
@foreach ($cities as $city)
@if (isset($kjpp))
<option value="{{ $city->code }}"
{{ old('city_code', $kjpp->city_code) == $city->code ? 'selected' : '' }}>
{{ $city->name }}
</option>
@else
<option value="{{ $city->code }}"
{{ old('city_code') == $city->code ? 'selected' : '' }}>
{{ $city->name }}
</option>
@endif
@endforeach
@endif
</select>
@error('city_code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex flex-col lg:flex-row gap-2 w-full mt-2 lg:mt-5">
<div class="flex flex-wrap items-baseline w-full">
<select id="district_code" name="district_code"
class="select w-full @error('district_code') border-danger @enderror">
<option value="">Pilih Kecamatan</option>
@if (isset($districts))
@foreach ($districts as $district)
@if (isset($kjpp))
<option value="{{ $district->code }}"
{{ old('district_code', $kjpp->district_code) == $district->code ? 'selected' : '' }}>
{{ $district->name }}
</option>
@else
<option value="{{ $district->code }}"
{{ old('district_code') == $district->code ? 'selected' : '' }}>
{{ $district->name }}
</option>
@endif
@endforeach
@endif
</select>
@error('district_code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<div class="flex flex-wrap items-baseline w-full">
<select id="village_code" name="village_code"
class="select w-full @error('village_code') border-danger @enderror">
<option value="">Pilih Kelurahan</option>
@if (isset($villages))
@foreach ($villages as $village)
@if (isset($kjpp))
<option value="{{ $village->code }}"
{{ old('village_code', $kjpp->village_code) == $village->code ? 'selected' : '' }}>
{{ $village->name }}
</option>
@else
<option value="{{ $village->code }}"
{{ old('village_code') == $village->code ? 'selected' : '' }}>
{{ $village->name }}
</option>
@endif
@endforeach
@endif
</select>
@error('village_code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('postal_code') border-danger @enderror" type="number"
id="postal_code" name="postal_code"
value="{{ $kjpp->postal_code ?? old('postal_code') }}" placeholder="Kode Pos">
@error('postal_code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
<div class="flex flex-col w-full mt-2 lg:mt-5">
<textarea class="textarea @error('address') border-danger @enderror" rows="3" type="number" id="address"
name="address">{{ $kjpp->address ?? old('address') }}</textarea>
@error('address')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Nomor Telepon Kantor
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_telepon_kantor') border-danger @enderror" type="text"
name="nomor_telepon_kantor"
value="{{ $kjpp->nomor_telepon_kantor ?? old('nomor_telepon_kantor') }}">
@error('nomor_telepon_kantor')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Email Kantor
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('email_kantor') border-danger @enderror" type="text"
name="email_kantor" value="{{ $kjpp->email_kantor ?? old('email_kantor') }}">
@error('email_kantor')
<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">
Nama Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pimpinan') border-danger @enderror" type="text"
name="nama_pimpinan" value="{{ $kjpp->nama_pimpinan ?? old('nama_pimpinan') }}">
@error('nama_pimpinan')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP Pimpinan
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pimpinan') border-danger @enderror" type="text"
name="nomor_hp_pimpinan"
value="{{ $kjpp->nomor_hp_pimpinan ?? old('nomor_hp_pimpinan') }}">
@error('nomor_hp_pimpinan')
<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">
Nama PIC Reviewer
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pic_reviewer') border-danger @enderror" type="text"
name="nama_pic_reviewer"
value="{{ $kjpp->nama_pic_reviewer ?? old('nama_pic_reviewer') }}">
@error('nama_pic_reviewer')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP PIC Reviewer
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pic_reviewer') border-danger @enderror" type="text"
name="nomor_hp_pic_reviewer"
value="{{ $kjpp->nomor_hp_pic_reviewer ?? old('nomor_hp_pic_reviewer') }}">
@error('nomor_hp_pic_reviewer')
<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">
Nama PIC Admin
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pic_admin') border-danger @enderror" type="text"
name="nama_pic_admin" value="{{ $kjpp->nama_pic_admin ?? old('nama_pic_admin') }}">
@error('nama_pic_admin')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP PIC Admin
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pic_admin') border-danger @enderror" type="text"
name="nomor_hp_pic_admin"
value="{{ $kjpp->nomor_hp_pic_admin ?? old('nomor_hp_pic_admin') }}">
@error('nomor_hp_pic_admin')
<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">
Nama PIC Marketing
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_pic_marketing') border-danger @enderror" type="text"
name="nama_pic_marketing"
value="{{ $kjpp->nama_pic_marketing ?? old('nama_pic_marketing') }}">
@error('nama_pic_marketing')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
<label class="form-label max-w-56">
Nomor HP PIC Marketing
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_hp_pic_marketing') border-danger @enderror"
type="text" name="nomor_hp_pic_marketing"
value="{{ $kjpp->nomor_hp_pic_marketing ?? old('nomor_hp_pic_marketing') }}">
@error('nomor_hp_pic_marketing')
<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">
Ijin Usaha
</label>
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
@foreach ($ijin_usaha as $row)
<label class="switch">
@if (isset($kjpp->ijin_usaha_id))
<input type="checkbox"
@if (in_array($row->code, old('ijin_usaha_id', json_decode($kjpp->ijin_usaha_id, true)))) {{ 'checked' }} @endif
value="{{ $row->code }}" name="ijin_usaha_id[]" />
@else
<input type="checkbox"
@if (in_array($row->code, old('ijin_usaha_id', []))) {{ 'checked' }} @endif
value="{{ $row->code }}" name="ijin_usaha_id[]" />
@endif
<span class="switch-label">
{{ $row->name }}
</span>
</label>
@endforeach
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Jenis Jaminan
</label>
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
@foreach ($jenis_aset as $row)
<label class="switch">
@if (isset($kjpp->jenis_aset_id))
<input type="checkbox"
@if (in_array($row->code, old('jenis_aset_id', json_decode($kjpp->jenis_aset_id, true)))) {{ 'checked' }} @endif
value="{{ $row->code }}" name="jenis_aset_id[]" />
@else
<input type="checkbox"
@if (in_array($row->code, old('jenis_aset_id', []))) {{ 'checked' }} @endif
value="{{ $row->code }}" name="jenis_aset_id[]" />
@endif
<span class="switch-label">
{{ $row->name }}
</span>
</label>
@endforeach
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Attachment
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="file-input @error('attachment') border-danger @enderror" name="attachment"
type="file" />
@error('attachment')
<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>
<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">
Nomor KJPP
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('code') border-danger bg-danger-light @enderror" type="text"
name="code" value="{{ $kjpp->code ?? old('code') }}">
@error('code')
<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">
Nama KJPP
</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="{{ $kjpp->name ?? old('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">Jenis Kantor / Cabang</label>
<div class="flex flex-wrap items-baseline w-full">
<select class="input tomselect @error('jenis_kantor') border-danger bg-danger-light @enderror"
name="jenis_kantor">
<option value="">Select Jenis Kantor / Cabang</option>
@if (isset($branch))
@foreach ($branch as $branches)
<option value="{{ $branches->id }}">
{{ $branches->name }}
</option>
@endforeach
@endif
</select>
@error('jenis_kantor')
<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