feat(estimates): add EstimatesPage hub with templates tab, estimate detail drawer, and template editor

- EstimatesPage: tabbed hub with Estimates and Templates tabs, KPI strip, search + filter
- EstimateDetailModal: right-side drawer showing scope of work, computed line items, and financial summary from template + roof area
- TemplateEditorModal: create/edit/duplicate templates with segmented mode toggle
- Owner-only template management (create, edit, duplicate, delete); Admin/FA read-only view
- Duplicate mode: toggle between 'Save as new copy' (default, editable name) and 'Replace original'
- MASTER_TEMPLATES and MOCK_ESTIMATES moved into mockStore with full CRUD helpers
- TemplateSelectionModal now reads from mockStore instead of local stub
- Sidebar nav updated to point to /estimates hub for all roles
- Routes added: /emp/fa/estimates, /admin/estimates, /owner/estimates
This commit is contained in:
Satyam-Rastogi
2026-04-01 16:13:36 +05:30
parent 9be8ec911f
commit 8f9cb9dd48
7 changed files with 1690 additions and 5 deletions
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import { useMockStore } from '../../data/mockStore';
const STUBBED_TEMPLATES = [
{
@@ -531,10 +532,11 @@ const STUBBED_TEMPLATES = [
];
export default function TemplateSelectionModal({ isOpen, onClose, onSelectTemplate }) {
const { templates } = useMockStore();
const [searchTerm, setSearchTerm] = useState('');
const [selected, setSelected] = useState(null);
const filtered = STUBBED_TEMPLATES.filter(t =>
const filtered = templates.filter(t =>
t.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
t.category.toLowerCase().includes(searchTerm.toLowerCase())
);
@@ -579,7 +581,7 @@ export default function TemplateSelectionModal({ isOpen, onClose, onSelectTempla
{/* Category Header */}
<div className="px-4 py-3 bg-blue-50/50 dark:bg-blue-900/10 border-b border-zinc-200 dark:border-white/10">
<h3 className="text-sm font-semibold text-blue-600 dark:text-blue-400">
Roofing ({filtered.length})
Templates ({filtered.length})
</h3>
</div>