@ -421,6 +421,7 @@ export default class OnboardMeetingView extends Vue {
allProjects : PlanData [ ] = [ ] ;
allProjects : PlanData [ ] = [ ] ;
allContacts : Contact [ ] = [ ] ;
allContacts : Contact [ ] = [ ] ;
allMyDids : string [ ] = [ ] ;
allMyDids : string [ ] = [ ] ;
selectedProjectData : PlanData | null = null ;
get minDateTime ( ) {
get minDateTime ( ) {
const now = new Date ( ) ;
const now = new Date ( ) ;
now . setMinutes ( now . getMinutes ( ) + 5 ) ; / / S e t m i n i m u m 5 m i n u t e s i n t h e f u t u r e
now . setMinutes ( now . getMinutes ( ) + 5 ) ; / / S e t m i n i m u m 5 m i n u t e s i n t h e f u t u r e
@ -447,6 +448,10 @@ export default class OnboardMeetingView extends Vue {
await this . loadProjects ( ) ;
await this . loadProjects ( ) ;
await this . fetchCurrentMeeting ( ) ;
await this . fetchCurrentMeeting ( ) ;
/ / E n s u r e s e l e c t e d p r o j e c t i s l o a d e d i f p r o j e c t L i n k e x i s t s
await this . ensureSelectedProjectLoaded ( ) ;
this . isLoading = false ;
this . isLoading = false ;
}
}
@ -518,6 +523,65 @@ export default class OnboardMeetingView extends Vue {
}
}
}
}
/ * *
* Ensure the selected project is loaded if projectLink exists
* Checks allProjects first , then fetches if not found
* /
async ensureSelectedProjectLoaded ( ) : Promise < void > {
const projectLink =
this . currentMeeting ? . projectLink ||
this . newOrUpdatedMeetingInputs ? . projectLink ;
if ( ! projectLink ) {
this . selectedProjectData = null ;
return ;
}
/ / C h e c k i f a l r e a d y l o a d e d i n a l l P r o j e c t s
const existingProject = this . allProjects . find (
( p ) => p . handleId === projectLink ,
) ;
if ( existingProject ) {
this . selectedProjectData = existingProject ;
return ;
}
/ / N o t i n a l l P r o j e c t s , f e t c h i t
await this . fetchProjectByHandleId ( projectLink ) ;
}
/ * *
* Fetch a single project by handleId
* @ param handleId - The project handleId to fetch
* /
async fetchProjectByHandleId ( handleId : string ) : Promise < void > {
try {
const headers = await getHeaders ( this . activeDid ) ;
const url = ` ${ this . apiServer } /api/v2/report/plans?handleId= ${ encodeURIComponent ( handleId ) } ` ;
const resp = await this . axios . get ( url , { headers } ) ;
if ( resp . status === 200 && resp . data . data && resp . data . data . length > 0 ) {
const project = resp . data . data [ 0 ] ;
this . selectedProjectData = {
name : project . name ,
description : project . description ,
image : project . image ,
handleId : project . handleId ,
issuerDid : project . issuerDid ,
rowId : project . rowId ,
} ;
} else {
this . selectedProjectData = null ;
}
} catch ( error ) {
this . $logAndConsole (
"Error fetching project by handleId: " + errorStringForLog ( error ) ,
true ,
) ;
this . selectedProjectData = null ;
}
}
async createMeeting ( ) {
async createMeeting ( ) {
this . isLoading = true ;
this . isLoading = true ;
@ -652,7 +716,7 @@ export default class OnboardMeetingView extends Vue {
}
}
}
}
startEditing ( ) {
async startEditing ( ) {
/ / P o p u l a t e f o r m w i t h e x i s t i n g m e e t i n g d a t a
/ / P o p u l a t e f o r m w i t h e x i s t i n g m e e t i n g d a t a
if ( this . currentMeeting ) {
if ( this . currentMeeting ) {
const localExpiresAt = new Date ( this . currentMeeting . expiresAt ) ;
const localExpiresAt = new Date ( this . currentMeeting . expiresAt ) ;
@ -663,6 +727,10 @@ export default class OnboardMeetingView extends Vue {
password : this . currentMeeting . password || "" ,
password : this . currentMeeting . password || "" ,
projectLink : this . currentMeeting . projectLink || "" ,
projectLink : this . currentMeeting . projectLink || "" ,
} ;
} ;
/ / E n s u r e s e l e c t e d p r o j e c t i s l o a d e d i f p r o j e c t L i n k e x i s t s
if ( this . currentMeeting . projectLink ) {
await this . ensureSelectedProjectLoaded ( ) ;
}
} else {
} else {
this . $logError (
this . $logError (
"There is no current meeting to edit. We should never get here." ,
"There is no current meeting to edit. We should never get here." ,
@ -670,9 +738,15 @@ export default class OnboardMeetingView extends Vue {
}
}
}
}
cancelEditing ( ) {
async cancelEditing ( ) {
/ / R e s e t f o r m d a t a
/ / R e s e t f o r m d a t a
this . newOrUpdatedMeetingInputs = null ;
this . newOrUpdatedMeetingInputs = null ;
/ / R e s t o r e s e l e c t e d p r o j e c t f r o m c u r r e n t M e e t i n g i f i t e x i s t s
if ( this . currentMeeting ? . projectLink ) {
await this . ensureSelectedProjectLoaded ( ) ;
} else {
this . selectedProjectData = null ;
}
}
}
async updateMeeting ( ) {
async updateMeeting ( ) {
@ -865,17 +939,10 @@ export default class OnboardMeetingView extends Vue {
/ * *
/ * *
* Computed property for selected project
* Computed property for selected project
* Derives the project from projectLink by finding it in allProjects
* Returns the separately stored selected project data
* /
* /
get selectedProject ( ) : PlanData | null {
get selectedProject ( ) : PlanData | null {
if ( ! this . newOrUpdatedMeetingInputs ? . projectLink ) {
return this . selectedProjectData ;
return null ;
}
return (
this . allProjects . find (
( p ) => p . handleId === this . newOrUpdatedMeetingInputs ? . projectLink ,
) || null
) ;
}
}
/ * *
/ * *
@ -905,6 +972,9 @@ export default class OnboardMeetingView extends Vue {
* Handle project assignment from dialog
* Handle project assignment from dialog
* /
* /
handleProjectLinkAssigned ( project : PlanData ) : void {
handleProjectLinkAssigned ( project : PlanData ) : void {
/ / S t o r e t h e s e l e c t e d p r o j e c t d i r e c t l y
this . selectedProjectData = project ;
if ( this . newOrUpdatedMeetingInputs ) {
if ( this . newOrUpdatedMeetingInputs ) {
this . newOrUpdatedMeetingInputs . projectLink = project . handleId ;
this . newOrUpdatedMeetingInputs . projectLink = project . handleId ;
}
}
@ -914,6 +984,7 @@ export default class OnboardMeetingView extends Vue {
* Unset the project link and revert to initial state
* Unset the project link and revert to initial state
* /
* /
unsetProjectLink ( ) : void {
unsetProjectLink ( ) : void {
this . selectedProjectData = null ;
if ( this . newOrUpdatedMeetingInputs ) {
if ( this . newOrUpdatedMeetingInputs ) {
this . newOrUpdatedMeetingInputs . projectLink = "" ;
this . newOrUpdatedMeetingInputs . projectLink = "" ;
}
}