diff --git a/AddLocationModal.tsx b/AddLocationModal.tsx index c3e16e1..8c5b693 100644 --- a/AddLocationModal.tsx +++ b/AddLocationModal.tsx @@ -67,6 +67,9 @@ export const AddLocationModal = ({ isOpen, onClose, tourId, initialLegId, editin longitude: 106.7009, type: 'VISIT', legId: '', + note: '', + expenseAmount: '', + expenseCategory: 'OTHER', plannedStart: '', plannedEnd: '' }); @@ -79,6 +82,9 @@ export const AddLocationModal = ({ isOpen, onClose, tourId, initialLegId, editin useEffect(() => { if (isOpen) { if (editingLocation) { + const leg = legs.find(l => l.id === editingLocation.legId); + const expense = leg?.expenses?.find((e: any) => e.locationId === editingLocation.id); + setFormData({ name: editingLocation.name || '', address: editingLocation.address || '', @@ -86,6 +92,9 @@ export const AddLocationModal = ({ isOpen, onClose, tourId, initialLegId, editin longitude: editingLocation.longitude, type: editingLocation.type || 'VISIT', legId: editingLocation.legId || '', + note: editingLocation.note || '', + expenseAmount: expense?.amount?.toString() || '', + expenseCategory: expense?.category || 'OTHER', plannedStart: editingLocation.plannedStart ? editingLocation.plannedStart.slice(0, 16) : '', plannedEnd: editingLocation.plannedEnd ? editingLocation.plannedEnd.slice(0, 16) : '' }); @@ -94,6 +103,7 @@ export const AddLocationModal = ({ isOpen, onClose, tourId, initialLegId, editin ...prev, name: '', address: '', legId: initialLegId || (legs.length > 0 ? legs[0].id : ''), + note: '', expenseAmount: '', expenseCategory: 'OTHER', plannedStart: '', plannedEnd: '' })); } @@ -195,6 +205,31 @@ export const AddLocationModal = ({ isOpen, onClose, tourId, initialLegId, editin setFormData({...formData, address: e.target.value})} /> +
+ +