@@ -512,6 +512,16 @@ const SubmitMeetingSummary: NextPage = () => {
512512
513513 const currentWorkgroup = workgroups . find ( ( wg ) => wg . workgroup_id === selectedWorkgroupId ) ;
514514
515+ const hasDateConflict =
516+ selectionMode === "cleanNew" &&
517+ newSummaryDate &&
518+ meetings . some ( ( m : any ) => {
519+ // Use meetingInfo.date if available to avoid timezone conversion issues.
520+ const meetingDate = m . meetingInfo ?. date || m . date . split ( "T" ) [ 0 ] ;
521+ return meetingDate === newSummaryDate && m . username === myVariable . currentUser ;
522+ } ) ;
523+
524+ console . log ( myVariable , meetings , newSummaryDate )
515525 return (
516526 < div className = { styles . container } >
517527 { /* ---------- MODAL ---------- */ }
@@ -523,20 +533,20 @@ const SubmitMeetingSummary: NextPage = () => {
523533 contentLabel = "Select Summary Option"
524534 style = { {
525535 overlay : {
526- backgroundColor : ' rgba(0, 0, 0, 0.5)' ,
527- display : ' flex' ,
528- alignItems : ' center' ,
529- justifyContent : ' center'
536+ backgroundColor : " rgba(0, 0, 0, 0.5)" ,
537+ display : " flex" ,
538+ alignItems : " center" ,
539+ justifyContent : " center" ,
530540 } ,
531541 content : {
532- position : ' relative' ,
533- inset : ' unset' ,
534- maxWidth : ' 500px' ,
535- margin : ' auto' ,
536- borderRadius : ' 8px' ,
537- padding : ' 1rem' ,
538- backgroundColor : ' #fff'
539- }
542+ position : " relative" ,
543+ inset : " unset" ,
544+ maxWidth : " 500px" ,
545+ margin : " auto" ,
546+ borderRadius : " 8px" ,
547+ padding : " 1rem" ,
548+ backgroundColor : " #fff" ,
549+ } ,
540550 } }
541551 >
542552 < h2 > Select how you want to proceed</ h2 >
@@ -545,7 +555,7 @@ const SubmitMeetingSummary: NextPage = () => {
545555 < strong > Workgroup:</ strong > { currentWorkgroup . workgroup }
546556 </ p >
547557 ) }
548- < div style = { { marginTop : ' 1rem' } } >
558+ < div style = { { marginTop : " 1rem" } } >
549559 { /* 1. Edit existing summary */ }
550560 < label style = { { display : 'block' , marginBottom : '0.5rem' } } >
551561 < input
@@ -572,40 +582,17 @@ const SubmitMeetingSummary: NextPage = () => {
572582 ) }
573583
574584 { /* 2. Clean new summary */ }
575- < label style = { { display : ' block' , marginBottom : ' 0.5rem' } } >
585+ < label style = { { display : " block" , marginBottom : " 0.5rem" } } >
576586 < input
577587 type = "radio"
578588 value = "cleanNew"
579- checked = { selectionMode === ' cleanNew' }
580- onChange = { ( ) => setSelectionMode ( ' cleanNew' ) }
589+ checked = { selectionMode === " cleanNew" }
590+ onChange = { ( ) => setSelectionMode ( " cleanNew" ) }
581591 />
582- Create a new ** clean** summary
592+ Create a new < strong > clean</ strong > summary
583593 </ label >
584- { selectionMode === 'cleanNew' && (
585- < div style = { { marginLeft : '1.5rem' , marginBottom : '1rem' } } >
586- < label >
587- Select meeting date:{ " " }
588- < input
589- type = "date"
590- value = { newSummaryDate }
591- onChange = { ( e ) => setNewSummaryDate ( e . target . value ) }
592- />
593- </ label >
594- </ div >
595- ) }
596-
597- { /* 3. Prefilled new summary */ }
598- < label style = { { display : 'block' , marginBottom : '0.5rem' } } >
599- < input
600- type = "radio"
601- value = "prefilledNew"
602- checked = { selectionMode === 'prefilledNew' }
603- onChange = { ( ) => setSelectionMode ( 'prefilledNew' ) }
604- />
605- Create a new **prefilled** summary (from the last one)
606- </ label >
607- { selectionMode === 'prefilledNew' && (
608- < div style = { { marginLeft : '1.5rem' , marginBottom : '1rem' } } >
594+ { selectionMode === "cleanNew" && (
595+ < div style = { { marginLeft : "1.5rem" , marginBottom : "1rem" } } >
609596 < label >
610597 Select meeting date:{ " " }
611598 < input
@@ -614,6 +601,12 @@ const SubmitMeetingSummary: NextPage = () => {
614601 onChange = { ( e ) => setNewSummaryDate ( e . target . value ) }
615602 />
616603 </ label >
604+ { hasDateConflict && (
605+ < p style = { { color : "red" , fontWeight : "bold" } } >
606+ You already have a summary for this date. Please choose a
607+ different date or choose to edit the existing summary above
608+ </ p >
609+ ) }
617610 </ div >
618611 ) }
619612
@@ -673,21 +666,17 @@ const SubmitMeetingSummary: NextPage = () => {
673666 style = { { marginTop : '1rem' } }
674667 onClick = { confirmModalSelection }
675668 disabled = {
676- ( ! selectionMode ) ||
669+ ! selectionMode ||
677670 ( selectionMode === 'edit' && ! selectedSummaryForEdit ) ||
678671 (
679- (
680- selectionMode === 'cleanNew' ||
681- selectionMode === 'prefilledNew' ||
682- selectionMode === 'noSummaryGiven' ||
683- selectionMode === 'canceledSummary'
684- ) &&
685- ! newSummaryDate
672+ ( selectionMode === 'cleanNew' && ( ! newSummaryDate || hasDateConflict ) ) ||
673+ ( ( selectionMode === 'noSummaryGiven' || selectionMode === 'canceledSummary' ) && ! newSummaryDate )
686674 )
687675 }
688676 >
689677 Confirm
690678 </ button >
679+
691680 </ Modal >
692681 { /* ---------- /MODAL ---------- */ }
693682
0 commit comments