From a3e3b3791466d4cf4be222240caaed93c59e2b3e Mon Sep 17 00:00:00 2001 From: Lixian Zhou Date: Mon, 9 Mar 2026 15:07:56 -0400 Subject: [PATCH] fix --- app/controllers/resource.controller.js | 1 + app/models/resource.model.js | 1 + .../event-request/EventRequestList.js | 6 + client/src/components/events/UpdateEvent.js | 2 +- .../components/resources/CreateResource.js | 17 +- .../src/components/resources/ResourcesList.js | 4 +- .../components/resources/UpdateResource.js | 18 +- .../src/components/resources/ViewResource.js | 5 +- .../src/components/trans-routes/RouteView.js | 6 +- .../trans-routes/RoutesDashboard.js | 462 +++++++++++++++++- .../src/shared/constants/resource.constant.js | 2 + 11 files changed, 513 insertions(+), 11 deletions(-) diff --git a/app/controllers/resource.controller.js b/app/controllers/resource.controller.js index 15cbe1c..fc16f27 100644 --- a/app/controllers/resource.controller.js +++ b/app/controllers/resource.controller.js @@ -15,6 +15,7 @@ exports.createResource = (req, res) => { office_name: req.body.office_name || '', specialty: req.body.specialty, type: req.body.type, // value may be ['doctor', 'pharmacy' or 'other'] + type_other: req.body.type_other || '', // Legacy fields for backward compatibility name_original: req.body.name_original || req.body.office_name || '', diff --git a/app/models/resource.model.js b/app/models/resource.model.js index 7c65a12..2f7fe5c 100644 --- a/app/models/resource.model.js +++ b/app/models/resource.model.js @@ -10,6 +10,7 @@ module.exports = mongoose => { office_name: String, // Merged from name_original and name_branch specialty: String, type: String, // value may be ['doctor', 'pharmacy' or 'other'] + type_other: String, // Legacy fields for backward compatibility name_original: String, diff --git a/client/src/components/event-request/EventRequestList.js b/client/src/components/event-request/EventRequestList.js index 6bec837..23902d7 100644 --- a/client/src/components/event-request/EventRequestList.js +++ b/client/src/components/event-request/EventRequestList.js @@ -36,6 +36,11 @@ const EventRequestList = () => { label: 'Type', show: true }, + { + key: 'transportation', + label: 'Transportation', + show: true + }, { key: 'symptom', label: 'Symptom Or Special Need', @@ -278,6 +283,7 @@ const EventRequestList = () => { {columns.find(col => col.key === 'resource_display')?.show && {eventRequest?.resource_display}} {columns.find(col => col.key === 'source')?.show && {EventRequestsService.sourceList.find((item) => item?.value === eventRequest?.source)?.label || eventRequest?.source}} {columns.find(col => col.key === 'type')?.show && {eventRequest?.type}} + {columns.find(col => col.key === 'transportation')?.show && {eventRequest?.transportation || '-'}} {columns.find(col => col.key === 'symptom')?.show && {eventRequest?.symptom}} {columns.find(col => col.key === 'np')?.show && {eventRequest?.np}} {columns.find(col => col.key === 'upload')?.show && {eventRequest?.upload}} diff --git a/client/src/components/events/UpdateEvent.js b/client/src/components/events/UpdateEvent.js index deaee2f..feacdf9 100644 --- a/client/src/components/events/UpdateEvent.js +++ b/client/src/components/events/UpdateEvent.js @@ -585,7 +585,7 @@ const UpdateEvent = () => { - setShowResourceModal(false)}> + setShowResourceModal(false)}> Select the Provider diff --git a/client/src/components/resources/CreateResource.js b/client/src/components/resources/CreateResource.js index 79a10d3..5c4b70a 100644 --- a/client/src/components/resources/CreateResource.js +++ b/client/src/components/resources/CreateResource.js @@ -13,6 +13,7 @@ const CreateResource = () => { const [officeName, setOfficeName] = useState(''); const [specialty, setSpecialty] = useState(''); const [type, setType] = useState(''); + const [typeOther, setTypeOther] = useState(''); // Contact Information const [phone, setPhone] = useState(''); // Office Phone Number @@ -48,6 +49,9 @@ const CreateResource = () => { if (!phone || phone.trim() === '') { errors.push('Office Phone Number'); } + if (type === 'other' && (!typeOther || typeOther.trim() === '')) { + errors.push('Other-please specify'); + } if (errors.length > 0) { window.alert(`Please fill in the following required fields:\n${errors.join('\n')}`); @@ -74,6 +78,7 @@ const CreateResource = () => { name_original: officeName, // Legacy field specialty, type, + type_other: type === 'other' ? typeOther : '', // Contact Information phone, // Office Phone Number @@ -144,13 +149,23 @@ const CreateResource = () => {
Type
- { + const nextType = e.target.value; + setType(nextType); + if (nextType !== 'other') { + setTypeOther(''); + } + }}> {RESOURCE_TYPE_OPTIONS.map((item, index) => ( ))}
+ {type === 'other' &&
+
Other-please specify
+ setTypeOther(e.target.value)} /> +
}
Specialty
setKeyword(e.currentTarget.value)} /> diff --git a/client/src/components/resources/UpdateResource.js b/client/src/components/resources/UpdateResource.js index c232b7a..8ed4628 100644 --- a/client/src/components/resources/UpdateResource.js +++ b/client/src/components/resources/UpdateResource.js @@ -15,6 +15,7 @@ const UpdateResource = () => { const [officeName, setOfficeName] = useState(''); const [specialty, setSpecialty] = useState(''); const [type, setType] = useState(''); + const [typeOther, setTypeOther] = useState(''); // Contact Information const [phone, setPhone] = useState(''); // Office Phone Number @@ -53,6 +54,9 @@ const UpdateResource = () => { if (!phone || phone.trim() === '') { errors.push('Office Phone Number'); } + if (type === 'other' && (!typeOther || typeOther.trim() === '')) { + errors.push('Other-please specify'); + } if (errors.length > 0) { window.alert(`Please fill in the following required fields:\n${errors.join('\n')}`); @@ -78,6 +82,7 @@ const UpdateResource = () => { name_original: officeName, // Legacy field specialty, type, + type_other: type === 'other' ? typeOther : '', // Contact Information phone, // Office Phone Number @@ -144,6 +149,7 @@ const UpdateResource = () => { setOfficeName(currentResource?.office_name || currentResource?.name_original || ''); setSpecialty(currentResource?.specialty || ''); setType(currentResource?.type || ''); + setTypeOther(currentResource?.type_other || ''); // Contact Information setPhone(currentResource?.phone || ''); @@ -195,13 +201,23 @@ const UpdateResource = () => {
Type
- { + const nextType = e.target.value; + setType(nextType); + if (nextType !== 'other') { + setTypeOther(''); + } + }}> {RESOURCE_TYPE_OPTIONS.map((item, index) => ( ))}
+ {type === 'other' &&
+
Other-please specify
+ setTypeOther(e.target.value)} /> +
}
Specialty