memperbaiki konflik dari branch staging
This commit is contained in:
47
app/Exports/IjinUsahaExport.php
Normal file
47
app/Exports/IjinUsahaExport.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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 IjinUsahaExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return IjinUsaha::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/JenisLaporanExport.php
Normal file
46
app/Exports/JenisLaporanExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\JenisLaporan;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisLaporanExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisLaporan::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/JenisPenilaianExport.php
Normal file
46
app/Exports/JenisPenilaianExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\JenisPenilaian;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class JenisPenilaianExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return JenisPenilaian::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Jenis Penilaian',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
89
app/Exports/KJPPExport.php
Normal file
89
app/Exports/KJPPExport.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?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\KJPP;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return KJPP::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->jenis_kantor,
|
||||
$row->nomor_ijin_usaha,
|
||||
$row->province_code,
|
||||
$row->city_code,
|
||||
$row->district_code,
|
||||
$row->village_code,
|
||||
$row->address,
|
||||
$row->postal_code,
|
||||
$row->nomor_telepon_kantor,
|
||||
$row->email_kantor,
|
||||
$row->nama_pimpinan,
|
||||
$row->nomor_hp_pimpinan,
|
||||
$row->nama_pic_reviewer,
|
||||
$row->nomor_hp_pic_reviewer,
|
||||
$row->nama_pic_admin,
|
||||
$row->nomor_hp_pic_admin,
|
||||
$row->nama_pic_marketing,
|
||||
$row->nomor_hp_pic_marketing,
|
||||
$row->ijin_usaha_id,
|
||||
$row->jenis_aset_id,
|
||||
$row->attachment,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'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',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
63
app/Exports/PenawaranTenderExport.php
Normal file
63
app/Exports/PenawaranTenderExport.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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\PenawaranTender;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class PenawaranTenderExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return PenawaranTender::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->nama_kjpp_sebelumnya,
|
||||
$row->biaya_kjpp_sebelumnya,
|
||||
$row->tanggal_penilaian_sebelumnya,
|
||||
$row->nomor_registrasi,
|
||||
$row->tujuan_penilaian_kjpp_id,
|
||||
$row->jenis_laporan_id,
|
||||
$row->start_date,
|
||||
$row->end_date,
|
||||
$row->catatan,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Nomor Penawaran',
|
||||
'Nama KJPP Sebelumnya',
|
||||
'Biaya KJPP Sebelumnya',
|
||||
'Tanggal Penilaian Sebelumnya',
|
||||
'Nomor Registrasi',
|
||||
'Tujuan Penilaian KJPP ID',
|
||||
'Jenis Laporan ID',
|
||||
'Start Date',
|
||||
'End Date',
|
||||
'Catatan',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@
|
||||
$row->branch->name,
|
||||
$row->tujuanPenilaian->name,
|
||||
$row->debiture->name,
|
||||
$row->fasilitasKredit->name,
|
||||
$row->plafond->name,
|
||||
$row->status,
|
||||
$row->authorized_at,
|
||||
$row->authorized_status,
|
||||
@@ -47,7 +49,9 @@
|
||||
'Branch Pemohon',
|
||||
'Tujuan Penilaian',
|
||||
'Debitur',
|
||||
'Status',
|
||||
'Jenis Fasilitas Kredit',
|
||||
'Nilai Plafond',
|
||||
'Status Permohonan',
|
||||
'Tanggal Pengesahan',
|
||||
'Status Pengesahan',
|
||||
'Pengesah',
|
||||
@@ -61,7 +65,8 @@
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'C' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'L' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
'K' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'N' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
49
app/Exports/RegionExport.php
Normal file
49
app/Exports/RegionExport.php
Normal 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\Regions;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class RegionExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Regions::all();
|
||||
}
|
||||
|
||||
public function map($row)
|
||||
: array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats()
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
57
app/Exports/TeamPenilaianExport.php
Normal file
57
app/Exports/TeamPenilaianExport.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?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\JenisPenilaian;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
|
||||
class TeamPenilaianExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Teams::select(
|
||||
'teams.id as id',
|
||||
'teams.name as team_name',
|
||||
'regions.name as region_name',
|
||||
DB::raw('STRING_AGG(users.name, \', \') as team_group')
|
||||
)
|
||||
->join('regions', 'teams.regions_id', '=', 'regions.id')
|
||||
->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id')
|
||||
->leftJoin('users', 'teams_users.user_id', '=', 'users.id')
|
||||
->groupBy('teams.id', 'teams.name', 'regions.name')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->team_name,
|
||||
$row->region_name,
|
||||
$row->team_group,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Name',
|
||||
'Region',
|
||||
'Anggota Team',
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_TEXT,
|
||||
'B' => NumberFormat::FORMAT_TEXT,
|
||||
'C' => NumberFormat::FORMAT_TEXT,
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Exports/TujuanPenilaianKJPPExport.php
Normal file
46
app/Exports/TujuanPenilaianKJPPExport.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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\TujuanPenilaianKJPP;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class TujuanPenilaianKJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return TujuanPenilaianKJPP::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@
|
||||
|
||||
public function update(DebitureRequest $request, $id)
|
||||
{
|
||||
//print_r($request->all());exit;
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
@@ -174,10 +175,4 @@
|
||||
{
|
||||
return Excel::download(new DebitureExport, 'debitur.xlsx');
|
||||
}
|
||||
|
||||
public function download($id)
|
||||
{
|
||||
$document = DokumenJaminan::find($id);
|
||||
return response()->download(storage_path('app/public/' . $document->dokumen_jaminan));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Location\Models\City;
|
||||
use Modules\Location\Models\District;
|
||||
use Modules\Location\Models\Province;
|
||||
use Modules\Location\Models\Village;
|
||||
use Modules\Lpj\Http\Requests\DokumenJaminanRequest;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
use Modules\Lpj\Models\DetailDokumenJaminan;
|
||||
use Modules\Lpj\Models\DokumenJaminan;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
use Modules\Lpj\Models\JenisLegalitasJaminan;
|
||||
@@ -23,7 +26,7 @@
|
||||
public function index($id)
|
||||
{
|
||||
$debitur = Debiture::find($id);
|
||||
$documents = DokumenJaminan::with('pemilik')->where('debiture_id', $id)->get();
|
||||
$documents = DokumenJaminan::with('pemilik', 'detail')->where('debiture_id', $id)->get();
|
||||
|
||||
return view(
|
||||
'lpj::debitur.edit',
|
||||
@@ -36,8 +39,10 @@
|
||||
$debitur = Debiture::find($id);
|
||||
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$validate['debiture_id'] = $id;
|
||||
|
||||
if ($validate['pemilik_jaminan_id'] == 0) {
|
||||
@@ -61,22 +66,53 @@
|
||||
$validate['pemilik_jaminan_id'] = $pemilikJaminan->id;
|
||||
}
|
||||
|
||||
if ($request->hasFile('dokumen_jaminan')) {
|
||||
$file = $request->file('dokumen_jaminan');
|
||||
$file_name = $file->getClientOriginalName();
|
||||
$file->storeAs('public/jaminan/' . $debitur->id, $file_name);
|
||||
$validate['dokumen_jaminan'] = 'jaminan/' . $debitur->id . '/' . $file_name;
|
||||
$document = DokumenJaminan::create($validate);
|
||||
|
||||
try {
|
||||
foreach ($request->dokumen_jaminan as $key => $value) {
|
||||
$file_name = $value->getClientOriginalName();
|
||||
|
||||
if ($file_name) {
|
||||
try {
|
||||
$file_name = $value->getClientOriginalName();
|
||||
$value->storeAs(
|
||||
'public/jaminan/' . $debitur->id . '/' . $document->id . '/',
|
||||
$file_name,
|
||||
);
|
||||
|
||||
$detail = [
|
||||
'dokumen_jaminan_id' => $document->id,
|
||||
'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key],
|
||||
'dokumen_jaminan' => 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name,
|
||||
'name' => $request->name[$key],
|
||||
'keterangan' => $request->keterangan[$key],
|
||||
];
|
||||
DetailDokumenJaminan::create($detail);
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with(
|
||||
'error',
|
||||
'Gagal upload file dokumen jaminan ' . $key . ': ' . $e->getMessage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
DB::commit();
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with(
|
||||
'error',
|
||||
'gg' . $e->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
DokumenJaminan::create($validate);
|
||||
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with(
|
||||
'success',
|
||||
'Dokumen Jaminan berhasil ditambahkan',
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with('error', $e->getMessage());
|
||||
DB::rollBack();
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with('error', 'ggl' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +138,7 @@
|
||||
$validate = $request->validated();
|
||||
if ($validate) {
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$validate['debiture_id'] = $id;
|
||||
|
||||
if ($validate['pemilik_jaminan_id'] == 0) {
|
||||
@@ -124,29 +161,77 @@
|
||||
], $pemilik_jaminan);
|
||||
}
|
||||
|
||||
if ($request->hasFile('dokumen_jaminan')) {
|
||||
$file = $request->file('dokumen_jaminan');
|
||||
$file_name = $file->getClientOriginalName();
|
||||
$file->storeAs('public/jaminan/' . $debitur->id, $file_name);
|
||||
$validate['dokumen_jaminan'] = 'jaminan/' . $debitur->id . '/' . $file_name;
|
||||
}
|
||||
|
||||
$document = DokumenJaminan::find($jaminan);
|
||||
$document->update($validate);
|
||||
|
||||
if ($request->detail_dokumen_jaminan_id) {
|
||||
foreach ($request->detail_dokumen_jaminan_id as $key => $value) {
|
||||
if (isset($request->dokumen_jaminan[$key])) {
|
||||
$file = $request->dokumen_jaminan[$key];
|
||||
if ($file) {
|
||||
$file_name = $file->getClientOriginalName();
|
||||
}
|
||||
|
||||
if (isset($file_name)) {
|
||||
$file->storeAs(
|
||||
'public/jaminan/' . $debitur->id . '/' . $document->id . '/',
|
||||
$file_name,
|
||||
);
|
||||
|
||||
$detail = [
|
||||
'dokumen_jaminan_id' => $document->id,
|
||||
'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key],
|
||||
'dokumen_jaminan' => 'jaminan/' . $debitur->id . '/' . $document->id . '/' . $file_name,
|
||||
'name' => $request->name[$key],
|
||||
'keterangan' => $request->keterangan[$key],
|
||||
];
|
||||
if (isset($request->detail_dokumen_jaminan_id[$key])) {
|
||||
$detailDocument = DetailDokumenJaminan::find(
|
||||
$request->detail_dokumen_jaminan_id[$key],
|
||||
);
|
||||
|
||||
$detailDocument->update($detail);
|
||||
$detailDocument->save();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$detail = [
|
||||
'dokumen_jaminan_id' => $document->id,
|
||||
'jenis_legalitas_jaminan_id' => $request->jenis_legalitas_jaminan_id[$key],
|
||||
'name' => $request->name[$key],
|
||||
'keterangan' => $request->keterangan[$key],
|
||||
];
|
||||
|
||||
if (isset($request->detail_dokumen_jaminan_id[$key])) {
|
||||
$detailDocument = DetailDokumenJaminan::find(
|
||||
$request->detail_dokumen_jaminan_id[$key],
|
||||
);
|
||||
$detailDocument->update($detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with(
|
||||
'success',
|
||||
'Dokumen Jaminan berhasil diubah',
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
} catch
|
||||
(Exception $e) {
|
||||
DB::rollBack();
|
||||
return redirect()->route('debitur.jaminan.index', $id)->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id, $jaminan)
|
||||
{
|
||||
public
|
||||
function edit(
|
||||
$id,
|
||||
$jaminan,
|
||||
) {
|
||||
$document = DokumenJaminan::find($jaminan);
|
||||
$details = DetailDokumenJaminan::where('dokumen_jaminan_id', $document->id)->get();
|
||||
$debitur = Debiture::find($document->debiture_id);
|
||||
$provinces = Province::all();
|
||||
$cities = City::where('province_code', $document->province_code)->get();
|
||||
@@ -164,6 +249,7 @@
|
||||
'jenisJaminan',
|
||||
'jenisLegalitasJaminan',
|
||||
'document',
|
||||
'details',
|
||||
'cities',
|
||||
'districts',
|
||||
'villages',
|
||||
@@ -172,14 +258,30 @@
|
||||
);
|
||||
}
|
||||
|
||||
public function destroy($id, $jaminan_id)
|
||||
{
|
||||
public
|
||||
function destroy(
|
||||
$id,
|
||||
$jaminan_id,
|
||||
) {
|
||||
try {
|
||||
$jaminan = DokumenJaminan::find($jaminan_id);
|
||||
$details = DetailDokumenJaminan::where('dokumen_jaminan_id',$jaminan->id)->get();
|
||||
foreach ($details as $detail){
|
||||
Storage::delete('public/'. $detail->dokumen_jaminan);
|
||||
$detail->delete();
|
||||
}
|
||||
$jaminan->delete();
|
||||
echo json_encode(['success' => true, 'message' => 'Dokumen Jaminan deleted successfully']);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete Dokumen Jaminan']);
|
||||
}
|
||||
}
|
||||
|
||||
public
|
||||
function download(
|
||||
$id,
|
||||
) {
|
||||
$document = DetailDokumenJaminan::find($id);
|
||||
return response()->download(storage_path('app/public/' . $document->dokumen_jaminan));
|
||||
}
|
||||
}
|
||||
|
||||
174
app/Http/Controllers/IjinUsahaController.php
Normal file
174
app/Http/Controllers/IjinUsahaController.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\IjinUsahaExport;
|
||||
use Modules\Lpj\Http\Requests\IjinUsahaRequest;
|
||||
use Modules\Lpj\Models\IjinUsaha;
|
||||
|
||||
class IjinUsahaController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::Ijin_usaha.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::Ijin_usaha.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(IjinUsahaRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
IjinUsaha::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.ijin_usaha.index')
|
||||
->with('success', 'Ijin Usaha created successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()
|
||||
->route('basicdata.ijin_usaha.create')
|
||||
->with('error', 'Failed to create ijin Usaha');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
// return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$ijin_usaha = IjinUsaha::find($id);
|
||||
return view('lpj::Ijin_usaha.create', compact('ijin_usaha'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(IjinUsahaRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
// Update in database
|
||||
$ijin_usaha = IjinUsaha::find($id);
|
||||
$ijin_usaha->update($validate);
|
||||
return redirect()
|
||||
->route('basicdata.ijin_usaha.index')
|
||||
->with('success', 'Ijin Usaha updated successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()
|
||||
->route('basicdata.ijin_usaha.edit', $id)
|
||||
->with('error', 'Failed to update ijin$ijin_usaha');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$ijin_usaha = IjinUsaha::find($id);
|
||||
$ijin_usaha->delete();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Ijin Usaha deleted successfully']);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete Ijin Usaha']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('Ijin_usaha.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = IjinUsaha::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('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new IjinUsahaExport, 'ijin_usaha.xlsx');
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
use Modules\Lpj\Exports\JenisJaminanExport;
|
||||
use Modules\Lpj\Http\Requests\JenisJaminanRequest;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
use Modules\Lpj\Models\JenisLegalitasJaminan;
|
||||
|
||||
class JenisJaminanController extends Controller
|
||||
{
|
||||
@@ -40,13 +41,15 @@
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::jenis_jaminan.create');
|
||||
$jenisLegalitasJaminan = JenisLegalitasJaminan::all();
|
||||
return view('lpj::jenis_jaminan.create', compact('jenisLegalitasJaminan'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$jenisJaminan = JenisJaminan::find($id);
|
||||
return view('lpj::jenis_jaminan.create', compact('jenisJaminan'));
|
||||
$jenisJaminan = JenisJaminan::find($id);
|
||||
$jenisLegalitasJaminan = JenisLegalitasJaminan::all();
|
||||
return view('lpj::jenis_jaminan.create', compact('jenisJaminan', 'jenisLegalitasJaminan'));
|
||||
}
|
||||
|
||||
public function update(JenisJaminanRequest $request, $id)
|
||||
@@ -147,4 +150,13 @@
|
||||
{
|
||||
return Excel::download(new JenisJaminanExport, 'jenis_jaminan.xlsx');
|
||||
}
|
||||
|
||||
public function legalitasJaminan($id)
|
||||
{
|
||||
$jenisJaminan = JenisJaminan::find($id);
|
||||
$legalitasJaminan = $jenisJaminan->jenis_legalitas_jaminan_id;
|
||||
|
||||
$legalitas = JenisLegalitasJaminan::whereIn('code', json_decode($legalitasJaminan, true))->get();
|
||||
echo json_encode($legalitas);
|
||||
}
|
||||
}
|
||||
|
||||
174
app/Http/Controllers/JenisLaporanController.php
Normal file
174
app/Http/Controllers/JenisLaporanController.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Models\JenisLaporan;
|
||||
use Modules\Lpj\Exports\JenisLaporanExport;
|
||||
use Modules\Lpj\Http\Requests\JenisLaporanRequest;
|
||||
use Throwable;
|
||||
|
||||
class JenisLaporanController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::jenis_laporan.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::jenis_laporan.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(JenisLaporanRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
JenisLaporan::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.jenis_laporan.index')
|
||||
->with('success', 'Jenis Laporan created successfully');
|
||||
} catch (Throwable $e) {
|
||||
return redirect()
|
||||
->route('basicdata.jenis_laporan.create')
|
||||
->with('success', 'Failed to create Jenis Laporan: ' . $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
// return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$jenisLaporan = JenisLaporan::find($id);
|
||||
return view('lpj::jenis_laporan.create', compact('jenisLaporan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(JenisLaporanRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
$jenisLaporan = JenisLaporan::find($id);
|
||||
$jenisLaporan->update($validate);
|
||||
return redirect()
|
||||
->route('basicdata.jenis_laporan.index')
|
||||
->with('success', 'Jenis Laporan updated successfully');
|
||||
} catch (Throwable $e) {
|
||||
return redirect()
|
||||
->route('basicdata.jenis_laporan.edit', $id)
|
||||
->with('success', 'Failed to update Jenis Laporan: ' . $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
// Delete from database
|
||||
$jenisLaporan = JenisLaporan::find($id);
|
||||
$jenisLaporan->delete();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Jenis Laporan deleted successfully']);
|
||||
} catch (Throwable $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete jenis Laporan']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('jenis_jaminan.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = JenisLaporan::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('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new JenisLaporanExport, 'jenis_laporan.xlsx');
|
||||
}
|
||||
}
|
||||
156
app/Http/Controllers/JenisPenilaianController.php
Normal file
156
app/Http/Controllers/JenisPenilaianController.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Exception;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Models\JenisPenilaian;
|
||||
use Modules\Lpj\Http\Requests\JenisPenilaianRequest;
|
||||
use Modules\Lpj\Exports\JenisPenilaianExport;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class JenisPenilaianController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::jenis_penilaian.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::jenis_penilaian.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(JenisPenilaianRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
try {
|
||||
JenisPenilaian::create($validate);
|
||||
return redirect()->route('basicdata.jenis-penilaian.index')->with('success', 'Jenis Penilaian created successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('basicdata.jenis-penilaian.create')->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$jenisPenilaian = JenisPenilaian::find($id);
|
||||
return view('lpj::jenis_penilaian.form', compact('jenisPenilaian'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(JenisPenilaianRequest $request, $id)
|
||||
{
|
||||
|
||||
$validated = $request->validated();
|
||||
|
||||
|
||||
if ($validated) {
|
||||
try {
|
||||
$jenisPenilaian = JenisPenilaian::find($id);
|
||||
$jenisPenilaian->update($validated);
|
||||
return redirect()->route('basicdata.jenis-penilaian.index')->with('success', 'Jenis Penilaian updated successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('basicdata.jenis-penilaian.edit', $id)->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$jenisPenilaian = JenisPenilaian::find($id);
|
||||
$jenisPenilaian->delete();
|
||||
echo json_encode(['success' => true, 'message' => 'Jenis Penilaian deleted successfully']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete Jenis Penilaian']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('jenis_penilaian.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
$query = JenisPenilaian::query();
|
||||
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
$totalRecords = $query->count();
|
||||
|
||||
|
||||
$size = $request->get('size');
|
||||
$pageCount = 1;
|
||||
|
||||
if ($size > 0) {
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$offset = ($page - 1) * $size;
|
||||
$query->skip($offset)->take($size);
|
||||
$filteredRecords = $query->count();
|
||||
$pageCount = ceil($totalRecords / $size);
|
||||
}
|
||||
|
||||
$data = $query->get();
|
||||
} else {
|
||||
$filteredRecords = $totalRecords;
|
||||
$data = $query->get();
|
||||
}
|
||||
|
||||
$currentPage = $request->get('page') ?? 1;
|
||||
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new JenisPenilaianExport(), 'jenis-penilaian.xlsx');
|
||||
}
|
||||
}
|
||||
255
app/Http/Controllers/KJPPController.php
Normal file
255
app/Http/Controllers/KJPPController.php
Normal file
@@ -0,0 +1,255 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Throwable;
|
||||
use Illuminate\Http\Request;
|
||||
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\Village;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
use Modules\Location\Models\District;
|
||||
use Modules\Location\Models\Province;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Modules\Lpj\Http\Requests\KJPPRequest;
|
||||
|
||||
class KJPPController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::kjpp.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$branch = Branch::all();
|
||||
$ijin_usaha = IjinUsaha::all();
|
||||
$jenis_aset = JenisJaminan::all();
|
||||
$provinces = Province::all();
|
||||
|
||||
// Generate KJPP Number
|
||||
$lastKjpp = KJPP::orderBy('code', 'desc')->first();
|
||||
$nextNumber = $lastKjpp ? intval(substr($lastKjpp->code, 1, 6)) + 1 : 1;
|
||||
$kjppNumber = 'K' . str_pad($nextNumber, 6, '0', STR_PAD_LEFT);
|
||||
|
||||
// Combine KJPP number with branch code
|
||||
$fullKjppNumber = $kjppNumber;
|
||||
|
||||
return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset', 'provinces', 'fullKjppNumber'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(KJPPRequest $request)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
if ($validated) {
|
||||
$file = $request->file('attachment');
|
||||
$filename = $file ? time() . '.' . $file->getClientOriginalExtension() : 'default.pdf';
|
||||
|
||||
if ($file) {
|
||||
// Simpan file yang diunggah
|
||||
$file->storeAs('public/uploads_pdf', $filename);
|
||||
} else {
|
||||
// Salin file default ke lokasi yang diinginkan
|
||||
Storage::copy('public/test/default.pdf', 'public/uploads_pdf/' . $filename);
|
||||
}
|
||||
|
||||
$validated['ijin_usaha_id'] = json_encode($request->input('ijin_usaha_id'));
|
||||
$validated['jenis_aset_id'] = json_encode($request->input('jenis_aset_id'));
|
||||
|
||||
// Tambahkan nama file ke data yang divalidasi
|
||||
$validated['attachment'] = $filename;
|
||||
|
||||
// Simpan data ke database
|
||||
KJPP::create($validated);
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.kjpp.index')
|
||||
->with('success', 'KJPP created successfully');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('basicdata.kjpp.create')
|
||||
->with('error', 'Validation failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$kjpp = KJPP::find($id);
|
||||
$ijin_usaha = IjinUsaha::where('code', $kjpp->nomor_ijin_usaha)->get();
|
||||
$ijin_usahas = IjinUsaha::all();
|
||||
$jenis_jaminan = JenisJaminan::all();
|
||||
$branches = Branch::where('name', $kjpp->jenis_kantor)->get();
|
||||
$provinces = Province::where('code', $kjpp->province_code)->get();
|
||||
$cities = City::where('code', $kjpp->city_code)->get();
|
||||
$districts = District::where('code', $kjpp->district_code)->get();
|
||||
$villages = Village::where('code', $kjpp->village_code)->get();
|
||||
// dd($branches);
|
||||
return view('lpj::kjpp.show', compact('jenis_jaminan', 'ijin_usahas', 'ijin_usaha', 'branches', 'kjpp', 'provinces', 'cities', 'districts', 'villages'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$kjpp = KJPP::find($id);
|
||||
$branch = Branch::all();
|
||||
$ijin_usaha = IjinUsaha::all();
|
||||
$jenis_aset = JenisJaminan::all();
|
||||
$provinces = Province::all();
|
||||
$cities = City::where('province_code', $kjpp->province_code)->get();
|
||||
$districts = District::where('city_code', $kjpp->city_code)->get();
|
||||
$villages = Village::where('district_code', $kjpp->district_code)->get();
|
||||
|
||||
return view('lpj::kjpp.create', compact('kjpp', 'branch', 'ijin_usaha', 'jenis_aset', 'provinces', 'cities', 'districts', 'villages'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(KJPPRequest $request, $id)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
if ($validated) {
|
||||
$file = $request->file('attachment');
|
||||
$filename = $file ? time() . '.' . $file->getClientOriginalExtension() : null;
|
||||
|
||||
if ($file !== null) {
|
||||
// Jika ada file dari database maka hapus file yang lama ke file yang baru
|
||||
$kjpp = KJPP::find($id);
|
||||
// Jika filenya ada default.pdf jangan dihapus
|
||||
if ($kjpp->attachment !== 'default.pdf') {
|
||||
Storage::delete('public/uploads_pdf/' . $kjpp->attachment);
|
||||
}
|
||||
// Simpan file yang diunggah
|
||||
$file->storeAs('public/uploads_pdf', $filename);
|
||||
$validated['attachment'] = $filename;
|
||||
} else {
|
||||
// Jika tidak ada file yang diunggah, gunakan file yang sudah ada atau file default
|
||||
$kjpp = KJPP::find($id);
|
||||
$validated['attachment'] = $kjpp->attachment ?? 'default.pdf';
|
||||
}
|
||||
|
||||
// Perbarui data di database
|
||||
KJPP::where('id', $id)->update($validated);
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.kjpp.index')
|
||||
->with('success', 'KJPP updated successfully');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('basicdata.kjpp.edit', $id)
|
||||
->with('error', 'Validation failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$kjpp = KJPP::find($id);
|
||||
|
||||
// Jangan hapus file default.pdf
|
||||
if ($kjpp->attachment && $kjpp->attachment !== 'default.pdf') {
|
||||
Storage::delete('public/uploads_pdf/' . $kjpp->attachment);
|
||||
}
|
||||
|
||||
// Hapus data dari database
|
||||
$kjpp->delete();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'KJPP deleted successfully']);
|
||||
} catch (Throwable $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete branch: ' . $e]);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('kjpp.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = KJPP::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('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
$q->orWhere('jenis_kantor', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new KJPPExport, 'kjpp.xlsx');
|
||||
}
|
||||
}
|
||||
225
app/Http/Controllers/PenilaianController.php
Normal file
225
app/Http/Controllers/PenilaianController.php
Normal file
@@ -0,0 +1,225 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Http\Requests\PenilaianRequest;
|
||||
use Modules\Lpj\Models\JenisPenilaian;
|
||||
use Modules\Lpj\Models\Penilaian;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
use Modules\Lpj\Models\TeamsUsers;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
|
||||
class PenilaianController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$status_permohonan = StatusPermohonan::all();
|
||||
|
||||
return view('lpj::penilaian.index', compact('status_permohonan'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(PenilaianRequest $request)
|
||||
{
|
||||
//print_r($request->all());exit;
|
||||
$validatedData = $request->validated();
|
||||
if ($validatedData) {
|
||||
try {
|
||||
$penilaian = Penilaian::create($validatedData);
|
||||
|
||||
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi);
|
||||
$permohonan->update([
|
||||
'status' => 'assign',
|
||||
]);
|
||||
|
||||
return redirect()->route('penilaian.index')->with('success', 'Penilaian berhasil disimpan');
|
||||
} catch (Exception $e) {
|
||||
|
||||
return redirect()->route('penilaian.index')->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create($id)
|
||||
{
|
||||
return view('lpj::penilaian.form');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(PenilaianRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
if ($validate) {
|
||||
try {
|
||||
$penilaian = Penilaian::where('nomor_registrasi', $request->nomor_registrasi)->firstOrFail();
|
||||
$penilaian->update($validate);
|
||||
$permohonan = Permohonan::where('nomor_registrasi', $request->nomor_registrasi);
|
||||
$permohonan->update([
|
||||
'status' => 'assign',
|
||||
]);
|
||||
|
||||
return redirect()->route('penilaian.index', $id)->with('success', 'Penilaian berhasil diubah');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('penilaian.index', $id)->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function assignment($id)
|
||||
{
|
||||
$permohonan = Permohonan::with(
|
||||
[
|
||||
'user',
|
||||
'debiture.province',
|
||||
'debiture.city',
|
||||
'debiture.district',
|
||||
'debiture.village',
|
||||
'branch',
|
||||
'tujuanPenilaian',
|
||||
],
|
||||
)->findOrFail($id);
|
||||
|
||||
$jenisPenilaian = JenisPenilaian::all();
|
||||
$teamPenilai = Teams::with(['regions', 'teamsUsers'])->get();
|
||||
|
||||
$penilaian = Penilaian::where('nomor_registrasi', $permohonan->nomor_registrasi)->first();
|
||||
|
||||
return view('lpj::penilaian.form', compact('permohonan', 'teamPenilai', 'jenisPenilaian', 'penilaian'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
|
||||
public function revisi(PenilaianRequest $request, $nomor_registrasi)
|
||||
{
|
||||
$validatedData = $request->validated();
|
||||
if ($validatedData) {
|
||||
|
||||
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')) {
|
||||
// abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
$query = Permohonan::query();
|
||||
|
||||
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 . '%');
|
||||
});
|
||||
}
|
||||
|
||||
$query->whereRaw('LOWER(status) = ?', ['register']);
|
||||
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
$totalRecords = $query->count();
|
||||
|
||||
$size = $request->get('size', 10);
|
||||
if ($size == 0) {
|
||||
$size = 10;
|
||||
}
|
||||
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page', 1);
|
||||
$offset = ($page - 1) * $size;
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
$filteredRecords = $query->count();
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->get();
|
||||
|
||||
$pageCount = ceil($totalRecords / $size);
|
||||
|
||||
$currentPage = max(1, $request->get('page', 1));
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getUserTeams($id)
|
||||
{
|
||||
$teamsUser = TeamsUsers::where('teams_id', $id)->get();
|
||||
$userIds = $teamsUser->pluck('user_id');
|
||||
$users = User::whereIn('id', $userIds)
|
||||
->with('roles')
|
||||
->get();
|
||||
|
||||
|
||||
if ($users->isNotEmpty()) {
|
||||
return response()->json($users, 200);
|
||||
}
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,11 +6,19 @@
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
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\Http\Requests\PermohonanRequest;
|
||||
use Modules\Lpj\Models\Branch;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
use Modules\Lpj\Models\DokumenJaminan;
|
||||
use Modules\Lpj\Models\JenisFasilitasKredit;
|
||||
use Modules\Lpj\Models\NilaiPlafond;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
use Modules\Lpj\Models\TujuanPenilaian;
|
||||
|
||||
class PermohonanController extends Controller
|
||||
@@ -26,7 +34,6 @@
|
||||
{
|
||||
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
// Save to database
|
||||
@@ -37,7 +44,7 @@
|
||||
} catch (Exception $e) {
|
||||
return redirect()
|
||||
->route('permohonan.create')
|
||||
->with('error', 'Failed to create permohonan'. $e->getMessage());
|
||||
->with('error', 'Failed to create permohonan' . $e->getMessage());
|
||||
}
|
||||
} else {
|
||||
return redirect()
|
||||
@@ -49,49 +56,56 @@
|
||||
|
||||
public function create()
|
||||
{
|
||||
$branches = Branch::all();
|
||||
$debitures = Debiture::all();
|
||||
$tujuanPenilaian = TujuanPenilaian::all();
|
||||
$status = [
|
||||
'order' => 'Order',
|
||||
'revisi' => 'Revisi',
|
||||
'register' => 'Register',
|
||||
'assign' => 'Assign',
|
||||
'survey' => 'Survey',
|
||||
'finalisasi' => 'Proses Laporan',
|
||||
'approved' => 'Diterima',
|
||||
'rejected' => 'Ditolak',
|
||||
'cancel' => 'Dibatalkan',
|
||||
'finished' => 'Selesai',
|
||||
'not_started' => 'Belum dimulai',
|
||||
];
|
||||
return view('lpj::permohonan.create');
|
||||
}
|
||||
|
||||
return view('lpj::permohonan.form', compact('branches', 'debitures', 'tujuanPenilaian','status'));
|
||||
public function createPermohonan($debitur)
|
||||
{
|
||||
$branches = Branch::all();
|
||||
$debitur = Debiture::find($debitur);
|
||||
$tujuanPenilaian = TujuanPenilaian::all();
|
||||
$status = StatusPermohonan::all();
|
||||
$fasilitasKredit = JenisFasilitasKredit::all();
|
||||
$plafond = NilaiPlafond::all();
|
||||
|
||||
return view(
|
||||
'lpj::permohonan.form',
|
||||
compact('branches', 'debitur', 'tujuanPenilaian', 'status', 'fasilitasKredit', 'plafond'),
|
||||
);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$permohonan = Permohonan::find($id);
|
||||
$branches = Branch::all();
|
||||
$debitures = Debiture::all();
|
||||
$debitur = Debiture::find($permohonan->debiture_id);
|
||||
$tujuanPenilaian = TujuanPenilaian::all();
|
||||
$status = [
|
||||
'order' => 'Order',
|
||||
'revisi' => 'Revisi',
|
||||
'register' => 'Register',
|
||||
'assign' => 'Assign',
|
||||
'survey' => 'Survey',
|
||||
'finalisasi' => 'Proses Laporan',
|
||||
'approved' => 'Diterima',
|
||||
'rejected' => 'Ditolak',
|
||||
'cancel' => 'Dibatalkan',
|
||||
'finished' => 'Selesai',
|
||||
'not_started' => 'Belum dimulai',
|
||||
];
|
||||
$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();
|
||||
|
||||
$fasilitasKredit = JenisFasilitasKredit::all();
|
||||
$plafond = NilaiPlafond::all();
|
||||
|
||||
return view(
|
||||
'lpj::permohonan.form',
|
||||
compact('permohonan', 'branches', 'debitures', 'tujuanPenilaian','status'),
|
||||
compact(
|
||||
'permohonan',
|
||||
'branches',
|
||||
'debitur',
|
||||
'tujuanPenilaian',
|
||||
'status',
|
||||
'provinces',
|
||||
'cities',
|
||||
'districts',
|
||||
'villages',
|
||||
'documents',
|
||||
'fasilitasKredit',
|
||||
'plafond',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,4 +212,96 @@
|
||||
{
|
||||
return Excel::download(new PermohonanExport, 'permohonan.xlsx');
|
||||
}
|
||||
|
||||
public function authorization()
|
||||
{
|
||||
return view('lpj::permohonan.authorization.index');
|
||||
}
|
||||
|
||||
public function dataForAuthorization(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 sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->with(['user', 'debiture', 'branch', 'tujuanPenilaian'])->where('status', '=', 'order')->get(
|
||||
);
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function showAuthorization($id)
|
||||
{
|
||||
$permohonan = Permohonan::find($id);
|
||||
return view('lpj::permohonan.authorization.show', compact('permohonan'));
|
||||
}
|
||||
|
||||
public function updateAuthorization(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$permohonan = Permohonan::find($id);
|
||||
$permohonan->status = $request->status;
|
||||
$permohonan->keterangan = $request->keterangan;
|
||||
$permohonan->save();
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('authorization.show', $id)->with('error', 'Failed to update permohonan');
|
||||
}
|
||||
|
||||
return redirect()->route('authorization.index')->with('success', 'Permohonan updated successfully');
|
||||
}
|
||||
}
|
||||
|
||||
164
app/Http/Controllers/RegionController.php
Normal file
164
app/Http/Controllers/RegionController.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
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\Regions;
|
||||
use Modules\Lpj\Http\Requests\RegionRequest;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Exports\RegionExport;
|
||||
|
||||
|
||||
class RegionController extends Controller
|
||||
{
|
||||
public $user;
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::region.index');
|
||||
}
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::region.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(RegionRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
// Save to database
|
||||
Regions::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.region.index')
|
||||
->with('success', 'region created successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()
|
||||
->route('basicdata.region.create')
|
||||
->with('error', 'Failed to create region');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$region = Regions::find($id);
|
||||
return view('lpj::region.create', compact('region'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(RegionRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
// Update in database
|
||||
$region = Regions::find($id);
|
||||
$region->update($validate);
|
||||
return redirect()
|
||||
->route('basicdata.region.index')
|
||||
->with('success', 'Region updated successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()
|
||||
->route('basicdata.region.edit', $id)
|
||||
->with('error', 'Failed to update region');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
// Delete from database
|
||||
$region = Regions::find($id);
|
||||
$region->delete();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Region deleted successfully']);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete region']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
|
||||
|
||||
if (is_null($this->user) || !$this->user->can('region.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
$query = Regions::query();
|
||||
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
if($request->has('sortOrder') && !empty($request->get('sortOrder'))){
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// dump($data);
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new RegionExport, 'region.xlsx');
|
||||
}
|
||||
}
|
||||
260
app/Http/Controllers/TeamsController.php
Normal file
260
app/Http/Controllers/TeamsController.php
Normal file
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
|
||||
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\Regions;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
use Modules\Lpj\Models\TeamsUsers;
|
||||
use Modules\Lpj\Http\Requests\TeamsRequest;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Lpj\Exports\TeamPenilaianExport;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class TeamsController extends Controller
|
||||
{
|
||||
public $user;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::teams.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
||||
// cek region apakah sudah ada di tabel teams
|
||||
$regionTeam = Teams::pluck('regions_id')->toArray();
|
||||
$region = Regions::whereNotIn('id', $regionTeam)->get();
|
||||
|
||||
// cek user apakah sudah ada di tabel teams_users
|
||||
$userTeam = TeamsUsers::pluck('user_id')->toArray();
|
||||
$user = User::whereNotIn('id', $userTeam)
|
||||
->with('roles')
|
||||
->get();
|
||||
|
||||
return view('lpj::teams.form', compact('region', 'user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(TeamsRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$teams = Teams::create($validate);
|
||||
|
||||
$users = $request->input('user', []);
|
||||
|
||||
// loop untuk insert data users ke tabel teams_users
|
||||
foreach ($users as $user) {
|
||||
TeamsUsers::create([
|
||||
'teams_id' => $teams->id,
|
||||
'user_id' => $user
|
||||
]);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.teams.index')
|
||||
->with('success', 'Data saved successfully. ');
|
||||
} catch (Exception $e) {
|
||||
|
||||
DB::rollBack();
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.teams.create')
|
||||
->with('error', 'Failed to save data. ');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$teams = Teams::find($id);
|
||||
|
||||
|
||||
$region = Regions::all();
|
||||
$usedUsers = TeamsUsers::where('teams_id', '!=', $id)->pluck('user_id')->toArray();
|
||||
$user = User::whereNotIn('id', $usedUsers)
|
||||
->with('roles')
|
||||
->get();
|
||||
// Ambil user yang sudah ada di tim ini
|
||||
$selectedUsers = $teams->teamsUsers->pluck('user_id')->toArray();
|
||||
|
||||
return view('lpj::teams.form', compact('teams', 'region', 'user', 'selectedUsers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(TeamsRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$teams = Teams::findOrFail($id);
|
||||
|
||||
// Update data tim
|
||||
$teams->update($validate);
|
||||
$userIds = $request->input('user', []);
|
||||
|
||||
$teams->teamsUsers()->delete();
|
||||
|
||||
|
||||
foreach ($userIds as $userId) {
|
||||
TeamsUsers::create([
|
||||
'teams_id' => $teams->id,
|
||||
'user_id' => $userId
|
||||
]);
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.teams.index')
|
||||
->with('success', 'Data updated successfully. ');
|
||||
} catch (Exception $e) {
|
||||
|
||||
DB::rollBack();
|
||||
|
||||
return redirect()
|
||||
->route('basicdata.teams.create')
|
||||
->with('error', 'Failed to update data. ');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
|
||||
$teams = Teams::findOrFail($id);
|
||||
$teams->teamsUsers()->delete();
|
||||
|
||||
// Hapus tim
|
||||
$teams->delete();
|
||||
|
||||
DB::commit();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Team has been deleted successfully']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete Team']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('teams.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Inisialisasi query
|
||||
$query = Teams::select('teams.id as id', 'teams.name as team_name', 'regions.name as region_name')
|
||||
->join('regions', 'teams.regions_id', '=', 'regions.id')
|
||||
->leftJoin('teams_users', 'teams.id', '=', 'teams_users.teams_id')
|
||||
->leftJoin('users', 'teams_users.user_id', '=', 'users.id')
|
||||
->addSelect('users.id as user_id', 'users.name as user_name');
|
||||
|
||||
// Filter pencarian
|
||||
if ($request->has('search') && !empty($request->get('search'))) {
|
||||
$search = $request->get('search');
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('teams.name', 'LIKE', "%$search%")
|
||||
->orWhere('regions.name', 'LIKE', "%$search%")
|
||||
->orWhere('users.name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Sorting
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Hitung total records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Pagination
|
||||
$size = $request->get('size', 10);
|
||||
$page = $request->get('page', 1);
|
||||
$offset = ($page - 1) * $size;
|
||||
|
||||
// Ambil data dengan pagination
|
||||
$data = $query->skip($offset)->take($size)->get();
|
||||
$filteredRecords = $data->count();
|
||||
$pageCount = ceil($totalRecords / $size);
|
||||
|
||||
// Ambil ID pengguna dari hasil query
|
||||
$userIds = $data->pluck('user_id')->unique();
|
||||
|
||||
// Ambil data pengguna dengan peran mereka
|
||||
$users = User::whereIn('id', $userIds)
|
||||
->with('roles')
|
||||
->get()
|
||||
->keyBy('id');
|
||||
|
||||
// Format data
|
||||
$formattedData = $data->groupBy('id')->map(function ($group) use ($users) {
|
||||
$team = $group->first();
|
||||
$team->user_team = $group->map(function ($item) use ($users) {
|
||||
$user = $users->get($item->user_id);
|
||||
return [
|
||||
'nama' => $item->user_name,
|
||||
'roles' => $user ? $user->roles->pluck('name')->toArray() : [],
|
||||
];
|
||||
})->toArray();
|
||||
return $team;
|
||||
})->values();
|
||||
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $page,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $formattedData
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new TeamPenilaianExport(), 'team-penilai.xlsx');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
179
app/Http/Controllers/TenderController.php
Normal file
179
app/Http/Controllers/TenderController.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Lpj\Models\Penawaran;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Models\PenawaranTender;
|
||||
use Modules\Lpj\Exports\PenawaranTenderExport;
|
||||
use Modules\Lpj\Http\Requests\TenderPenawaranRequest;
|
||||
use Modules\Lpj\Models\JenisLaporan;
|
||||
use Modules\Lpj\Models\KJPP;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Lpj\Models\StatusPermohonan;
|
||||
use Modules\Lpj\Models\TujuanPenilaianKJPP;
|
||||
|
||||
class TenderController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function penawaran_index()
|
||||
{
|
||||
return view('lpj::penawaran/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function penawaran_create($id)
|
||||
{
|
||||
$status = StatusPermohonan::all();
|
||||
$tujuan_penilaian_kjpp = TujuanPenilaianKJPP::all();
|
||||
$jenis_laporan = JenisLaporan::all();
|
||||
$kjpp = KJPP::all();
|
||||
$permohonan = Permohonan::find($id);
|
||||
$permohonanId = $permohonan->id;
|
||||
$permohonanNomorRegistrasi = $permohonan->nomor_registrasi;
|
||||
|
||||
return view('lpj::penawaran/create', compact('status', 'tujuan_penilaian_kjpp', 'jenis_laporan', 'kjpp', 'permohonanId', 'permohonanNomorRegistrasi'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function penawaran_store(TenderPenawaranRequest $request, $id)
|
||||
{
|
||||
$validated = $request->validated();
|
||||
|
||||
if ($validated) {
|
||||
$validated['nomor_registrasi'] = $request->nomor_registrasi;
|
||||
|
||||
$validated['nama_kjpp_sebelumnya'] = json_encode($request->input('nama_kjpp_sebelumnya'));
|
||||
|
||||
PenawaranTender::create($validated);
|
||||
|
||||
return redirect()
|
||||
->route('tender.penawaran.index')
|
||||
->with('success', 'Data Penawaran created successfully');
|
||||
} else {
|
||||
return redirect()
|
||||
->route('tender.penawaran.createPenawaran', $id)
|
||||
->with('error', 'Validation failed');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function penawaran_show($id)
|
||||
{
|
||||
return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('lpj::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function datatablesPenawaran(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('penawaran.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = PenawaranTender::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('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('nama_kjpp_sebelumnya', 'LIKE', "%$search%");
|
||||
$q->orWhere('tanggal_penilaian_sebelumnya', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function exportPenawaran()
|
||||
{
|
||||
return Excel::download(new PenawaranTenderExport, 'kjpp.xlsx');
|
||||
}
|
||||
|
||||
public function proses_penawaran_index()
|
||||
{
|
||||
return view('lpj::proses_penawaran/index');
|
||||
}
|
||||
|
||||
public function penawaran_ulang_index()
|
||||
{
|
||||
return view('lpj::penawaran_ulang/index');
|
||||
}
|
||||
}
|
||||
174
app/Http/Controllers/TujuanPenilaianKJPPController.php
Normal file
174
app/Http/Controllers/TujuanPenilaianKJPPController.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Throwable;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Models\TujuanPenilaianKJPP;
|
||||
use Modules\Lpj\Exports\TujuanPenilaianKJPPExport;
|
||||
use Modules\Lpj\Http\Requests\JenisPenilaianKJPPRequest;
|
||||
|
||||
class TujuanPenilaianKJPPController extends Controller
|
||||
{
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('lpj::tujuan_penilaian_kjpp.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('lpj::tujuan_penilaian_kjpp.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(JenisPenilaianKJPPRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
TujuanPenilaianKJPP::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.tujuan_penilaian_kjpp.index')
|
||||
->with('success', 'Tujuan Penilaian KJPP created successfully');
|
||||
} catch (Throwable $e) {
|
||||
return redirect()
|
||||
->route('basicdata.tujuan_penilaian_kjpp.create')
|
||||
->with('success', 'Failed to create Tujuan Penilaian KJPP: ' . $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('lpj::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id);
|
||||
return view('lpj::tujuan_penilaian_kjpp.create', compact('tujuanPenilaianKJPP'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(JenisPenilaianKJPPRequest $request, $id)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
if ($validate) {
|
||||
try {
|
||||
$tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id);
|
||||
$tujuanPenilaianKJPP->update($validate);
|
||||
return redirect()
|
||||
->route('basicdata.tujuan_penilaian_kjpp.index')
|
||||
->with('success', 'Tujuan Penilaian KJPP updated successfully');
|
||||
} catch (Throwable $e) {
|
||||
return redirect()
|
||||
->route('basicdata.tujuan_penilaian_kjpp.edit', $id)
|
||||
->with('success', 'Failed to update Tujuan Penilaian KJPP: ' . $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
// Delete from database
|
||||
$tujuanPenilaianKJPP = TujuanPenilaianKJPP::find($id);
|
||||
$tujuanPenilaianKJPP->delete();
|
||||
|
||||
echo json_encode(['success' => true, 'message' => 'Tujuan Penilaian deleted successfully']);
|
||||
} catch (Throwable $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Failed to delete deleted']);
|
||||
}
|
||||
}
|
||||
|
||||
public function dataForDatatables(Request $request)
|
||||
{
|
||||
if (is_null($this->user) || !$this->user->can('jenis_jaminan.view')) {
|
||||
//abort(403, 'Sorry! You are not allowed to view users.');
|
||||
}
|
||||
|
||||
// Retrieve data from the database
|
||||
$query = TujuanPenilaianKJPP::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('code', 'LIKE', "%$search%");
|
||||
$q->orWhere('name', 'LIKE', "%$search%");
|
||||
});
|
||||
}
|
||||
|
||||
// Apply sorting if provided
|
||||
if ($request->has('sortOrder') && !empty($request->get('sortOrder'))) {
|
||||
$order = $request->get('sortOrder');
|
||||
$column = $request->get('sortField');
|
||||
$query->orderBy($column, $order);
|
||||
}
|
||||
|
||||
// Get the total count of records
|
||||
$totalRecords = $query->count();
|
||||
|
||||
// Apply pagination if provided
|
||||
if ($request->has('page') && $request->has('size')) {
|
||||
$page = $request->get('page');
|
||||
$size = $request->get('size');
|
||||
$offset = ($page - 1) * $size; // Calculate the offset
|
||||
|
||||
$query->skip($offset)->take($size);
|
||||
}
|
||||
|
||||
// Get the filtered count of records
|
||||
$filteredRecords = $query->count();
|
||||
|
||||
// Get the data for the current page
|
||||
$data = $query->get();
|
||||
|
||||
// Calculate the page count
|
||||
$pageCount = ceil($totalRecords / $request->get('size'));
|
||||
|
||||
// Calculate the current page number
|
||||
$currentPage = 0 + 1;
|
||||
|
||||
// Return the response data as a JSON object
|
||||
return response()->json([
|
||||
'draw' => $request->get('draw'),
|
||||
'recordsTotal' => $totalRecords,
|
||||
'recordsFiltered' => $filteredRecords,
|
||||
'pageCount' => $pageCount,
|
||||
'page' => $currentPage,
|
||||
'totalCount' => $totalRecords,
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
return Excel::download(new TujuanPenilaianKJPPExport, 'jenis_laporan.xlsx');
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Modules\Lpj\Rules\UniqueCifExceptZero;
|
||||
|
||||
class DebitureRequest extends FormRequest
|
||||
{
|
||||
@@ -21,7 +22,7 @@
|
||||
'nomor_rekening' => 'nullable|string|max:50',
|
||||
'name' => 'required',
|
||||
'registered_at' => 'nullable|date',
|
||||
'npwp' => 'nullable|string|max:16',
|
||||
'npwp' => 'nullable|string|min:15|max:16',
|
||||
'email' => 'nullable|email',
|
||||
'phone' => 'nullable|string|max:15',
|
||||
'address' => 'nullable|string',
|
||||
@@ -29,10 +30,10 @@
|
||||
'status' => 'nullable|boolean'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['cif'] = 'nullable|unique:debitures,cif,' . $this->id;
|
||||
} else {
|
||||
$rules['cif'] = 'nullable|unique:debitures,cif';
|
||||
if($this->method() == 'PUT'){
|
||||
$rules['cif'] = ['required', new UniqueCifExceptZero($this->id)];
|
||||
}else{
|
||||
$rules['cif'] = ['required', new UniqueCifExceptZero(null)];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
|
||||
43
app/Http/Requests/DetailDokumenJaminanRequest.php
Normal file
43
app/Http/Requests/DetailDokumenJaminanRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DokumenJaminanRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'pemilik_jaminan_id' => 'required',
|
||||
'jenis_jaminan_id' => 'required',
|
||||
'jenis_legalitas_jaminan_id' => 'required',
|
||||
'dokumen_jaminan' => 'nullable|file|mimes:pdf',
|
||||
'keterangan' => 'nullable|string|max:255',
|
||||
'province_code' => 'nullable|exists:provinces,code',
|
||||
'city_code' => 'nullable|exists:cities,code',
|
||||
'district_code' => 'nullable|exists:districts,code',
|
||||
'village_code' => 'nullable|exists:villages,code',
|
||||
'name' => 'required',
|
||||
'address' => 'nullable|string',
|
||||
'postal_code' => 'nullable|string|max:10',
|
||||
'status' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize()
|
||||
: bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,10 @@
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'pemilik_jaminan_id' => 'required',
|
||||
'jenis_jaminan_id' => 'required',
|
||||
'jenis_legalitas_jaminan_id' => 'required',
|
||||
'dokumen_jaminan' => 'nullable|file|mimes:pdf',
|
||||
'keterangan' => 'nullable|string|max:255',
|
||||
'province_code' => 'nullable|exists:provinces,code',
|
||||
'city_code' => 'nullable|exists:cities,code',
|
||||
'district_code' => 'nullable|exists:districts,code',
|
||||
'village_code' => 'nullable|exists:villages,code',
|
||||
'name' => 'required',
|
||||
'address' => 'nullable|string',
|
||||
'postal_code' => 'nullable|string|max:10',
|
||||
'status' => 'nullable|boolean',
|
||||
|
||||
46
app/Http/Requests/IjinUsahaRequest.php
Normal file
46
app/Http/Requests/IjinUsahaRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class IjinUsahaRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'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!'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class JenisJaminanRequest extends FormRequest
|
||||
{
|
||||
@@ -12,16 +14,12 @@
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|max:255',
|
||||
return [
|
||||
'code' => 'required|max:5',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
'jenis_legalitas_jaminan_id' => 'nullable',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_jaminan,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_jaminan,code';
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,4 +30,21 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function prepareForValidation()
|
||||
: void
|
||||
{
|
||||
if ($this->method() == 'POST') {
|
||||
$this->merge([
|
||||
'code' => IdGenerator::generate(
|
||||
['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'jenis_legalitas_jaminan_id' => json_encode($this->jenis_legalitas_jaminan_id),
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Http/Requests/JenisLaporanRequest.php
Normal file
46
app/Http/Requests/JenisLaporanRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class JenisLaporanRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'code' => 'required|max:5',
|
||||
'name' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:5|unique:jenis_laporan,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:5|unique:jenis_laporan,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode Jenis Laporan Wajib diisi!',
|
||||
'code.max' => 'Kode Jenis Laporan maksimum 5 huruf!',
|
||||
'code.unique' => 'Kode Jenis Laporan tidak boleh sama!',
|
||||
'name.required' => 'Nama Jenis Laporan Wajib diisi!',
|
||||
'name.max' => 'Nama Jenis Laporan Wajib diisi!'
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class JenisLegalitasJaminanRequest extends FormRequest
|
||||
{
|
||||
@@ -12,16 +14,11 @@
|
||||
public function rules()
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
return [
|
||||
'code' => 'required|max:6',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:jenis_legalitas_jaminan,code';
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,4 +29,20 @@
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
if($this->method() == 'POST' && $this->code == null) {
|
||||
$this->merge([
|
||||
'code' => IdGenerator::generate(
|
||||
['table' => 'jenis_legalitas_jaminan', 'length' => 6, 'prefix' => 'JLJ', 'field' => 'code'],
|
||||
),
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
} else {
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal file
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class JenisPenilaianKJPPRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'code' => 'required|max:5',
|
||||
'name' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'code.max' => 'Kode Tujuan Penilaian KJPP maksimum 5 huruf!',
|
||||
'code.unique' => 'Kode Tujuan Penilaian KJPP tidak boleh sama!',
|
||||
'name.required' => 'Nama Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'name.max' => 'Nama Tujuan Penilaian KJPP Wajib diisi!'
|
||||
];
|
||||
}
|
||||
}
|
||||
41
app/Http/Requests/JenisPenilaianRequest.php
Normal file
41
app/Http/Requests/JenisPenilaianRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class JenisPenilaianRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
$rules = [
|
||||
'name' => 'required|string|max:255',
|
||||
'status' => 'nullable|boolean',
|
||||
'authorized_at' => 'nullable|datetime',
|
||||
'authorized_status' => 'nullable|string|max:1',
|
||||
'authorized_by' => 'nullable|exists:users,id',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
|
||||
$rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code,' . $this->id;
|
||||
|
||||
} else {
|
||||
$rules['code'] = 'required|string|max:3|unique:jenis_penilaian,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
111
app/Http/Requests/KJPPRequest.php
Normal file
111
app/Http/Requests/KJPPRequest.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use daengdeni\LaravelIdGenerator\IdGenerator;
|
||||
|
||||
class KJPPRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'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' => 'required|array',
|
||||
'ijin_usaha_id.*' => 'exists:ijin_usaha,code',
|
||||
'jenis_aset_id' => 'required|array',
|
||||
'jenis_aset_id.*' => 'exists:jenis_jaminan,code',
|
||||
'attachment' => 'nullable|mimes:pdf|max:1024'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:kjpp,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:kjpp,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode KJPP Wajib diisi!',
|
||||
'code.max' => 'Kode KJPP maksimal 255 huruf!',
|
||||
'code.unique' => 'Kode KJPP tidak boleh sama!',
|
||||
'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 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!',
|
||||
'ijin_usaha_id.required' => 'Ijin Usaha Wajib diisi!',
|
||||
'ijin_usaha_id.min' => 'Ijin Usaha Wajib diisi minimal satu atau lebih!',
|
||||
'jenis_aset_id.required' => 'Jenis Aset Wajib diisi!',
|
||||
'jenis_aset_id.min' => 'Jenis Aset Wajib diisi minimal satu atau lebih!',
|
||||
'attachment.mimes' => 'Attachment harus berformat pdf!',
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,8 @@
|
||||
'status' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id;
|
||||
|
||||
//$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id;
|
||||
$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,debiture_id,' . $this->debiture_id;
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
59
app/Http/Requests/PenilaianRequest.php
Normal file
59
app/Http/Requests/PenilaianRequest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PenilaianRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
|
||||
$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',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
// Menetapkan nilai default untuk 'status' jika tidak ada dalam request
|
||||
$this->merge([
|
||||
'status' => $this->status ?? 'assign',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -14,13 +14,17 @@
|
||||
: array
|
||||
{
|
||||
$rules = [
|
||||
'nomor_registrasi' => 'nullable|string|max:10',
|
||||
'tanggal_permohonan' => 'nullable|date',
|
||||
'user_id' => 'nullable|exists:users,id',
|
||||
'branch_id' => 'required|exists:branches,id',
|
||||
'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id',
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'status' => 'required|string',
|
||||
'nomor_registrasi' => 'nullable|string|max:10',
|
||||
'tanggal_permohonan' => 'nullable|date',
|
||||
'user_id' => 'nullable|exists:users,id',
|
||||
'branch_id' => 'required|exists:branches,id',
|
||||
'tujuan_penilaian_id' => 'required|exists:tujuan_penilaian,id',
|
||||
'debiture_id' => 'required|exists:debitures,id',
|
||||
'status' => 'required|string',
|
||||
'jenis_fasilitas_kredit_id' => 'required|exists:jenis_fasilitas_kredit,id',
|
||||
'nilai_plafond_id' => 'required|exists:nilai_plafond,id',
|
||||
'status_bayar' => 'required|string',
|
||||
'nilai_njop' => 'nullable|numeric'
|
||||
];
|
||||
|
||||
return $rules;
|
||||
@@ -40,10 +44,11 @@
|
||||
if (!$this->id) {
|
||||
$this->merge([
|
||||
'nomor_registrasi' => IdGenerator::generate(
|
||||
['table' => 'permohonan', 'length' => 10, 'prefix'=>'REG', 'field' => 'nomor_registrasi'],
|
||||
['table' => 'permohonan', 'length' => 10, 'prefix' => 'REG', 'field' => 'nomor_registrasi'],
|
||||
),
|
||||
'tanggal_permohonan' => date('Y-m-d'),
|
||||
'user_id' => auth()->user()->id,
|
||||
'branch_id' => auth()->user()->branch_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
38
app/Http/Requests/RegionRequest.php
Normal file
38
app/Http/Requests/RegionRequest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RegionRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string|max:255',
|
||||
'status' => 'nullable|boolean',
|
||||
'authorized_at' => 'nullable|datetime',
|
||||
'authorized_status' => 'nullable|string|max:1',
|
||||
'authorized_by' => 'nullable|exists:users,id',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|string|max:3|unique:regions,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|string|max:3|unique:regions,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
$rules = [
|
||||
'description' => 'nullable|max:255',
|
||||
'status' => 'required|boolean',
|
||||
'slug' => 'nullable|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
@@ -37,9 +38,9 @@
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
return $this->merge([
|
||||
'status' => isset($this->status) ? 1 : 0,
|
||||
'slug'=> Str::slug($this->name)
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
41
app/Http/Requests/TeamsRequest.php
Normal file
41
app/Http/Requests/TeamsRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TeamsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string|max:255',
|
||||
'status' => 'nullable|boolean',
|
||||
'regions_id' => 'required|nullable|exists:regions,id',
|
||||
'user.*' => 'nullable|exists:users,id',
|
||||
'authorized_at' => 'nullable|datetime',
|
||||
'authorized_status' => 'nullable|string|max:1',
|
||||
'authorized_by' => 'nullable|exists:users,id',
|
||||
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|string|max:3|unique:teams,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|string|max:3|unique:teams,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
75
app/Http/Requests/TenderPenawaranRequest.php
Normal file
75
app/Http/Requests/TenderPenawaranRequest.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TenderPenawaranRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'nama_kjpp_sebelumnya' => 'required|array',
|
||||
'nama_kjpp_sebelumnya.*' => 'exists:kjpp,name',
|
||||
'biaya_kjpp_sebelumnya' => 'required|numeric',
|
||||
'tanggal_penilaian_sebelumnya' => 'required',
|
||||
'nomor_registrasi' => 'required',
|
||||
'tujuan_penilaian_kjpp_id' => 'required',
|
||||
'jenis_laporan_id' => 'required',
|
||||
'start_date' => 'required',
|
||||
'end_date' => 'required',
|
||||
'catatan' => 'nullable',
|
||||
'status' => 'required'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:penawaran,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:penawaran,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode Penawaran Wajib diisi!',
|
||||
'code.max' => 'Kode Penawaran maksimal 255 huruf!',
|
||||
'code.unique' => 'Kode Penawaran tidak boleh sama!',
|
||||
'nama_kjpp_sebelumnya.required' => 'Nama KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.required' => 'Biaya KJPP Sebelumnya Wajib diisi!',
|
||||
'biaya_kjpp_sebelumnya.numeric' => 'Biaya KJPP Sebelumnya harus berupa angka!',
|
||||
'tanggal_penilaian_sebelumnya.required' => 'Tanggal Penilaian Sebelumnya Wajib diisi!',
|
||||
'nomor_registrasi.required' => 'Nomor Registrasi Wajib diisi!',
|
||||
'tujuan_penilaian_kjpp_id.required' => 'Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'jenis_laporan_id.required' => 'Jenis Laporan Wajib diisi!',
|
||||
'start_date.required' => 'Tanggal Awal Wajib diisi!',
|
||||
'end_date.required' => 'Tanggal Akhir Wajib diisi!',
|
||||
'status.required' => 'Status Wajib diisi!'
|
||||
];
|
||||
}
|
||||
|
||||
public function withValidator($validator)
|
||||
{
|
||||
$validator->after(function ($validator) {
|
||||
$startDate = strtotime($this->input('start_date'));
|
||||
$endDate = strtotime($this->input('end_date'));
|
||||
|
||||
if ($endDate < $startDate) {
|
||||
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,8 @@
|
||||
return $this->belongsTo(Village::class, 'village_code', 'code');
|
||||
}
|
||||
|
||||
public function documents(){
|
||||
return $this->hasMany(DokumenJaminan::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
34
app/Models/DetailDokumenJaminan.php
Normal file
34
app/Models/DetailDokumenJaminan.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Modules\Location\Models\City;
|
||||
use Modules\Location\Models\District;
|
||||
use Modules\Location\Models\Province;
|
||||
use Modules\Location\Models\Village;
|
||||
use Modules\Lpj\Database\Factories\DokumenJaminanFactory;
|
||||
|
||||
class DetailDokumenJaminan extends Base
|
||||
{
|
||||
protected $table = 'detail_dokumen_jaminan';
|
||||
protected $fillable = [
|
||||
'dokumen_jaminan_id',
|
||||
'jenis_legalitas_jaminan_id',
|
||||
'name',
|
||||
'dokumen_jaminan',
|
||||
'keterangan',
|
||||
|
||||
'status',
|
||||
'authorized_at',
|
||||
'authorized_status',
|
||||
'authorized_by',
|
||||
];
|
||||
|
||||
public function jenisLegalitasJaminan(){
|
||||
return $this->belongsTo(JenisLegalitasJaminan::class, 'jenis_legalitas_jaminan_id', 'id');
|
||||
}
|
||||
|
||||
public function dokumenJaminan(){
|
||||
return $this->belongsTo(DokumenJaminan::class, 'dokumen_jaminan_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -16,10 +16,6 @@
|
||||
'permohonan_id',
|
||||
'pemilik_jaminan_id',
|
||||
'jenis_jaminan_id',
|
||||
'jenis_legalitas_jaminan_id',
|
||||
'name',
|
||||
'dokumen_jaminan',
|
||||
'keterangan',
|
||||
'province_code',
|
||||
'city_code',
|
||||
'district_code',
|
||||
@@ -64,11 +60,11 @@
|
||||
return $this->belongsTo(JenisJaminan::class, 'jenis_jaminan_id', 'id');
|
||||
}
|
||||
|
||||
public function jenisLegalitasJaminan(){
|
||||
return $this->belongsTo(JenisLegalitasJaminan::class, 'jenis_legalitas_jaminan_id', 'id');
|
||||
}
|
||||
|
||||
public function permohonan(){
|
||||
return $this->belongsTo(Permohonan::class, 'permohonan_id', 'id');
|
||||
}
|
||||
|
||||
public function detail(){
|
||||
return $this->hasMany(DetailDokumenJaminan::class, 'dokumen_jaminan_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
18
app/Models/IjinUsaha.php
Normal file
18
app/Models/IjinUsaha.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class IjinUsaha extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'ijin_usaha';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = ['code', 'name'];
|
||||
}
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Modules\Lpj\Database\Factories\JenisJaminanFactory;
|
||||
|
||||
class JenisJaminan extends Base
|
||||
{
|
||||
protected $table = 'jenis_jaminan';
|
||||
protected $fillable = ['code', 'name'];
|
||||
}
|
||||
class JenisJaminan extends Base
|
||||
{
|
||||
protected $table = 'jenis_jaminan';
|
||||
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id'];
|
||||
}
|
||||
|
||||
22
app/Models/JenisLaporan.php
Normal file
22
app/Models/JenisLaporan.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\JenisLaporanFactory;
|
||||
|
||||
class JenisLaporan extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
|
||||
// Define the table if not using default table naming
|
||||
protected $table = 'jenis_laporan';
|
||||
|
||||
|
||||
protected $fillable = ['code', 'name'];
|
||||
}
|
||||
@@ -7,5 +7,5 @@
|
||||
class JenisLegalitasJaminan extends Base
|
||||
{
|
||||
protected $table = 'jenis_legalitas_jaminan';
|
||||
protected $fillable = ['code', 'name'];
|
||||
protected $fillable = ['code', 'name','slug'];
|
||||
}
|
||||
|
||||
25
app/Models/JenisPenilaian.php
Normal file
25
app/Models/JenisPenilaian.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Lpj\Database\Factories\JenisPenilaianFactory;
|
||||
use Modules\Lpj\Models\Penilaian;
|
||||
class JenisPenilaian extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'jenis_penilaian';
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by',
|
||||
'created_at', 'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
|
||||
];
|
||||
|
||||
public function penilaian(){
|
||||
return $this->hasMany(Penilaian::class , 'jenis_penilaian_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
46
app/Models/KJPP.php
Normal file
46
app/Models/KJPP.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Location\Models\Province;
|
||||
|
||||
// use Modules\Lpj\Database\Factories\KJPPFactory;
|
||||
|
||||
class KJPP extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// Define the table if not using default table naming
|
||||
protected $table = 'kjpp';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
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'
|
||||
];
|
||||
}
|
||||
18
app/Models/PenawaranTender.php
Normal file
18
app/Models/PenawaranTender.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class PenawaranTender extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'penawaran';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
}
|
||||
56
app/Models/Penilaian.php
Normal file
56
app/Models/Penilaian.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\PenilaianFactory;
|
||||
use Modules\Lpj\Models\JenisPenilaian;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
use Modules\Lpj\Models\Permohonan;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
|
||||
|
||||
class Penilaian extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'penilaian';
|
||||
protected $fillable = [
|
||||
'jenis_penilaian_id', 'teams_id', 'user_id', 'tanggal_kunjungan', 'keterangan','nomor_registrasi','penilaian_id','surveyor_id','penilai_surveyor_id',
|
||||
'status', 'authorized_status', 'authorized_at', 'authorized_by', 'created_at',
|
||||
'created_by', 'updated_at', 'updated_by', 'deleted_at', 'deleted_by'
|
||||
];
|
||||
|
||||
public function jenis_penilaian(){
|
||||
return $this->belongsTo(JenisPenilaian::class, 'jenis_penilaian_id', 'id');
|
||||
}
|
||||
|
||||
public function teams(){
|
||||
return $this->belongsTo(Teams::class, 'teams_id', 'id');
|
||||
}
|
||||
|
||||
public function users(){
|
||||
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
|
||||
{
|
||||
@@ -17,6 +19,10 @@ class Permohonan extends Base
|
||||
'branch_id',
|
||||
'tujuan_penilaian_id',
|
||||
'debiture_id',
|
||||
'keterangan',
|
||||
'dokumen',
|
||||
'jenis_fasilitas_kredit_id',
|
||||
'nilai_plafond_id',
|
||||
'status',
|
||||
'authorized_at',
|
||||
'authorized_status',
|
||||
@@ -26,7 +32,10 @@ class Permohonan extends Base
|
||||
'registrasi_by',
|
||||
'registrasi_at',
|
||||
'jenis_penilaian_id',
|
||||
'region_id'
|
||||
'region_id',
|
||||
// andy add
|
||||
'status_bayar',
|
||||
'nilai_njop'
|
||||
];
|
||||
|
||||
public function user(){
|
||||
@@ -48,4 +57,16 @@ class Permohonan extends Base
|
||||
public function documents(){
|
||||
return $this->hasMany(DokumenJaminan::class);
|
||||
}
|
||||
|
||||
public function nilaiPlafond(){
|
||||
return $this->belongsTo(NilaiPlafond::class);
|
||||
}
|
||||
|
||||
public function jenisFasilitasKredit(){
|
||||
return $this->belongsTo(JenisFasilitasKredit::class);
|
||||
}
|
||||
|
||||
public function penilaian(){
|
||||
return $this->belongsTo(Penilaian::class, 'nomor_registrasi', 'nomor_registrasi');
|
||||
}
|
||||
}
|
||||
|
||||
26
app/Models/Regions.php
Normal file
26
app/Models/Regions.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\RegionsFactory;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
|
||||
class Regions extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'regions';
|
||||
|
||||
protected $fillable = [
|
||||
'code', 'name', 'status', 'authorized_status', 'authorized_at', 'authorized_by'
|
||||
];
|
||||
|
||||
public function teams(){
|
||||
return $this->hasMany(Teams::class, 'regions_id', 'id');
|
||||
}
|
||||
}
|
||||
40
app/Models/Teams.php
Normal file
40
app/Models/Teams.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\TeamsFactory;
|
||||
use Modules\Lpj\Models\TeamsUsers;
|
||||
use Modules\Lpj\Models\Regions;
|
||||
use Modules\Lpj\Models\Penilaian;
|
||||
|
||||
|
||||
class Teams extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'teams';
|
||||
protected $fillable = [
|
||||
'regions_id', 'code', 'name', 'status', 'authorized_status', 'authorized_at',
|
||||
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
|
||||
'deleted_at', 'deleted_by'
|
||||
];
|
||||
|
||||
public function regions(){
|
||||
return $this->belongsTo(Regions::class, 'regions_id', 'id');
|
||||
}
|
||||
|
||||
public function teamsUsers(){
|
||||
return $this->hasMany(TeamsUsers::class, 'teams_id', 'id');
|
||||
}
|
||||
|
||||
public function penilaian(){
|
||||
return $this->hasMany(Penilaian::class, 'teams_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
33
app/Models/TeamsUsers.php
Normal file
33
app/Models/TeamsUsers.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Lpj\Database\Factories\TeamsUsersFactory;
|
||||
use Modules\Usermanagement\Models\User;
|
||||
use Modules\Lpj\Models\Teams;
|
||||
|
||||
class TeamsUsers extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $table = 'teams_users';
|
||||
protected $fillable = [
|
||||
'teams_id', 'user_id', 'status', 'authorized_status', 'authorized_at',
|
||||
'authorized_by', 'created_at', 'created_by', 'updated_at', 'updated_by',
|
||||
'deleted_at', 'deleted_by'
|
||||
];
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo(Teams::class, 'teams_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
19
app/Models/TujuanPenilaianKJPP.php
Normal file
19
app/Models/TujuanPenilaianKJPP.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Lpj\Database\Factories\TujuanPenilaianKJPPFactory;
|
||||
|
||||
class TujuanPenilaianKJPP extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'tujuan_penilaian_kjpp';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = ['code', 'name'];
|
||||
}
|
||||
25
app/Rules/UniqueCifExceptZero.php
Normal file
25
app/Rules/UniqueCifExceptZero.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Modules\Lpj\Models\Debiture;
|
||||
|
||||
class UniqueCifExceptZero implements ValidationRule
|
||||
{
|
||||
public function __construct($id = null)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function validate($attribute, $value, $fail): void
|
||||
{
|
||||
if (Debiture::where($attribute, $value)
|
||||
->where('id', '!=', $this->id)
|
||||
->where($attribute, '!=', '000000')
|
||||
->exists()) {
|
||||
$fail('The :attribute field must be uniquse.'.$this->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user