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
@@ -177,45 +177,42 @@
</div>
</div>
</div>
<div class="container-div width-100 pb-20">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class-no-height width-100">
<ion-textarea placeholder="Detalhes" [(ngModel)]="postEvent.Body.Text" rows="6" cols="20"></ion-textarea>
</div>
</div>
<div hidden class="ion-item-container-no-border">
<div (click)="getDoc()" class="d-flex container-div width-100 ion-item-container-no-border" >
<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>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments" >
<ion-list class="width-100 list">
<ion-item class="width-100">
<ion-label class="width-100">
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="app-name" *ngIf="document.ApplicationId == 8"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == 361 "> ArquivoDespachoElect </span>
<span class="close-button text-black" (click)="deleteAttachment(document.Id)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate | date: 'dd-MM-yy'}} </span></p>
</ion-label>
</ion-item>
</ion-list>
</div>
<div hidden>
<ion-item>
<ion-label>Documentos Anexados</ion-label>
</ion-item>
<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>
</ion-label>
</ion-item>
</ion-list>
</div>
</ion-item-sliding>
</div>
@@ -163,4 +163,39 @@
padding: 20px;
overflow: auto;
}
.app-name{
background: #42b9f2;
border-radius: 18px;
text-align: center;
display: flex;
align-items: center;
padding: 0px 5px;
color: white;
font-size: 9pt;
font-weight: 500;
height: 19px;
-webkit-border-radius: 18px;
-moz-border-radius: 18px;
-ms-border-radius: 18px;
-o-border-radius: 18px;
}
.close-button {
display: none;
}
.list:hover {
.app-name {
display: none;
}
.close-button {
display: block !important;
}
}
@@ -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);
});
}
});
}
}