This commit is contained in:
Paulo Pinto
2020-09-08 09:44:11 +01:00
4 changed files with 35 additions and 45 deletions
@@ -1,7 +1,7 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button (click)="navigateBack()" defaultHref="" icon="chevron-back"></ion-back-button>
<ion-back-button (click)="close()" defaultHref="" icon="chevron-back"></ion-back-button>
</ion-buttons>
<ion-title>Anexos do evento</ion-title>
</ion-toolbar>
@@ -24,20 +24,7 @@
</div>
<!-- Skeleton screen -->
<div *ngIf="!loadedEventAttachments">
<div class="ion-padding custom-skeleton">
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
<ion-skeleton-text animated></ion-skeleton-text>
<ion-skeleton-text animated style="width: 88%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 70%"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</div>
<ion-list>
<ion-list-header>
<ion-label>
<ion-skeleton-text animated style="width: 20%"></ion-skeleton-text>
</ion-label>
</ion-list-header>
<ion-item>
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
@@ -55,23 +42,9 @@
</ion-label>
</ion-item>
<ion-item>
<ion-thumbnail slot="start">
<ion-avatar slot="start">
<ion-skeleton-text animated></ion-skeleton-text>
</ion-thumbnail>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
</h3>
<p>
<ion-skeleton-text animated style="width: 80%"></ion-skeleton-text>
</p>
<p>
<ion-skeleton-text animated style="width: 60%"></ion-skeleton-text>
</p>
</ion-label>
</ion-item>
<ion-item>
<ion-skeleton-text animated style="width: 27px; height: 27px" slot="start"></ion-skeleton-text>
</ion-avatar>
<ion-label>
<h3>
<ion-skeleton-text animated style="width: 50%"></ion-skeleton-text>
@@ -3,6 +3,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute, Router } from '@angular/router';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { ModalController, NavParams } from '@ionic/angular';
@Component({
selector: 'app-attachments',
@@ -16,19 +17,12 @@ export class AttachmentsPage implements OnInit {
constructor(
private attachamentsService: AttachmentsService,
private activatedRoute: ActivatedRoute,
private iab: InAppBrowser,
private route: Router) { }
private modalCtrl: ModalController,
private navParams: NavParams) { }
ngOnInit() {
/* Emit new data when something changes */
this.activatedRoute.paramMap.subscribe(paramMap =>{
if(!paramMap.has('eventId')){
//Redirect
return;
}
this.loadAttachments(paramMap.get('eventId'));
});
this.loadAttachments(this.navParams.get('eventId'));
}
loadAttachments(eventid:string)
@@ -45,9 +39,8 @@ export class AttachmentsPage implements OnInit {
const browser = this.iab.create(url,"_blank");
browser.show();
}
navigateBack(){
this.route.navigate(['/home/events',this.pageId]);
close(){
this.modalCtrl.dismiss(null);
}
@@ -137,9 +137,9 @@
</div>
</div>
<div *ngIf="loadedEventAttachments.length > 1">
<!-- <ion-button class="see-more-button" fill="none" shape="round" [routerLink]="['/home/attachments', loadedEvent.EventId]">
<ion-button class="see-more-button" fill="none" shape="round" (click)="openAttachments()"><!-- [routerLink]="['/home/attachments', loadedEvent.EventId]" -->
<ion-label color="secondary">Ver mais...</ion-label>
</ion-button> -->
</ion-button>
</div>
</div>
<!-- Skeleton Attachment -->
@@ -12,6 +12,7 @@ import { Attachment } from 'src/app/models/attachment.model';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AttachmentsPage } from '../attachments/attachments.page';
@Component({
@@ -208,4 +209,27 @@ export class EventDetailPage implements OnInit {
navigateTo(ev){
this.route.navigate(['/home/events',ev]);
}
async openAttachments(){
const modal = await this.modalCtrl.create({
component: AttachmentsPage,
componentProps: {
eventId: this.pageId,
attachments: this.loadedEventAttachments
},
cssClass: 'attachments',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((data) => {
if (data['data'] != null)
{
let newattendees: EventPerson[] = data['data'];
this.loadedEvent.Attendees = newattendees;
}
});
}
}