Merge remote-tracking branch 'origin/feature/senior-officer' into staging
This commit is contained in:
152
app/Http/Controllers/ActivityController.php
Normal file
152
app/Http/Controllers/ActivityController.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Exception;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
|
||||
class ActivityController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$status_permohonan = StatusPermohonan::all();
|
||||
return view('lpj::activity.index', compact('status_permohonan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
|
||||
$status_permohonan = StatusPermohonan::orderBy('id')->get();
|
||||
|
||||
$permohonan = Permohonan::with(
|
||||
[
|
||||
'user',
|
||||
'debiture.province',
|
||||
'debiture.city',
|
||||
'debiture.district',
|
||||
'debiture.village',
|
||||
'branch',
|
||||
'tujuanPenilaian',
|
||||
'penilaian'
|
||||
],
|
||||
)->findOrFail($id);
|
||||
|
||||
return view('lpj::activity.activitydetail', compact('id', 'status_permohonan', 'permohonan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('lpj::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = Permohonan::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('nomor_registrasi', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('tanggal_permohonan', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('user', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('debiture', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('tujuanPenilaian', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhereRelation('branch', 'name', 'LIKE', '%' . $search . '%');
|
||||
$q->orWhere('status', 'LIKE', '%' . $search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
// Apply status filter if provided
|
||||
if ($request->has('status') && !empty($request->get('status'))) {
|
||||
$status = $request->get('status');
|
||||
$query->where('status', '=', $status);
|
||||
}
|
||||
|
||||
// Default sorting if no sort provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
} else {
|
||||
$query->orderBy('nomor_registrasi', 'asc'); // Default order by nomor_registrasi
|
||||
}
|
||||
|
||||
// Get the total count of records before paginating
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = (int) $request->get('page', 1); // Default page is 1
|
||||
$size = (int) $request->get('size', 10); // Default size is 10
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
// Limit results based on pagination
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records (after search & filters applied)
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
|
||||
|
||||
// Calculate the total number of pages
|
||||
$pageCount = ceil($totalRecords / $request->get('size', 10));
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $request->get('page', 1),
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download the specified resource from storage.
|
||||
*/
|
||||
public function download($id)
|
||||
{
|
||||
$document = Permohonan::find($id);
|
||||
return response()->download(storage_path('app/public/' . $document->dokumen));
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ class PenilaianController extends Controller
|
||||
*/
|
||||
public function store(PenilaianRequest $request)
|
||||
{
|
||||
//print_r($request->all());exit;
|
||||
$validatedData = $request->validated();
|
||||
if ($validatedData) {
|
||||
try {
|
||||
@@ -80,14 +81,6 @@ class PenilaianController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
@@ -116,21 +109,40 @@ class PenilaianController extends Controller
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function revisi(Request $request, $nomor_registrasi)
|
||||
|
||||
public function revisi(PenilaianRequest $request, $nomor_registrasi)
|
||||
{
|
||||
$validate = $request->validate([
|
||||
'keterangan_revisi' => 'required',
|
||||
'dokumen_revisi' => 'required|file',
|
||||
]);
|
||||
if ($validate) {
|
||||
$permohonan = Permohonan::where('nomor_registrasi',
|
||||
$nomor_registrasi);
|
||||
$validatedData = $request->validated();
|
||||
if ($validatedData) {
|
||||
|
||||
$permohonan->update($validate);
|
||||
try {
|
||||
|
||||
if (isset($validatedData['dokumen']) && $request->hasFile('dokumen')) {
|
||||
$file_name = $validatedData['dokumen']->getClientOriginalName();
|
||||
$validatedData['dokumen']->storeAs('public/dokumen_revisi', $file_name);
|
||||
}
|
||||
|
||||
$dataToUpdate = [
|
||||
'keterangan' => $validatedData['keterangan'],
|
||||
'dokumen' => 'dokumen_revisi/' . $file_name,
|
||||
'status' => 'revisi',
|
||||
];
|
||||
|
||||
// dump($dataToUpdate);
|
||||
|
||||
$permohonan = Permohonan::where('nomor_registrasi', $nomor_registrasi)->first();
|
||||
|
||||
$permohonan->update($dataToUpdate);
|
||||
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil direvisi');
|
||||
} catch (Exception $e) {
|
||||
dump($e->getMessage());
|
||||
// return redirect()->route('penilaian.index')->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('debitur.view')) {
|
||||
|
||||
@@ -9,20 +9,36 @@ class PenilaianRequest extends FormRequest
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'jenis_penilaian_id' => 'required|max:255',
|
||||
'teams_id' => 'required|max:255',
|
||||
'tanggal_kunjungan' => 'required|max:255',
|
||||
'status' => 'required|string',
|
||||
'nomor_registrasi' => 'required|string',
|
||||
'surveyor_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||
'penilaian_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||
'penilai_surveyor_id' => 'nullable|required_without:surveyor_id|required_without:penilaian_id',
|
||||
'keterangan' => 'nullable',
|
||||
];
|
||||
}
|
||||
{
|
||||
|
||||
|
||||
$action = $this->input('action');
|
||||
|
||||
if ($action === 'revisi') {
|
||||
return [
|
||||
'dokumen' => 'required|file|mimes:pdf',
|
||||
'keterangan' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'jenis_penilaian_id' => 'required|max:255',
|
||||
'teams_id' => 'required|max:255',
|
||||
'tanggal_kunjungan' => 'required|max:255',
|
||||
'status' => 'required|string',
|
||||
'nomor_registrasi' => 'required|string',
|
||||
'surveyor_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||
'penilaian_id' => 'nullable|required_without:penilai_surveyor_id',
|
||||
'penilai_surveyor_id' => 'nullable|required_without_all:surveyor_id,penilaian_id',
|
||||
'keterangan' => 'nullable',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,18 @@ class Penilaian extends Model
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function userPenilai(){
|
||||
return $this->belongsTo(User::class, 'penilaian_id', 'id');
|
||||
}
|
||||
|
||||
public function userSurveyor(){
|
||||
return $this->belongsTo(User::class, 'surveyor_id', 'id');
|
||||
}
|
||||
|
||||
public function userPenilaiSurveyor(){
|
||||
return $this->belongsTo(User::class, 'penilai_surveyor_id', 'id');
|
||||
}
|
||||
|
||||
public function permohonan(){
|
||||
return $this->belongsTo(Permohonan::class, 'nomor_registrasi', 'nomor_registrasi');
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\PermohonanFactory;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Lpj\Models\TujuanPenilaian;
|
||||
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||
|
||||
class Permohonan extends Base
|
||||
{
|
||||
@@ -18,6 +20,7 @@ class Permohonan extends Base
|
||||
'tujuan_penilaian_id',
|
||||
'debiture_id',
|
||||
'keterangan',
|
||||
'dokumen',
|
||||
'jenis_fasilitas_kredit_id',
|
||||
'nilai_plafond_id',
|
||||
'status',
|
||||
@@ -55,4 +58,8 @@ class Permohonan extends Base
|
||||
public function jenisFasilitasKredit(){
|
||||
return $this->belongsTo(JenisFasilitasKredit::class);
|
||||
}
|
||||
|
||||
public function penilaian(){
|
||||
return $this->belongsTo(Penilaian::class, 'nomor_registrasi', 'nomor_registrasi');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Lpj\Database\Factories\TeamsUsersFactory;
|
||||
// use Modules\User\Models\User;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
|
||||
class TeamsUsers extends Model
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('permohonan', function (Blueprint $table) {
|
||||
$table->string('dokumen')->nullable()->after('status');
|
||||
$table->string('keterangan')->nullable()->after('dokumen');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('permohonan', function (Blueprint $table) {
|
||||
$table->dropColumn('dokumen');
|
||||
$table->dropColumn('keterangan');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -69,7 +69,7 @@
|
||||
},
|
||||
{
|
||||
"title": "Activity",
|
||||
"path": "penilaian",
|
||||
"path": "activity",
|
||||
"icon": "ki-filled ki-some-files text-lg",
|
||||
"classes": "",
|
||||
"attributes": [],
|
||||
|
||||
120
resources/views/activity/activitydetail.blade.php
Normal file
120
resources/views/activity/activitydetail.blade.php
Normal file
@@ -0,0 +1,120 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render(request()->route()->getName()) }}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@push('styles')
|
||||
<style>
|
||||
.border-l-primary {
|
||||
border-left-color: #0d6efd !important;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
<div class="w-full grid gap-5 lg:gap-7.5 mx-auto">
|
||||
<div class="card">
|
||||
<div class="card-header" id="advanced_settings_appearance">
|
||||
<h3 class="card-title">
|
||||
Activity Permohonan
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('activity.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i>
|
||||
Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body lg:py-7.5 grid grid-cols-3">
|
||||
<div class="mb-5">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Nomor Register Permohonan:
|
||||
</h3>
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{ $permohonan->nomor_registrasi }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Pemohon:
|
||||
</h3>
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{ $permohonan->user->nik }} | {{ $permohonan->user->name }} | {{ $permohonan->user->branch->name }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-5">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Tujan Permohonan:
|
||||
</h3>
|
||||
<span class="text-2sm text-gray-700">
|
||||
{{ $permohonan->tujuanPenilaian->name }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card grow" id="activity_2024">
|
||||
<div class="card-header">
|
||||
<h3 class="text-md font-medium text-gray-900">
|
||||
Status Activity
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="flex flex-col">
|
||||
@foreach ($status_permohonan as $index => $status)
|
||||
{{-- Cek apakah status adalah "Revisi" dan status permohonan tidak sama, maka tidak ditampilkan --}}
|
||||
@if (strtolower($status->name) == 'revisi' && strtolower($status->name) != strtolower($permohonan->status))
|
||||
@continue
|
||||
@endif
|
||||
|
||||
<div class="flex items-start relative">
|
||||
@if ($index < count($status_permohonan) - 1)
|
||||
<div
|
||||
class="w-9 left-0 top-9 absolute bottom-0 translate-x-1/2
|
||||
{{ strtolower($status->name) == strtolower($permohonan->status) ? 'border-l border-l-primary' : 'border-l border-l-gray-300' }}">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="flex items-center justify-center shrink-0 rounded-full
|
||||
{{ strtolower($status->name) == strtolower($permohonan->status) ? ' btn-outline btn-primary' : 'bg-gray-100 border-gray-300 text-gray-600' }}
|
||||
size-9">
|
||||
@switch(strtolower($status->name))
|
||||
@case('order')
|
||||
<i class="ki-filled ki-handcart text-base"></i>
|
||||
@break
|
||||
|
||||
@case('revisi')
|
||||
<i class="ki-filled ki-notepad-edit text-base"></i>
|
||||
@break
|
||||
|
||||
@case('register')
|
||||
<i class="ki-filled ki-note-2 text-base"></i>
|
||||
@break
|
||||
|
||||
@case('assign')
|
||||
<i class="ki-filled ki-file-added"></i>
|
||||
@break
|
||||
|
||||
@case('survey')
|
||||
<i class="ki-filled ki-map text-base"></i>
|
||||
@break
|
||||
|
||||
@default
|
||||
<i class="ki-filled ki-people text-base"></i>
|
||||
@endswitch
|
||||
|
||||
</div>
|
||||
@include('lpj::activity.components.status')
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer justify-center">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
94
resources/views/activity/components/status.blade.php
Normal file
94
resources/views/activity/components/status.blade.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<div class="pl-2.5 mb-7 text-md grow">
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm text-gray-800">
|
||||
{{ $status->name . ' ' . $status->description }}
|
||||
</div>
|
||||
<span class="text-xs text-gray-600">
|
||||
@if (strtolower($status->name) == 'order')
|
||||
{{ $permohonan->created_at }}
|
||||
@elseif (strtolower($status->name) == strtolower($permohonan->status))
|
||||
{{ $permohonan->updated_at }}
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$isCurrentStatus = strtolower($status->name) == strtolower($permohonan->status);
|
||||
$hasKeterangan = isset($permohonan->keterangan);
|
||||
@endphp
|
||||
|
||||
{{-- Tampilkan keterangan jika status 'register' --}}
|
||||
@if (strtolower($status->name) == 'register' && $hasKeterangan && $isCurrentStatus)
|
||||
<div class="card shadow-none">
|
||||
<div class="card-body">
|
||||
<p class="text-xs text-gray-800 leading-[22px]">
|
||||
{{ $permohonan->keterangan }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Tampilkan dokumen dan keterangan jika status 'revisi' --}}
|
||||
@if (strtolower($status->name) == 'revisi' && $hasKeterangan)
|
||||
<div class="card shadow-none">
|
||||
<div class="card-body">
|
||||
<a href="{{ route('activity.download', $permohonan->id) }}" class="badge badge-sm badge-outline">
|
||||
{{ basename($permohonan->dokumen) }}
|
||||
<i class="ki-filled ki-cloud-download"></i>
|
||||
</a>
|
||||
<p class="text-xs text-gray-800 leading-[22px]">
|
||||
{{ $permohonan->keterangan }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Tampilkan informasi assign jika status 'assign' --}}
|
||||
@if (strtolower($status->name) == 'assign' && $isCurrentStatus)
|
||||
<div class="card shadow-none">
|
||||
<div class="card-body grid grid-cols-3 gap-5">
|
||||
{{-- Informasi Penilai, Surveyor, dan Penilai Surveyor --}}
|
||||
<div>
|
||||
@isset($permohonan->penilaian)
|
||||
@if ($penilai = $permohonan->penilaian->userPenilai->name ?? null)
|
||||
<div class="mb-3">
|
||||
<p class="text-md font-medium text-gray-900">Penilai:</p>
|
||||
<span class="text-2sm text-gray-700">{{ $penilai }}</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($surveyor = $permohonan->penilaian->userSurveyor->name ?? null)
|
||||
<div class="mb-3">
|
||||
<p class="text-md font-medium text-gray-900">Surveyor:</p>
|
||||
<span class="text-2sm text-gray-700">{{ $surveyor }}</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($penilaiSurveyor = $permohonan->penilaian->userPenilaiSurveyor->name ?? null)
|
||||
<div class="mb-3">
|
||||
<p class="text-md font-medium text-gray-900">Penilai Surveyor:</p>
|
||||
<span class="text-2sm text-gray-700">{{ $penilaiSurveyor }}</span>
|
||||
</div>
|
||||
@endif
|
||||
@endisset
|
||||
</div>
|
||||
|
||||
{{-- Teams --}}
|
||||
<div>
|
||||
<h3 class="text-md font-medium text-gray-900">Teams:</h3>
|
||||
<ul>
|
||||
@foreach ($permohonan->penilaian->teams->teamsUsers as $item)
|
||||
<li class="text-xs text-gray-800 leading-[22px]">{{ $item->user->name }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{-- Catatan --}}
|
||||
<div>
|
||||
<h3 class="text-md font-medium text-gray-900">Catatan:</h3>
|
||||
<span class="text-2sm text-gray-700">{{ $permohonan->penilaian->keterangan }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
211
resources/views/activity/index.blade.php
Normal file
211
resources/views/activity/index.blade.php
Normal file
@@ -0,0 +1,211 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@section('breadcrumbs')
|
||||
{{ Breadcrumbs::render('activity') }}
|
||||
@endsection
|
||||
@section('content')
|
||||
<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">
|
||||
Activity
|
||||
</div>
|
||||
<div class="card-header py-5 flex-wrap">
|
||||
<h3 class="card-title">
|
||||
{{-- Daftar {{}} --}}
|
||||
</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 Penilaian" id="search" type="text" value="">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<select class="select select-sm w-28" name="select" id="status-filter">
|
||||
<option value="">Pilih Status</option>
|
||||
@foreach ($status_permohonan as $item)
|
||||
<option value="{{ strtolower($item->name) }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</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('activity.export') }}"> Export to Excel </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-grid min-w-full" data-datatable="false" data-datatable-page-size="5"
|
||||
data-datatable-state-save="false" id="permohonan-table" data-api-url="{{ route('activity.datatables') }}">
|
||||
|
||||
<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-[150px]" data-datatable-column="nomor_registrasi">
|
||||
<span class="sort"><span class="sort-label">Nomor Registrasi</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tanggal_permohonan">
|
||||
<span class="sort"><span class="sort-label">Tanggal Permohonan</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="user_id">
|
||||
<span class="sort"><span class="sort-label">User Pemohon</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="branch_id">
|
||||
<span class="sort"><span class="sort-label">Cabang Pemohon</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="debitur_id">
|
||||
<span class="sort"><span class="sort-label">Debitur</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="tujuan_penilaian_id">
|
||||
<span class="sort"><span class="sort-label">Tujuan Penilaian</span>
|
||||
<span class="sort-icon"></span>
|
||||
</span>
|
||||
</th>
|
||||
<th class="min-w-[150px]" data-datatable-column="status">
|
||||
<span class="sort"><span class="sort-label">Status</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>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="module">
|
||||
const element = document.querySelector('#permohonan-table');
|
||||
const searchInput = document.getElementById('search');
|
||||
const statusFilter = document.getElementById('status-filter'); // Dropdown filter element
|
||||
|
||||
const apiUrl = element.getAttribute('data-api-url');
|
||||
const dataTableOptions = {
|
||||
apiEndpoint: apiUrl,
|
||||
pageSize: 5,
|
||||
order: [{
|
||||
column: 'nomor_registrasi',
|
||||
dir: 'asc'
|
||||
} // Default order by 'nomor_registrasi' ascending
|
||||
],
|
||||
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();
|
||||
},
|
||||
},
|
||||
nomor_registrasi: {
|
||||
title: 'Nomor Registrasi',
|
||||
},
|
||||
tanggal_permohonan: {
|
||||
title: 'Tanggal Permohonan'
|
||||
},
|
||||
user_id: {
|
||||
title: 'User Pemohon',
|
||||
render: (item, data) => `${data.user.name}`,
|
||||
},
|
||||
branch_id: {
|
||||
title: 'Cabang Pemohon',
|
||||
render: (item, data) => `${data.branch.name}`,
|
||||
},
|
||||
debitur_id: {
|
||||
title: 'Debitur',
|
||||
render: (item, data) => `${data.debiture.name}`,
|
||||
},
|
||||
tujuan_penilaian_id: {
|
||||
title: 'Tujuan Penilaian',
|
||||
render: (item, data) => `${data.tujuan_penilaian.name}`,
|
||||
},
|
||||
status: {
|
||||
title: 'Status',
|
||||
render: (item, data) => {
|
||||
let badgeClass = '';
|
||||
switch (data.status.toLowerCase()) {
|
||||
case 'revisi':
|
||||
badgeClass = 'badge badge-pill badge-outline badge-warning';
|
||||
break;
|
||||
case 'order':
|
||||
badgeClass = 'badge badge-pill badge-outline badge-info';
|
||||
break;
|
||||
case 'register':
|
||||
badgeClass = 'badge badge-pill badge-outline badge-success';
|
||||
break;
|
||||
case 'survey':
|
||||
badgeClass = 'badge badge-pill badge-outline badge-primary';
|
||||
break;
|
||||
case 'assign':
|
||||
badgeClass = 'badge badge-pill badge-outline badge-dark';
|
||||
break;
|
||||
default:
|
||||
badgeClass = 'badge badge-pill badge-outline';
|
||||
}
|
||||
|
||||
return `<span class="badge ${badgeClass}">${data.status}</span>`;
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
title: 'Action',
|
||||
render: (item, data) => `
|
||||
<div class="flex flex-nowrap justify-center">
|
||||
<a class="btn btn-sm btn-icon btn-clear btn-warning" href="activity/${data.id}/show">
|
||||
<i class="ki-outline ki-eye"></i>
|
||||
</a>
|
||||
</div>`,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
let dataTable = new KTDataTable(element, dataTableOptions);
|
||||
|
||||
searchInput.addEventListener('input', function() {
|
||||
const searchValue = this.value.trim();
|
||||
dataTable.search(searchValue, true);
|
||||
});
|
||||
|
||||
statusFilter.addEventListener('change', function() {
|
||||
const selectedStatus = this.value;
|
||||
dataTable.search(selectedStatus);
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -27,6 +27,10 @@
|
||||
<h3 class="card-title">
|
||||
Data Permohonan
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('penilaian.index') }}" class="btn btn-xs btn-info"><i class="ki-filled ki-exit-left"></i>
|
||||
Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body lg:py-7.5 grid grid-cols-3">
|
||||
<div class="mb-5">
|
||||
@@ -330,7 +334,7 @@
|
||||
Surveyor yang di tunjuk
|
||||
</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<select id="surveyor_id" name=""
|
||||
<select id="surveyor_id" name="surveyor_id"
|
||||
class="input select @error('surveyor_id') border-danger bg-danger-light @enderror w-full">
|
||||
<option value="">Pilih Surveyor</option>
|
||||
</select>
|
||||
@@ -414,56 +418,65 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal" data-modal="true" id="modal_revisi">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">
|
||||
Revisi
|
||||
</h3>
|
||||
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
|
||||
<i class="ki-outline ki-cross">
|
||||
</i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('penilaian.revisi', $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="pl-1 grid gap-2.5">
|
||||
<input type="hidden" name="nomor_registrasi" value="{{ $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi }}">
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Dokumen Revisi</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input class="file-input @error('dokumen_revisi') border-danger bg-danger-light @enderror" type="file" name="dokumen_revisi" value="">
|
||||
</div>
|
||||
@error('dokumen_revisi')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Catatan</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea class="textarea @error('keterangan_revisi') border-danger bg-danger-light @enderror" rows="3" name="keterangan_revisi">{{ old('keterangan_revisi', $penilaian->keterangan ?? '') }}</textarea>
|
||||
</div>
|
||||
@error('keterangan')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" data-modal="true" id="modal_revisi" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Revisi</h3>
|
||||
<button class="btn btn-xs btn-icon btn-light" data-modal-dismiss="true">
|
||||
<i class="ki-outline ki-cross"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form
|
||||
action="{{ route('penilaian.revisi', $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi) }}"
|
||||
method="POST" enctype="multipart/form-data" id="revisiForm">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<input type="hidden" name="action" value="revisi">
|
||||
<input type="hidden" name="nomor_registrasi"
|
||||
value="{{ $penilaian->nomor_registrasi ?? $permohonan->nomor_registrasi }}">
|
||||
|
||||
<div class="pl-1 grid gap-2.5">
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Dokumen Revisi</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<input id="dokumen"
|
||||
class="file-input @error('dokumen') border-danger bg-danger-light @enderror"
|
||||
type="file" name="dokumen">
|
||||
@error('dokumen')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer justify-end mt-2">
|
||||
<div class="flex gap-4">
|
||||
<button class="btn btn-light" data-modal-dismiss="true">Cancel</button>
|
||||
<button class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
<div class="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||
<label class="form-label max-w-56">Catatan</label>
|
||||
<div class="flex flex-wrap items-baseline w-full">
|
||||
<textarea id="keterangan" class="textarea @error('keterangan') border-danger bg-danger-light @enderror"
|
||||
rows="3" name="keterangan"></textarea>
|
||||
@error('keterangan')
|
||||
<em class="alert text-danger text-sm">{{ $message }}</em>
|
||||
@enderror
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer justify-end mt-2">
|
||||
<div class="flex gap-4">
|
||||
<button type="button" class="btn btn-light" data-modal-dismiss="true">Cancel</button>
|
||||
<button id="btnSubmit" type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -477,7 +490,7 @@
|
||||
let penilaiSurveyorSelect = document.getElementById('penilai_surveyor_id');
|
||||
|
||||
let selectedSurveyorId = @json($penilaian->surveyor_id ?? null);
|
||||
let selectedPenilaiId = @json($penilaian->penilai_id ?? null);
|
||||
let selectedPenilaiId = @json($penilaian->penilaian_id ?? null);
|
||||
let selectedPenilaiSurveyorId = @json($penilaian->penilai_surveyor_id ?? null);
|
||||
|
||||
function fetchPenilai(teamId) {
|
||||
@@ -508,7 +521,6 @@
|
||||
surveyorSelect.appendChild(optionSurveyor);
|
||||
penilaiSurveyorSelect.appendChild(optionPenilaiSurveyor);
|
||||
|
||||
// Jika dalam mode edit dan data sudah ada, set opsi yang sesuai sebagai selected
|
||||
if (selectedPenilaiId && selectedPenilaiId == user.id) {
|
||||
optionPenilai.selected = true;
|
||||
}
|
||||
@@ -560,14 +572,46 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const revisiForm = document.getElementById('revisiForm');
|
||||
const btnSubmit = document.getElementById('btnSubmit');
|
||||
|
||||
@if($errors->any())
|
||||
var modal = new Modal(document.getElementById('modal_revisi'));
|
||||
modal.show();
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
btnSubmit.addEventListener('click', function(event) {
|
||||
// Cegah form dari pengiriman default
|
||||
event.preventDefault();
|
||||
|
||||
// Ambil nilai dari input dan textarea
|
||||
const dokumenRevisi = document.getElementById('dokumen').value;
|
||||
const keteranganRevisi = document.getElementById('keterangan').value.trim();
|
||||
|
||||
// Bersihkan pesan kesalahan sebelumnya
|
||||
document.querySelectorAll('.alert.text-danger').forEach(el => el.remove());
|
||||
|
||||
// Validasi: jika ada field kosong, tampilkan pesan kesalahan
|
||||
let isValid = true;
|
||||
|
||||
if (!dokumenRevisi) {
|
||||
const errorMessage = document.createElement('em');
|
||||
errorMessage.className = 'alert text-danger text-sm';
|
||||
errorMessage.innerText = 'Dokumen Revisi harus diisi.';
|
||||
document.getElementById('dokumen').parentElement.appendChild(errorMessage);
|
||||
isValid = false; // Set isValid ke false
|
||||
}
|
||||
|
||||
if (!keteranganRevisi) {
|
||||
const errorMessage = document.createElement('em');
|
||||
errorMessage.className = 'alert text-danger text-sm';
|
||||
errorMessage.innerText = 'Catatan harus diisi.';
|
||||
document.getElementById('keterangan').parentElement.appendChild(errorMessage);
|
||||
isValid = false; // Set isValid ke false
|
||||
}
|
||||
|
||||
// Jika semua field valid, kirim form
|
||||
if (isValid) {
|
||||
revisiForm.submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -296,7 +296,6 @@
|
||||
|
||||
|
||||
Breadcrumbs::for('penilaian', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('basicdata');
|
||||
$trail->push('Penilaian', route('penilaian.index'));
|
||||
});
|
||||
Breadcrumbs::for('penilaian.assignment', function (BreadcrumbTrail $trail) {
|
||||
@@ -313,3 +312,12 @@
|
||||
$trail->push('Detail Permohonan');
|
||||
});
|
||||
|
||||
|
||||
Breadcrumbs::for('activity', function (BreadcrumbTrail $trail) {
|
||||
$trail->push('Activity', route('activity.index'));
|
||||
});
|
||||
|
||||
Breadcrumbs::for('activity.show', function (BreadcrumbTrail $trail) {
|
||||
$trail->parent('activity');
|
||||
$trail->push('Activity activity');
|
||||
});
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
use Modules\Lpj\Http\Controllers\StatusPermohonanController;
|
||||
use Modules\Lpj\Http\Controllers\TeamsController;
|
||||
use Modules\Lpj\Http\Controllers\TujuanPenilaianController;
|
||||
use Modules\Lpj\Http\Controllers\ActivityController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -270,9 +271,20 @@
|
||||
Route::get('/', [PenilaianController::class, 'index'])->name('index');
|
||||
Route::get('{id}/assignment', [PenilaianController::class, 'assignment'])->name('assignment');
|
||||
Route::put('{id}', [PenilaianController::class, 'update'])->name('update');
|
||||
Route::put('{nomor_registrasi}', [PenilaianController::class, 'revisi'])->name('revisi');
|
||||
Route::put('revisi/{nomor_registrasi}', [PenilaianController::class, 'revisi'])->name('revisi');
|
||||
Route::post('create', [PenilaianController::class, 'create'])->name('create');
|
||||
Route::post('store', [PenilaianController::class, 'store'])->name('store');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Route::name('activity.')->prefix('activity')->group(function () {
|
||||
Route::get('restore/{id}', [ActivityController::class, 'restore'])->name('restore');
|
||||
Route::get('datatables', [ActivityController::class, 'dataForDatatables'])->name('datatables');
|
||||
Route::get('export', [ActivityController::class, 'export'])->name('export');
|
||||
Route::get('/', [ActivityController::class, 'index'])->name('index');
|
||||
|
||||
Route::get('/{id}/show', [ActivityController::class, 'show'])->name('show');
|
||||
Route::get('download/{id}', [ActivityController::class, 'download'])->name('download');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user