@@ -2,8 +2,8 @@ import { Box } from '@mui/system';
22import { MaterialPreview , Project , isGuest } from 'shared' ;
33import { NERButton } from '../../../components/NERButton' ;
44import WarningIcon from '@mui/icons-material/Warning' ;
5+ import React , { useState } from 'react' ;
56import { Tooltip , useTheme } from '@mui/material' ;
6- import { useState } from 'react' ;
77import BOMTableWrapper from './BOM/BOMTableWrapper' ;
88import CreateMaterialModal from './BOM/MaterialForm/CreateMaterialModal' ;
99import CreateAssemblyModal from './BOM/AssemblyForm/CreateAssemblyModal' ;
@@ -13,6 +13,7 @@ import { useCurrentUser } from '../../../hooks/users.hooks';
1313import LoadingIndicator from '../../../components/LoadingIndicator' ;
1414import ErrorPage from '../../ErrorPage' ;
1515import { useGetAssembliesForWbsElement , useGetMaterialsForWbsElement } from '../../../hooks/bom.hooks' ;
16+ import BOMCopyConfirmModal from './BOM/MaterialForm/BOMCopyConfirmModal' ;
1617
1718export const addMaterialCosts = ( accumulator : number , currentMaterial : MaterialPreview ) =>
1819 currentMaterial . subtotal ?? 0 + accumulator ;
@@ -22,8 +23,9 @@ const BOMTab = ({ project }: { project: Project }) => {
2223 const [ hideColumn , setHideColumn ] = useState < boolean [ ] > ( initialHideColumn ) ;
2324 const [ showAddMaterial , setShowAddMaterial ] = useState ( false ) ;
2425 const [ showAddAssembly , setShowAddAssembly ] = useState ( false ) ;
25- const theme = useTheme ( ) ;
26+ const [ bomConfirmOpen , setBomConfirmOpen ] = React . useState ( false ) ;
2627
28+ const theme = useTheme ( ) ;
2729 const user = useCurrentUser ( ) ;
2830
2931 const {
@@ -93,12 +95,26 @@ const BOMTab = ({ project }: { project: Project }) => {
9395 >
9496 Show All Columns
9597 </ NERButton >
96- { /*
97- <NERButton variant="contained" onClick={() => {}} disabled={isGuest(user.role)}>
98+ < NERButton
99+ variant = "contained"
100+ onClick = { ( ) => {
101+ setBomConfirmOpen ( true ) ;
102+ } }
103+ disabled = { isGuest ( user . role ) }
104+ >
98105 Copy Existing BOM
99106 </ NERButton >
100- */ }
101107 </ Box >
108+ < BOMCopyConfirmModal
109+ open = { bomConfirmOpen }
110+ onHide = { ( ) => {
111+ setBomConfirmOpen ( false ) ;
112+ } }
113+ onSuccess = { ( ) => { } }
114+ materialsCount = { 1 }
115+ sourceProjectName = { 'Source Project' }
116+ currentProjectName = { 'Target Project' }
117+ > </ BOMCopyConfirmModal >
102118 < Box display = "flex" gap = "20px" alignItems = "center" >
103119 < Box sx = { { backgroundColor : theme . palette . background . paper , padding : '8px 14px 8px 14px' , borderRadius : '6px' } } >
104120 Budget: ${ project . budget }
0 commit comments