74 lines
2.3 KiB
PHP
74 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Construction;
|
||
|
|
|
||
|
|
use App\Models\Construction\Contract;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Validation\Rule;
|
||
|
|
|
||
|
|
class ContractUpdateRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
// 기본 정보
|
||
|
|
'contract_code' => 'sometimes|string|max:50',
|
||
|
|
'project_name' => 'sometimes|string|max:255',
|
||
|
|
|
||
|
|
// 거래처 정보
|
||
|
|
'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',
|
||
|
|
|
||
|
|
// 계약 상세
|
||
|
|
'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,
|
||
|
|
]),
|
||
|
|
],
|
||
|
|
|
||
|
|
// 연결 정보
|
||
|
|
'bidding_id' => 'nullable|integer',
|
||
|
|
'bidding_code' => 'nullable|string|max:50',
|
||
|
|
|
||
|
|
// 기타
|
||
|
|
'remarks' => 'nullable|string',
|
||
|
|
'is_active' => 'nullable|boolean',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'contract_code.max' => __('validation.max.string', ['attribute' => '계약번호', 'max' => 50]),
|
||
|
|
'contract_end_date.after_or_equal' => __('validation.after_or_equal', ['attribute' => '계약종료일', 'date' => '계약시작일']),
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|