Templates and export tables

This commit is contained in:
2026-03-11 14:34:10 -05:00
parent 6906cfe5da
commit cd6265e2f2
4 changed files with 457 additions and 2 deletions
+18 -1
View File
@@ -1,7 +1,7 @@
import type { Component } from 'solid-js';
import { createSignal, For, createMemo, onMount, Show } from 'solid-js';
import { Portal } from 'solid-js/web';
import { Plus, ChevronRight, ListTree, Calculator, FolderKanban, Info, PanelLeftOpen, PanelLeftClose, FileUp, Download, Upload, FileText, ChevronDown, AlertTriangle, CheckCircle2, X } from 'lucide-solid';
import { Plus, ChevronRight, ListTree, Calculator, FolderKanban, Info, PanelLeftOpen, PanelLeftClose, FileUp, Download, Upload, FileText, ChevronDown, AlertTriangle, CheckCircle2, X, Table } from 'lucide-solid';
import { GENERAL_NOTES_DEFAULT, GENERAL_PRE_NOTES_DEFAULT } from '../company-info';
import type { Scope, SubScope, EstimateItem } from '../types';
import type { ExtractedItem } from '../utils/csv-parser';
@@ -14,6 +14,8 @@ import CalculatorPopover from './CalculatorPopover';
import { appStore } from '../store/appStore';
import { pb, COLLECTIONS } from '../utils/db';
import CloudLoadModal from './CloudLoadModal';
import ExportTableModal from './ExportTableModal';
import ApplyTemplateModal from './ApplyTemplateModal';
interface EstimateBuilderProps {
initialItems: ExtractedItem[];
@@ -48,6 +50,8 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
const [showSaveModal, setShowSaveModal] = createSignal(false);
const [showLoadModal, setShowLoadModal] = createSignal(false);
const [isCloudLoading, setIsCloudLoading] = createSignal(false);
const [showExportTableModal, setShowExportTableModal] = createSignal(false);
const [applyTemplateScopeId, setApplyTemplateScopeId] = createSignal<string | null>(null);
onMount(() => {
// Initialize general notes if not already set by an imported estimate
@@ -500,6 +504,12 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
<Upload class="w-4 h-4" /> Import JSON
<input type="file" accept=".json" class="hidden" onChange={importEstimate} />
</label>
<button
onClick={() => setShowExportTableModal(true)}
class="flex items-center gap-2 px-3 py-2 bg-muted text-muted-foreground rounded-xl text-xs font-bold hover:bg-accent hover:text-accent-foreground transition-all border border-border mr-2"
>
<Table class="w-4 h-4" /> Export Table
</button>
<button
onClick={exportEstimate}
class="flex items-center gap-2 px-3 py-2 bg-muted text-muted-foreground rounded-xl text-xs font-bold hover:bg-accent hover:text-accent-foreground transition-all border border-border mr-2"
@@ -818,6 +828,7 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
allScopes={scopes}
allSubScopes={subScopes}
onCopySubScopeItems={copySubScopeItems}
onOpenApplyTemplate={setApplyTemplateScopeId}
isSidebarCollapsed={isSidebarCollapsed}
selectedIds={selectedIds()}
onToggleSelection={toggleSelection}
@@ -1064,6 +1075,12 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
{/* Load Modal */}
<CloudLoadModal show={showLoadModal()} onClose={() => setShowLoadModal(false)} />
{/* Export Table Modal */}
<ExportTableModal show={showExportTableModal()} onClose={() => setShowExportTableModal(false)} />
{/* Apply Template Modal */}
<ApplyTemplateModal show={!!applyTemplateScopeId()} scopeId={applyTemplateScopeId()} onClose={() => setApplyTemplateScopeId(null)} />
</div>
);
};