From eb75efd91cc2b2659ed21099e24f5fd3644dcb4a Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Wed, 19 Nov 2025 09:11:57 -0600 Subject: [PATCH 1/9] [ocotillo/IThing] Update thing interface to include the notes fields --- src/components/form/thing/SelectThingComponent.tsx | 1 - src/interfaces/ocotillo/IThing.ts | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/form/thing/SelectThingComponent.tsx b/src/components/form/thing/SelectThingComponent.tsx index 3c9e7332..5322012d 100644 --- a/src/components/form/thing/SelectThingComponent.tsx +++ b/src/components/form/thing/SelectThingComponent.tsx @@ -15,7 +15,6 @@ import TableContainer from '@mui/material/TableContainer' import TableRow from '@mui/material/TableRow' import Grid from '@mui/material/Grid2' -import wellknown from 'wellknown' import bbox from '@turf/bbox' import { SpatialSearchComponent } from '@/components/SpatialSearchComponent' diff --git a/src/interfaces/ocotillo/IThing.ts b/src/interfaces/ocotillo/IThing.ts index 9de1bba4..520a2afc 100644 --- a/src/interfaces/ocotillo/IThing.ts +++ b/src/interfaces/ocotillo/IThing.ts @@ -12,16 +12,19 @@ export interface IThing { groups?: IGroup[] monitoring_status?: string | null alternate_ids?: IThingIdLink[] + water_notes?: string | null + measuring_notes?: string | null + notes?: string | null } export interface IWell extends IThing { - well_purposes?: string[] | null - well_depth?: number | null - well_depth_unit?: string | null - + first_visit_date?: string | null hole_depth?: number | null hole_depth_unit?: string | null + well_depth?: number | null + well_depth_unit?: string | null + well_casing_diameter?: number | null well_casing_diameter_unit?: string | null @@ -31,6 +34,7 @@ export interface IWell extends IThing { well_casing_materials?: string[] | null well_construction_notes?: string | null + well_purposes?: string[] | null well_status?: string | null measuring_point_height?: number | null From 02f8d39344b0b9db0f155b7cd6f80e48e4253614 Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Fri, 14 Nov 2025 13:17:20 -0600 Subject: [PATCH 2/9] [Notes] init new notes accordion for well-show page --- src/components/Accordion/WellShow/Notes.tsx | 65 +++++++++++++++++++++ src/components/Accordion/WellShow/index.ts | 3 +- src/pages/ocotillo/thing/well-show.tsx | 2 + 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/components/Accordion/WellShow/Notes.tsx diff --git a/src/components/Accordion/WellShow/Notes.tsx b/src/components/Accordion/WellShow/Notes.tsx new file mode 100644 index 00000000..cd5d7072 --- /dev/null +++ b/src/components/Accordion/WellShow/Notes.tsx @@ -0,0 +1,65 @@ +import { + Accordion, + AccordionDetails, + AccordionSummary, + Stack, + Typography, +} from '@mui/material' +import { ExpandMore, Notes } from '@mui/icons-material' +import Grid from '@mui/material/Grid2' +import { IWell } from '@/interfaces/ocotillo/IThing' + +export const NotesAccordion = ({ well }: { well?: IWell }) => { + return ( + + } + // Match the visual height of summaries that contain a CreateButton + sx={{ + minHeight: 36, + '& .MuiAccordionSummary-content': { + margin: 0, + paddingY: 2.75, + }, + '&.Mui-expanded': { + minHeight: 36, + }, + }} + > + + + + + Notes + + + + + + + + Water Notes: + + {well?.water_notes || 'N/A'} + + + + Measuring Notes: + + {well?.measuring_notes || 'N/A'} + + + + Notes: + {well?.notes || 'N/A'} + + + + + ) +} diff --git a/src/components/Accordion/WellShow/index.ts b/src/components/Accordion/WellShow/index.ts index a1481ab6..40e9f922 100644 --- a/src/components/Accordion/WellShow/index.ts +++ b/src/components/Accordion/WellShow/index.ts @@ -1,5 +1,6 @@ export * from './Attachments' export * from './AlternateIds' -export * from './Equipment' export * from './Contacts' +export * from './Equipment' +export * from './Notes' export * from './WellScreens' diff --git a/src/pages/ocotillo/thing/well-show.tsx b/src/pages/ocotillo/thing/well-show.tsx index e0769541..b0ede089 100644 --- a/src/pages/ocotillo/thing/well-show.tsx +++ b/src/pages/ocotillo/thing/well-show.tsx @@ -18,6 +18,7 @@ import { WellPDFDownloadButton as DownloadButton, WellScreensAccordion, EquipmentAccordion, + NotesAccordion, } from '@/components' export const WellShow = () => { @@ -133,6 +134,7 @@ export const WellShow = () => { + From f7c9904934f1797eb61491e260420bea09f4ac15 Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Wed, 19 Nov 2025 09:17:38 -0600 Subject: [PATCH 3/9] [pdf] Update well pdf to include the note fields --- src/components/pdf/well.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/pdf/well.tsx b/src/components/pdf/well.tsx index c6b00157..bfe51d3f 100644 --- a/src/components/pdf/well.tsx +++ b/src/components/pdf/well.tsx @@ -264,10 +264,6 @@ export const WellPDF = ({ - + + + {assets.length === 0 && ( From 62bf45ff5399b6577728e12092028dee30cd53f0 Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Wed, 19 Nov 2025 09:59:41 -0600 Subject: [PATCH 4/9] [/src] Fix broken fields & add new types --- src/components/card/CoreWellInfo.tsx | 21 +++--- .../card/InteractiveSatelliteMap.tsx | 4 +- .../form/location/CreateEditLocation.tsx | 24 +++--- .../form/thing/SelectThingComponent.tsx | 3 +- src/components/pdf/well.tsx | 22 +++--- src/interfaces/ocotillo/ILocation.ts | 38 +++++----- src/pages/amp/wellinventoryform/index.tsx | 5 +- src/utils/ParseWktPoint.ts | 8 +- src/utils/UtmToLonLat.ts | 73 +++++++++++-------- 9 files changed, 113 insertions(+), 85 deletions(-) diff --git a/src/components/card/CoreWellInfo.tsx b/src/components/card/CoreWellInfo.tsx index 6863daff..f9e0709d 100644 --- a/src/components/card/CoreWellInfo.tsx +++ b/src/components/card/CoreWellInfo.tsx @@ -1,4 +1,5 @@ import { IWell } from '@/interfaces/ocotillo/IThing' +import { convertLonLatToUTM, parseWktPoint } from '@/utils' import { Card, CardContent, @@ -24,6 +25,9 @@ export const CoreWellInfoCard = ({ return } + const { lon, lat } = parseWktPoint(well.current_location) + const { easting, northing } = convertLonLatToUTM({ lon, lat }) + return ( {well?.name}} /> @@ -99,37 +103,36 @@ export const CoreWellInfoCard = ({ Northing/Easting: - {`${well?.current_location?.properties?.utm_coordinates?.easting?.toFixed(0) || 'N/A'}, ${well?.current_location?.properties?.utm_coordinates?.northing?.toFixed(0) || 'N/A'}`} + {`${easting?.toFixed(0) || 'N/A'}, ${northing?.toFixed(0) || 'N/A'}`} Vertical Datum: - {well?.current_location?.properties?.vertical_datum || 'N/A'}{' '} + {well?.current_location?.vertical_datum || 'N/A'}{' '} Latitude/Longitude: - {well?.current_location?.geometry?.coordinates - ? `${well?.current_location?.geometry?.coordinates?.[0]?.toFixed(6)}, ${well?.current_location?.geometry?.coordinates?.[1]?.toFixed(6)}` + {well?.current_location?.point + ? `${lat?.toFixed(6)}, ${lon?.[1]?.toFixed(6)}` : 'N/A'} Elevation: - {well?.current_location?.properties?.elevation?.toFixed(2) || - 'N/A'} - {well?.current_location?.properties?.elevation_unit - ? ` ${well?.current_location?.properties?.elevation_unit}` + {well?.current_location?.elevation?.toFixed(2) || 'N/A'} + {well?.current_location?.elevation_unit + ? ` ${well?.current_location?.elevation_unit}` : null} Elevation Method: - {well?.current_location?.properties?.elevation_method || 'N/A'} + {well?.current_location?.elevation_method || 'N/A'} diff --git a/src/components/card/InteractiveSatelliteMap.tsx b/src/components/card/InteractiveSatelliteMap.tsx index cbb8a9fb..319f5a23 100644 --- a/src/components/card/InteractiveSatelliteMap.tsx +++ b/src/components/card/InteractiveSatelliteMap.tsx @@ -12,6 +12,7 @@ import { import { Map } from '@mui/icons-material' import { Layer, MapRef, Source } from 'react-map-gl' import { MapComponent, MapPopup } from '@/components' +import { parseWktPoint } from '@/utils' import { useThingLayers } from '@/hooks' import { useGo } from '@refinedev/core' @@ -25,8 +26,7 @@ export const InteractiveSatelliteMapCard = ({ well }: { well: IWell }) => { const waterWellsLayer = THING_LAYERS['water-wells'] const { sourceProps, layerProps } = waterWellsLayer - const coordinates = well?.current_location?.geometry?.coordinates ?? [] - const [lon, lat] = coordinates + const { lon, lat } = parseWktPoint(well.current_location) // Automatically zoom to well coordinates when map loads or well changes useEffect(() => { diff --git a/src/components/form/location/CreateEditLocation.tsx b/src/components/form/location/CreateEditLocation.tsx index c41af26a..3338c66a 100644 --- a/src/components/form/location/CreateEditLocation.tsx +++ b/src/components/form/location/CreateEditLocation.tsx @@ -25,7 +25,11 @@ import { MenuItem, } from '@mui/material' import wellknown from 'wellknown' -import { convertUTMToLonLat, convertLonLatToUTM } from '@/utils/UtmToLonLat' +import { + convertUTMToLonLat, + convertLonLatToUTM, + Datum, +} from '@/utils/UtmToLonLat' import { useElevation } from '@/hooks/useElevation' /** @@ -66,7 +70,7 @@ export const CreateEditLocation: React.FC = ({ //Local state for UTM zone/datum/easting/northing/lat/long since only point is sent to backend const [utmZone, setUtmZone] = useState(13) - const [utmDatum, setUtmDatum] = useState('NAD83') + const [utmDatum, setUtmDatum] = useState('NAD83') const [latitude, setLatitude] = useState('') const [longitude, setLongitude] = useState('') const [easting, setEasting] = useState('') @@ -144,18 +148,17 @@ export const CreateEditLocation: React.FC = ({ //handle map click to set lat and long or easting and northing const handleMapClick = (e: any) => { - const { lng, lat } = e.lngLat + const { lng: lon, lat } = e.lngLat if (useUTM) { - const [easting, northing] = convertLonLatToUTM( - lng, - lat, + const { easting, northing } = convertLonLatToUTM( + { lon, lat }, utmZone, utmDatum ) setEasting(easting.toFixed(3)) setNorthing(northing.toFixed(3)) } else { - setLongitude(lng.toFixed(10)) + setLongitude(lon.toFixed(10)) setLatitude(lat.toFixed(10)) } } @@ -174,9 +177,8 @@ export const CreateEditLocation: React.FC = ({ setLatitude(lat.toFixed(10)) } else if (!useUTM && latitude && longitude) { // Lat/Long to UTM - const [easting, northing] = convertLonLatToUTM( - Number(longitude), - Number(latitude), + const { easting, northing } = convertLonLatToUTM( + { lon: Number(longitude), lat: Number(latitude) }, utmZone, utmDatum ) @@ -275,7 +277,7 @@ export const CreateEditLocation: React.FC = ({