This commit is contained in:
Jake Kasper
2025-08-22 10:49:41 -04:00
parent 0d2ef31d95
commit ea81018f80
4 changed files with 168 additions and 534 deletions

View File

@@ -20,7 +20,6 @@ import Dashboard from './pages/Dashboard/Dashboard';
import Properties from './pages/Properties/Properties'; import Properties from './pages/Properties/Properties';
import PropertyDetail from './pages/Properties/PropertyDetail'; import PropertyDetail from './pages/Properties/PropertyDetail';
import Equipment from './pages/Equipment/Equipment'; import Equipment from './pages/Equipment/Equipment';
import Nozzles from './pages/Nozzles/Nozzles';
import Products from './pages/Products/Products'; import Products from './pages/Products/Products';
import Applications from './pages/Applications/Applications'; import Applications from './pages/Applications/Applications';
import ApplicationPlan from './pages/Applications/ApplicationPlan'; import ApplicationPlan from './pages/Applications/ApplicationPlan';
@@ -180,16 +179,6 @@ function App() {
</ProtectedRoute> </ProtectedRoute>
} }
/> />
<Route
path="/nozzles"
element={
<ProtectedRoute>
<Layout>
<Nozzles />
</Layout>
</ProtectedRoute>
}
/>
<Route <Route
path="/products" path="/products"
element={ element={

View File

@@ -14,7 +14,6 @@ import {
Bars3Icon, Bars3Icon,
XMarkIcon, XMarkIcon,
BellIcon, BellIcon,
SparklesIcon,
} from '@heroicons/react/24/outline'; } from '@heroicons/react/24/outline';
import { import {
HomeIcon as HomeIconSolid, HomeIcon as HomeIconSolid,
@@ -24,7 +23,6 @@ import {
CalendarDaysIcon as CalendarIconSolid, CalendarDaysIcon as CalendarIconSolid,
ClockIcon as ClockIconSolid, ClockIcon as ClockIconSolid,
CloudIcon as CloudIconSolid, CloudIcon as CloudIconSolid,
SparklesIcon as SparklesIconSolid,
} from '@heroicons/react/24/solid'; } from '@heroicons/react/24/solid';
import { useAuth } from '../../hooks/useAuth'; import { useAuth } from '../../hooks/useAuth';
@@ -55,12 +53,6 @@ const Layout = ({ children }) => {
icon: WrenchScrewdriverIcon, icon: WrenchScrewdriverIcon,
iconSolid: WrenchIconSolid, iconSolid: WrenchIconSolid,
}, },
{
name: 'Nozzles',
href: '/nozzles',
icon: SparklesIcon,
iconSolid: SparklesIconSolid,
},
{ {
name: 'Products', name: 'Products',
href: '/products', href: '/products',

View File

@@ -255,6 +255,17 @@ const Equipment = () => {
{item.powerSource && <p><strong>Power:</strong> {item.powerSource}</p>} {item.powerSource && <p><strong>Power:</strong> {item.powerSource}</p>}
</> </>
); );
case 'nozzle':
return (
<>
{item.orificeSize && <p><strong>Orifice:</strong> {item.orificeSize}</p>}
{item.sprayAngle && <p><strong>Spray Angle:</strong> {item.sprayAngle}°</p>}
{item.flowRateGpm && <p><strong>Flow Rate:</strong> {item.flowRateGpm} GPM</p>}
{item.dropletSize && <p><strong>Droplet Size:</strong> {item.dropletSize}</p>}
{item.sprayPattern && <p><strong>Pattern:</strong> {item.sprayPattern.replace('_', ' ')}</p>}
{item.quantityOwned && <p><strong>Quantity:</strong> {item.quantityOwned}</p>}
</>
);
default: default:
return ( return (
<> <>
@@ -270,6 +281,7 @@ const Equipment = () => {
'Mower': 'bg-green-100 text-green-800', 'Mower': 'bg-green-100 text-green-800',
'Spreader': 'bg-orange-100 text-orange-800', 'Spreader': 'bg-orange-100 text-orange-800',
'Sprayer': 'bg-blue-100 text-blue-800', 'Sprayer': 'bg-blue-100 text-blue-800',
'Nozzle': 'bg-teal-100 text-teal-800',
'Pump': 'bg-purple-100 text-purple-800', 'Pump': 'bg-purple-100 text-purple-800',
'Aerator': 'bg-yellow-100 text-yellow-800', 'Aerator': 'bg-yellow-100 text-yellow-800',
'Dethatcher': 'bg-red-100 text-red-800', 'Dethatcher': 'bg-red-100 text-red-800',
@@ -505,6 +517,17 @@ const EquipmentFormModal = ({ isEdit, equipment, categories, equipmentTypes, onS
maxGpm: equipment?.maxGpm || '', maxGpm: equipment?.maxGpm || '',
maxPsi: equipment?.maxPsi || '', maxPsi: equipment?.maxPsi || '',
powerSource: equipment?.powerSource || '', powerSource: equipment?.powerSource || '',
// Nozzle fields
orificeSize: equipment?.orificeSize || '',
sprayAngle: equipment?.sprayAngle || '',
flowRateGpm: equipment?.flowRateGpm || '',
dropletSize: equipment?.dropletSize || '',
sprayPattern: equipment?.sprayPattern || '',
pressureRangePsi: equipment?.pressureRangePsi || '',
threadSize: equipment?.threadSize || '',
material: equipment?.material || '',
colorCode: equipment?.colorCode || '',
quantityOwned: equipment?.quantityOwned || 1,
// General fields // General fields
purchaseDate: equipment?.purchaseDate || '', purchaseDate: equipment?.purchaseDate || '',
purchasePrice: equipment?.purchasePrice || '', purchasePrice: equipment?.purchasePrice || '',
@@ -552,6 +575,17 @@ const EquipmentFormModal = ({ isEdit, equipment, categories, equipmentTypes, onS
maxGpm: formData.maxGpm ? parseFloat(formData.maxGpm) : null, maxGpm: formData.maxGpm ? parseFloat(formData.maxGpm) : null,
maxPsi: formData.maxPsi ? parseFloat(formData.maxPsi) : null, maxPsi: formData.maxPsi ? parseFloat(formData.maxPsi) : null,
powerSource: formData.powerSource || null, powerSource: formData.powerSource || null,
// Nozzle fields
orificeSize: formData.orificeSize || null,
sprayAngle: formData.sprayAngle ? parseInt(formData.sprayAngle) : null,
flowRateGpm: formData.flowRateGpm ? parseFloat(formData.flowRateGpm) : null,
dropletSize: formData.dropletSize || null,
sprayPattern: formData.sprayPattern || null,
pressureRangePsi: formData.pressureRangePsi || null,
threadSize: formData.threadSize || null,
material: formData.material || null,
colorCode: formData.colorCode || null,
quantityOwned: formData.quantityOwned ? parseInt(formData.quantityOwned) : null,
purchaseDate: formData.purchaseDate || null, purchaseDate: formData.purchaseDate || null,
purchasePrice: formData.purchasePrice ? parseFloat(formData.purchasePrice) : null, purchasePrice: formData.purchasePrice ? parseFloat(formData.purchasePrice) : null,
notes: formData.notes || null, notes: formData.notes || null,
@@ -804,6 +838,140 @@ const EquipmentFormModal = ({ isEdit, equipment, categories, equipmentTypes, onS
</> </>
); );
case 'nozzle':
return (
<>
<div className="grid grid-cols-3 gap-4">
<div>
<label className="label">Orifice Size *</label>
<input
type="text"
className="input"
value={formData.orificeSize}
onChange={(e) => setFormData({ ...formData, orificeSize: e.target.value })}
placeholder="02, 03, 04..."
required
/>
</div>
<div>
<label className="label">Spray Angle *</label>
<input
type="number"
className="input"
value={formData.sprayAngle}
onChange={(e) => setFormData({ ...formData, sprayAngle: e.target.value })}
placeholder="80, 110..."
required
/>
</div>
<div>
<label className="label">Flow Rate (GPM) *</label>
<input
type="number"
step="0.001"
className="input"
value={formData.flowRateGpm}
onChange={(e) => setFormData({ ...formData, flowRateGpm: e.target.value })}
placeholder="0.20, 0.30..."
required
/>
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="label">Droplet Size *</label>
<select
className="input"
value={formData.dropletSize}
onChange={(e) => setFormData({ ...formData, dropletSize: e.target.value })}
required
>
<option value="">Select droplet size</option>
<option value="fine">Fine</option>
<option value="medium">Medium</option>
<option value="coarse">Coarse</option>
<option value="very_coarse">Very Coarse</option>
<option value="extremely_coarse">Extremely Coarse</option>
</select>
</div>
<div>
<label className="label">Spray Pattern *</label>
<select
className="input"
value={formData.sprayPattern}
onChange={(e) => setFormData({ ...formData, sprayPattern: e.target.value })}
required
>
<option value="">Select spray pattern</option>
<option value="flat_fan">Flat Fan</option>
<option value="hollow_cone">Hollow Cone</option>
<option value="full_cone">Full Cone</option>
<option value="flooding">Flooding</option>
</select>
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div>
<label className="label">Pressure Range (PSI)</label>
<input
type="text"
className="input"
value={formData.pressureRangePsi}
onChange={(e) => setFormData({ ...formData, pressureRangePsi: e.target.value })}
placeholder="15-60"
/>
</div>
<div>
<label className="label">Thread Size</label>
<input
type="text"
className="input"
value={formData.threadSize}
onChange={(e) => setFormData({ ...formData, threadSize: e.target.value })}
placeholder="1/4&quot;, 3/8&quot;..."
/>
</div>
</div>
<div className="grid grid-cols-3 gap-4">
<div>
<label className="label">Material</label>
<select
className="input"
value={formData.material}
onChange={(e) => setFormData({ ...formData, material: e.target.value })}
>
<option value="">Select material</option>
<option value="polymer">Polymer</option>
<option value="stainless_steel">Stainless Steel</option>
<option value="brass">Brass</option>
<option value="ceramic">Ceramic</option>
</select>
</div>
<div>
<label className="label">Color Code</label>
<input
type="text"
className="input"
value={formData.colorCode}
onChange={(e) => setFormData({ ...formData, colorCode: e.target.value })}
placeholder="Yellow, Blue, Red..."
/>
</div>
<div>
<label className="label">Quantity Owned</label>
<input
type="number"
min="1"
className="input"
value={formData.quantityOwned}
onChange={(e) => setFormData({ ...formData, quantityOwned: e.target.value })}
placeholder="1"
/>
</div>
</div>
</>
);
default: default:
return ( return (
<> <>

View File

@@ -1,515 +0,0 @@
import React, { useState, useEffect } from 'react';
import {
PlusIcon,
MagnifyingGlassIcon,
TrashIcon,
PencilIcon,
BeakerIcon
} from '@heroicons/react/24/outline';
import { nozzlesAPI } from '../../services/api';
import LoadingSpinner from '../../components/UI/LoadingSpinner';
import toast from 'react-hot-toast';
const Nozzles = () => {
const [userNozzles, setUserNozzles] = useState([]);
const [nozzleTypes, setNozzleTypes] = useState([]);
const [loading, setLoading] = useState(true);
const [showCreateForm, setShowCreateForm] = useState(false);
const [showEditForm, setShowEditForm] = useState(false);
const [editingNozzle, setEditingNozzle] = useState(null);
const [searchTerm, setSearchTerm] = useState('');
const [selectedManufacturer, setSelectedManufacturer] = useState('');
const [selectedDropletSize, setSelectedDropletSize] = useState('');
useEffect(() => {
fetchData();
}, []);
const fetchData = async () => {
try {
setLoading(true);
const [userNozzlesResponse, nozzleTypesResponse] = await Promise.all([
nozzlesAPI.getUserNozzles(),
nozzlesAPI.getNozzleTypes()
]);
setUserNozzles(userNozzlesResponse.data.data.userNozzles || []);
setNozzleTypes(nozzleTypesResponse.data.data.nozzleTypes || []);
} catch (error) {
console.error('Failed to fetch nozzles:', error);
toast.error('Failed to load nozzles');
setUserNozzles([]);
setNozzleTypes([]);
} finally {
setLoading(false);
}
};
const handleCreateNozzle = async (nozzleData) => {
try {
await nozzlesAPI.create(nozzleData);
toast.success('Nozzle added successfully!');
setShowCreateForm(false);
fetchData();
} catch (error) {
console.error('Failed to create nozzle:', error);
toast.error('Failed to add nozzle');
}
};
const handleEditNozzle = (nozzle) => {
setEditingNozzle(nozzle);
setShowEditForm(true);
};
const handleUpdateNozzle = async (nozzleData) => {
try {
await nozzlesAPI.update(editingNozzle.id, nozzleData);
toast.success('Nozzle updated successfully!');
setShowEditForm(false);
setEditingNozzle(null);
fetchData();
} catch (error) {
console.error('Failed to update nozzle:', error);
toast.error('Failed to update nozzle');
}
};
const handleDeleteNozzle = async (nozzleId) => {
if (window.confirm('Are you sure you want to delete this nozzle?')) {
try {
await nozzlesAPI.delete(nozzleId);
toast.success('Nozzle deleted successfully');
fetchData();
} catch (error) {
console.error('Failed to delete nozzle:', error);
toast.error('Failed to delete nozzle');
}
}
};
// Filter nozzles based on search and filters
const filteredNozzles = userNozzles.filter(nozzle => {
const matchesSearch = searchTerm === '' ||
nozzle.nozzleType?.name?.toLowerCase().includes(searchTerm.toLowerCase()) ||
nozzle.customName?.toLowerCase().includes(searchTerm.toLowerCase()) ||
nozzle.nozzleType?.manufacturer?.toLowerCase().includes(searchTerm.toLowerCase());
const matchesManufacturer = selectedManufacturer === '' ||
nozzle.nozzleType?.manufacturer === selectedManufacturer;
const matchesDropletSize = selectedDropletSize === '' ||
nozzle.nozzleType?.dropletSize === selectedDropletSize;
return matchesSearch && matchesManufacturer && matchesDropletSize;
});
// Get unique manufacturers and droplet sizes for filters
const manufacturers = [...new Set(nozzleTypes.map(type => type.manufacturer).filter(Boolean))];
const dropletSizes = [...new Set(nozzleTypes.map(type => type.dropletSize).filter(Boolean))];
const NozzleCard = ({ nozzle }) => (
<div className="card">
<div className="flex justify-between items-start mb-3">
<div className="flex items-start gap-3">
<div className="p-2 bg-green-100 rounded-lg">
<BeakerIcon className="h-5 w-5 text-green-600" />
</div>
<div>
<h3 className="font-semibold text-gray-900">
{nozzle.customName || nozzle.nozzleType?.name}
</h3>
{nozzle.nozzleType?.manufacturer && (
<p className="text-sm text-gray-600">{nozzle.nozzleType.manufacturer} {nozzle.nozzleType.model}</p>
)}
<div className="flex flex-wrap gap-1 mt-1">
<span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Qty: {nozzle.quantity}
</span>
<span className={`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${getConditionColor(nozzle.condition)}`}>
{nozzle.condition}
</span>
</div>
</div>
</div>
<div className="flex gap-1">
<button
onClick={() => handleEditNozzle(nozzle)}
className="p-1 text-gray-400 hover:text-blue-600"
title="Edit nozzle"
>
<PencilIcon className="h-4 w-4" />
</button>
<button
onClick={() => handleDeleteNozzle(nozzle.id)}
className="p-1 text-gray-400 hover:text-red-600"
title="Delete nozzle"
>
<TrashIcon className="h-4 w-4" />
</button>
</div>
</div>
{/* Nozzle Specifications */}
<div className="grid grid-cols-2 gap-3 text-sm text-gray-600">
{nozzle.nozzleType?.orificeSize && (
<div><strong>Orifice:</strong> {nozzle.nozzleType.orificeSize}</div>
)}
{nozzle.nozzleType?.sprayAngle && (
<div><strong>Spray Angle:</strong> {nozzle.nozzleType.sprayAngle}°</div>
)}
{nozzle.nozzleType?.dropletSize && (
<div><strong>Droplet Size:</strong> {nozzle.nozzleType.dropletSize}</div>
)}
{nozzle.nozzleType?.sprayPattern && (
<div><strong>Pattern:</strong> {nozzle.nozzleType.sprayPattern.replace('_', ' ')}</div>
)}
{nozzle.nozzleType?.flowRateGpm && (
<div><strong>Flow Rate:</strong> {nozzle.nozzleType.flowRateGpm} GPM @ rated PSI</div>
)}
{nozzle.nozzleType?.pressureRangePsi && (
<div><strong>Pressure Range:</strong> {nozzle.nozzleType.pressureRangePsi} PSI</div>
)}
</div>
{nozzle.notes && (
<p className="text-sm text-gray-600 mt-3">
<strong>Notes:</strong> {nozzle.notes}
</p>
)}
{nozzle.purchaseDate && (
<p className="text-xs text-gray-500 mt-2">
Purchased: {new Date(nozzle.purchaseDate).toLocaleDateString()}
</p>
)}
</div>
);
const getConditionColor = (condition) => {
const colors = {
'excellent': 'bg-green-100 text-green-800',
'good': 'bg-blue-100 text-blue-800',
'fair': 'bg-yellow-100 text-yellow-800',
'poor': 'bg-orange-100 text-orange-800',
'needs_replacement': 'bg-red-100 text-red-800',
};
return colors[condition] || 'bg-gray-100 text-gray-800';
};
if (loading) {
return (
<div className="p-6">
<div className="flex justify-center items-center h-64">
<LoadingSpinner size="lg" />
</div>
</div>
);
}
return (
<div className="p-6">
<div className="flex justify-between items-center mb-6">
<div>
<h1 className="text-2xl font-bold text-gray-900">Nozzles</h1>
<p className="text-gray-600">Manage your spray nozzle inventory with specifications</p>
</div>
<button
onClick={() => setShowCreateForm(true)}
className="btn-primary flex items-center gap-2"
>
<PlusIcon className="h-5 w-5" />
Add Nozzle
</button>
</div>
{/* Search and Filters */}
<div className="card mb-6">
<div className="flex flex-wrap gap-4">
{/* Search */}
<div className="flex-1 min-w-64">
<div className="relative">
<MagnifyingGlassIcon className="h-5 w-5 absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
<input
type="text"
className="input pl-10"
placeholder="Search nozzles..."
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
/>
</div>
</div>
{/* Manufacturer Filter */}
<div className="min-w-48">
<select
className="input"
value={selectedManufacturer}
onChange={(e) => setSelectedManufacturer(e.target.value)}
>
<option value="">All Manufacturers</option>
{manufacturers.map((manufacturer) => (
<option key={manufacturer} value={manufacturer}>
{manufacturer}
</option>
))}
</select>
</div>
{/* Droplet Size Filter */}
<div className="min-w-48">
<select
className="input"
value={selectedDropletSize}
onChange={(e) => setSelectedDropletSize(e.target.value)}
>
<option value="">All Droplet Sizes</option>
{dropletSizes.map((size) => (
<option key={size} value={size}>
{size}
</option>
))}
</select>
</div>
</div>
</div>
{/* Nozzles Grid */}
{filteredNozzles.length === 0 ? (
<div className="card text-center py-12">
<BeakerIcon className="h-16 w-16 text-gray-300 mx-auto mb-4" />
<h3 className="text-lg font-medium text-gray-900 mb-2">No Nozzles Found</h3>
<p className="text-gray-600 mb-6">
{searchTerm || selectedManufacturer || selectedDropletSize
? 'Try adjusting your search or filters'
: 'Start building your nozzle inventory'
}
</p>
{!searchTerm && !selectedManufacturer && !selectedDropletSize && (
<button
onClick={() => setShowCreateForm(true)}
className="btn-primary"
>
Add Your First Nozzle
</button>
)}
</div>
) : (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{filteredNozzles.map((nozzle) => (
<NozzleCard key={nozzle.id} nozzle={nozzle} />
))}
</div>
)}
{/* Create Nozzle Form Modal */}
{showCreateForm && (
<NozzleFormModal
isEdit={false}
nozzle={null}
nozzleTypes={nozzleTypes}
onSubmit={handleCreateNozzle}
onCancel={() => setShowCreateForm(false)}
/>
)}
{/* Edit Nozzle Form Modal */}
{showEditForm && editingNozzle && (
<NozzleFormModal
isEdit={true}
nozzle={editingNozzle}
nozzleTypes={nozzleTypes}
onSubmit={handleUpdateNozzle}
onCancel={() => {
setShowEditForm(false);
setEditingNozzle(null);
}}
/>
)}
</div>
);
};
// Nozzle Form Modal Component
const NozzleFormModal = ({ isEdit, nozzle, nozzleTypes, onSubmit, onCancel }) => {
const [formData, setFormData] = useState({
nozzleTypeId: nozzle?.nozzleTypeId || '',
customName: nozzle?.customName || '',
quantity: nozzle?.quantity || 1,
condition: nozzle?.condition || 'good',
purchaseDate: nozzle?.purchaseDate || '',
notes: nozzle?.notes || ''
});
const [selectedNozzleType, setSelectedNozzleType] = useState(
nozzle?.nozzleType || null
);
useEffect(() => {
if (formData.nozzleTypeId) {
const nozzleType = nozzleTypes.find(type => type.id === parseInt(formData.nozzleTypeId));
setSelectedNozzleType(nozzleType);
}
}, [formData.nozzleTypeId, nozzleTypes]);
const handleSubmit = (e) => {
e.preventDefault();
if (!formData.nozzleTypeId) {
toast.error('Please select a nozzle type');
return;
}
const submitData = {
nozzleTypeId: parseInt(formData.nozzleTypeId),
customName: formData.customName || null,
quantity: parseInt(formData.quantity),
condition: formData.condition,
purchaseDate: formData.purchaseDate || null,
notes: formData.notes || null
};
onSubmit(submitData);
};
// Group nozzle types by manufacturer and droplet size for better organization
const groupedNozzleTypes = nozzleTypes.reduce((groups, type) => {
const key = `${type.manufacturer || 'Other'} - ${type.dropletSize || 'Unknown'}`;
if (!groups[key]) {
groups[key] = [];
}
groups[key].push(type);
return groups;
}, {});
return (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
<div className="bg-white rounded-lg p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<h3 className="text-lg font-semibold mb-4">
{isEdit ? 'Edit Nozzle' : 'Add New Nozzle'}
</h3>
<form onSubmit={handleSubmit} className="space-y-4">
{/* Nozzle Type Selection */}
<div>
<label className="label">Nozzle Type *</label>
<select
className="input"
value={formData.nozzleTypeId}
onChange={(e) => setFormData({ ...formData, nozzleTypeId: e.target.value })}
required
>
<option value="">Select nozzle type...</option>
{Object.entries(groupedNozzleTypes).map(([group, types]) => (
<optgroup key={group} label={group}>
{types.map((type) => (
<option key={type.id} value={type.id}>
{type.name} - {type.orificeSize} ({type.flowRateGpm} GPM)
</option>
))}
</optgroup>
))}
</select>
</div>
{/* Nozzle Specifications Preview */}
{selectedNozzleType && (
<div className="p-4 bg-gray-50 rounded-lg">
<h4 className="font-medium mb-2">Nozzle Specifications</h4>
<div className="grid grid-cols-2 gap-3 text-sm">
<div><strong>Manufacturer:</strong> {selectedNozzleType.manufacturer}</div>
<div><strong>Model:</strong> {selectedNozzleType.model}</div>
<div><strong>Orifice Size:</strong> {selectedNozzleType.orificeSize}</div>
<div><strong>Spray Angle:</strong> {selectedNozzleType.sprayAngle}°</div>
<div><strong>Flow Rate:</strong> {selectedNozzleType.flowRateGpm} GPM</div>
<div><strong>Droplet Size:</strong> {selectedNozzleType.dropletSize}</div>
<div><strong>Spray Pattern:</strong> {selectedNozzleType.sprayPattern?.replace('_', ' ')}</div>
<div><strong>Pressure Range:</strong> {selectedNozzleType.pressureRangePsi} PSI</div>
</div>
</div>
)}
{/* Custom Name */}
<div>
<label className="label">Custom Name (Optional)</label>
<input
type="text"
className="input"
value={formData.customName}
onChange={(e) => setFormData({ ...formData, customName: e.target.value })}
placeholder="e.g., Backyard Sprayer Nozzles"
/>
</div>
{/* Quantity and Condition */}
<div className="grid grid-cols-2 gap-4">
<div>
<label className="label">Quantity *</label>
<input
type="number"
min="1"
className="input"
value={formData.quantity}
onChange={(e) => setFormData({ ...formData, quantity: e.target.value })}
required
/>
</div>
<div>
<label className="label">Condition</label>
<select
className="input"
value={formData.condition}
onChange={(e) => setFormData({ ...formData, condition: e.target.value })}
>
<option value="excellent">Excellent</option>
<option value="good">Good</option>
<option value="fair">Fair</option>
<option value="poor">Poor</option>
<option value="needs_replacement">Needs Replacement</option>
</select>
</div>
</div>
{/* Purchase Date */}
<div>
<label className="label">Purchase Date</label>
<input
type="date"
className="input"
value={formData.purchaseDate}
onChange={(e) => setFormData({ ...formData, purchaseDate: e.target.value })}
/>
</div>
{/* Notes */}
<div>
<label className="label">Notes</label>
<textarea
className="input"
rows="3"
value={formData.notes}
onChange={(e) => setFormData({ ...formData, notes: e.target.value })}
placeholder="Usage notes, compatibility info, etc."
/>
</div>
<div className="flex gap-3 pt-4">
<button type="submit" className="btn-primary flex-1">
{isEdit ? 'Update Nozzle' : 'Add Nozzle'}
</button>
<button
type="button"
onClick={onCancel}
className="btn-secondary flex-1"
>
Cancel
</button>
</div>
</form>
</div>
</div>
);
};
export default Nozzles;