This commit is contained in:
Peter Maquiran
2023-01-24 15:56:47 +01:00
parent 0748612054
commit fbd50137f3
153 changed files with 5997 additions and 953 deletions
@@ -68,10 +68,12 @@ export class NewEventPage implements OnInit {
recurringTypes = []
selectedRecurringType: any;
@Input() attendees: []
@Input() profile:string;
@Input() roomId:string;
@Input() selectedSegment: string;
@Input() selectedDate: Date;
@Input() CalendarDate: Date;
@Input() taskParticipants: EventPerson[] = [];
@Input() taskParticipantsCc: any = [];
@@ -140,13 +142,13 @@ export class NewEventPage implements OnInit {
if(!this.CalendarName) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else if(this.eventService.calendarNamesAry.length == 1 ) {
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
}
}
this.getRecurrenceTypes();
if(!this.restoreTemporaryData()){
if(!this.restoreTemporaryData()) {
// clear
this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.Body = this.eventBody;
@@ -162,7 +164,7 @@ export class NewEventPage implements OnInit {
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: null,
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
@@ -184,7 +186,7 @@ export class NewEventPage implements OnInit {
StartDate: this.autoStartTime,
EndDate: this.autoEndTime,
EventType: 'Reunião',
Attendees: null,
Attendees: this.attendees || null,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
@@ -217,11 +219,18 @@ export class NewEventPage implements OnInit {
this.date = new Date(2021,9,4,5,6,7);
this.injectValidation();
this.setDefaultTime();
}
roundTimeQuarterHour() {
var timeToReturn = new Date();
setDefaultTime() {
console.log(this.CalendarDate)
this.postEvent.StartDate = this.roundTimeQuarterHour(this.CalendarDate);
this.postEvent.EndDate = this.postEvent.StartDate;
}
roundTimeQuarterHour(timeToReturn?) {
var timeToReturn = timeToReturn || new Date();
// var minutes = timeToReturn.getMinutes();
var minutes = timeToReturn.getMinutes();
var hours = timeToReturn.getHours();
@@ -259,11 +268,11 @@ export class NewEventPage implements OnInit {
}
setStartDate(){
this.postEvent.StartDate = this.roundTimeQuarterHour();
// this.postEvent.StartDate = this.roundTimeQuarterHour();
}
setEndDate(){
this.postEvent.EndDate = this.postEvent.StartDate;
// this.postEvent.EndDate = this.postEvent.StartDate;
}
runValidation() {
@@ -361,7 +370,7 @@ export class NewEventPage implements OnInit {
}
}
async getDoc(){
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'modal-width-100-width-background modal',
@@ -372,7 +381,7 @@ export class NewEventPage implements OnInit {
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
modal.onDidDismiss().then((res) => {
if(res){
const data = res.data;
this.documents.push(data.selected);
@@ -496,12 +505,12 @@ export class NewEventPage implements OnInit {
});
await DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
if(DocumentToSave.length == (i+1)) {
this.afterSave();
}
});
});
if(DocumentToSave.length == 0){
if(DocumentToSave.length == 0) {
this.afterSave();
}
this.toastService._successMessage('Evento criado');
@@ -585,7 +594,6 @@ export class NewEventPage implements OnInit {
this.postEvent.CalendarName
const CalendarId = this.selectedCalendarId()
let loader = this.toastService.loading();
@@ -645,13 +653,15 @@ export class NewEventPage implements OnInit {
selectedCalendarId () {
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') {
console.log('1')
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postEvent.CalendarName == 'Pessoal') {
console.log('2')
return this.eventService.calendarNamesType[this.CalendarName]['PessoalId']
} else {
console.log('1:1',this.eventService.calendarNamesType,'2', this.CalendarName)
return '11:11'
}
}