fix(WEB): 폼 컴포넌트 DatePicker 적용 및 코드 정리
- ExpectedExpenseManagement DatePicker 적용 및 간소화 - BoardForm 날짜 필드 개선 - AttendanceInfoDialog, ReasonInfoDialog 코드 정리 - ReceivingDetail 기능 보강 - ShipmentCreate/Edit DatePicker 적용 - VehicleDispatchEdit 수정 - WorkOrderCreate 개선 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { IntegratedDetailTemplate } from '@/components/templates/IntegratedDetailTemplate';
|
||||
import { vehicleDispatchEditConfig } from './vehicleDispatchConfig';
|
||||
import { isNextRedirectError } from '@/lib/utils/redirect-error';
|
||||
import { getVehicleDispatchById, updateVehicleDispatch } from './actions';
|
||||
import {
|
||||
VEHICLE_DISPATCH_STATUS_LABELS,
|
||||
@@ -135,22 +136,23 @@ export function VehicleDispatchEdit({ id }: VehicleDispatchEditProps) {
|
||||
router.push(`/ko/outbound/vehicle-dispatches/${id}?mode=view`);
|
||||
}, [router, id]);
|
||||
|
||||
const handleSubmit = useCallback(async () => {
|
||||
const handleSubmit = useCallback(async (): Promise<{ success: boolean; error?: string }> => {
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
const result = await updateVehicleDispatch(id, formData);
|
||||
if (result.success) {
|
||||
router.push(`/ko/outbound/vehicle-dispatches/${id}?mode=view`);
|
||||
} else {
|
||||
setValidationErrors([result.error || '배차차량 수정에 실패했습니다.']);
|
||||
if (!result.success) {
|
||||
return { success: false, error: result.error || '배차차량 수정에 실패했습니다.' };
|
||||
}
|
||||
return { success: true };
|
||||
} catch (err) {
|
||||
if (isNextRedirectError(err)) throw err;
|
||||
console.error('[VehicleDispatchEdit] handleSubmit error:', err);
|
||||
setValidationErrors(['저장 중 오류가 발생했습니다.']);
|
||||
const errorMessage = err instanceof Error ? err.message : '저장 중 오류가 발생했습니다.';
|
||||
return { success: false, error: errorMessage };
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}, [id, formData, router]);
|
||||
}, [id, formData]);
|
||||
|
||||
// 동적 config
|
||||
const dynamicConfig = {
|
||||
@@ -387,9 +389,8 @@ export function VehicleDispatchEdit({ id }: VehicleDispatchEditProps) {
|
||||
mode="edit"
|
||||
isLoading={isLoading}
|
||||
onCancel={handleCancel}
|
||||
onSubmit={async (_data: Record<string, unknown>) => {
|
||||
await handleSubmit();
|
||||
return { success: true };
|
||||
onSubmit={async () => {
|
||||
return await handleSubmit();
|
||||
}}
|
||||
renderForm={renderFormContent}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user