Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-07-12 16:06:02 +01:00
8 changed files with 256 additions and 145 deletions
@@ -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>();
@@ -91,6 +93,7 @@ export class NewEventPage implements OnInit {
@ViewChild('picker') picker: any;
@ViewChild('fim') fim: any;
@ViewChild('inicio') inicio: any;
@ViewChild('occurrence') occurrence: any;
@ViewChild('picker1') picker1: any;
Form: FormGroup;
@@ -109,6 +112,7 @@ export class NewEventPage implements OnInit {
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh"));
showLoader = false
@@ -120,9 +124,13 @@ export class NewEventPage implements OnInit {
return this.dateControlEnd.value
}
get dateOccurrence () {
return this.dateControlOccurrence.value
}
constructor(
private modalController: ModalController,
private eventService: EventsService,
private eventService: EventsService,
private attachmentsService: AttachmentsService,
private toastService: ToastService,
private userService: AuthService,
@@ -137,23 +145,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 +181,7 @@ export class NewEventPage implements OnInit {
Organizer: '',
Categories: ['Reunião'],
HasAttachments: false,
EventRecurrence: null,
EventRecurrence: {Type:'-1'},
};
}
else{
@@ -195,7 +203,7 @@ export class NewEventPage implements OnInit {
Organizer: '',
Categories: ['Reunião'],
HasAttachments: false,
EventRecurrence: null,
EventRecurrence: {Type:'-1'},
};
}
@@ -206,7 +214,7 @@ export class NewEventPage implements OnInit {
} else {
this.taskParticipantsCc.push(e);
}
})
})
}
this.taskParticipants = removeDuplicate(this.taskParticipants);
@@ -221,7 +229,8 @@ export class NewEventPage implements OnInit {
this.date = new Date(2021,9,4,5,6,7);
this.getDatepickerData()
this.injectValidation()
this.injectValidation();
}
runValidation() {
@@ -248,6 +257,9 @@ export class NewEventPage implements OnInit {
dateEnd: new FormControl(this.dateEnd, [
Validators.required
]),
dateOccurrence: new FormControl(this.dateOccurrence, [
Validators.required
]),
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
@@ -277,6 +289,13 @@ export class NewEventPage implements OnInit {
}
}
openLastOccurrence() {
let input: any = document.querySelector('#last-occurrence')
if(input) {
input.click()
}
}
async getDoc(){
const modal = await this.modalController.create({
component: SearchPage,
@@ -295,7 +314,7 @@ export class NewEventPage implements OnInit {
}
});
}
close(){
this.deleteTemporaryData();
@@ -306,10 +325,29 @@ 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
this.postEvent.EndDate = this.dateEnd
this.postEvent.EventRecurrence.LastOccurrence = this.dateOccurrence
}
}
@@ -335,6 +373,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');
@@ -343,9 +384,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) => {
@@ -368,10 +412,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();
}
@@ -379,7 +423,7 @@ export class NewEventPage implements OnInit {
});
if(DocumentToSave.length == 0){
this.afterSave();
@@ -389,11 +433,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');
@@ -401,7 +446,7 @@ export class NewEventPage implements OnInit {
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
console.log(id);
const eventId: any = id;
@@ -420,7 +465,7 @@ export class NewEventPage implements OnInit {
DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){
this.afterSave();
}
@@ -468,7 +513,7 @@ export class NewEventPage implements OnInit {
async addParticipantsCc() {
this.saveTemporaryData();
this.openAttendeesComponent.emit({
type: "CC"
});
@@ -486,7 +531,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
*/