Tables Good
This commit is contained in:
@@ -15,6 +15,7 @@ import CloudLoadModal from './CloudLoadModal';
|
||||
import ExportTableModal from './ExportTableModal';
|
||||
import ApplyTemplateModal from './ApplyTemplateModal';
|
||||
import HistoryModal from './estimate-builder/HistoryModal';
|
||||
import { NewEstimateModal } from './estimate-builder/NewEstimateModal';
|
||||
|
||||
// Import extracted components & hooks
|
||||
import { useEstimateCalculations } from './estimate-builder/useEstimateCalculations';
|
||||
@@ -33,7 +34,6 @@ import { ScopesList } from './estimate-builder/ScopesList';
|
||||
|
||||
interface EstimateBuilderProps {
|
||||
initialItems: ExtractedItem[];
|
||||
onReset: () => void;
|
||||
}
|
||||
|
||||
const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
@@ -48,6 +48,7 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
const [showSaveModal, setShowSaveModal] = createSignal(false);
|
||||
const [showLoadModal, setShowLoadModal] = createSignal(false);
|
||||
const [showHistoryModal, setShowHistoryModal] = createSignal(false);
|
||||
const [showNewEstimateModal, setShowNewEstimateModal] = createSignal(false);
|
||||
const [showExportTableModal, setShowExportTableModal] = createSignal(false);
|
||||
const [applyTemplateScopeId, setApplyTemplateScopeId] = createSignal<string | null>(null);
|
||||
|
||||
@@ -105,6 +106,7 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
setScopes(prev => [...prev, newScope]);
|
||||
addSubScopeWithName(scopeId, 'Materials');
|
||||
addSubScopeWithName(scopeId, 'Labor');
|
||||
return scopeId;
|
||||
};
|
||||
|
||||
const addSubScopeWithName = (scopeId: string, name: string) => {
|
||||
@@ -114,6 +116,7 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
scopeId
|
||||
};
|
||||
setSubScopes(prev => [...prev, newSubScope]);
|
||||
return newSubScope.id;
|
||||
};
|
||||
|
||||
const addSubScope = (scopeId: string) => {
|
||||
@@ -195,14 +198,14 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
isSidebarCollapsed={isSidebarCollapsed()}
|
||||
onToggleSidebar={() => setIsSidebarCollapsed(!isSidebarCollapsed())}
|
||||
onAddScope={addScope}
|
||||
onReset={props.onReset}
|
||||
onShowNewEstimateModal={() => setShowNewEstimateModal(true)}
|
||||
onImportEstimate={importEstimate}
|
||||
onShowExportTableModal={() => setShowExportTableModal(true)}
|
||||
onExportEstimate={exportEstimate}
|
||||
onShowLoadModal={() => setShowLoadModal(true)}
|
||||
onShowSaveModal={() => setShowSaveModal(true)}
|
||||
onShowHistoryModal={() => setShowHistoryModal(true)}
|
||||
onSaveChanges={saveChangesToCloud}
|
||||
onSaveChanges={() => appStore.isLatestVersion() ? saveChangesToCloud() : saveAsNewestToCloud()}
|
||||
/>
|
||||
|
||||
<div class="flex flex-1 relative items-start">
|
||||
@@ -358,6 +361,29 @@ const EstimateBuilder: Component<EstimateBuilderProps> = (props) => {
|
||||
<ExportTableModal show={showExportTableModal()} onClose={() => setShowExportTableModal(false)} />
|
||||
<ApplyTemplateModal show={!!applyTemplateScopeId()} scopeId={applyTemplateScopeId()} onClose={() => setApplyTemplateScopeId(null)} />
|
||||
<HistoryModal show={showHistoryModal()} onClose={() => setShowHistoryModal(false)} onCheckout={checkoutVersion} />
|
||||
|
||||
<NewEstimateModal
|
||||
show={showNewEstimateModal()}
|
||||
onClose={() => setShowNewEstimateModal(false)}
|
||||
onResetCSV={() => {
|
||||
appStore.resetEstimate();
|
||||
setShowNewEstimateModal(false);
|
||||
}}
|
||||
onManualEstimate={() => {
|
||||
appStore.resetEstimate();
|
||||
setItems([{
|
||||
id: crypto.randomUUID(),
|
||||
description: 'Item',
|
||||
quantity: 1,
|
||||
unitPrice: 0,
|
||||
markup: 0,
|
||||
markupType: 'percent',
|
||||
contingency: 0,
|
||||
contingencyType: 'percent'
|
||||
}]);
|
||||
setShowNewEstimateModal(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user