Skip to content

Commit e0e9d8a

Browse files
committed
#3885: Created basic modal on click; functionality incomplete
1 parent e795e1e commit e0e9d8a

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Console } from 'console';
2+
import NERModal from '../../../../../components/NERModal';
3+
4+
export interface BOMCopyConfirmModalProps {
5+
open: boolean;
6+
onHide: () => void;
7+
onSuccess?: () => void;
8+
}
9+
10+
const BOMCopyConfirmModal = ({ open, onHide, onSuccess }: BOMCopyConfirmModalProps) => {
11+
// TODO: make the actual message
12+
return (
13+
<NERModal open={open} onHide={onHide} onSubmit={onSuccess} title="Confirm Copy">
14+
Are you sure you want to copy [X] materials from [Source Project Name] to [Current Project Name]?
15+
</NERModal>
16+
);
17+
};
18+
19+
export default BOMCopyConfirmModal;

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/BOM/MaterialForm/MaterialFormView.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
Button,
23
FormControl,
34
FormHelperText,
45
FormLabel,
@@ -22,6 +23,7 @@ import { displayEnum } from '../../../../../utils/pipes';
2223
import { MaterialStatus } from 'shared';
2324
import React from 'react';
2425
import { AddCircle } from '@mui/icons-material';
26+
import BOMCopyConfirmModal from './BOMCopyConfirmModal';
2527

2628
export interface MaterialFormViewProps {
2729
submitText: 'Add' | 'Edit';
@@ -70,6 +72,7 @@ const MaterialFormView: React.FC<MaterialFormViewProps> = ({
7072
const quantity = watch('quantity');
7173
const price = watch('price');
7274
const subtotal = quantity && price ? quantity * price : 0;
75+
const [bomConfirmOpen, setBomConfirmOpen] = React.useState(false);
7376

7477
return (
7578
<NERFormModal
@@ -477,7 +480,7 @@ const MaterialFormView: React.FC<MaterialFormViewProps> = ({
477480
</FormControl>
478481
</Box>
479482
</Grid>
480-
{/*submitText === 'Add' && (
483+
{submitText === 'Add' && (
481484
<Grid item xs={12} sx={{ pl: 0, pr: 0 }}>
482485
<Box
483486
sx={{
@@ -487,9 +490,12 @@ const MaterialFormView: React.FC<MaterialFormViewProps> = ({
487490
<Button
488491
variant="contained"
489492
disableElevation
490-
onClick={() => {}}
493+
onClick={() => {
494+
setBomConfirmOpen(true);
495+
}}
491496
sx={{
492497
mx: 0,
498+
my: 1,
493499
textTransform: 'none',
494500
bgcolor: '#EF4345',
495501
color: (t) => t.palette.getContrastText('#EF4345'),
@@ -500,7 +506,14 @@ const MaterialFormView: React.FC<MaterialFormViewProps> = ({
500506
</Button>
501507
</Box>
502508
</Grid>
503-
)*/}
509+
)}
510+
<BOMCopyConfirmModal
511+
open={bomConfirmOpen}
512+
onHide={() => {
513+
setBomConfirmOpen(false);
514+
}}
515+
onSuccess={() => {}}
516+
></BOMCopyConfirmModal>
504517
</NERFormModal>
505518
);
506519
};

0 commit comments

Comments
 (0)