Mengubah tampilan menu master Ijin Usaha

This commit is contained in:
rahmatrafli1 2024-09-18 15:53:15 +07:00
parent 2041b38980
commit 43e6f8d71e
13 changed files with 300 additions and 135 deletions

View File

@ -3,9 +3,11 @@
namespace Modules\Lpj\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Lpj\Models\Branch;
use Modules\Lpj\Models\IjinUsaha;
use Modules\Lpj\Models\JenisAset;
use Modules\Lpj\Models\KJPP;
class KJPPController extends Controller
@ -24,13 +26,17 @@ class KJPPController extends Controller
*/
public function create()
{
return view('lpj::create');
$branch = Branch::all();
$ijin_usaha = IjinUsaha::all();
$jenis_aset = JenisAset::all();
return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset'));
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
public function store(Request $request)
{
//
}
@ -54,7 +60,7 @@ class KJPPController extends Controller
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
public function update(Request $request, $id)
{
//
}

View File

@ -12,9 +12,15 @@ class IjinUsahaRequest extends FormRequest
public function rules(): array
{
$rules = [
'nama_ijin_usaha' => 'required|string|not_regex:/^\d+$/|max:255'
'name' => 'required|string|not_regex:/^\d+$/|max:255'
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|max:50|unique:ijin_usaha,code,' . $this->id;
} else {
$rules['code'] = 'required|max:50|unique:ijin_usaha,code';
}
return $rules;
}
@ -29,9 +35,12 @@ class IjinUsahaRequest extends FormRequest
public function messages(): array
{
return [
'nama_ijin_usaha.required' => 'Nama Ijin Usaha harus diisi!',
'nama_ijin_usaha.not_regex' => 'Nama Ijin Usaha harus berupa huruf!',
'nama_ijin_usaha.max' => 'Nama Ijin Usaha maksimal 255 huruf!'
'code.required' => 'Kode Ijin Usaha harus diisi!',
'code.max' => 'Kode Ijin Usaha maksimal 255 huruf!',
'code.unique' => 'Kode Ijin Usaha tidak boleh sama!',
'name.required' => 'Nama Ijin Usaha harus diisi!',
'name.not_regex' => 'Nama Ijin Usaha harus berupa huruf!',
'name.max' => 'Nama Ijin Usaha maksimal 255 huruf!'
];
}
}

View File

@ -1,16 +1,16 @@
<?php
namespace Modules\Lpj\Models;
namespace Modules\Lpj\Models;
use Modules\Lpj\Database\Factories\BranchFactory;
use Modules\Lpj\Database\Factories\BranchFactory;
class Branch extends Base
class Branch extends Base
{
protected $table = 'branches';
protected $fillable = ['code', 'name', 'status', 'authorized_at', 'authorized_status', 'authorized_by'];
public function debitures()
{
protected $table = 'branches';
protected $fillable = ['code', 'name', 'status', 'authorized_at', 'authorized_status', 'authorized_by'];
public function debitures()
{
return $this->hasMany(Debiture::class, 'branch_id', 'id');
}
return $this->hasMany(Debiture::class, 'branch_id', 'id');
}
}

View File

@ -4,7 +4,6 @@ namespace Modules\Lpj\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Lpj\Database\Factories\IjinUsahaFactory;
class IjinUsaha extends Model
{
@ -15,10 +14,5 @@ class IjinUsaha extends Model
/**
* The attributes that are mass assignable.
*/
protected $fillable = ['nama_ijin_usaha'];
// protected static function newFactory(): IjinUsahaFactory
// {
// //return IjinUsahaFactory::new();
// }
protected $fillable = ['code', 'name'];
}

View File

@ -1,11 +1,11 @@
<?php
namespace Modules\Lpj\Models;
namespace Modules\Lpj\Models;
use Modules\Lpj\Database\Factories\JenisAsetFactory;
use Modules\Lpj\Database\Factories\JenisAsetFactory;
class JenisAset extends Base
{
protected $table = 'jenis_aset';
protected $fillable = ['code', 'name'];
}
class JenisAset extends Base
{
protected $table = 'jenis_aset';
protected $fillable = ['code', 'name'];
}

View File

@ -17,16 +17,4 @@ class KJPP extends Model
* The attributes that are mass assignable.
*/
protected $guarded = ['id'];
// If you're using JSON columns, you may want to cast them properly
protected $casts = [
'jenis_usaha' => 'array',
'pengalaman' => 'array',
'kerjasama_sejak' => 'date', // For date fields
];
// protected static function newFactory(): KJPPFactory
// {
// //return KJPPFactory::new();
// }
}

