68 lines
2.2 KiB
PHP
68 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Construction;
|
||
|
|
|
||
|
|
use App\Models\Construction\Contract;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class ContractFromBiddingRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
// 기본 정보 (입찰에서 가져오므로 optional)
|
||
|
|
'project_name' => 'nullable|string|max:255',
|
||
|
|
|
||
|
|
// 거래처 정보 (입찰에서 가져오므로 optional)
|
||
|
|
'partner_id' => 'nullable|integer',
|
||
|
|
'partner_name' => 'nullable|string|max:255',
|
||
|
|
|
||
|
|
// 담당자 정보
|
||
|
|
'contract_manager_id' => 'nullable|integer',
|
||
|
|
'contract_manager_name' => 'nullable|string|max:100',
|
||
|
|
'construction_pm_id' => 'nullable|integer',
|
||
|
|
'construction_pm_name' => 'nullable|string|max:100',
|
||
|
|
|
||
|
|
// 계약 상세 (입찰에서 가져오므로 optional)
|
||
|
|
'total_locations' => 'nullable|integer|min:0',
|
||
|
|
'contract_amount' => 'nullable|numeric|min:0',
|
||
|
|
'contract_start_date' => 'nullable|date',
|
||
|
|
'contract_end_date' => 'nullable|date|after_or_equal:contract_start_date',
|
||
|
|
|
||
|
|
// 상태 정보
|
||
|
|
'status' => [
|
||
|
|
'nullable',
|
||
|
|
Rule::in([Contract::STATUS_PENDING, Contract::STATUS_COMPLETED]),
|
||
|
|
],
|
||
|
|
'stage' => [
|
||
|
|
'nullable',
|
||
|
|
Rule::in([
|
||
|
|
Contract::STAGE_ESTIMATE_SELECTED,
|
||
|
|
Contract::STAGE_ESTIMATE_PROGRESS,
|
||
|
|
Contract::STAGE_DELIVERY,
|
||
|
|
Contract::STAGE_INSTALLATION,
|
||
|
|
Contract::STAGE_INSPECTION,
|
||
|
|
Contract::STAGE_OTHER,
|
||
|
|
]),
|
||
|
|
],
|
||
|
|
|
||
|
|
// 기타
|
||
|
|
'remarks' => 'nullable|string',
|
||
|
|
'is_active' => 'nullable|boolean',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'contract_end_date.after_or_equal' => __('validation.after_or_equal', ['attribute' => '계약종료일', 'date' => '계약시작일']),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|