feat:차량정비이력 비용 수정 모달에 복사 버튼 추가

기존 비용 데이터를 복사하여 새 비용으로 등록할 수 있는 기능
- 복사 클릭 시 폼 데이터 유지한 채 등록 모드로 전환
- 날짜만 오늘 날짜로 자동 변경

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-11 17:42:41 +09:00
parent 1cc87ecc27
commit b0c4f18c2e

View File

@@ -235,6 +235,12 @@ function VehicleMaintenanceManagement() {
}
};
const handleCopy = () => {
setModalMode('add');
setEditingItem(null);
setFormData(prev => ({ ...prev, date: new Date().toISOString().split('T')[0] }));
};
const handleDownload = () => {
const rows = [['차량 유지비', `${dateRange.start} ~ ${dateRange.end}`], [], ['날짜', '차량', '구분', '내용', '금액', '주행거리', '업체'],
...maintenances.map(item => [item.date, getVehicleDisplay(item.vehicleId), item.category, item.description, item.amount, item.mileage, item.vendor])];
@@ -403,6 +409,7 @@ className="flex items-center gap-2 px-3 py-2 border border-gray-300 text-gray-70
</div>
<div className="flex gap-3 mt-6">
{modalMode === 'edit' && <button onClick={() => handleDelete(editingItem.id)} className="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg">삭제</button>}
{modalMode === 'edit' && <button onClick={handleCopy} className="px-4 py-2 border border-teal-500 text-teal-600 rounded-lg hover:bg-teal-50">복사</button>}
<button onClick={() => setShowModal(false)} className="flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50">취소</button>
<button onClick={handleSave} disabled={saving} className="flex-1 px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50">{saving ? '저장 중...' : (modalMode === 'add' ? '등록' : '저장')}</button>
</div>