This commit is contained in:
Peter Maquiran
2021-11-07 20:56:34 +01:00
parent c1bdeddb00
commit 585e0989d8
8 changed files with 421 additions and 15 deletions
+2 -1
View File
@@ -951,7 +951,7 @@ export class AgendaPage implements OnInit {
// });
this.myCal.update();
this.myCal.loadEvents();
// this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
this.cloneAllmobileComponent();
@@ -1146,6 +1146,7 @@ export class AgendaPage implements OnInit {
async closeComponentEditEventOrAdd() {
if (this.IsEvent = 'edit') {
// this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.eventClicked(this.viewingEventObject);
} else if (this.IsEvent = 'add') {
this.cloneAllmobileComponent();
@@ -281,12 +281,12 @@ export class NewEventPage implements OnInit {
});
this.toastService.successMessage()
this.toastService._successMessage()
this.modalController.dismiss(this.postEvent);
} catch (error) {
this.toastService.badRequest()
this.toastService._badRequest()
} finally {
loader.remove()
}
+67
View File
@@ -24,6 +24,73 @@ export class ToastService {
toast.present();
}
async _successMessage(message?: any, callback?) {
let notification = document.createElement('div')
notification.className = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-center success">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
document.body.append(notification)
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
setTimeout(()=>{
if (callback) {
callback()
}
notification.style.right = "-100%"
setTimeout(()=>{
notification.remove()
},1000)
},6000)
}
async _badRequest(message?: string, callback?) {
let notification = document.createElement('div')
notification.className = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-center faild">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/notification-error.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
notification.style.animationName = 'notification-top'
document.body.append(notification)
notification.querySelector('.text').innerHTML = message || 'Processo não efetuado'
setTimeout(()=>{
if (callback) {
callback()
}
notification.style.right = "-100%"
setTimeout(()=>{
notification.remove()
},1000)
},6000)
}
async successMessage(message?: any, callback?) {
let notification = document.createElement('div')
@@ -142,6 +142,10 @@ export class EditEventPage implements OnInit {
}
ngOnChanges(changes: any): void {
// this.loadedEventAttachments = this.loadedEventAttachments.concat(this.postEvent.Attachments)
}
close() {
this.closeComponent.emit();
this.setIntervenient.emit([]);
@@ -282,7 +286,6 @@ export class EditEventPage implements OnInit {
async saveDocument() {
console.log(this.loadedEventAttachments)
await this.loadedEventAttachments.forEach( async (e)=>{
@@ -303,10 +306,10 @@ export class EditEventPage implements OnInit {
};
await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();
this.getAttachments(this.postEvent.EventId);
await this.getAttachments(this.postEvent.EventId);
} else if(remove) {
this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {})
await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()
}
})
@@ -365,11 +368,9 @@ export class EditEventPage implements OnInit {
window['temp.path:/home/agenda/edit-event.component.ts'] = {}
}
getAttachments(eventId: string){
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = res;
console.log('res', res);
});
async getAttachments(eventId: string){
const rest: any = this.attachmentsService.getAttachmentsById(eventId).toPromise()
this.loadedEventAttachments = rest;
}
deleteAttachment(attachmentID: string, index) {
@@ -409,14 +409,14 @@ export class NewEventPage implements OnInit {
this.afterSave();
}
this.toastService.successMessage('Evento criado')
this.toastService._successMessage('Evento criado')
},
error => {
loader.remove()
this.showLoader = false
this.toastService.badRequest('Evento não criado')
this.toastService._badRequest('Evento não criado')
});
@@ -95,6 +95,7 @@ export class ViewEventPage implements OnInit {
}
loadEvent() {
this.eventsService.getEvent(this.eventId).subscribe(res => {
console.log(res);
this.loadedEvent = res;