View File

@ -13,8 +13,16 @@ return new class extends Migration
{
Schema::create('ijin_usaha', function (Blueprint $table) {
$table->id();
$table->string('nama_ijin_usaha');
$table->string('code')->unique()->index();
$table->string('name');
$table->boolean('status')->default(true)->nullable();
$table->char('authorized_status', 1)->nullable();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->timestamps();
$table->softDeletes();
$table->unsignedBigInteger('deleted_by')->nullable();
});
}

View File

@ -13,28 +13,35 @@ return new class extends Migration
{
Schema::create('kjpp', function (Blueprint $table) {
$table->id();
$table->string('nomor');
$table->string('nama_kjpp');
$table->string('kantor_pusat');
$table->string('code');
$table->string('name');
$table->string('jenis_kantor');
$table->string('nomor_ijin_usaha');
$table->string('kota');
$table->date('kerjasama_sejak');
$table->text('alamat_kantor');
$table->string('no_tlp_kantor', 15);
$table->string('alamat_email');
$table->string('nama_pimpinan_kantor');
$table->string('no_hp_pimpinan', 15);
$table->string('province_code');
$table->string('city_code');
$table->string('district_code');
$table->string('village_code');
$table->string('address');
$table->string('postal_code');
$table->string('nomor_telepon_kantor');
$table->string('email_kantor');
$table->string('nomor_hp_pimpinan');
$table->string('nama_pic_reviewer');
$table->string('no_pic_reviewer', 15);
$table->string('nomor_hp_pic_reviewer');
$table->string('nama_pic_admin');
$table->string('no_pic_admin', 15);
$table->string('nomor_hp_pic_admin');
$table->string('nama_pic_marketing');
$table->string('no_pic_marketing', 15);
$table->json('ijin_usaha');
$table->json('pengalaman');
$table->string('company_name');
$table->string('ijin_ijin');
$table->string('npwp');
$table->string('nomor_hp_pic_marketing');
$table->foreignId('ijin_usaha_id')->constrained()->onDelete('cascade');
$table->foreignId('jenis_aset_id')->constrained()->onDelete('cascade');
$table->string('attachment');
$table->boolean('status')->default(true)->nullable();
$table->char('authorized_status', 1)->nullable();
$table->timestamp('authorized_at')->nullable();
$table->unsignedBigInteger('authorized_by')->nullable();
$table->softDeletes();
$table->unsignedBigInteger('deleted_by')->nullable();
$table->timestamps();
});
}

View File

@ -25,15 +25,42 @@
</div>
</div>
<div class="card-body grid gap-5">
@if (isset($ijin_usaha->id))
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Kode Ijin Usaha
</label>
<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="{{ $ijin_usaha->code ?? old('code') }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@else
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Kode Ijin Usaha
</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="{{ $ijin_usaha->code ?? old('code') }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endif
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Nama Ijin Usaha
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nama_ijin_usaha') border-danger bg-danger-light @enderror"
type="text" name="nama_ijin_usaha"
value="{{ $ijin_usaha->nama_ijin_usaha ?? old('nama_ijin_usaha') }}">
@error('nama_ijin_usaha')
<input class="input @error('name') border-danger bg-danger-light @enderror" type="text"
name="name" value="{{ $ijin_usaha->name ?? old('name') }}">
@error('name')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>

View File

