Melhorias

Alterar a ordem de apresentação do pop up sobre a recorrencia - Apresentar logo após o click no botão de edição do evento;
A app não envia o comentario na revisão de eventos;
Ao remover a recorrência do evento a app não remove os eventos da Agenda
This commit is contained in:
Peter Maquiran
2024-07-02 14:15:06 +01:00
parent f0402a1e5b
commit fea0279ad7
199 changed files with 40665 additions and 164593 deletions
@@ -168,7 +168,7 @@
</div>
</div>
<div class="container-div">
<div class="container-div" *ngIf="postEvent?.EventRecurrence?.frequency">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
@@ -200,7 +200,7 @@
</div>
</div>
<div *ngIf="postEvent.EventRecurrence.frequency != 'never'" class="container-div">
<div *ngIf="postEvent?.EventRecurrence?.frequency != 'never'" class="container-div">
<div class="ion-item-class-2 d-flex" >
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
@@ -499,7 +499,7 @@
<ion-footer class="ion-no-border">
<ion-toolbar class="footer-toolbar px-20">
<ion-buttons slot="start">
<button class="btn-ok" fill="clear" color="#fff" (click)="validationEditAllEvent()">
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
<ion-label>Gravar</ion-label>
</button>
</ion-buttons>
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { AlertController, ModalController, NavParams } from '@ionic/angular';
import { Attachment } from 'src/app/models/attachment.model';
import { EventBody } from 'src/app/models/eventbody.model';
@@ -24,6 +23,7 @@ import { Observable } from 'rxjs';
import { RoleIdService } from 'src/app/services/role-id.service'
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { AttendeesLIstChangeDetector } from 'src/app/services/Repositorys/Agenda/async/change/attendeesLIstChangeDetector';
import { EventRecurrencePage, EventRecurrenceComponentReturn } from 'src/app/modals/event-recurrence/event-recurrence.page';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -36,6 +36,14 @@ const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
monthYearA11yLabel: "MMMM YYYY"
}
}
export interface EditEventPageParams {
eventId: string
caller?: string
closeModal: Boolean
}
@Component({
selector: 'app-edit-event',
templateUrl: './edit-event.page.html',
@@ -46,6 +54,8 @@ const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
})
export class EditEventPage implements OnInit {
static params: EditEventPageParams
Form: FormGroup;
validateFrom = false
@@ -102,6 +112,8 @@ export class EditEventPage implements OnInit {
serverCurrentList = []
CalendarNamesOptions = ['Oficial', 'Pessoal']
editAllEvent = false
closeModal = false
constructor(
private modalController: ModalController,
@@ -109,7 +121,6 @@ export class EditEventPage implements OnInit {
public eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private router: Router,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private contactsService: ContactsService,
@@ -126,8 +137,11 @@ export class EditEventPage implements OnInit {
console.log('this.postEvent', this.postEvent)
this.caller = this.navParams.get('caller');
this.closeModal = this.navParams.get('closeModal');
this.initCalendarName = this.postEvent.CalendarName;
this.allDayCheck = this.postEvent.IsAllDayEvent;
this.validationEditAllEvent()
@@ -243,10 +257,6 @@ export class EditEventPage implements OnInit {
this.modalController.dismiss({ action: 'cancel' });
}
goBack() {
this.router.navigate(['/home', this.caller]);
}
roundTimeQuarterHour(timeToReturn = new Date()) {
let date = timeToReturn || new Date();
@@ -389,55 +399,41 @@ export class EditEventPage implements OnInit {
}
}
validationEditAllEvent() {
if (this.postEvent.IsRecurring && this.postEvent.EventRecurrence.frequency != 'never') {
this.alertController.create({
header: 'Editar evento?',
message: 'Este evento tem recorrência, deseja editar a Sequência de eventos?',
inputs: [
{
name: 'confirm',
type: 'checkbox',
label: '',
value: 'confirm',
checked: false
}
],
buttons: [
{
text: 'Sim',
handler: (data) => {
// Check if the checkbox is checked
if (data.includes('confirm')) {
this.save_v2(true)
} else {
this.save_v2(false)
}
}
},
{
text: 'Não',
handler: () => {
this.save_v2(false)
}
}
]
}).then(res => {
res.present();
async validationEditAllEvent() {
if (this.postEvent.IsRecurring) {
const modal = await this.modalController.create({
component: EventRecurrencePage,
componentProps: {},
cssClass: 'event-recurrence-modal',
});
} else {
this.save_v2(false)
modal.onDidDismiss().then((res) => {
const data: EventRecurrenceComponentReturn = res.data
if(data =='EditAll') {
this.editAllEvent = true
} else if (data == 'EditOne') {
this.editAllEvent = false
} else if(data == 'Cancel') {
this.cancel()
} else {
this.cancel()
}
});
await modal.present();
}
}
@XTracerAsync({name:'mobile/create-event', bugPrint: true, daley: 4000})
async save_v2(editAllEvent, tracing?: TracingType) {
async save_v2(tracing?: TracingType) {
this.injectValidation()
this.runValidation()
if (this.Form.invalid) {
return false
}
@@ -447,9 +443,9 @@ export class EditEventPage implements OnInit {
const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
if(calendar.isOk()) {
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent, editAllEvent, calendar.value, tracing).subscribe((value) => {
this.agendaDataRepository.updateEvent(this.postEvent.EventId, this.postEvent, this.editAllEvent, calendar.value, tracing).subscribe((value) => {
console.log(value)
this.goBack();
this.close();
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
tracing.setAttribute('outcome', 'success')
}, ((error) => {
@@ -484,8 +480,6 @@ export class EditEventPage implements OnInit {
}
await this.saveDocument()
if (this.addedAttachmentsList.length > 0) {
this.agendaDataRepository.addEventAttachment(this.postEvent.EventId, this.loadedEventAttachments, tracing).subscribe((value) => {
console.log(value)
@@ -519,45 +513,6 @@ export class EditEventPage implements OnInit {
}
async saveDocument() {
try {
for (let e of this.loadedEventAttachments) {
const id: any = e.Id
const remove = e['remove']
if (id == 'add') {
//data.selected
const DocumentToSave = {
SourceTitle: e.SourceName,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: e.SourceId,
ApplicationId: e.ApplicationId.toString(),
Id: '0',
Link: '',
SerialNumber: '',
};
// await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
} else if (remove) {
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
}
}
} catch (error) {
} finally {
}
this.modalController.dismiss({
isEventEdited: this.isEventEdited,
postEvent: this.postEvent
});
}
async openAttendees() {
if (window.innerWidth > 801) {
@@ -132,7 +132,7 @@ export class EventActionsPopoverPage implements OnInit {
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Revision').subscribe((value) => {
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Revision', res.data.note).subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao()
this.goBack();
@@ -162,7 +162,7 @@ export class EventActionsPopoverPage implements OnInit {
const loader = this.toastService.loading();
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Declined').subscribe((value) => {
this.agendaDataRepository.eventToaprovalStatus(this.serialNumber, 'Declined', '').subscribe((value) => {
this.TaskService.loadEventosParaAprovacao()
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack();
@@ -11,14 +11,10 @@ import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTas
import { DocumentSetUpMeetingPage } from 'src/app/modals/document-set-up-meeting/document-set-up-meeting.page';
import { ExpedientTaskModalPage } from '../../gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { BackgroundService } from 'src/app/services/background.service';
import { StorageService } from 'src/app/services/storage.service';
import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { AttachmentsService } from 'src/app/services/attachments.service';
import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
@@ -62,20 +58,15 @@ export class ViewEventPage implements OnInit {
constructor(
private modalController: ModalController,
/* private navParams: NavParams, */
public eventsService: EventsService,
public alertController: AlertController,
public popoverController: PopoverController,
private activatedRoute: ActivatedRoute,
private toastService: ToastService,
public platform: Platform,
private backgroundservice: BackgroundService,
private storage: StorageService,
public ThemeService: ThemeService,
private RouteService: RouteService,
private httpErrorHandle: HttpErrorHandle,
private attachmentsService: AttachmentsService,
private dateService: DateService,
private agendaDataRepository: AgendaDataRepositoryService,
public p: PermissionService,
) {
@@ -112,25 +103,6 @@ export class ViewEventPage implements OnInit {
ngOnInit() {
this.loadEvent();
// this.backgroundservice.registerBackService('Online', () => {
// this.storage.get('eventEdit').then((req) => {
// JSON.parse(req).forEach(element => {
// this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
// this.storage.remove('eventEdit')
// })
// });
// })
// this.storage.get('eventDelete').then((req) => {
// JSON.parse(req).forEach(element => {
// this.eventsService.editEvent(element, 2, 3).subscribe((res) => {
// this.storage.remove('eventDelete')
// })
// });
// })
// this.loadEvent();
// });
window.onresize = (event) => {
// if not mobile remove all component
@@ -141,25 +113,7 @@ export class ViewEventPage implements OnInit {
}
// getEventsFromDB () {
// return new Promise((resolve, reject) => {
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.get('agendaResponse').then((events) => {
// resolve(events)
// })
// } else {
// this.sqliteservice.getAllEvents().then((events: any[] = []) => {
// resolve(events)
// })
// }
// }).catch ((error) => {
// console.error(error);
// });
// }
openOptions() { }
close() {
this.modalController.dismiss(this.isEventEdited);
@@ -232,37 +186,6 @@ export class ViewEventPage implements OnInit {
}
/* loadEvent1() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
// this.addEventToDb(res);
}, (error) => {
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
}, (error) => {
});
}
}
} */
deleteYesOrNo() {
if (this.loadedEvent.IsRecurring) {
this.alertController.create({
@@ -350,49 +273,6 @@ 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();
});
} */
}
@@ -435,6 +315,7 @@ export class ViewEventPage implements OnInit {
componentProps: {
eventId: this.loadedEvent.EventId,
caller: this.caller,
closeModal: true
},
cssClass: 'modal modal-desktop',
@@ -451,10 +332,10 @@ export class ViewEventPage implements OnInit {
this.loadEvent()
this.isEventEdited = true;
if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true
this.getAttachments()
}
// if (res.data.Attendees?.length >= 1) {
// this.loadedEvent.HasAttachments = true
// // this.getAttachments()
// }
console.log('res', res)
}
@@ -491,11 +372,11 @@ export class ViewEventPage implements OnInit {
this.loadEvent()
this.isEventEdited = true;
if (res.data.Attendees?.length >= 1) {
this.loadedEvent.HasAttachments = true
this.getAttachments()
}
console.log('res', res)
// if (res.data.Attendees?.length >= 1) {
// this.loadedEvent.HasAttachments = true
// // this.getAttachments()
// }
// console.log('res', res)
}
});
@@ -508,17 +389,6 @@ export class ViewEventPage implements OnInit {
}
getAttachments() {
if (this.loadedEvent.HasAttachments) {
this.attachmentsService.getAttachmentsById(this.loadedEvent.EventId).subscribe(res => {
this.loadedEvent.Attachments = res;
}, ((erro) => {
console.error('editgetAttchament', erro)
}));
}
}
async LoadDocumentDetails() {
const docId = this.loadedEvent.Attachments[this.dicIndex].SourceId
@@ -341,29 +341,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.loadFiles();
}
// async goToEvent(event: any) {
// let classs;
// if (window.innerWidth < 701) {
// classs = 'modal modal-desktop'
// } else {
// classs = 'modal modal-desktop showAsideOptions'
// }
// const modal = await this.modalController.create({
// component: ViewEventPage,
// componentProps: {
// eventId: event.id,
// CalendarId: event.calendarId
// },
// cssClass: classs,
// });
// modal.onDidDismiss().then((res) => {
// });
// await modal.present();
// }
ngOnDestroy() {
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
+1
View File
@@ -264,6 +264,7 @@ export class EventsPage implements OnInit {
}
} catch (error) {
tracing.setAttribute('component.catch', 'true')
tracing.setAttribute('component.catch', JSON.stringify(error))
tracing.setAttribute('outcome', 'failed')
}
@@ -197,7 +197,7 @@ export class ApproveEventPage implements OnInit {
try {
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Revision', res.data.note).subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.goBack();
@@ -229,7 +229,7 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
/* await this.processes.PostTaskAction(body).toPromise(); */
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Declined', '').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.TaskService.loadEventosParaAprovacao();
this.goBack();