bugs solved

This commit is contained in:
Eudes Inácio
2024-06-11 11:23:38 +01:00
parent 05bbbd0242
commit 26c68fa7a2
10 changed files with 181 additions and 113 deletions
+3 -3
View File
@@ -70,16 +70,16 @@
<div *ngIf="environment.presidential">
<div *ngIf="calendars.roleId == RoleIdService.PRES">PR </div>
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">MDGPR</div>
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda do {{calendars.wxFullName}} </div>
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda {{calendars.wxFullName}} </div>
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId ">
Minha agenda
</div>
</div>
<div *ngIf="environment.presidential">
<div *ngIf="!environment.presidential">
<div *ngIf="calendars.roleId == RoleIdService.PRES">{{ environment.agendaPR}} </div>
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">{{ environment.agendaVP}}</div>
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda do {{calendars.wxFullName}} </div>
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda {{calendars.wxFullName}} </div>
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId ">
Minha agenda
</div>
@@ -86,13 +86,13 @@
<mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
<!-- <input matInput type="text" > -->
<mat-select [(value)]="postEvent.Category" >
<mat-option value="Reunião">
<mat-option value="Meeting">
Reunião
</mat-option>
<mat-option value="Viagem">
<mat-option value="Travel">
Viagem
</mat-option>
<mat-option value="Conferência">
<mat-option value="Conference">
Conferência
</mat-option>
<mat-option value="Encontro">
@@ -188,17 +188,6 @@
<mat-form-field appearance="none" class="date-hour-picker">
<!-- <input matInput [matDatepicker]="picker1"
placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker> -->
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate"
@@ -222,16 +211,6 @@
<mat-form-field appearance="none" class="date-hour-picker">
<!-- <input matInput [matDatepicker]="picker1"
placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker> -->
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Data Inicio*"
@@ -229,7 +229,7 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { frequency: this.eventRecurence, until: this.autoEndTime,
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
};
}
@@ -252,7 +252,7 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { frequency: this.eventRecurence, until: this.autoEndTime,
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
};
}
@@ -416,7 +416,7 @@ export class NewEventPage implements OnInit {
}
injectValidation() {
this.Form = new FormGroup({
Subject: new FormControl(this.postEvent.Subject, [
Validators.required,
@@ -437,9 +437,9 @@ export class NewEventPage implements OnInit {
participantes: new FormControl(this.taskParticipants, [
Validators.required
]),
dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
/* dateOccurrence: new FormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [
Validators.required
]),
]), */
})
@@ -472,11 +472,14 @@ export class NewEventPage implements OnInit {
this.injectValidation()
this.runValidation()
console.log(new Date(this.postEvent.StartDate).getTime())
console.log(new Date(this.postEvent.EndDate).getTime())
console.log(new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime() ? 'ok' : null)
if (this.Form.invalid) {
if (new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()) {
/* if (new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()) {
this.toastService._badRequest("Data de inicio menor que a data de fim")
}
} */
return false
}
@@ -242,35 +242,73 @@ export class ViewEventPage implements OnInit {
} */
deleteYesOrNo() {
this.alertController.create({
header: 'Eliminar evento?',
message: '',
buttons: [
{
text: 'Sim',
handler: () => {
this.deleteEvent();
if (this.loadedEvent.IsRecurring) {
this.alertController.create({
header: 'Eliminar evento?',
message: '',
inputs: [
{
name: 'confirm',
type: 'checkbox',
label: 'Este evento tem recorrência, deseja eliminar a Sequência de eventos?',
value: 'confirm',
checked: false,
}
},
{
text: 'Não',
handler: () => {
// sconsole.log('Let me think');
],
buttons: [
{
text: 'Sim',
handler: (data) => {
if (data.includes('confirm')) {
this.deleteEvent(true);
} else {
this.deleteEvent(false);
}
}
},
{
text: 'Não',
handler: () => {
// sconsole.log('Let me think');
}
}
}
]
}).then(res => {
res.present();
});
]
}).then(res => {
res.present();
});
} else {
this.alertController.create({
header: 'Eliminar evento?',
message: '',
buttons: [
{
text: 'Sim',
handler: (data) => {
this.deleteEvent(false);
}
},
{
text: 'Não',
handler: () => {
// sconsole.log('Let me think');
}
}
]
}).then(res => {
res.present();
});
}
}
deleteEvent() {
deleteEvent(deleteAll) {
const loader = this.toastService.loading()
console.log(this.loadedEvent.EventId)
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(async () => {
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId,deleteAll).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
@@ -292,47 +330,47 @@ export class ViewEventPage implements OnInit {
/* if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, () => { },
() => {
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
},
() => {
loader.remove();
});
} */
/* if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, () => { },
() => {
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('delete event')
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
},
() => {
loader.remove();
});
} */
}
@@ -97,6 +97,7 @@ export class AgendaDataRepositoryService {
}
createEvent(eventData: Event, CalendarName, documents) {
console.log('create repository 1',eventData)
let eventInput = {
userId: CalendarName,
@@ -104,20 +105,22 @@ export class AgendaDataRepositoryService {
subject: eventData.Subject,
body: eventData.Body.Text,
location: eventData.Location,
startDate: eventData.StartDate.toISOString(),
endDate: eventData.EndDate.toISOString(),
startDate: this.utils.addOneHourToIsoString(eventData.StartDate.toISOString()),
endDate: this.utils.addOneHourToIsoString(eventData.EndDate.toISOString()),
type: this.utils.calendarTypeSeleted(eventData.Category),
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
attendees: this.utils.attendeesAdded(eventData.Attendees),
attachments: this.utils.documentAdded(documents),
recurrence: {
frequency: this.utils.eventRecurence(eventData.EventRecurrence.frequency),
until: eventData.EndDate.toISOString(),
until:((eventData.EventRecurrence.until === "") ? this.utils.addOneHourToIsoString(eventData.EndDate.toISOString()) : eventData.EventRecurrence.until),
},
organizerId: SessionStore.user.UserId,
isAllDayEvent: eventData.IsAllDayEvent,
}
console.log('create repository 2',eventInput)
return this.agendaDataService.createEvent(eventInput)
}
@@ -152,8 +155,8 @@ export class AgendaDataRepositoryService {
return this.agendaDataService.addEventAttachment(id, { attachments: this.utils.documentAdded(attachmentData) });
}
deleteEvent(eventId) {
return this.agendaDataService.deleteEvent(eventId, false)
deleteEvent(eventId,deleteAll) {
return this.agendaDataService.deleteEvent(eventId, deleteAll)
}
removeEventAttachment(eventId, attachmentData) {
@@ -67,8 +67,8 @@ export class EventMapper {
"DayOfWeek": null,
"Month": null,
"LastOccurrence": null,
"frequency": dto.eventRecurrence.frequency,
"until": dto.eventRecurrence.until
"frequency": dto.eventRecurrence?.frequency,
"until": dto.eventRecurrence?.until
},
"Attachments": dto.attachments.map( e => ({
"Id": e.id,
@@ -176,4 +176,12 @@ export class Utils {
}
return selectedType[recurenceType];
}
addOneHourToIsoString(isoDateString) {
let date = new Date(isoDateString);
/* date.setHours(date.getHours()); */
let newIsoDateString = date.toISOString();
return newIsoDateString;
}
}
@@ -102,13 +102,13 @@
<mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
<!-- <input matInput type="text" > -->
<mat-select [(value)]="postEvent.Category" >
<mat-option value="Reunião">
<mat-option value="Meeting">
Reunião
</mat-option>
<mat-option value="Viagem">
<mat-option value="Travel">
Viagem
</mat-option>
<mat-option value="Conferência">
<mat-option value="Conference">
Conferência
</mat-option>
<mat-option value="Encontro">
@@ -207,7 +207,6 @@ export class NewEventPage implements OnInit {
}
ngOnInit() {
console.log(' INTERVENIENTES', this.taskParticipants)
this.changeProfileService.registerCallback(() => {
this.initializeData()
@@ -278,7 +277,7 @@ export class NewEventPage implements OnInit {
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: {
frequency: this.eventRecurence, until: this.autoEndTime,
frequency: this.eventRecurence, until: "",
Type: ''
},
};
@@ -302,7 +301,7 @@ export class NewEventPage implements OnInit {
Organizer: '',
Category: 'Reunião',
HasAttachments: false,
EventRecurrence: { frequency: this.eventRecurence, until: this.autoEndTime,
EventRecurrence: { frequency: this.eventRecurence, until: "",
Type: '' },
}
}
@@ -595,6 +594,7 @@ export class NewEventPage implements OnInit {
}, ((error) => {
console.log('create event error: ', error)
loader.remove();
this.hhtpErrorHandle.httpStatusHandle(error.status)
}));
@@ -92,7 +92,7 @@ export class ViewEventPage implements OnInit {
}
toDateString(e) {
return new Date(e).toDateString()
return new Date(e).toString()
}
openOptions() {
@@ -140,19 +140,54 @@ export class ViewEventPage implements OnInit {
this.viewEventDetailDismiss.emit({
type: 'close'
})
console.log(res.error)
}
}
deleteYesOrNo() {
this.alertController.create({
if (this.loadedEvent.IsRecurring) {
this.alertController.create({
header: 'Eliminar evento?',
message: '',
inputs: [
{
name: 'confirm',
type: 'checkbox',
label: 'Este evento tem recorrência, deseja eliminar a Sequência de eventos?',
value: 'confirm',
checked: false,
}
],
buttons: [
{
text: 'Sim',
handler: (data) => {
if (data.includes('confirm')) {
this.deleteEvent_v2(true);
} else {
this.deleteEvent_v2(false);
}
}
},
{
text: 'Não',
handler: () => {
}
}
]
}).then(res => {
res.present();
});
} else {
this.alertController.create({
header: 'Eliminar evento?',
message: '',
buttons: [
{
text: 'Sim',
handler: () => {
this.deleteEvent_v2();
this.deleteEvent_v2(false);
}
},
{
@@ -164,12 +199,14 @@ export class ViewEventPage implements OnInit {
}).then(res => {
res.present();
});
}
}
deleteEvent_v2() {
deleteEvent_v2(deleteAll) {
console.log(this.loadedEvent.EventId)
const loader = this.toastService.loading()
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId).subscribe(() => {
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId,deleteAll).subscribe(() => {
console.log()
this.httpErrorHandle.httpsSucessMessagge('delete event')
this.close();