mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve responsiveness
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AlertController, ModalController, NavParams } from '@ionic/angular';
|
||||
import { Attachment } from 'src/app/models/attachment.model';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { Event } from '../../../models/event.model';
|
||||
import { AttendeesPage } from '../../events/attendees/attendees.page';
|
||||
import { SearchPage } from '../../search/search.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-event',
|
||||
@@ -27,6 +30,7 @@ export class EditEventPage implements OnInit {
|
||||
minDate: string;
|
||||
|
||||
|
||||
loadedEventAttachments: Attachment[];
|
||||
taskParticipants: any = [];
|
||||
taskParticipantsCc: any = [];
|
||||
adding: "intervenient" | "CC" = "intervenient";
|
||||
@@ -39,11 +43,17 @@ export class EditEventPage implements OnInit {
|
||||
private navParams: NavParams,
|
||||
private eventsService: EventsService,
|
||||
public alertController: AlertController,
|
||||
private attachmentsService: AttachmentsService,
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.postEvent = this.navParams.get('event');
|
||||
|
||||
if(this.postEvent){
|
||||
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
|
||||
if( this.postEvent.Body){
|
||||
if(typeof(this.postEvent.Body.Text) == 'string'){
|
||||
this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.postEvent.Attendees == null){
|
||||
@@ -67,6 +77,8 @@ export class EditEventPage implements OnInit {
|
||||
this.isRecurring = "Repete";
|
||||
}
|
||||
this.profile = this.navParams.get('profile');
|
||||
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -157,4 +169,52 @@ export class EditEventPage implements OnInit {
|
||||
this.taskParticipantsCc = taskParticipantsCc;
|
||||
}
|
||||
|
||||
|
||||
getAttachments(eventId: string){
|
||||
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
|
||||
this.loadedEventAttachments = res;
|
||||
console.log('res', res);
|
||||
});
|
||||
}
|
||||
|
||||
deleteAttachment(attachmentID: string) {
|
||||
|
||||
this.attachmentsService.deleteEventAttachmentById(attachmentID).subscribe(
|
||||
res=>{
|
||||
this.loadedEventAttachments = this.loadedEventAttachments.filter(e=> e.Id.toString() != attachmentID);
|
||||
})
|
||||
}
|
||||
|
||||
async getDoc() {
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'modal-width-100-width-background modal',
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect'
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
if(res){
|
||||
const data = res.data;
|
||||
//data.selected
|
||||
const DocumentToSave = {
|
||||
SourceTitle: data.selected.Assunto,
|
||||
ParentId: this.postEvent.EventId,
|
||||
Source: '1',
|
||||
SourceId: data.selected.Id,
|
||||
ApplicationId: data.selected.ApplicationType.toString(),
|
||||
Id: '0',
|
||||
Link: '',
|
||||
SerialNumber: '',
|
||||
};
|
||||
|
||||
await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
|
||||
this.getAttachments(this.postEvent.EventId);
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user