Merge branch 'staging' into feature/senior-officer
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
|
||||
];
|
||||
}
|
||||
}
|
||||
49
app/Exports/KJPPExport.php
Normal file
49
app/Exports/KJPPExport.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\IjinUsaha;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class KJPPExport implements WithColumnFormatting, WithHeadings, FromCollection, withMapping
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return IjinUsaha::all();
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row->id,
|
||||
$row->code,
|
||||
$row->name,
|
||||
$row->jenis_kantor,
|
||||
$row->created_at
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ID',
|
||||
'Code',
|
||||
'Name',
|
||||
'Jenis Kantor / Cabang',
|
||||
'Created At'
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_NUMBER,
|
||||
'B' => NumberFormat::FORMAT_NUMBER,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME
|
||||
];
|
||||
}
|
||||
}
|
||||
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');
|
||||
}
|
||||
}
|
||||
166
app/Http/Controllers/KJPPController.php
Normal file
166
app/Http/Controllers/KJPPController.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Lpj\Models\KJPP;
|
||||
use Illuminate\Http\Response;
|
||||
use Modules\Lpj\Models\Branch;
|
||||
use Modules\Lpj\Models\IjinUsaha;
|
||||
use Modules\Lpj\Exports\KJPPExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Modules\Lpj\Models\JenisJaminan;
|
||||
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();
|
||||
|
||||
return view('lpj::kjpp.create', compact('branch', 'ijin_usaha', 'jenis_aset', 'provinces'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(KJPPRequest $request)
|
||||
{
|
||||
$validate = $request->validated();
|
||||
|
||||
|
||||
if ($validate) {
|
||||
$file = $request->file('attachment');
|
||||
$filename = $file ? time() . '.' . $file->getClientOriginalExtension() : 'default.pdf';
|
||||
|
||||
if ($file) {
|
||||
$file->storeAs('uploads_pdf', $filename, 'public');
|
||||
} else {
|
||||
Storage::copy('/home/bagi/Downloads/default.pdf', 'public/uploads_pdf/' . $filename);
|
||||
}
|
||||
|
||||
dd($validate);
|
||||
KJPP::create($validate);
|
||||
return redirect()
|
||||
->route('basicdata.kjpp.index')
|
||||
->with('success', 'Ijin Usaha created successfully');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function 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(KJPP $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
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, 'currency.xlsx');
|
||||
}
|
||||
}
|
||||
94
app/Http/Controllers/TenderController.php
Normal file
94
app/Http/Controllers/TenderController.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?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\Penawaran;
|
||||
|
||||
class TenderController extends Controller
|
||||
{
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
return view('lpj::penawaran/create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function penawaran_store(Request $request): RedirectResponse
|
||||
{
|
||||
// $validated = $request->validate([
|
||||
// 'nama_kjpp_sebelumnya' => 'required|string',
|
||||
// 'biaya_kjpp_sebelumnya' => 'required|numeric',
|
||||
// 'tgl_penilaian_sebelumnya' => 'required|date',
|
||||
// 'nama_kjpp_1' => 'required|exists:kjpps,id',
|
||||
// 'nama_kjpp_2' => 'required|exists:kjpps,id',
|
||||
// 'nama_kjpp_3' => 'required|exists:kjpps,id',
|
||||
// 'data_jaminan_legalitas' => 'required|string',
|
||||
// 'tujuan_penilaian' => 'required|in:Penjaminan Hutang,Lelang,Revaluasi Aset',
|
||||
// 'jenis_laporan' => 'required|in:Short report,Full report',
|
||||
// 'batas_waktu' => 'required|date',
|
||||
// 'catatan' => 'nullable|string'
|
||||
// ]);
|
||||
|
||||
// Penawaran::create($validated);
|
||||
|
||||
// return redirect()->back()->with('success', 'Data berhasil disimpan!');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function proses_penawaran_index()
|
||||
{
|
||||
return view('lpj::proses_penawaran/index');
|
||||
}
|
||||
|
||||
public function penawaran_ulang_index()
|
||||
{
|
||||
return view('lpj::penawaran_ulang/index');
|
||||
}
|
||||
}
|
||||
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!'
|
||||
];
|
||||
}
|
||||
}
|
||||
122
app/Http/Requests/KJPPRequest.php
Normal file
122
app/Http/Requests/KJPPRequest.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?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.*' => 'nullable',
|
||||
'jenis_jaminan.*' => 'nullable',
|
||||
'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 prepareForValidation(): void
|
||||
{
|
||||
if ($this->method() == 'POST') {
|
||||
$this->merge([
|
||||
'code' => IdGenerator::generate(
|
||||
['table' => 'ijin_usaha', 'length' => 5, 'prefix' => 'IU', 'field' => 'code'],
|
||||
['table' => 'jenis_jaminan', 'length' => 5, 'prefix' => 'JJ', 'field' => 'code'],
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'ijin_usaha_id' => json_encode($this->ijin_usaha_id),
|
||||
'jenis_aset_id' => json_encode($this->jenis_aset_id)
|
||||
]);
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode KJPP 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!',
|
||||
'attachment.mimes' => 'Attachment harus berformat pdf!',
|
||||
'attachment.max' => 'Attachment berukuran maksimum 1 MB!',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,21 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
public function kjpp()
|
||||
{
|
||||
return $this->belongsTo(KJPP::class);
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Models/IjinUsaha.php
Normal file
24
app/Models/IjinUsaha.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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'];
|
||||
|
||||
// relasi ke kjpp
|
||||
public function kjpp()
|
||||
{
|
||||
return $this->belongsTo(KJPP::class);
|
||||
}
|
||||
}
|
||||
@@ -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,9 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
class JenisJaminan extends Base
|
||||
class JenisJaminan extends Base
|
||||
{
|
||||
protected $table = 'jenis_jaminan';
|
||||
protected $fillable = ['code', 'name', 'slug', 'jenis_legalitas_jaminan_id'];
|
||||
|
||||
// relasi ke kjpp
|
||||
public function kjpp()
|
||||
{
|
||||
protected $table = 'jenis_jaminan';
|
||||
protected $fillable = ['code', 'name','slug','jenis_legalitas_jaminan_id'];
|
||||
return $this->belongsTo(KJPP::class);
|
||||
}
|
||||
}
|
||||
|
||||
62
app/Models/KJPP.php
Normal file
62
app/Models/KJPP.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
// 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'
|
||||
];
|
||||
|
||||
// relasi ke branch
|
||||
public function branch()
|
||||
{
|
||||
return $this->hasOne(Branch::class, 'jenis_kantor');
|
||||
}
|
||||
|
||||
// relasi ke jenis aset
|
||||
public function jenis_aset()
|
||||
{
|
||||
return $this->hasMany(JenisJaminan::class, 'jenis_aset_id');
|
||||
}
|
||||
|
||||
// relasi ke ijin usaha
|
||||
public function ijin_usaha()
|
||||
{
|
||||
return $this->hasMany(IjinUsaha::class, 'ijin_usaha_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user