Add generic modal

This commit is contained in:
2021-02-24 09:14:58 +01:00
parent 23f5e954c9
commit 7f5a698b20
27 changed files with 2049 additions and 468 deletions
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewEventPage } from './view-event.page';
const routes: Routes = [
{
path: '',
component: ViewEventPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ViewEventPageRoutingModule {}
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ViewEventPageRoutingModule } from './view-event-routing.module';
import { ViewEventPage } from './view-event.page';
import { SharedModule } from 'src/app/shared/shared.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SharedModule,
ViewEventPageRoutingModule
],
declarations: [ViewEventPage]
})
export class ViewEventPageModule {}
@@ -0,0 +1,69 @@
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content">
<div class="left">
<ion-icon (click)="close()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
</div>
<div class="middle">
<ion-label class="title">{{loadedEvent.Subject}}</ion-label>
</div>
<div class="div-icon">
<ion-icon class="edit" (click)="editEvent()" slot="end" src="assets/images/icons-edit.svg" ></ion-icon>
<ion-icon class="delete" (click)="deleteEvent()" name="trash-sharp"></ion-icon>
</div>
</div>
</div>
</ion-toolbar>
<div class="main-content">
<div class="upper-content">
<div class="content-location">
<div class="location-detail">
<ion-label >{{loadedEvent.Location}}</ion-label>
</div>
<div class="button-{{profile}}-{{loadedEvent.CalendarName}}">
<ion-button class="button-{{profile}}-{{loadedEvent.CalendarName}}" slot="end">{{loadedEvent.CalendarName}}</ion-button>
</div>
</div>
<div class="content-details">
<ion-label>
<p>{{customDate}}</p>
<p>das {{loadedEvent.StartDate | date: 'HH:mm'}} às {{loadedEvent.EndDate | date: 'HH:mm'}}</p>
<p *ngIf="!loadedEvent.IsRecurring">(Não se repete)</p>
<p *ngIf="loadedEvent.IsRecurring">Repete</p>
</ion-label>
</div>
</div>
<div class="middle-content">
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<h3>Intervenientes</h3>
<div *ngFor="let attendee of loadedEvent.Attendees">
<p>{{attendee.Name}}</p>
</div>
</ion-label>
</ion-item>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<h3>Detalhes</h3>
<p>{{loadedEvent.Body.Text}}</p>
</ion-label>
</ion-item>
</div>
<div *ngIf="loadedAttachments" class="bottom-content">
<ion-list>
<h3>Documentos Anexados</h3>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label *ngFor="let attach of loadedAttachments"
(click)="viewDocument()">
<p class="attach-title-item">{{attach.SourceName}}</p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yy' }}</span></p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
@@ -0,0 +1,191 @@
ion-content{
--background:transparent;
--padding-top:0px;
--padding-start: 20px;
--padding-end: 20px;
font-size: 18px;
}
ion-menu{
--height: 225px;
}
.header-toolbar{
--background:transparent;
--opacity: 1;
}
.main-header{
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 30px 0px 0px 0px;
color:#000;
transform: translate3d(0, 1px, 0);
.title-content{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.left{
width: 37px;
float: left;
font-size: 35px;
overflow: hidden;
}
.middle{
width: 230px;
padding: 0!important;
float: left;
margin: 2.5px 0 0 0;
}
.header-icon-right{
width: 45px;
font-size: 45px;
float: right;
overflow: auto;
}
.div-icon{
width: 92px;
float: right;
overflow: auto;
padding: 1px;
}
.div-icon .edit{
font-size: 35px;
float: left;
}
.div-icon .delete{
padding: 7px;
font-size: 21px;
color:#fff;
background: #d30606;
border-radius: 20px;
margin-left: 10px;
}
}
.title{
font-size: 25px;
}
}
.main-content{
width: 100%; /* 400px */
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow:auto;
padding: 15px 0px 0 0px;
.upper-content{
margin-left: 50px;
overflow: auto;
font-size: 18px;
.content-location{
width: 100%;
margin: 0 auto;
padding: 0;
overflow: auto;
}
.location-detail{
width: 210px;
font-weight: 700;
font-size: 18px;
float: left;
margin: 5px 5px 5px 0px;
}
.button-mdgpr-Oficial{
width: 91px;
--border-radius: 20px;
--background: #ffb703;
margin-left: 5px;
float: left;
}
.button-mdgpr-Pessoal{
width: 91px;
--border-radius: 20px;
--background: #f05d5e;
margin-left: 5px;
float: left;
}
.button-pr-Oficial{
width: 91px;
--border-radius: 20px;
--background: #cbeecb;
margin-left: 5px;
float: left;
}
.button-pr-Pessoal{
width: 91px;
--border-radius: 20px;
--background: #cab0dc;
margin-left: 5px;
float: left;
}
.button-calendar-type ion-button{
height: 25px;
}
.button-edit-event {
width: 140px;
height: 44px;
border-radius: 22.5px;
--background: #e0e9ee;
--color:#061b52;
}
.content-details p{
font-size: 16px;
}
}
.middle-conten{
.middle-content h3, .middle-content p{
font-size: 16px;
}
}
.bottom-content{
width: 360px;
margin: 0 auto;
.bottom-content h3{
font-size: 16px;
margin: 0 0 0 10px;
}
.attach-document{
font-size: 15px;
color: #0d89d1;
margin: 5px 5px 5px 10px;
padding: 5px;
float: left;
}
.attach-icon{
width: 37px;
font-size: 35px;
float: left;
}
.attach-title-item{
width: 100%;
font-size: 15px;
color:#0d89d1;
}
/* SPAN */
.span-left{
float: left;
font-size: 15x;
}
.span-right{
text-align: right;
float: right;
font-size: 13px;
}
}
}
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ViewEventPage } from './view-event.page';
describe('ViewEventPage', () => {
let component: ViewEventPage;
let fixture: ComponentFixture<ViewEventPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewEventPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ViewEventPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,111 @@
import { Component, OnInit, Input, Output, EventEmitter } 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 { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { Event } from 'src/app/models/event.model';
import { EditEventPage } from 'src/app/pages/agenda/edit-event/edit-event.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
selector: 'app-view-event',
templateUrl: './view-event.page.html',
styleUrls: ['./view-event.page.scss'],
})
export class ViewEventPage implements OnInit {
loadedEvent: Event;
isEventEdited: boolean;
eventBody: EventBody;
loadedAttachments:any;
loadedEventAttachments: Attachment[];
pageId: string;
showLoader: boolean;
minDate: Date;
customDate:any;
today:any;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() profile:string;
@Input() eventId: string;
@Output() viewEventDetailDismiss = new EventEmitter<any>();
constructor(
private eventsService: EventsService,
private attachmentsService: AttachmentsService,
public alertController: AlertController,
private iab: InAppBrowser,
)
{
this.isEventEdited = false;
this.loadedEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""};
this.loadedEvent.Body = this.eventBody;
}
ngOnInit() {
/* console.log(this.eventId); */
this.loadEvent();
this.getAttachments();
}
close(){
console.log(this.isEventEdited);
this.viewEventDetailDismiss.emit({
type: 'close'
})
}
loadEvent(){
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
console.log(res);
this.today = new Date(res.StartDate);
console.log(new Date(this.today));
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
});
}
deleteEvent(){
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () =>
{
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
await alert.present();
this.close();
});
}
getAttachments(){
this.attachmentsService.getAttachmentsById(this.eventId).subscribe(res=>{
this.loadedAttachments = res;
console.log(res);
});
}
async editEvent() {
this.viewEventDetailDismiss.emit({
type: 'edit',
event: this.loadedEvent
})
}
viewDocument(){
const url: string = this.loadedAttachments.DocumentURL.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
}
}