mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
criar evento com recorrencia
This commit is contained in:
@@ -66,13 +66,15 @@ export class NewEventPage implements OnInit {
|
||||
public stepMinute = 5;
|
||||
public stepSecond = 5;
|
||||
public color: ThemePalette = 'primary';
|
||||
recurringTypes: any;
|
||||
selectedRecurringType: any;
|
||||
|
||||
@Input() profile:string;
|
||||
@Input() selectedSegment: string;
|
||||
@Input() selectedDate: Date;
|
||||
@Input() taskParticipants: EventPerson[] = [];
|
||||
@Input() taskParticipantsCc: any = [];
|
||||
|
||||
|
||||
@Output() setIntervenient = new EventEmitter<any>();
|
||||
@Output() setIntervenientCC = new EventEmitter<any>();
|
||||
|
||||
@@ -122,7 +124,7 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private eventService: EventsService,
|
||||
private eventService: EventsService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private toastService: ToastService,
|
||||
private userService: AuthService,
|
||||
@@ -137,23 +139,23 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
|
||||
this.getRecurrenceTypes();
|
||||
if(!this.restoreTemporaryData()){
|
||||
// clear
|
||||
|
||||
this.postEvent = new Event();
|
||||
this.eventBody = { BodyType : "1", Text : ""};
|
||||
this.postEvent.Body = this.eventBody;
|
||||
this.postEvent.Body = this.eventBody;
|
||||
|
||||
/* console.log(this.profile); */
|
||||
|
||||
|
||||
let selectedStartdDate = this.selectedDate;
|
||||
let selectedEndDate = new Date(this.selectedDate);
|
||||
/* Set + 30minutes to seleted datetime */
|
||||
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
|
||||
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
|
||||
|
||||
|
||||
|
||||
if(this.selectedSegment != "Combinada"){
|
||||
this.postEvent ={
|
||||
EventId: '',
|
||||
@@ -173,7 +175,7 @@ export class NewEventPage implements OnInit {
|
||||
Organizer: '',
|
||||
Categories: ['Reunião'],
|
||||
HasAttachments: false,
|
||||
EventRecurrence: null,
|
||||
EventRecurrence: {Type:'-1'},
|
||||
};
|
||||
}
|
||||
else{
|
||||
@@ -195,7 +197,7 @@ export class NewEventPage implements OnInit {
|
||||
Organizer: '',
|
||||
Categories: ['Reunião'],
|
||||
HasAttachments: false,
|
||||
EventRecurrence: null,
|
||||
EventRecurrence: {Type:'-1'},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -206,7 +208,7 @@ export class NewEventPage implements OnInit {
|
||||
} else {
|
||||
this.taskParticipantsCc.push(e);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.taskParticipants = removeDuplicate(this.taskParticipants);
|
||||
@@ -221,7 +223,8 @@ export class NewEventPage implements OnInit {
|
||||
this.date = new Date(2021,9,4,5,6,7);
|
||||
this.getDatepickerData()
|
||||
|
||||
this.injectValidation()
|
||||
this.injectValidation();
|
||||
|
||||
}
|
||||
|
||||
runValidation() {
|
||||
@@ -292,7 +295,7 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
close(){
|
||||
|
||||
this.deleteTemporaryData();
|
||||
@@ -303,6 +306,24 @@ export class NewEventPage implements OnInit {
|
||||
this.setIntervenientCC.emit([]);
|
||||
}
|
||||
|
||||
getRecurrenceTypes() {
|
||||
this.eventService.getRecurrenceTypes().subscribe(res=>{
|
||||
console.log(res);
|
||||
this.recurringTypes = res;
|
||||
});
|
||||
}
|
||||
|
||||
onSelectedRecurringChanged(ev:any){
|
||||
console.log(ev);
|
||||
if(ev.length > 1){
|
||||
console.log(ev.filter(data => data != '-1'));
|
||||
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
|
||||
}
|
||||
if(ev.length == 0){
|
||||
this.postEvent.EventRecurrence.Type = "-1";
|
||||
}
|
||||
}
|
||||
|
||||
getDatepickerData() {
|
||||
if (this.postEvent) {
|
||||
this.postEvent.StartDate = this.dateStart
|
||||
@@ -332,6 +353,9 @@ export class NewEventPage implements OnInit {
|
||||
if(this.documents.length >= 0) {
|
||||
this.postEvent.HasAttachments = true;
|
||||
}
|
||||
if(this.selectedRecurringType != '-1'){
|
||||
/* this.postEvent.EventRecurrence.Type = this.selectedRecurringType; */
|
||||
}
|
||||
|
||||
if(this.loggeduser.Profile == 'MDGPR') {
|
||||
// console.log('MD - Aqui');
|
||||
@@ -340,9 +364,12 @@ export class NewEventPage implements OnInit {
|
||||
this.showLoader = true;
|
||||
|
||||
console.log(this.postEvent);
|
||||
|
||||
|
||||
let loader = this.toastService.loading()
|
||||
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
console.log(this.postEvent);
|
||||
|
||||
|
||||
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
async (id) => {
|
||||
@@ -365,10 +392,10 @@ export class NewEventPage implements OnInit {
|
||||
SerialNumber: ''
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
await DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
|
||||
|
||||
|
||||
if(DocumentToSave.length == (i+1)){
|
||||
this.afterSave();
|
||||
}
|
||||
@@ -376,7 +403,7 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(DocumentToSave.length == 0){
|
||||
|
||||
this.afterSave();
|
||||
@@ -386,11 +413,12 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
},
|
||||
error => {
|
||||
|
||||
|
||||
loader.remove()
|
||||
this.showLoader = false
|
||||
this.toastService.badRequest('Evento não criado')
|
||||
});
|
||||
loader.remove();
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR') {
|
||||
console.log('PR - Aqui');
|
||||
@@ -398,7 +426,7 @@ export class NewEventPage implements OnInit {
|
||||
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
|
||||
(id) => {
|
||||
console.log(id);
|
||||
|
||||
|
||||
|
||||
const eventId: any = id;
|
||||
|
||||
@@ -417,7 +445,7 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
DocumentToSave.forEach((attachments, i) => {
|
||||
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
|
||||
|
||||
|
||||
if(DocumentToSave.length == (i+1)){
|
||||
this.afterSave();
|
||||
}
|
||||
@@ -465,7 +493,7 @@ export class NewEventPage implements OnInit {
|
||||
async addParticipantsCc() {
|
||||
|
||||
this.saveTemporaryData();
|
||||
|
||||
|
||||
this.openAttendeesComponent.emit({
|
||||
type: "CC"
|
||||
});
|
||||
@@ -483,7 +511,7 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @description o pipeline já esta a funcionar tuda vez que nos fazer push na branch master e test o pipeline executa os teste, mas agora os teste temos que melhora para testar a app em tudos os pontos
|
||||
* o pipeline já está a funcionar toda vez que nos fazer um push na branch master ou teste o pipeline executa os testes, mas agora os testes temos que melhorar para testar a app em todos os pontos
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user