@ -35,7 +35,11 @@
<th class="w-14">
<input class="checkbox checkbox-sm" data-datatable-check="true" type="checkbox" />
</th>
<th class="min-w-[250px]" data-datatable-column="nama_ijin_usaha">
<th class="min-w-[250px]" data-datatable-column="code">
<span class="sort"> <span class="sort-label"> Kode Ijin Usaha </span>
<span class="sort-icon"> </span> </span>
</th>
<th class="min-w-[250px]" data-datatable-column="name">
<span class="sort"> <span class="sort-label"> Nama Ijin Usaha </span>
<span class="sort-icon"> </span> </span>
</th>
@ -114,7 +118,10 @@
return checkbox.outerHTML.trim();
},
},
nama_ijin_usaha: {
code: {
title: 'Kode Ijin Usaha',
},
name: {
title: 'Nama Ijin Usaha',
},
actions: {

View File

@ -6,75 +6,94 @@
@section('content')
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
@if(isset($jenisJaminan->id))
@if (isset($jenisJaminan->id))
<form action="{{ route('basicdata.jenis-jaminan.update', $jenisJaminan->id) }}" method="POST">
<input type="hidden" name="id" value="{{ $jenisJaminan->id }}">
@method('PUT')
@else
<form method="POST" action="{{ route('basicdata.jenis-jaminan.store') }}">
@endif
@csrf
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
{{ isset($jenisJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Jaminan
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('basicdata.jenis-jaminan.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">
@if(isset($jenisJaminan->id))
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Code
</label>
<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="{{ $jenisJaminan->code ?? '' }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endif
<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="{{ $jenisJaminan->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 Legalitas Jaminan
</label>
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
@foreach($jenisLegalitasJaminan as $row)
<label class="switch">
@if(isset($jenisJaminan->jenis_legalitas_jaminan_id))
<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[]"/>
@else
<input type="checkbox" value="{{ $row->code }}" name="jenis_legalitas_jaminan_id[]"/>
@endif
<span class="switch-label">
{{ $row->name }}
</span>
</label>
@endforeach
</div>
</div>
<div class="flex justify-end">
<button type="submit" class="btn btn-primary">
Save
</button>
</div>
</div>
@else
<form method="POST" action="{{ route('basicdata.jenis-jaminan.store') }}">
@endif
@csrf
<div class="card pb-2.5">
<div class="card-header" id="basic_settings">
<h3 class="card-title">
{{ isset($jenisJaminan->id) ? 'Edit' : 'Tambah' }} Jenis Jaminan
</h3>
<div class="flex items-center gap-2">
<a href="{{ route('basicdata.jenis-jaminan.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">
@if (isset($jenisJaminan->id))
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Code
</label>
<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="{{ $jenisJaminan->code ?? '' }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</form>
</div>
@else
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Code
</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="{{ $ijin_usaha->code ?? old('code') }}">
@error('code')
<em class="alert text-danger text-sm">{{ $message }}</em>
@enderror
</div>
</div>
@endif
<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="{{ $jenisJaminan->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 Legalitas Jaminan
</label>
<div class="grid grid-cols-3 lg:grid-cols-4 w-full gap-2.5">
@foreach ($jenisLegalitasJaminan as $row)
<label class="switch">
@if (isset($jenisJaminan->jenis_legalitas_jaminan_id))
<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[]" />
@else
<input type="checkbox" value="{{ $row->code }}"
name="jenis_legalitas_jaminan_id[]" />
@endif
<span class="switch-label">
{{ $row->name }}
</span>
</label>
@endforeach
</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,90 @@
@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($kjpp->id))
<form action="{{ route('kjpp.update', $kjpp->id) }}" method="POST">
<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>
</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('nomor') border-danger bg-danger-light @enderror" type="text"
name="nomor" value="{{ $kjpp->nomor ?? old('nomor') }}">
@error('nomor')
<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('nama_kjpp') border-danger bg-danger-light @enderror" type="text"
name="nama_kjpp" value="{{ $kjpp->nama_kjpp ?? old('nama_kjpp') }}">
@error('nama_kjpp')
<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">Kantor Cabang</label>
<div class="flex flex-wrap items-baseline w-full">
<select
class="input tomselect w-full @error('cabang_id') border-danger bg-danger-light @enderror select2"
name="cabang_id">
<option value="">Select Kantor Cabang</option>
@if (isset($branch))
@foreach ($branch as $branches)
<option value="{{ $branches->id }}">{{ $branches->name }}</option>
@endforeach
@endif
</select>
</div>
</div>
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
<label class="form-label max-w-56">
Nomor Ijin Usaha
</label>
<div class="flex flex-wrap items-baseline w-full">
<input class="input @error('nomor_ijin_usaha') border-danger bg-danger-light @enderror"
type="text" name="nomor_ijin_usaha"
value="{{ $kjpp->nomor_ijin_usaha ?? old('nomor_ijin_usaha') }}">
@error('nomor_ijin_usaha')
<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

@ -193,6 +193,16 @@ Breadcrumbs::for('basicdata.kjpp', function (BreadcrumbTrail $trail) {
$trail->push('KJPP', route('basicdata.kjpp.index'));
});
Breadcrumbs::for('basicdata.kjpp.create', function (BreadcrumbTrail $trail) {
$trail->parent('basicdata.kjpp');
$trail->push('Tambah KJPP', route('basicdata.kjpp.create'));
});
Breadcrumbs::for('basicdata.kjpp.edit', function (BreadcrumbTrail $trail) {
$trail->parent('basicdata.kjpp');
$trail->push('Edit KJPP');
});
Breadcrumbs::for('basicdata.ijin_usaha', function (BreadcrumbTrail $trail) {
$trail->parent('basicdata');
$trail->push('Ijin Usaha', route('basicdata.ijin_usaha.index'));