Improve responsiveness

This commit is contained in:
Peter Maquiran
2021-04-23 10:35:53 +01:00
parent 53dff7237d
commit 74bc2a3f2f
31 changed files with 712 additions and 92 deletions
@@ -194,30 +194,33 @@
</div>
</div>
<div hidden class="ion-item-container-no-border">
<div class="ion-item-container-no-border" (click)="getDoc()">
<ion-label>
<div class="attach-icon">
<ion-icon src="assets/images/icons-attach-doc.svg"></ion-icon>
</div>
<div class="attach-document">
<ion-label>Anexar Documentos</ion-label>
<ion-label>Adicionar documentos</ion-label>
</div>
</ion-label>
</div>
<div hidden>
<ion-item>
<ion-label>Documentos Anexados</ion-label>
</ion-item>
<div class="list " *ngFor="let document of documents; let i = index" >
<ion-list>
<ion-item>
<ion-label>
<h4 class="attach-title-item">Text</h4>
<p><span class="span-left">Text</span><span class="span-right"> Text </span></p>
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span>
<span class="app-name">{{document.appName}}</span>
<span class="close-button text-black" (click)="removeAttachment(i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yy'}} </span></p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
</div>
</ion-content>
<ion-footer class="ion-no-border d-flex justify-center px-20">
@@ -1,7 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { EventAttachment } from 'src/app/models/attachment.model';
import { EventBody } from 'src/app/models/eventbody.model';
import { EventPerson } from 'src/app/models/eventperson.model';
import { SearchDocument } from 'src/app/models/search-document';
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';
@@ -28,10 +31,13 @@ export class NewEventPage implements OnInit {
taskParticipants: any = [];
taskParticipantsCc: any = [];
documents:SearchDocument[] = [];
constructor(
private modalController: ModalController,
private navParams: NavParams,
private eventService: EventsService,
private attachmentsService: AttachmentsService
) {
this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""};
@@ -105,17 +111,42 @@ export class NewEventPage implements OnInit {
close(){
this.modalController.dismiss();
}
save(){
async save(){
/* console.log(this.postEvent);
console.log(this.profile); */
if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true;
}
let eventId: string;
if(this.profile=='mdgpr'){
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe();
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
}
else if(this.profile=='pr'){
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe();
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
}
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
await DocumentToSave.forEach( async (attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).toPromise();
});
this.modalController.dismiss(this.postEvent);
}
@@ -168,4 +199,30 @@ export class NewEventPage implements OnInit {
this.openAttendees();
}
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((res)=>{
if(res){
const data = res.data;
this.documents.push(data.selected);
}
});
}
removeAttachment(index: number){
this.documents = this.documents.filter( (e, i) => index != i);
}
}