feat: 입찰(Bidding) 관리 기능 구현
- Bidding 모델, 서비스, 컨트롤러, FormRequest 추가 - 마이그레이션 및 시더 추가 - Swagger API 문서 추가 - 견적에서 입찰 전환 시 중복 체크 로직 추가 - per_page 파라미터 100 초과 시 자동 클램핑 처리 - error.bidding.already_registered 에러 메시지 추가
This commit is contained in:
36
app/Http/Requests/Bidding/BiddingFilterRequest.php
Normal file
36
app/Http/Requests/Bidding/BiddingFilterRequest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bidding;
|
||||
|
||||
use App\Models\Bidding\Bidding;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BiddingFilterRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => ['nullable', 'string', Rule::in(Bidding::STATUSES)],
|
||||
'from_date' => ['nullable', 'date'],
|
||||
'to_date' => ['nullable', 'date', 'after_or_equal:from_date'],
|
||||
'search' => ['nullable', 'string', 'max:100'],
|
||||
'sort_by' => ['nullable', 'string', Rule::in(['bidding_date', 'bidding_code', 'client_name', 'project_name', 'bidding_amount', 'status', 'created_at'])],
|
||||
'sort_dir' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
'per_page' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'status.in' => __('validation.in', ['attribute' => __('validation.attributes.status')]),
|
||||
'to_date.after_or_equal' => __('validation.after_or_equal', ['attribute' => __('validation.attributes.to_date'), 'date' => __('validation.attributes.from_date')]),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/Bidding/BiddingStatusRequest.php
Normal file
30
app/Http/Requests/Bidding/BiddingStatusRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bidding;
|
||||
|
||||
use App\Models\Bidding\Bidding;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BiddingStatusRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => ['required', 'string', Rule::in(Bidding::STATUSES)],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'status.required' => __('validation.required', ['attribute' => __('validation.attributes.status')]),
|
||||
'status.in' => __('validation.in', ['attribute' => __('validation.attributes.status')]),
|
||||
];
|
||||
}
|
||||
}
|
||||
56
app/Http/Requests/Bidding/BiddingStoreRequest.php
Normal file
56
app/Http/Requests/Bidding/BiddingStoreRequest.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bidding;
|
||||
|
||||
use App\Models\Bidding\Bidding;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BiddingStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
// 견적 연결 (선택사항)
|
||||
'quote_id' => ['nullable', 'integer', 'exists:quotes,id'],
|
||||
// 거래처/현장
|
||||
'client_id' => ['nullable', 'integer'],
|
||||
'client_name' => ['nullable', 'string', 'max:100'],
|
||||
'project_name' => ['required', 'string', 'max:200'],
|
||||
// 입찰 정보
|
||||
'bidding_date' => ['nullable', 'date'],
|
||||
'bid_date' => ['nullable', 'date'],
|
||||
'submission_date' => ['nullable', 'date'],
|
||||
'confirm_date' => ['nullable', 'date'],
|
||||
'total_count' => ['nullable', 'integer', 'min:0'],
|
||||
'bidding_amount' => ['nullable', 'numeric', 'min:0'],
|
||||
// 상태 (기본값: waiting)
|
||||
'status' => ['nullable', 'string', Rule::in(Bidding::STATUSES)],
|
||||
// 입찰자
|
||||
'bidder_id' => ['nullable', 'integer'],
|
||||
'bidder_name' => ['nullable', 'string', 'max:50'],
|
||||
// 공사기간
|
||||
'construction_start_date' => ['nullable', 'date'],
|
||||
'construction_end_date' => ['nullable', 'date', 'after_or_equal:construction_start_date'],
|
||||
'vat_type' => ['nullable', 'string', Rule::in(Bidding::VAT_TYPES)],
|
||||
// 비고
|
||||
'remarks' => ['nullable', 'string'],
|
||||
// 견적 데이터 스냅샷 (견적에서 전환 시)
|
||||
'expense_items' => ['nullable', 'array'],
|
||||
'estimate_detail_items' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'project_name.required' => __('validation.required', ['attribute' => '현장명']),
|
||||
'quote_id.exists' => __('validation.exists', ['attribute' => '견적']),
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/Bidding/BiddingUpdateRequest.php
Normal file
46
app/Http/Requests/Bidding/BiddingUpdateRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bidding;
|
||||
|
||||
use App\Models\Bidding\Bidding;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BiddingUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
// 거래처/현장
|
||||
'client_id' => ['nullable', 'integer'],
|
||||
'client_name' => ['nullable', 'string', 'max:100'],
|
||||
'project_name' => ['nullable', 'string', 'max:200'],
|
||||
// 입찰 정보
|
||||
'bidding_date' => ['nullable', 'date'],
|
||||
'bid_date' => ['nullable', 'date'],
|
||||
'submission_date' => ['nullable', 'date'],
|
||||
'confirm_date' => ['nullable', 'date'],
|
||||
'total_count' => ['nullable', 'integer', 'min:0'],
|
||||
'bidding_amount' => ['nullable', 'numeric', 'min:0'],
|
||||
// 상태
|
||||
'status' => ['nullable', 'string', Rule::in(Bidding::STATUSES)],
|
||||
// 입찰자
|
||||
'bidder_id' => ['nullable', 'integer'],
|
||||
'bidder_name' => ['nullable', 'string', 'max:50'],
|
||||
// 공사기간
|
||||
'construction_start_date' => ['nullable', 'date'],
|
||||
'construction_end_date' => ['nullable', 'date', 'after_or_equal:construction_start_date'],
|
||||
'vat_type' => ['nullable', 'string', Rule::in(Bidding::VAT_TYPES)],
|
||||
// 비고
|
||||
'remarks' => ['nullable', 'string'],
|
||||
// 견적 데이터 스냅샷
|
||||
'expense_items' => ['nullable', 'array'],
|
||||
'estimate_detail_items' => ['nullable', 'array'],
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/Bidding/BulkDeleteRequest.php
Normal file
30
app/Http/Requests/Bidding/BulkDeleteRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Bidding;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BulkDeleteRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'ids' => ['required', 'array', 'min:1'],
|
||||
'ids.*' => ['required', 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'ids.required' => __('validation.required', ['attribute' => 'ids']),
|
||||
'ids.array' => __('validation.array', ['attribute' => 'ids']),
|
||||
'ids.min' => __('validation.min.array', ['attribute' => 'ids', 'min' => 1]),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user