2026-01-08 11:11:54 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Order;
|
|
|
|
|
|
|
|
|
|
use App\Models\Orders\Order;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
|
|
|
|
|
class UpdateOrderRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
// 기본 정보 (order_no는 수정 불가)
|
|
|
|
|
'order_type_code' => ['nullable', Rule::in([Order::TYPE_ORDER, Order::TYPE_PURCHASE])],
|
|
|
|
|
'category_code' => 'nullable|string|max:50',
|
|
|
|
|
|
|
|
|
|
// 거래처 정보
|
|
|
|
|
'client_id' => 'nullable|integer|exists:clients,id',
|
|
|
|
|
'client_name' => 'nullable|string|max:200',
|
|
|
|
|
'client_contact' => 'nullable|string|max:100',
|
|
|
|
|
'site_name' => 'nullable|string|max:200',
|
|
|
|
|
|
|
|
|
|
// 금액 정보
|
|
|
|
|
'supply_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
'tax_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
'total_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
'discount_rate' => 'nullable|numeric|min:0|max:100',
|
|
|
|
|
'discount_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
|
|
|
|
|
// 배송/기타
|
|
|
|
|
'delivery_date' => 'nullable|date',
|
|
|
|
|
'delivery_method_code' => 'nullable|string|max:50',
|
|
|
|
|
'received_at' => 'nullable|date',
|
|
|
|
|
'memo' => 'nullable|string',
|
|
|
|
|
'remarks' => 'nullable|string',
|
|
|
|
|
'note' => 'nullable|string',
|
|
|
|
|
|
2026-01-16 21:58:57 +09:00
|
|
|
// 옵션 (운임비용, 수신자 정보 등)
|
|
|
|
|
'options' => 'nullable|array',
|
|
|
|
|
'options.shipping_cost_code' => 'nullable|string|max:50',
|
|
|
|
|
'options.receiver' => 'nullable|string|max:100',
|
|
|
|
|
'options.receiver_contact' => 'nullable|string|max:100',
|
|
|
|
|
'options.shipping_address' => 'nullable|string|max:500',
|
|
|
|
|
'options.shipping_address_detail' => 'nullable|string|max:500',
|
|
|
|
|
|
2026-01-08 11:11:54 +09:00
|
|
|
// 품목 배열 (전체 교체)
|
|
|
|
|
'items' => 'nullable|array',
|
|
|
|
|
'items.*.item_id' => 'nullable|integer|exists:items,id',
|
|
|
|
|
'items.*.item_name' => 'required|string|max:200',
|
|
|
|
|
'items.*.specification' => 'nullable|string|max:500',
|
|
|
|
|
'items.*.quantity' => 'required|numeric|min:0',
|
|
|
|
|
'items.*.unit' => 'nullable|string|max:20',
|
|
|
|
|
'items.*.unit_price' => 'required|numeric|min:0',
|
|
|
|
|
'items.*.supply_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
'items.*.tax_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
'items.*.total_amount' => 'nullable|numeric|min:0',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'items.*.item_name.required' => __('validation.required', ['attribute' => '품목명']),
|
|
|
|
|
'items.*.quantity.required' => __('validation.required', ['attribute' => '수량']),
|
|
|
|
|
'items.*.unit_price.required' => __('validation.required', ['attribute' => '단가']),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|