EventsService Changes. Attendees Page. Others.

This commit is contained in:
Paulo Pinto
2020-08-25 12:47:49 +01:00
parent 751b8dd7c5
commit 11fdfe1e54
78 changed files with 201 additions and 1187 deletions
+4 -1
View File
@@ -10,6 +10,8 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
@@ -18,7 +20,8 @@ import { HttpClientModule } from '@angular/common/http';
StatusBar,
SplashScreen,
HttpClientModule,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
InAppBrowser
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
+10
View File
@@ -33,6 +33,16 @@ const routes: Routes = [
]
},
{
path: 'attendees',
children: [
{
path:'',
loadChildren: ()=> import('../pages/events/attendees/attendees.module').then(m => m.AttendeesPageModule)
},
]
},
{
path: 'agenda',
children: [
+1 -2
View File
@@ -12,8 +12,7 @@ export class Event{
StartDate: string;
EndDate: string;
EventType: string;
RequiredAttendees: EventPerson[];
OptionalAttendees: EventPerson[];
Attendees: EventPerson[];
IsMeeting: boolean;
IsRecurring: boolean;
AppointmentState: number;
+1
View File
@@ -1,4 +1,5 @@
export class EventPerson{
EmailAddress: string;
Name: string;
IsRequired: boolean;
}
@@ -10,7 +10,7 @@
<div *ngIf="loadedEventAttachments">
<ion-list>
<ion-item-sliding>
<ion-item lines="none" *ngFor="let att of loadedEventAttachments" [routerLink]="['/home/viewer', att.SourceId]">
<ion-item lines="none" *ngFor="let att of loadedEventAttachments" (click)="viewDocument(att.Link)">
<div class="div-item">
<div class="div-up">
<div class="div-icon">
@@ -2,6 +2,7 @@ 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';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
selector: 'app-attachments',
@@ -12,7 +13,7 @@ export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute) { }
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser) { }
ngOnInit() {
/* Emit new data when something changes */
@@ -32,4 +33,10 @@ export class AttachmentsPage implements OnInit {
});
}
viewDocument(documenturl:string)
{
const browser = this.iab.create(documenturl);
browser.show();
}
}
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AttendeesPage } from './attendees.page';
const routes: Routes = [
{
path: '',
component: AttendeesPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AttendeesPageRoutingModule {}
@@ -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 { AttendeesPageRoutingModule } from './attendees-routing.module';
import { AttendeesPage } from './attendees.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
AttendeesPageRoutingModule
],
declarations: [AttendeesPage]
})
export class AttendeesPageModule {}
@@ -0,0 +1,40 @@
<ion-header>
<ion-toolbar>
<ion-title>attendees</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<!-- Searchbar with cancel button always shown -->
<ion-searchbar></ion-searchbar>
<!-- TABS -->
<ion-toolbar >
<ion-segment [(ngModel)]="segment" (ionChange)="onSegmentChange()">
<ion-segment-button value="required">
Necessários
</ion-segment-button>
<ion-segment-button value="optional">
Opcionais
</ion-segment-button>
</ion-segment>
</ion-toolbar>
<div [ngSwitch]="segment">
<ion-list>
<ion-item-sliding>
<ion-item lines="none" *ngFor="let attendee of eventAttendees">
<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>{{ attendee.Name }}</h3>
<p>{{ attendee.EmailAddress }}</p>
</div>
</div>
</div>
</ion-item>
</ion-item-sliding>
</ion-list>
</div>
</ion-content>
@@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { AttendeesPage } from './attendees.page';
describe('AttendeesPage', () => {
let component: AttendeesPage;
let fixture: ComponentFixture<AttendeesPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AttendeesPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(AttendeesPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,24 @@
import { Component, OnInit, Injectable } from '@angular/core';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ActivatedRoute } from '@angular/router';
import { EventDetailPage } from '../event-detail/event-detail.page';
import { EventsService } from 'src/app/services/events.service';
@Component({
selector: 'app-attendees',
templateUrl: './attendees.page.html',
styleUrls: ['./attendees.page.scss'],
})
export class AttendeesPage implements OnInit {
eventAttendees: EventPerson[];
segment:string;
constructor(private activatedRoute: ActivatedRoute, public eventService: EventsService) {
}
ngOnInit() {
this.eventAttendees = this.eventService.loadedEvent.Attendees;
console.log(this.eventService.loadedEvent);
}
}
@@ -21,14 +21,12 @@
<ion-label position="stacked">Localização</ion-label>
<ion-input [(ngModel)]='loadedEvent.Location'></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">Intervenientes</ion-label>
<ion-list>
<ion-item *ngFor="let inter of loadedEvent.RequiredAttendees">
<ion-input [(ngModel)]='inter.Name'></ion-input>
</ion-item>
</ion-list>
</ion-item>
<ion-item-sliding>
<ion-item
[routerLink]="['/home/attendees']">
<ion-label position="stacked">Pessoas</ion-label>
</ion-item>
</ion-item-sliding>
<ion-item>
<ion-label position="stacked">Agenda</ion-label>
<ion-select [(ngModel)]="loadedEvent.CalendarName" interface="action-sheet" class="custom-options" Cancel-text="Cancelar">
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Component, OnInit, Injectable } from '@angular/core';
import { ActivatedRoute, NavigationExtras } from '@angular/router';
import { EventsService } from 'src/app/services/events.service';
import { Router } from '@angular/router';
@@ -9,6 +9,7 @@ import { AlertController } from '@ionic/angular';
import { Attachment } from 'src/app/models/attachment.model';
import { ActionSheetController } from '@ionic/angular';
@Component({
selector: 'app-event-detail',
templateUrl: './event-detail.page.html',
@@ -16,12 +17,12 @@ import { ActionSheetController } from '@ionic/angular';
})
export class EventDetailPage implements OnInit {
loadedEvent: Event;
public loadedEvent: Event;
loadedEventAttachments: Attachment[];
showLoader: boolean = true;
constructor(public actionSheetController: ActionSheetController, public alertController: AlertController, private router: Router, private activatedRoute: ActivatedRoute,
private eventsService: EventsService) {
public eventsService: EventsService) {
this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody();
}
@@ -44,6 +45,7 @@ export class EventDetailPage implements OnInit {
this.eventsService.getEvent(eventid).subscribe(event => {
this.loadedEvent = event;
this.showLoader = false;
this.eventsService.loadedEvent = this.loadedEvent;
});
}
@@ -102,4 +104,13 @@ export class EventDetailPage implements OnInit {
this.router.navigate(['/home/events']);
});
}
openDetailsWithQueryParams() {
let navigationExtras: NavigationExtras = {
queryParams: {
special: JSON.stringify(this.loadedEvent.Attendees)
}
};
this.router.navigate(['details'], navigationExtras);
}
}
@@ -15,6 +15,10 @@ const routes: Routes = [
{
path: 'attachments',
loadChildren: () => import('./attachments/attachments.module').then( m => m.AttachmentsPageModule)
},
{
path: 'attendees',
loadChildren: () => import('./attendees/attendees.module').then( m => m.AttendeesPageModule)
}
];
-1
View File
@@ -34,7 +34,6 @@ export class AuthService {
try {
result = await this.http.get<boolean>(service, options).toPromise();
} catch(e) {
console.log(e);
result = false;
}
+1
View File
@@ -15,6 +15,7 @@ export class EventsService {
authheader = {};
loggeduser: User;
headers: HttpHeaders;
public loadedEvent: Event;
constructor(private http: HttpClient, user: AuthService) {
this.loggeduser = user.ValidatedUser;