mobile: Optimizations for Maps Drawer, Legend, and Customer Profile Tabs

This commit is contained in:
Satyam
2026-02-10 20:36:44 +05:30
parent 91b47e83c3
commit 83250d687e
15 changed files with 1140 additions and 91 deletions
+105 -3
View File
@@ -142,6 +142,14 @@ const EMPLOYERS_BY_OCCUPATION = {
"Consultant": ["McKinsey", "BCG", "Accenture", "Freelance"]
};
// --- NEW INSURANCE SCHEMA CONSTANTS ---
const INSURANCE_COMPANIES = [
"State Farm", "Allstate", "Liberty Mutual", "Farmers", "Nationwide",
"USAA", "Chubb", "Travelers", "Progressive", "American Family"
];
const ADJUSTER_TYPES = ["Staff Adjuster", "Independent Adjuster", "Public Adjuster"];
// --- DATA GENERATION HELPERS ---
function generatePolygon(lat, lng) {
@@ -342,7 +350,52 @@ function generateProperties() {
willingToSellProperty: Math.random() > 0.85,
desiredSellingPrice: Math.floor(value * 1.1),
minimumAcceptableSellingPrice: Math.floor(value * 1.05)
}
},
// New Insurance Data Schema
insuranceData: (() => {
const claimFiled = Math.random() > 0.8; // 20% likely
if (!claimFiled) {
return {
insurance_company: getWeightedRandom(INSURANCE_COMPANIES, Array(10).fill(0.1)),
insurance_company_not_listed: false,
damage_location: null,
date_of_loss: null,
claim_filed: false,
claim_number: null,
has_paperwork: false,
adjuster_name: null,
adjuster_phone: null,
adjuster_ext: null,
adjuster_type: null,
adjuster_fax: null,
adjuster_email: null,
met_with_adjuster: false,
claim_approved: false
};
}
// If claim filed, populate detailed data
const lossDate = new Date();
lossDate.setDate(lossDate.getDate() - Math.floor(Math.random() * 60)); // Last 60 days
return {
insurance_company: getWeightedRandom(INSURANCE_COMPANIES, Array(10).fill(0.1)),
insurance_company_not_listed: false,
damage_location: "Roof, Gutters, Fence",
date_of_loss: lossDate.toISOString().split('T')[0],
claim_filed: true,
claim_number: `CLM-${Math.floor(Math.random() * 1000000)}`,
has_paperwork: Math.random() > 0.3,
adjuster_name: REAL_NAMES[Math.floor(Math.random() * REAL_NAMES.length)],
adjuster_phone: `214-555-${Math.floor(Math.random() * 9000) + 1000}`,
adjuster_ext: `${Math.floor(Math.random() * 900) + 100}`,
adjuster_type: ADJUSTER_TYPES[Math.floor(Math.random() * ADJUSTER_TYPES.length)],
adjuster_fax: `214-555-${Math.floor(Math.random() * 9000) + 1000}`,
adjuster_email: `adjuster.${Math.floor(Math.random() * 100)}@insurance.com`,
met_with_adjuster: Math.random() > 0.5,
claim_approved: Math.random() > 0.7
};
})()
};
});
@@ -484,7 +537,7 @@ function generateProperties() {
const MOCK_USERS = [
// Customers
{ id: 'c1', type: 'customer', username: 'alice', email: 'alice@example.com', password: 'password', name: 'Alice Customer' },
{ id: 'c1', type: 'customer', username: 'alice', email: 'alice@example.com', password: 'password', name: 'Alice Customer', propertyId: 'P-2600' },
{ id: 'c2', type: 'customer', username: 'bob', email: 'bob@example.com', password: 'password', name: 'Bob Buyer' },
{ id: 'c3', type: 'customer', username: 'charlie', email: 'charlie@example.com', password: 'password', name: 'Charlie Client' },
@@ -545,6 +598,52 @@ function generateMockMeetings() {
}
});
// Generate Alice's Demo Meetings
const aliceMeetings = [
// Upcoming
{
id: `m-alice-1`,
agentId: 'e1',
customerName: 'Alice Customer',
customerId: 'c1', // Explicit ID link
propertyId: 'P-Alice-1',
date: new Date(Date.now() + 86400000 * 2).toISOString().split('T')[0], // 2 days from now
time: '14:00',
status: 'Scheduled',
agentName: 'Frank Agent',
notes: 'Initial Roof Inspection'
},
// History
{
id: `m-alice-2`,
agentId: 'e2',
customerName: 'Alice Customer',
customerId: 'c1',
propertyId: 'P-Alice-1',
date: new Date(Date.now() - 86400000 * 15).toISOString().split('T')[0], // 15 days ago
time: '10:00',
status: 'Completed',
agentName: 'Fiona Field',
dealValue: 1500,
notes: 'Minor repairs completed. Payment received.'
},
{
id: `m-alice-3`,
agentId: 'e1',
customerName: 'Alice Customer',
customerId: 'c1',
propertyId: 'P-Alice-1',
date: new Date(Date.now() - 86400000 * 45).toISOString().split('T')[0], // 45 days ago
time: '11:00',
status: 'Completed',
agentName: 'Frank Agent',
dealValue: 0,
notes: 'Consultation - Quote provided.'
}
];
meetings.push(...aliceMeetings);
return meetings;
}
@@ -582,7 +681,10 @@ export const MockStoreProvider = ({ children }) => {
users,
meetings,
updatePropertyStatus,
addMeeting
addMeeting,
updateUser: (updatedUser) => {
setUsers(prev => prev.map(u => u.id === updatedUser.id ? updatedUser : u));
}
}}>
{children}
</MockStoreContext.Provider>