This commit is contained in:
Peter Maquiran
2022-05-16 14:29:42 +01:00
parent 286c28e9ba
commit cdf921975c
4 changed files with 106 additions and 116 deletions
@@ -64,6 +64,7 @@ export class BookMeetingModalPage implements OnInit {
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
CalendarNamesOptions = ['Oficial', 'Pessoal']
Form: FormGroup;
validateFrom = false
@@ -116,7 +117,9 @@ export class BookMeetingModalPage implements OnInit {
loggeduser: LoginUserRespose;
emptyTextDescription = "Sem intervenientes selecionados";
CalendarName: 'myCalendar' | 'sharedCalendar' = 'myCalendar'
CalendarName = ''
CalendarOwnerName = ''
sessionStore = SessionStore;
constructor(
@@ -145,17 +148,6 @@ export class BookMeetingModalPage implements OnInit {
this.postData.Category = 'Reunião'
if(this.calendarService.hasOwnCalendar == false || !this.calendarService.hasSharedCalendar == false) {
if(this.calendarService.hasOwnCalendar == false && this.calendarService.hasSharedCalendar == true) {
this.CalendarName = 'sharedCalendar'
} else if (this.calendarService.hasOwnCalendar == true && this.calendarService.hasSharedCalendar == false) {
this.CalendarName = 'myCalendar'
}
}
}
@@ -174,6 +166,29 @@ export class BookMeetingModalPage implements OnInit {
}
changeAgenda() {
setTimeout(() => {
if(this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Oficial'] && this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Oficial']) {
this.CalendarNamesOptions = ['Oficial']
this.CalendarName = 'Oficial'
} else if (this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Pessoal']
this.CalendarName = 'Pessoal'
} else {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
}
}, 50)
}
setDefaultTime() {
this.postData.StartDate = new Date()
this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000))
@@ -278,8 +293,8 @@ export class BookMeetingModalPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.calendarService.genericPostExpedientEvent(this.task.DocId, this.postData, "",this.task.SerialNumber, this.task.FsId, this.CalendarName).toPromise();
const CalendarId = this.selectedCalendarId()
await this.calendarService.genericPostExpedientEvent(this.task.DocId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.modalController.dismiss();
this.toastService._successMessage('Reunião criada');
@@ -298,7 +313,8 @@ export class BookMeetingModalPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, this.CalendarName).toPromise();
const CalendarId = this.selectedCalendarId()
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.close();
this.toastService._successMessage('Reunião criada');
@@ -315,6 +331,22 @@ export class BookMeetingModalPage implements OnInit {
}
selectedCalendarId () {
if (this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Oficial']) {
return this.calendarService.calendarNamesType[this.CalendarOwnerName]['OficialId']
} else if (this.calendarService.calendarNamesType[this.CalendarOwnerName]?.['Pessoal']) {
return this.calendarService.calendarNamesType[this.CalendarOwnerName]['PessoalId']
} else {
return '11:11'
}
}
async addParticipants() {
this.adding = "intervenient";