diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx
index 33ca7f5..58ab28b 100644
--- a/src/pages/Login.jsx
+++ b/src/pages/Login.jsx
@@ -74,10 +74,11 @@ const Login = () => {
const result = login(identifier, password, type);
if (result.success) {
- if (type === 'customer') {
+ // Role-based Redirect
+ if (result.role === 'CUSTOMER') {
navigate('/');
} else {
- navigate('/emp/fa/dashboard'); // Default for employees
+ navigate('/emp/fa/dashboard');
}
} else {
setError(result.message);
diff --git a/src/pages/Maps.jsx b/src/pages/Maps.jsx
index e8073da..80954b0 100644
--- a/src/pages/Maps.jsx
+++ b/src/pages/Maps.jsx
@@ -1,6 +1,6 @@
import React, { useState, useMemo, useEffect } from 'react';
import { MapContainer, TileLayer, Polygon, useMapEvents, Marker, Popup } from 'react-leaflet';
-import { X, Home, DollarSign, User, Info, Edit2, Save, Check, MapPin, Loader2, Plus, AlertCircle } from 'lucide-react';
+import { X, Home, DollarSign, User, Info, Edit2, Save, Check, MapPin, Loader2, Plus, AlertCircle, ShieldCheck } from 'lucide-react';
import 'leaflet/dist/leaflet.css';
import { useMockStore } from '../data/mockStore';
import { useAuth } from '../context/AuthContext';
@@ -51,33 +51,53 @@ const MapInteraction = ({ onMapClick }) => {
return null;
};
-const MapLegend = () => (
-
-
Map Legend
-
-
-
-
Hot Lead
+const MapLegend = () => {
+ const [isOpen, setIsOpen] = useState(false);
+
+ return (
+ <>
+ {/* Mobile Toggle - Top Right */}
+
+
+ {/* Legend Content - Below Toggle */}
+
+
+ Map Legend
+
+
+
-
-
-
-
-
-
-);
+ >
+ );
+};
// Map View
const MapView = ({ data, onSelect, onMapCreate }) => {
@@ -102,7 +122,6 @@ const MapView = ({ data, onSelect, onMapCreate }) => {
/>
-
{data.map((item) => {
let color = "#a78bfa"; // Violet-400 (New Neutral)
@@ -175,6 +194,7 @@ const RenderInput = ({ label, field, type = "text", placeholder, options, min, m
const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, loadingAddr }) => {
const [isEditing, setIsEditing] = useState(false);
+ // Initial State Matching Schema
// Initial State Matching Schema
const initialFormState = {
// Status
@@ -224,6 +244,23 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
desiredPrice: '',
minPrice: '',
+ // 3.0 Insurance Information
+ insurance_company: '',
+ insurance_company_not_listed: false,
+ damage_location: '',
+ date_of_loss: '',
+ claim_filed: 'No',
+ claim_number: '',
+ has_paperwork: 'No',
+ adjuster_name: '',
+ adjuster_phone: '',
+ adjuster_ext: '',
+ adjuster_type: '',
+ adjuster_fax: '',
+ adjuster_email: '',
+ met_with_adjuster: 'No',
+ claim_approved: 'No',
+
// Notes
notes: ''
};
@@ -245,7 +282,7 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
propertyType: data.propertyData?.propertyType || 'House',
// Correctly map fields from mockStore structure (flat objects) to form state
builtUpArea: data.propertyData?.totalBuiltUpArea || '',
- lotSize: data.propertyData?.lotPlotSize || '', // mockStore might return string "0.22 Acres", assuming input handles text or needs parsing if strictly number
+ lotSize: data.propertyData?.lotPlotSize || '',
yearBuilt: data.propertyData?.yearBuilt || '',
bedrooms: data.propertyData?.numberOfBedrooms || '',
bathrooms: data.propertyData?.numberOfBathrooms || '',
@@ -271,6 +308,23 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
desiredPrice: data.ownerData?.desiredSellingPrice || '',
minPrice: data.ownerData?.minimumAcceptableSellingPrice || '',
ownerAddress: data.ownerData?.mailingAddress || '',
+
+ // Map Insurance Data
+ insurance_company: data.insuranceData?.insurance_company || '',
+ insurance_company_not_listed: data.insuranceData?.insurance_company_not_listed || false,
+ damage_location: data.insuranceData?.damage_location || '',
+ date_of_loss: data.insuranceData?.date_of_loss || '',
+ claim_filed: data.insuranceData?.claim_filed ? 'Yes' : 'No',
+ claim_number: data.insuranceData?.claim_number || '',
+ has_paperwork: data.insuranceData?.has_paperwork ? 'Yes' : 'No',
+ adjuster_name: data.insuranceData?.adjuster_name || '',
+ adjuster_phone: data.insuranceData?.adjuster_phone || '',
+ adjuster_ext: data.insuranceData?.adjuster_ext || '',
+ adjuster_type: data.insuranceData?.adjuster_type || '',
+ adjuster_fax: data.insuranceData?.adjuster_fax || '',
+ adjuster_email: data.insuranceData?.adjuster_email || '',
+ met_with_adjuster: data.insuranceData?.met_with_adjuster ? 'Yes' : 'No',
+ claim_approved: data.insuranceData?.claim_approved ? 'Yes' : 'No',
});
setIsEditing(false);
} else if (newLocation) {
@@ -340,7 +394,7 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
};
return (
-
+
{/* Header */}
@@ -375,7 +429,7 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
{isEditing && (
-
+
{["Neutral", "Hot Lead", "Renovated", "Customer", "Not Interested"].map(s => (
))}
@@ -388,12 +442,12 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
Property Basics
-
+
-
+
@@ -406,7 +460,7 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
Value & Condition
-
+
@@ -427,22 +481,22 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
Tenant Profile
-
+
-
+
-
+
Lease Details
-
+
@@ -459,20 +513,73 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
)}
- {/* SECTION 4: OWNER INTENT (Conditional) */}
+ {/* SECTION 4: INSURANCE INFORMATION */}
+
+
+
Insurance Information
+
+
+
+
+
+
+ isEditing && setFormData({ ...formData, insurance_company_not_listed: e.target.checked })}
+ disabled={!isEditing}
+ className="rounded border-zinc-300 dark:border-white/10"
+ />
+ Company Not Listed
+
+
+
+
+
+
+
+ {formData.claim_filed === 'Yes' && (
+
+
+
+
+
+
+
+
Adjuster Details
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+
+
+ {/* SECTION 5: OWNER INTENT (Conditional) */}
-
+
{formData.willingToSell === 'Yes' ? (
-
+
@@ -488,7 +595,7 @@ const Drawer = ({ isOpen, onClose, data, newLocation, onUpdateStatus, onSave, lo
Owner Contact
-
+
@@ -666,6 +773,24 @@ function Maps() {
}
};
+ const newInsuranceData = {
+ insurance_company: formData.insurance_company,
+ insurance_company_not_listed: formData.insurance_company_not_listed,
+ damage_location: formData.damage_location,
+ date_of_loss: formData.date_of_loss,
+ claim_filed: formData.claim_filed === 'Yes',
+ claim_number: formData.claim_number,
+ has_paperwork: formData.has_paperwork === 'Yes',
+ adjuster_name: formData.adjuster_name,
+ adjuster_phone: formData.adjuster_phone,
+ adjuster_ext: formData.adjuster_ext,
+ adjuster_type: formData.adjuster_type,
+ adjuster_fax: formData.adjuster_fax,
+ adjuster_email: formData.adjuster_email,
+ met_with_adjuster: formData.met_with_adjuster === 'Yes',
+ claim_approved: formData.claim_approved === 'Yes',
+ };
+
if (selectedPropertyId) {
// Update Existing
setProperties(prev => prev.map(p => {
@@ -678,7 +803,8 @@ function Maps() {
...p.propertyData,
...newPropertyData,
details: { ...p.propertyData.details, ...newPropertyData.details } // Merge to keep existing data not in form if any
- }
+ },
+ insuranceData: newInsuranceData
};
}
return p;
@@ -691,6 +817,7 @@ function Maps() {
polygon: [], // We don't have a polygon drawing tool yet, implies point-based or empty
canvassingStatus: formData.status,
ownerData: newOwnerData,
+ insuranceData: newInsuranceData,
propertyData: {
...newPropertyData,
propertyAddress: newPropertyLocation.address,
@@ -732,6 +859,7 @@ function Maps() {
onSelect={handlePropertySelect}
onMapCreate={handleMapCreate}
/>
+