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:
@@ -170,7 +170,7 @@ export function WorkOrderCreate() {
|
||||
};
|
||||
|
||||
// 폼 제출
|
||||
const handleSubmit = async () => {
|
||||
const handleSubmit = async (): Promise<{ success: boolean; error?: string }> => {
|
||||
// Validation 체크
|
||||
const errors: ValidationErrors = {};
|
||||
|
||||
@@ -200,7 +200,7 @@ export function WorkOrderCreate() {
|
||||
setValidationErrors(errors);
|
||||
// 페이지 상단으로 스크롤
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
return;
|
||||
return { success: false, error: '' };
|
||||
}
|
||||
|
||||
// 에러 초기화
|
||||
@@ -218,16 +218,15 @@ export function WorkOrderCreate() {
|
||||
note: formData.note || undefined,
|
||||
});
|
||||
|
||||
if (result.success) {
|
||||
toast.success('작업지시가 등록되었습니다.');
|
||||
router.push('/production/work-orders');
|
||||
} else {
|
||||
toast.error(result.error || '작업지시 등록에 실패했습니다.');
|
||||
if (!result.success) {
|
||||
return { success: false, error: result.error || '작업지시 등록에 실패했습니다.' };
|
||||
}
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
if (isNextRedirectError(error)) throw error;
|
||||
console.error('[WorkOrderCreate] handleSubmit error:', error);
|
||||
toast.error('작업지시 등록 중 오류가 발생했습니다.');
|
||||
const errorMessage = error instanceof Error ? error.message : '작업지시 등록 중 오류가 발생했습니다.';
|
||||
return { success: false, error: errorMessage };
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
@@ -518,9 +517,8 @@ export function WorkOrderCreate() {
|
||||
mode="create"
|
||||
isLoading={isLoadingProcesses}
|
||||
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