-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from uatisdeproblem/107-migrate-room-page
- Loading branch information
Showing
9 changed files
with
215 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>{{ 'ROOMS.DETAILS' | translate }}</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<ion-grid class="contentGrid"> | ||
<ion-row class="ion-justify-content-center"> | ||
<ion-col size="12" size-md="6"> | ||
<app-room-card [room]="room"></app-room-card> | ||
</ion-col> | ||
<ion-col size="12" size-md="6"> | ||
<ion-list> | ||
<ion-list-header> | ||
<ion-label class="ion-text-center"> | ||
<h2>{{ 'ROOMS.SESSIONS' | translate }}</h2> | ||
</ion-label> | ||
</ion-list-header> | ||
<ion-searchbar #searchbar color="light" (ionInput)="filterSessions($event.target.value)"></ion-searchbar> | ||
<ion-col *ngIf="!sessions"> | ||
<app-session-card [preview]="true"></app-session-card> | ||
</ion-col> | ||
<ion-col *ngIf="sessions && sessions.length === 0"> | ||
<ion-item lines="none" color="white"> | ||
<ion-label class="ion-text-center">{{ 'COMMON.NO_ELEMENT_FOUND' | translate }}</ion-label> | ||
</ion-item> | ||
</ion-col> | ||
<ion-col *ngFor="let session of sessions"> | ||
<app-session-card [session]="session" [preview]="true" (click)="app.goToInTabs(['sessions', session.sessionId])"></app-session-card> | ||
</ion-col> | ||
</ion-list> | ||
</ion-col> | ||
</ion-row> | ||
</ion-grid> | ||
</ion-content> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
|
||
import { IDEALoadingService, IDEAMessageService } from '@idea-ionic/common'; | ||
|
||
import { AppService } from 'src/app/app.service'; | ||
import { RoomsService } from './rooms.service'; | ||
import { SessionsService } from '../sessions/sessions.service'; | ||
|
||
import { Room } from '@models/room.model'; | ||
import { Session } from '@models/session.model'; | ||
|
||
@Component({ | ||
selector: 'app-room', | ||
templateUrl: './room.page.html', | ||
styleUrls: ['./room.page.scss'] | ||
}) | ||
export class RoomPage implements OnInit { | ||
room: Room; | ||
sessions: Session[]; | ||
|
||
constructor( | ||
private route: ActivatedRoute, | ||
private loading: IDEALoadingService, | ||
private message: IDEAMessageService, | ||
private _sessions: SessionsService, | ||
private _rooms: RoomsService, | ||
public app: AppService | ||
) {} | ||
|
||
async ngOnInit() { | ||
await this.loadData(); | ||
} | ||
|
||
async loadData() { | ||
try { | ||
await this.loading.show(); | ||
const roomId = this.route.snapshot.paramMap.get('roomId'); | ||
this.room = await this._rooms.getById(roomId); | ||
this.sessions = await this._sessions.getList({ room: this.room.roomId, force: true }); | ||
} catch (err) { | ||
this.message.error('COMMON.NOT_FOUND'); | ||
} finally { | ||
await this.loading.hide(); | ||
} | ||
} | ||
|
||
async filterSessions(search: string = ''): Promise<void> { | ||
this.sessions = await this._sessions.getList({ search, room: this.room.roomId }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { Routes, RouterModule } from '@angular/router'; | ||
|
||
import { RoomPage } from './room.page'; | ||
|
||
const routes: Routes = [ | ||
{ path: ':roomId', component: RoomPage }, | ||
{ path: '', redirectTo: '/', pathMatch: 'full' } | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class RoomsRoutingModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { IonicModule } from '@ionic/angular'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { IDEATranslationsModule } from '@idea-ionic/common'; | ||
|
||
import { RoomsRoutingModule } from './rooms-routing.module'; | ||
import { RoomPage } from './room.page'; | ||
import { RoomCardStandaloneComponent } from './roomCard.component'; | ||
import { SessionCardStandaloneComponent } from '../sessions/sessionCard.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
IonicModule, | ||
IDEATranslationsModule, | ||
RoomsRoutingModule, | ||
RoomCardStandaloneComponent, | ||
SessionCardStandaloneComponent | ||
], | ||
declarations: [RoomPage] | ||
}) | ||
export class RoomsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { IDEATranslationsModule } from '@idea-ionic/common'; | ||
|
||
import { AppService } from 'src/app/app.service'; | ||
|
||
import { Session } from '@models/session.model'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [CommonModule, FormsModule, IonicModule, IDEATranslationsModule], | ||
selector: 'app-session-card', | ||
template: ` | ||
<ng-container *ngIf="session; else skeletonTemplate"> | ||
<ion-card *ngIf="preview" [color]="preview ? 'white' : ''"> | ||
<ion-card-header> | ||
<ion-card-title>{{ session.name }}</ion-card-title> | ||
<ion-card-subtitle>{{ session.description }}</ion-card-subtitle> | ||
</ion-card-header> | ||
</ion-card> | ||
<ion-card *ngIf="!preview" color="white"> | ||
<ion-card-header> | ||
<ion-card-subtitle style="font-weight: 300;" class="ion-text-right"> | ||
<ion-button fill="clear" (click)="app.goToInTabs(['sessions', session.sessionId])"> | ||
<ion-icon name="location-outline"></ion-icon> | ||
<ion-label> | ||
{{ session.room.venue.name }} | ||
</ion-label> | ||
</ion-button> | ||
</ion-card-subtitle> | ||
<ion-card-title>{{ session.name }}</ion-card-title> | ||
<ion-card-subtitle>{{ session.description }}</ion-card-subtitle> | ||
</ion-card-header> | ||
<ion-card-content> | ||
<div class="divDescription" *ngIf="session.description"> | ||
<ion-textarea readonly [rows]="4" [(ngModel)]="session.description"></ion-textarea> | ||
</div> | ||
</ion-card-content> | ||
</ion-card> | ||
</ng-container> | ||
<ng-template #skeletonTemplate> | ||
<ion-card color="white"> | ||
<ion-skeleton-text animated style="height: 200px;"></ion-skeleton-text> | ||
<ion-card-header> | ||
<ion-card-title> | ||
<ion-skeleton-text animated style="width: 60%;"></ion-skeleton-text> | ||
</ion-card-title> | ||
<ion-card-subtitle> | ||
<ion-skeleton-text animated style="width: 50%;"></ion-skeleton-text> | ||
</ion-card-subtitle> | ||
</ion-card-header> | ||
<ion-card-content> | ||
<ion-skeleton-text animated style="width: 80%;"></ion-skeleton-text> | ||
<ion-skeleton-text animated style="width: 70%;"></ion-skeleton-text> | ||
<ion-skeleton-text animated style="width: 60%;"></ion-skeleton-text> | ||
</ion-card-content> | ||
</ion-card> | ||
</ng-template> | ||
` | ||
}) | ||
export class SessionCardStandaloneComponent { | ||
@Input() session: Session; | ||
@Input() preview: boolean; | ||
|
||
constructor(public app: AppService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters