New Attachmentes Page with Skeleton. EventAttachments Model revised. Compatibility with v2. Get Attachments revised.

This commit is contained in:
Paulo Pinto
2020-08-24 23:41:15 +01:00
parent 91147ef6b9
commit 751b8dd7c5
23 changed files with 494 additions and 74 deletions
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AttachmentsPage } from './attachments.page';
const routes: Routes = [
{
path: '',
component: AttachmentsPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AttachmentsPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { AttachmentsPageRoutingModule } from './attachments-routing.module';
import { AttachmentsPage } from './attachments.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
AttachmentsPageRoutingModule
],
declarations: [AttachmentsPage]
})
export class AttachmentsPageModule {}
@@ -0,0 +1,102 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button routerDirection="back">Voltar</ion-back-button>
</ion-buttons>
<ion-title>Anexos do evento</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<div *ngIf="loadedEventAttachments">
<ion-list>
<ion-item-sliding>
<ion-item lines="none" *ngFor="let att of loadedEventAttachments" [routerLink]="['/home/viewer', att.SourceId]">
<div class="div-item">
<div class="div-up">
<div class="div-icon">
<ion-icon class="ion-icon-attach" slot="end" name="attach-outline"></ion-icon>
</div>
<div class="div-content-attachment">
<h3>{{ att.SourceName }}</h3>
<p>{{ att.CreateDate }}</p>
<p>{{ att.Description }}</p>
</div>
</div>
<div class="div-botton">
<div class="div-botton-left">
<ion-icon class="ion-icon-location" slot="start" name="location"></ion-icon>
</div>
<div class="div-botton-middle">
<p class="item-list-small">{{ att.Stakeholders }}</p>
</div>
</div>
</div>
</ion-item>
</ion-item-sliding>
</ion-list>
</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>
</ion-avatar>
<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-thumbnail 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-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-list>
</div>
</ion-content>
@@ -0,0 +1,102 @@
/* CONTENT */
.item-list-small{
font-size: 14px;
overflow: auto;
}
.ion-item-class{
padding: 0;
}
.label-text{
width: 100%;
padding: 0;
margin: 0;
}
//DIV
.div-item{
width: 100%;
overflow: auto;
border-bottom: 1px solid #ccc;
margin: 10px 0 5px 0;
}
.div-up{
width: 100%;
overflow: auto;
}
.div-up h3{
margin: 0;
padding: 0;
font-size: 17px;
width: 100%;
}
.div-icon{
width: 10%;
font-size: 22px;
float: left;
color: #808080;
}
.div-icon ion-icon{
display: block;
margin: 0 auto;
}
.div-content-attachment{
width: 85%;
float: left;
padding: 0 0 0 12px;
}
.div-content-oficial h3, .div-content-pessoal h3{
font-size: 16pt;
/* border: 1px solid red; */
}
.div-content-oficial p, .div-content-pessoal p{
font-size: 14pt;
color: rgb(94, 92, 92);
padding: 0 !important;
margin: 0 !important;
}
.div-botton{
width: 100%;
overflow: auto;
margin: 10px 0 5px 0;
}
.div-botton-left{
width: 10%;
float: left;
}
.ion-icon-location{
text-align: center;
display: block;
color: #000;
font-size: 16px;
margin: 0 auto;
}
.div-botton-middle{
width: 75%;
float: left;
margin-top: 0.5px;
}
.div-botton-middle p{
padding: 0;
margin: 0;
}
.div-botton-right{
width: 10%;
float: left;
margin: 0;
padding: 0;
}
.ion-icon-attach{
color: #666666;
font-size: 20px;
}
/* Custom Skeleton Line Height and Margin */
.custom-skeleton ion-skeleton-text {
line-height: 13px;
}
.custom-skeleton ion-skeleton-text:last-child {
margin-bottom: 5px;
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { AttachmentsPage } from './attachments.page';
describe('AttachmentsPage', () => {
let component: AttachmentsPage;
let fixture: ComponentFixture<AttachmentsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttachmentsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(AttachmentsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,35 @@
import { Component, OnInit } from '@angular/core';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-attachments',
templateUrl: './attachments.page.html',
styleUrls: ['./attachments.page.scss'],
})
export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute) { }
ngOnInit() {
/* Emit new data when something changes */
this.activatedRoute.paramMap.subscribe(paramMap =>{
if(!paramMap.has('eventId')){
//Redirect
return;
}
this.loadAttachments(paramMap.get('eventId'));
});
}
loadAttachments(eventid:string)
{
this.attachamentsService.getEventAttachments(eventid).subscribe(attachments => {
this.loadedEventAttachments = attachments;
});
}
}