Improve add attachment

This commit is contained in:
Peter Maquiran
2021-04-20 15:05:40 +01:00
parent e794c12872
commit ecb87959a0
9 changed files with 86 additions and 24 deletions
+2
View File
@@ -31,4 +31,6 @@ export class EventAttachment {
Link?: string; Link?: string;
SerialNumber?: string; SerialNumber?: string;
ApplicationId: string; ApplicationId: string;
SourceTitle: string;
} }
@@ -70,7 +70,7 @@ export class ViewEventPage implements OnInit {
} }
close(){ close(){
console.log(this.isEventEdited); /* console.log(this.isEventEdited); */
this.modalController.dismiss(this.isEventEdited); this.modalController.dismiss(this.isEventEdited);
} }
@@ -78,10 +78,10 @@ export class ViewEventPage implements OnInit {
this.eventsService.getEvent(this.eventId).subscribe(res => { this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res; this.loadedEvent = res;
console.log(res); /* console.log(res); */
this.today = new Date(res.StartDate); this.today = new Date(res.StartDate);
console.log(new Date(this.today)); /* console.log(new Date(this.today)); */
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
}); });
} }
@@ -154,7 +154,7 @@ export class ViewEventPage implements OnInit {
viewDocument(sourceId){ viewDocument(sourceId){
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{ this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
console.log(res); /* console.log(res); */
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank"); const browser = this.iab.create(url,"_blank");
browser.show(); browser.show();
+16 -3
View File
@@ -71,10 +71,23 @@ export class AttachmentsService {
headers: this.headers, headers: this.headers,
} }
alert('send');
console.log('send', body);
return this.http.post(`${geturl}`, body, options); return this.http.post(`${geturl}`, body, options);
} }
deleteEventAttachmentById(attachmentId) {
let geturl = environment.apiURL + `Attachments/Delete?attachmentId=${attachmentId}`;
let params = new HttpParams();
params = params.set("attachmentId", attachmentId);
let options = {
headers: this.headers,
params: params
}
return this.http.post(`${geturl}`, options);
}
} }
@@ -199,15 +199,18 @@
</div> </div>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments" > <div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments" >
<ion-list class="width-100"> <ion-list class="width-100 list">
<ion-item class="width-100"> <ion-item class="width-100">
<ion-label class="width-100"> <ion-label class="width-100">
<p class="d-flex ion-justify-content-between"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span> <span class="attach-title-item">{{document.SourceName}}</span>
<span class="app-name" *ngIf="document.Source == 1"> webTRIX</span> <span class="app-name" *ngIf="document.Source == 1"> webTRIX</span>
<span class="app-name" *ngIf="document.Source == 2"> K2</span> <span class="app-name" *ngIf="document.Source == 2"> K2</span>
<span class="app-name" *ngIf="document.Source == 3"> Exchange</span> <span class="app-name" *ngIf="document.Source == 3"> Exchange</span>
<span class="app-name" *ngIf="document.Source == 4"> File</span> <span class="app-name" *ngIf="document.Source == 4"> File</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>
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate}} </span></p> <p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate}} </span></p>
@@ -186,3 +186,19 @@ ion-content{
-ms-border-radius: 18px; -ms-border-radius: 18px;
-o-border-radius: 18px; -o-border-radius: 18px;
} }
.close-button {
display: none;
}
.list:hover {
.app-name {
display: none;
}
.close-button {
display: block !important;
}
}
@@ -63,8 +63,6 @@ export class EditEventComponent implements OnInit {
} }
} }
// attendees list // attendees list
if(this.postEvent.Attendees != null) { if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{ this.postEvent.Attendees.forEach(e =>{
@@ -186,7 +184,17 @@ export class EditEventComponent implements OnInit {
getAttachments(eventId: string){ getAttachments(eventId: string){
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{ this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = 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);
})
}
} }
@@ -194,13 +194,16 @@
</ion-label> </ion-label>
</div> </div>
<div *ngFor="let document of documents" > <div class="list" *ngFor="let document of documents; let i = index" >
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span> <span class="attach-title-item">{{document.Assunto}}</span>
<span class="app-name">{{document.appName}}</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>
<p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data}} </span></p> <p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data}} </span></p>
</ion-label> </ion-label>
@@ -195,3 +195,19 @@ ion-content{
-ms-border-radius: 18px; -ms-border-radius: 18px;
-o-border-radius: 18px; -o-border-radius: 18px;
} }
.close-button {
display: none;
}
.list:hover {
.app-name {
display: none;
}
.close-button {
display: block !important;
}
}
@@ -173,6 +173,7 @@ export class NewEventPage implements OnInit {
const DocumentToSave: EventAttachment[] = this.documents.map((e) => { const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return { return {
SourceTitle: e.Assunto,
ParentId: eventId, ParentId: eventId,
Source: '1', Source: '1',
SourceId: e.Id, SourceId: e.Id,
@@ -197,10 +198,14 @@ export class NewEventPage implements OnInit {
const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => { const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => {
return { return {
SourceTitle: e.Assunto,
ParentId: eventId, ParentId: eventId,
Source: '1', Source: '1',
SourceId: e.Id, SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(), ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
}; };
}); });
@@ -210,16 +215,12 @@ export class NewEventPage implements OnInit {
}); });
} }
this.gobackOnSave();
} }
async gobackOnSave(){ removeAttachment(index: number){
//this.onAddEvent.emit(this.postEvent);
//this.GoBackEditOrAdd.emit(); this.documents = this.documents.filter( (e, i) => index != i);
//this.deleteTemporaryData();
//this.setIntervenient.emit([]);
//this.setIntervenientCC.emit([]);
} }
@@ -255,7 +256,7 @@ export class NewEventPage implements OnInit {
} }
restoreTemporaryData(): boolean{ restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/home/agenda/new-event.component.ts'] const restoredData = window['temp.path:/home/agenda/new-event.component.ts']