@@ -14,6 +14,7 @@ import GetAppIcon from '@mui/icons-material/GetApp';
1414import GridOnIcon from '@mui/icons-material/GridOn' ;
1515import GroupWork from '@mui/icons-material/GroupWork' ;
1616import ReduceCapacityIcon from '@mui/icons-material/ReduceCapacity' ;
17+ import Warning from '@mui/icons-material/Warning' ;
1718import { IconButton , Tooltip } from '@mui/material' ;
1819import Box from '@mui/material/Box' ;
1920import Button from '@mui/material/Button' ;
@@ -462,6 +463,30 @@ const ProposalTableOfficer = ({
462463 searchParams . getAll ( 'selection' ) . includes ( item . primaryKey . toString ( ) )
463464 ) ;
464465
466+ const runWithMultiSelectConfirm = ( action : ( ) => void ) => {
467+ const selectedCount = getSelectedProposalPks ( ) . length ;
468+
469+ if ( selectedCount > 1 ) {
470+ confirm ( action , {
471+ title : 'Are you sure? Multiple proposals selected!' ,
472+ description : (
473+ < Box display = "flex" alignItems = "center" >
474+ < Warning color = "warning" sx = { { marginRight : 1 } } />
475+ < span >
476+ < b > { selectedCount } </ b > proposals are selected. This action will
477+ run on all of the selected proposals. Are you sure you want to
478+ proceed?
479+ </ span >
480+ </ Box >
481+ ) ,
482+ confirmationText : 'Yes, proceed' ,
483+ cancellationText : 'Cancel' ,
484+ } ) ( ) ;
485+ } else {
486+ action ( ) ;
487+ }
488+ } ;
489+
465490 const handleClose = ( selectedOption : string ) => {
466491 const firstSelectedProposalTitle = getSelectedProposalsData ( ) [ 0 ] . title ;
467492 if ( selectedOption === PdfDownloadMenuOption . PDF ) {
@@ -780,9 +805,10 @@ const ProposalTableOfficer = ({
780805 {
781806 icon : FileCopy ,
782807 tooltip : 'Clone proposals to call' ,
783- onClick : ( ) => {
784- setOpenCallSelection ( true ) ;
785- } ,
808+ onClick : ( ) =>
809+ runWithMultiSelectConfirm ( ( ) => {
810+ setOpenCallSelection ( true ) ;
811+ } ) ,
786812 position : 'toolbarOnSelect' ,
787813 } ,
788814 {
@@ -817,8 +843,7 @@ const ProposalTableOfficer = ({
817843 } ,
818844 {
819845 title : 'Delete proposals' ,
820- description :
821- 'This action will delete proposals and all data associated with them.' ,
846+ description : `This action will delete ${ selectedProposalsData . length } proposal(s) and all data associated with them.` ,
822847 }
823848 ) ( ) ;
824849 } ,
@@ -911,7 +936,9 @@ const ProposalTableOfficer = ({
911936 tableActions . push ( {
912937 icon : ReduceCapacityIconComponent ,
913938 tooltip : 'Reassign selected Techniqual Reviews' ,
914- onClick : handleBulkTechnicalReviewsReassign ,
939+ onClick : ( ) => {
940+ runWithMultiSelectConfirm ( handleBulkTechnicalReviewsReassign ) ;
941+ } ,
915942 position : 'toolbarOnSelect' ,
916943 } ) ;
917944
0 commit comments