mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -113,10 +113,13 @@ export class NewEventPage implements OnInit {
|
||||
showLoader = false
|
||||
|
||||
CalendarName;
|
||||
CalendarNameShow = true
|
||||
|
||||
CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private eventService: EventsService,
|
||||
public eventService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private toastService: ToastService,
|
||||
private userService: AuthService,
|
||||
@@ -131,13 +134,13 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
let now = new Date();
|
||||
|
||||
if(now.getMinutes() <= 30){
|
||||
if(now.getMinutes() <= 30) {
|
||||
this.autoStartTime = new Date(now.setMinutes(30));
|
||||
this.postEvent.StartDate = this.autoStartTime;
|
||||
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
|
||||
this.postEvent.EndDate = this.autoEndTime;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.autoStartTime = new Date(now.setHours(now.getHours()+1));
|
||||
this.autoStartTime = new Date(this.autoStartTime.setMinutes(0));
|
||||
this.postEvent.StartDate = this.autoStartTime;
|
||||
@@ -176,7 +179,7 @@ export class NewEventPage implements OnInit {
|
||||
Organizer: '',
|
||||
Category: 'Reunião',
|
||||
HasAttachments: false,
|
||||
EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime},
|
||||
EventRecurrence: { Type:'-1', LastOccurrence: this.autoEndTime },
|
||||
};
|
||||
}
|
||||
else{
|
||||
@@ -286,6 +289,33 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
changeAgenda() {
|
||||
|
||||
this.CalendarNameShow = false
|
||||
|
||||
setTimeout(()=>{
|
||||
|
||||
this.CalendarNameShow = true
|
||||
|
||||
if(this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
||||
|
||||
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
|
||||
this.CalendarNamesOptions = ['Oficial']
|
||||
this.postEvent.CalendarName = 'Oficial'
|
||||
|
||||
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
||||
this.CalendarNamesOptions = ['Pessoal']
|
||||
this.postEvent.CalendarName = 'Pessoal'
|
||||
|
||||
} else {
|
||||
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
}
|
||||
}, 50)
|
||||
|
||||
}
|
||||
|
||||
openLastOccurrence() {
|
||||
let input: any = document.querySelector('#last-occurrence')
|
||||
if(input) {
|
||||
@@ -362,12 +392,12 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
this.showLoader = true;
|
||||
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
async (id) => {
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
@@ -413,8 +443,9 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR') {
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
|
||||
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
(id) => {
|
||||
|
||||
|
||||
@@ -447,10 +478,15 @@ export class NewEventPage implements OnInit {
|
||||
this.toastService.successMessage('Evento criado')
|
||||
});
|
||||
} else {
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
|
||||
this.postEvent.CalendarName
|
||||
|
||||
|
||||
const CalendarId = this.selectedCalendarId()
|
||||
|
||||
this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe(
|
||||
(id) => {
|
||||
|
||||
|
||||
const eventId: any = id;
|
||||
|
||||
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
||||
@@ -478,7 +514,22 @@ export class NewEventPage implements OnInit {
|
||||
this.afterSave();
|
||||
}
|
||||
this.toastService.successMessage('Evento criado')
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarId () {
|
||||
|
||||
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
||||
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['PessoalId']
|
||||
|
||||
} else {
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,7 +543,7 @@ export class NewEventPage implements OnInit {
|
||||
this.setIntervenientCC.emit([]);
|
||||
}
|
||||
|
||||
removeAttachment(index: number){
|
||||
removeAttachment(index: number) {
|
||||
this.documents = this.documents.filter( (e, i) => index != i);
|
||||
|
||||
}
|
||||
@@ -534,7 +585,6 @@ export class NewEventPage implements OnInit {
|
||||
*/
|
||||
restoreTemporaryData(): boolean {
|
||||
|
||||
|
||||
const restoredData = window['temp.path:/home/agenda/new-event.component.ts']
|
||||
|
||||
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
|
||||
@@ -551,7 +601,7 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
deleteTemporaryData(){
|
||||
deleteTemporaryData() {
|
||||
window['temp.path:/home/agenda/new-event.component.ts'] = {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user