Merge branch 'staging' into feature/senior-officer

This commit is contained in:
majid
2024-11-05 08:38:22 +07:00
130 changed files with 8934 additions and 2169 deletions

View File

@@ -1,40 +0,0 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class BranchRequest 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:branches,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:branches,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -1,41 +0,0 @@
<?php
namespace Modules\Lpj\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CurrencyRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|string|max:255',
'decimal_places' => 'nullable|integer|between:0,3',
'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:currencies,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:currencies,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}

View File

@@ -4,6 +4,7 @@
use Illuminate\Foundation\Http\FormRequest;
use Modules\Lpj\Rules\UniqueCifExceptZero;
use Modules\Lpj\Rules\UniqueExcept;
class DebitureRequest extends FormRequest
{

View File

@@ -15,9 +15,11 @@
: array
{
return [
'code' => 'required|max:6',
'name' => 'required|max:255',
'slug' => 'required|max:255',
'code' => 'required|max:6',
'name' => 'required|max:255',
'slug' => 'required|max:255',
'custom_field' => 'nullable|max:255',
'custom_field_type' => 'nullable|max:255',
];
}
@@ -32,7 +34,7 @@
public function prepareForValidation()
{
if($this->method() == 'POST' && $this->code == null) {
if ($this->method() == 'POST' && $this->code == null) {
$this->merge([
'code' => IdGenerator::generate(
['table' => 'jenis_legalitas_jaminan', 'length' => 6, 'prefix' => 'JLJ', 'field' => 'code'],
@@ -41,7 +43,7 @@
]);
} else {
$this->merge([
'slug' => Str::slug($this->name),
'slug' => Str::slug($this->name),
]);
}
}

View File

@@ -26,6 +26,7 @@
'address' => 'nullable|string',
'postal_code' => 'nullable|string|max:10',
'status' => 'nullable|boolean',
'detail_sertifikat' => 'nullable|string|max:255',
];
//$rules['nomor_id'] = 'nullable|max:16|unique:pemilik_jaminan,nomor_id,debiture_id,' . $this->debiture_id;
@@ -41,4 +42,24 @@
{
return true;
}
public function prepareForValidation() {
$detailSertifikat = [];
$names = $this->input('detail_sertifikat.name', []);
$nomorIds = $this->input('detail_sertifikat.nomor_id', []);
foreach ($names as $index => $name) {
if (isset($nomorIds[$index])) {
$detailSertifikat[] = [
'name' => $name,
'nomor_id' => $nomorIds[$index]
];
}
}
$this->merge([
'detail_sertifikat' => json_encode($detailSertifikat),
]);
}
}

View File

@@ -63,13 +63,17 @@ class TenderPenawaranRequest extends FormRequest
$endDate = strtotime($this->input('end_date'));
$today = strtotime(date('Y-m-d'));
// Jika dalam keadaan tambah penawaran maka munculkan pesan ini
if ($this->method() !== 'PUT') {
if ($startDate < $today) {
$validator->errors()->add('start_date', 'Tanggal Awal tidak boleh sebelum hari ini.');
}
}
if ($endDate < $startDate) {
$validator->errors()->add('end_date', 'Tanggal Akhir tidak boleh lebih awal dari Tanggal Awal.');
}
if ($startDate < $today) {
$validator->errors()->add('start_date', 'Tanggal Awal tidak boleh sebelum hari ini.');
}
// Validasi minimal 3 pilihan pada nama_kjpp
$namaKjpp = $this->input('kjpp', []);