This commit is contained in:
Jake Kasper
2025-09-05 08:08:09 -04:00
parent 6bf68364ec
commit 833cc730d4
3 changed files with 17 additions and 8 deletions

View File

@@ -376,7 +376,15 @@ router.post('/', async (req, res, next) => {
// General fields
purchaseDate,
purchasePrice,
notes
notes,
// Sprinkler specific fields
sprinklerMount,
sprinklerHeadType,
sprinklerGpm,
sprinklerThrowFeet,
sprinklerDegrees,
sprinklerLengthFeet,
sprinklerWidthFeet
} = req.body;
// Validate required fields

View File

@@ -90,12 +90,6 @@ const Layout = ({ children }) => {
icon: CloudIcon,
iconSolid: CloudIconSolid,
},
{
name: 'Watering',
href: '/watering',
icon: CloudIcon,
iconSolid: CloudIconSolid,
},
];
const adminNavigation = [

View File

@@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react';
import { MapContainer, TileLayer, Polygon, Marker, Circle, Rectangle, useMapEvents } from 'react-leaflet';
import { MapContainer, TileLayer, Polygon, Marker, Circle, Rectangle, useMapEvents, useMap } from 'react-leaflet';
import 'leaflet/dist/leaflet.css';
import { propertiesAPI, wateringAPI, equipmentAPI } from '../../services/api';
import toast from 'react-hot-toast';
@@ -112,6 +112,12 @@ const Watering = () => {
return [39.8,-98.6];
}, [selectedProperty, sections]);
const CenterOnChange = ({ center }) => {
const map = useMap();
useEffect(() => { if (center && Array.isArray(center)) map.setView(center); }, [center, map]);
return null;
};
const startGuidance = () => {
if (points.length === 0) { toast.error('Add at least one point'); return; }
if (!navigator.geolocation) { toast.error('GPS not available'); return; }
@@ -274,6 +280,7 @@ const Watering = () => {
</div>
</div>
<MapContainer center={center} zoom={18} style={{height:'100%', width:'100%'}}>
<CenterOnChange center={center} />
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
{sections.map((s)=> (
<Polygon key={s.id} positions={s.polygonData?.coordinates?.[0]||[]} pathOptions={{ color:'#16a34a', weight:2, fillOpacity:0.1 }} />