Update Edit Permohonan
This commit is contained in:
@@ -6,10 +6,15 @@
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
use Modules\Location\Models\City;
|
||||||
|
use Modules\Location\Models\District;
|
||||||
|
use Modules\Location\Models\Province;
|
||||||
|
use Modules\Location\Models\Village;
|
||||||
use Modules\Lpj\Exports\PermohonanExport;
|
use Modules\Lpj\Exports\PermohonanExport;
|
||||||
use Modules\Lpj\Http\Requests\PermohonanRequest;
|
use Modules\Lpj\Http\Requests\PermohonanRequest;
|
||||||
use Modules\Lpj\Models\Branch;
|
use Modules\Lpj\Models\Branch;
|
||||||
use Modules\Lpj\Models\Debiture;
|
use Modules\Lpj\Models\Debiture;
|
||||||
|
use Modules\Lpj\Models\DokumenJaminan;
|
||||||
use Modules\Lpj\Models\Permohonan;
|
use Modules\Lpj\Models\Permohonan;
|
||||||
use Modules\Lpj\Models\StatusPermohonan;
|
use Modules\Lpj\Models\StatusPermohonan;
|
||||||
use Modules\Lpj\Models\TujuanPenilaian;
|
use Modules\Lpj\Models\TujuanPenilaian;
|
||||||
@@ -47,8 +52,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(){
|
public function create()
|
||||||
|
{
|
||||||
return view('lpj::permohonan.create');
|
return view('lpj::permohonan.create');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,10 +74,26 @@
|
|||||||
$debitur = Debiture::find($permohonan->debiture_id);
|
$debitur = Debiture::find($permohonan->debiture_id);
|
||||||
$tujuanPenilaian = TujuanPenilaian::all();
|
$tujuanPenilaian = TujuanPenilaian::all();
|
||||||
$status = StatusPermohonan::all();
|
$status = StatusPermohonan::all();
|
||||||
|
$provinces = Province::all();
|
||||||
|
$cities = City::where('province_code', $debitur->province_code)->get();
|
||||||
|
$districts = District::where('city_code', $debitur->city_code)->get();
|
||||||
|
$villages = Village::where('district_code', $debitur->district_code)->get();
|
||||||
|
$documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get();
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'lpj::permohonan.form',
|
'lpj::permohonan.form',
|
||||||
compact('permohonan', 'branches', 'debitur', 'tujuanPenilaian', 'status'),
|
compact(
|
||||||
|
'permohonan',
|
||||||
|
'branches',
|
||||||
|
'debitur',
|
||||||
|
'tujuanPenilaian',
|
||||||
|
'status',
|
||||||
|
'provinces',
|
||||||
|
'cities',
|
||||||
|
'districts',
|
||||||
|
'villages',
|
||||||
|
'documents'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +252,8 @@
|
|||||||
$filteredRecords = $query->count();
|
$filteredRecords = $query->count();
|
||||||
|
|
||||||
// Get the data for the current page
|
// Get the data for the current page
|
||||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->where('status','=','order')->get();
|
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->where('status', '=', 'order')->get(
|
||||||
|
);
|
||||||
|
|
||||||
// Calculate the page count
|
// Calculate the page count
|
||||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||||
@@ -254,16 +276,17 @@
|
|||||||
public function showAuthorization($id)
|
public function showAuthorization($id)
|
||||||
{
|
{
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
return view('lpj::permohonan.authorization.show',compact('permohonan'));
|
return view('lpj::permohonan.authorization.show', compact('permohonan'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAuthorization(Request $request, $id){
|
public function updateAuthorization(Request $request, $id)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$permohonan = Permohonan::find($id);
|
$permohonan = Permohonan::find($id);
|
||||||
$permohonan->status = $request->status;
|
$permohonan->status = $request->status;
|
||||||
$permohonan->keterangan = $request->keterangan;
|
$permohonan->keterangan = $request->keterangan;
|
||||||
$permohonan->save();
|
$permohonan->save();
|
||||||
}catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan');
|
return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,21 +6,25 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
|
||||||
<div class="card pb-2.5">
|
<div class="card pb-2.5">
|
||||||
<div class="card-header" id="basic_settings">
|
<div class="card-header" id="basic_settings">
|
||||||
<div class="card-title flex flex-row gap-1.5">
|
<div class="card-title flex flex-row gap-1.5">
|
||||||
|
@if(request()->get('permohonan_id'))
|
||||||
|
<a href="{{ route('permohonan.edit',['permohonan'=>request()->get('permohonan_id')]) }}" class="btn btn-xs {{ request()->routeIs('permohonan.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Permohonan</a>
|
||||||
|
@endif
|
||||||
<a href="{{ route('debitur.edit',array_merge(request()->query(),['debitur'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Debitur</a>
|
<a href="{{ route('debitur.edit',array_merge(request()->query(),['debitur'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Debitur</a>
|
||||||
<a href="{{ route('debitur.jaminan.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.jaminan.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Dokumen Jaminan</a>
|
<a href="{{ route('debitur.jaminan.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.jaminan.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Dokumen Jaminan</a>
|
||||||
<a href="{{ route('debitur.pemilik.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.pemilik.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Pemilk Jaminan</a>
|
<a href="{{ route('debitur.pemilik.index',array_merge(request()->query(),['id'=>$debitur->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.pemilik.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Pemilk Jaminan</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@if(isset($debitur->id))
|
@if(isset($debitur->id) && request()->get('permohonan_id') == null)
|
||||||
<a class="btn btn-sm btn-primary" href="{{ route('permohonan.create.debitur', $debitur->id) }}"> Buat Permohonan </a>
|
<a class="btn btn-sm btn-primary" href="{{ route('permohonan.create.debitur', $debitur->id) }}"> Buat Permohonan </a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if(request()->get('from') == 'permohonan')
|
@if(request()->get('from') == 'permohonan')
|
||||||
<a href="{{ route('permohonan.create') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
<a href="{{ route('permohonan.create') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
|
@elseif(request()->get('permohonan_id'))
|
||||||
|
<a href="{{ route('permohonan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
@else
|
@else
|
||||||
<a href="{{ route('debitur.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
<a href="{{ route('debitur.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -5,6 +5,120 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
@if(isset($permohonan))
|
||||||
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
<div class="card pb-2.5">
|
||||||
|
<div class="card-header" id="basic_settings">
|
||||||
|
<div class="card-title flex flex-row gap-1.5">
|
||||||
|
<a href="{{ route('permohonan.edit',array_merge(request()->query(),['permohonan'=>$permohonan->id])) }}" class="btn btn-xs {{ request()->routeIs('permohonan.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Permohonan</a>
|
||||||
|
<a href="{{ route('debitur.edit',array_merge(request()->query(),['debitur'=>$debitur->id,'permohonan_id' => $permohonan->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.edit') ? 'btn-outline btn-primary' : 'btn-light' }}">Data Debitur</a>
|
||||||
|
<a href="{{ route('debitur.jaminan.index',array_merge(request()->query(),['id'=>$debitur->id,'permohonan_id' => $permohonan->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.jaminan.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Dokumen Jaminan</a>
|
||||||
|
<a href="{{ route('debitur.pemilik.index',array_merge(request()->query(),['id'=>$debitur->id,'permohonan_id' => $permohonan->id])) }}" class="btn btn-xs {{ request()->routeIs('debitur.pemilik.index') ? 'btn-outline btn-primary' : 'btn-light' }}">Pemilk Jaminan</a>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
@if(isset($debitur->id) && !isset($permohonan->id))
|
||||||
|
<a class="btn btn-sm btn-primary" href="{{ route('permohonan.create.debitur', $debitur->id) }}"> Buat Permohonan </a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(request()->get('from') == 'permohonan')
|
||||||
|
<a href="{{ route('permohonan.create') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
|
@elseif($permohonan->id)
|
||||||
|
<a href="{{ route('permohonan.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
|
@else
|
||||||
|
<a href="{{ route('debitur.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i> Back</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
@if(request()->routeIs('permohonan.edit', $permohonan))
|
||||||
|
<form action="{{ isset($permohonan->id) ? route('permohonan.update', $permohonan) : route('permohonan.store') }}" method="POST" class="grid gap-5" enctype="multipart/form-data">
|
||||||
|
@if(isset($permohonan->id))
|
||||||
|
@method('PUT')
|
||||||
|
@endif
|
||||||
|
@csrf
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Debitur
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<input type="hidden" name="debiture_id" value="{{ $debitur->id }}">
|
||||||
|
<p class="text-base text-bold">{{ $debitur->name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label class="form-label max-w-56">
|
||||||
|
Tujuan Penilaian
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select class="input tomselect w-full @error('branch_id') border-danger bg-danger-light @enderror" name="tujuan_penilaian_id" id="tujuan_penilaian_id">
|
||||||
|
<option value="">Pilih Tujuan Penilaian</option>
|
||||||
|
@if(isset($tujuanPenilaian))
|
||||||
|
@foreach($tujuanPenilaian as $row)
|
||||||
|
@if(isset($permohonan))
|
||||||
|
<option value="{{ $row->id }}" {{ isset($permohonan->tujuan_penilaian_id) && $permohonan->tujuan_penilaian_id == $row->id?'selected' : '' }}>
|
||||||
|
{{ $row->name }}
|
||||||
|
</option>
|
||||||
|
@else
|
||||||
|
<option value="{{ $row->id }}">
|
||||||
|
{{ $row->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
@error('tujuan_penilaian_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">
|
||||||
|
Status Permohonan
|
||||||
|
</label>
|
||||||
|
<div class="flex flex-wrap items-baseline w-full">
|
||||||
|
<select class="input tomselect w-full @error('branch_id') border-danger bg-danger-light @enderror" name="status" id="status">
|
||||||
|
<option value="">Pilih Status Permohonan</option>
|
||||||
|
@if(isset($status))
|
||||||
|
@foreach($status as $row)
|
||||||
|
@if(isset($permohonan))
|
||||||
|
<option value="{{ $row->slug }}" {{ isset($permohonan->status) && $permohonan->status == $row->slug ?'selected' : '' }}>
|
||||||
|
{{ $row->name }}
|
||||||
|
</option>
|
||||||
|
@else
|
||||||
|
<option value="{{ $row->slug }}">
|
||||||
|
{{ $row->name }}
|
||||||
|
</option>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
|
@error('status')
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
@elseif(request()->routeIs('debitur.edit', $debitur))
|
||||||
|
@include('lpj::debitur.components.debitur')
|
||||||
|
@elseif(request()->routeIs('debitur.pemilik.index', $debitur))
|
||||||
|
@include('lpj::debitur.components.pemilik')
|
||||||
|
@else
|
||||||
|
@include('lpj::debitur.components.jaminan')
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||||
|
|
||||||
<div class="card pb-2.5">
|
<div class="card pb-2.5">
|
||||||
@@ -98,4 +212,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
Reference in New Issue
Block a user