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;
SerialNumber?: string;
ApplicationId: string;
SourceTitle: string;
}
@@ -70,7 +70,7 @@ export class ViewEventPage implements OnInit {
}
close(){
console.log(this.isEventEdited);
/* console.log(this.isEventEdited); */
this.modalController.dismiss(this.isEventEdited);
}
@@ -78,10 +78,10 @@ export class ViewEventPage implements OnInit {
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
console.log(res);
/* console.log(res); */
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()]);
});
}
@@ -154,7 +154,7 @@ export class ViewEventPage implements OnInit {
viewDocument(sourceId){
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
console.log(res);
/* console.log(res); */
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
+16 -3
View File
@@ -71,10 +71,23 @@ export class AttachmentsService {
headers: this.headers,
}
alert('send');
console.log('send', body);
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 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-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.Source == 1"> webTRIX</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 == 4"> File</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 == 3"> Exchange</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><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate}} </span></p>
@@ -185,4 +185,20 @@ ion-content{
-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;
}
}
@@ -62,8 +62,6 @@ export class EditEventComponent implements OnInit {
}
}
}
// attendees list
if(this.postEvent.Attendees != null) {
@@ -186,7 +184,17 @@ export class EditEventComponent implements OnInit {
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);
})
}
}
@@ -194,13 +194,16 @@
</ion-label>
</div>
<div *ngFor="let document of documents" >
<div class="list" *ngFor="let document of documents; let i = index" >
<ion-list>
<ion-item>
<ion-label>
<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}} </span></p>
</ion-label>
@@ -194,4 +194,20 @@ ion-content{
-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;
}
}
@@ -173,6 +173,7 @@ export class NewEventPage implements OnInit {
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
@@ -197,10 +198,14 @@ export class NewEventPage implements OnInit {
const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => {
return {
SourceTitle: e.Assunto,
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
@@ -210,16 +215,12 @@ export class NewEventPage implements OnInit {
});
}
this.gobackOnSave();
}
async gobackOnSave(){
//this.onAddEvent.emit(this.postEvent);
//this.GoBackEditOrAdd.emit();
//this.deleteTemporaryData();
//this.setIntervenient.emit([]);
//this.setIntervenientCC.emit([]);
removeAttachment(index: number){
this.documents = this.documents.filter( (e, i) => index != i);
}
@@ -255,7 +256,7 @@ export class NewEventPage implements OnInit {
}
restoreTemporaryData(): boolean{
restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/home/agenda/new-event.component.ts']