Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Door check #51

Merged
merged 3 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@
<ion-label>Hello, {{nickname}}</ion-label>
</ion-item>

<ion-list-header *ngIf="hasApps">
Apps
</ion-list-header>

<ion-menu-toggle *ngIf="hasDoorCheck" autoHide="false">
<ion-item routerLink="/app/tabs/door-check" routerLinkActive="active" routerDirection="root" detail="false">
<ion-icon slot="start" name="checkbox-outline"></ion-icon>
<ion-label>
Door Check
</ion-label>
</ion-item>
</ion-menu-toggle>

<ion-menu-toggle *ngIf="hasLeadRetrieval" autoHide="false">
<ion-item routerLink="/app/tabs/lead-retrieval" routerLinkActive="active" routerDirection="root" detail="false">
<ion-icon slot="start" name="qr-code"></ion-icon>
<ion-label>
Lead Scanner
</ion-label>
</ion-item>
</ion-menu-toggle>

<ion-list-header>
Schedule
</ion-list-header>
Expand Down Expand Up @@ -61,22 +83,6 @@

</ion-list>

<ion-list *ngIf="hasApps" lines="none">
<ion-list-header>
Apps
</ion-list-header>

<ion-menu-toggle *ngIf="hasLeadRetrieval" autoHide="false">
<ion-item routerLink="/app/tabs/lead-retrieval" routerLinkActive="active" routerDirection="root" detail="false">
<ion-icon slot="start" name="qr-code"></ion-icon>
<ion-label>
Lead Scanner
</ion-label>
</ion-item>
</ion-menu-toggle>

</ion-list>

<ion-list *ngIf="loggedIn" lines="none">
<ion-list-header>
Account
Expand Down
7 changes: 6 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class AppComponent implements OnInit {

hasApps = false;
hasLeadRetrieval = false;
hasDoorCheck= false;

constructor(
private menu: MenuController,
Expand Down Expand Up @@ -90,9 +91,13 @@ export class AppComponent implements OnInit {
this.loggedIn = loggedIn;
this.userData.fetchPreferences();
this.userData.checkHasLeadRetrieval().then(hasLeadRetrieval => {
this.hasApps = hasLeadRetrieval;
this.hasApps = this.hasApps || hasLeadRetrieval;
this.hasLeadRetrieval = hasLeadRetrieval;
});
this.userData.checkHasDoorCheck().then(hasDoorCheck => {
this.hasApps = this.hasApps || hasDoorCheck;
this.hasDoorCheck = hasDoorCheck;
});
this.userData.getNickname().then(nickname => {
this.nickname = nickname;
});
Expand Down
17 changes: 17 additions & 0 deletions src/app/pages/door-check/door-check-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { DoorCheckPage } from './door-check.page';

const routes: Routes = [
{
path: '',
component: DoorCheckPage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class DoorCheckPageRoutingModule {}
20 changes: 20 additions & 0 deletions src/app/pages/door-check/door-check.module.ts
Original file line number Diff line number Diff line change
@@ -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 { DoorCheckPageRoutingModule } from './door-check-routing.module';

import { DoorCheckPage } from './door-check.page';

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
DoorCheckPageRoutingModule
],
declarations: [DoorCheckPage]
})
export class DoorCheckPageModule {}
87 changes: 87 additions & 0 deletions src/app/pages/door-check/door-check.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<ion-header>
<ion-toolbar>
<ion-title>Door Check</ion-title>
</ion-toolbar>
</ion-header>

<ion-content [style.visibility]="content_visibility">
<ion-list>
<ion-item *ngIf="show_permissions_error">
<ion-card>
<ion-card-header>
<ion-card-title>Uh oh..</ion-card-title>
<ion-card-subtitle>Camera Permissions Not Granted</ion-card-subtitle>
</ion-card-header>
<ion-card-content>
<ion-text>Looks like you did not grant this application permission to access your camera.</ion-text>
<ion-text>
You can resolve this by opening<br><br>
<code *ngIf="ios">Settings > Privacy & Security > Camera > PyCon US 2023<br><br></code>
<code *ngIf="!ios">Settings > Apps > PyCon US 2023 > Permissions > Camera<br><br></code>
And enabling camera permssions for this app.
</ion-text>
</ion-card-content>
</ion-card>
</ion-item>

<ion-item>
<ion-select [(ngModel)]="category" (ionChange)="refreshProducts()" interface="popover" [interfaceOptions]="{'cssClass': 'mycomponent-wider-popover'}" aria-label="categories" label="Category" placeholder="Category">
<ion-select-option *ngFor="let category of redeemable_categories" [value]="category.id">{{category.name}}</ion-select-option>
</ion-select>
</ion-item>

<ion-item *ngIf="!dirty">
<ion-select [(ngModel)]="product" interface="popover" [interfaceOptions]="{'cssClass': 'mycomponent-wider-popover'}" aria-label="products" label="Product" placeholder="Product">
<div *ngFor="let product of display_products">
<ion-select-option [value]="product.id">{{product.name}}</ion-select-option>
</div>
</ion-select>
</ion-item>

<ion-item *ngIf="category || product">
<ion-card>
<ion-card-header>
<ion-card-title>Scanning for...</ion-card-title>
</ion-card-header>
<ion-card-content>
<h1>{{ getCategoryName(category) }}</h1>
<h2>{{ getProductName(product) }}</h2>
</ion-card-content>
</ion-card>
</ion-item>

</ion-list>
</ion-content>

<ion-footer>
<ion-card *ngIf="last_scan">
<ion-item>
<ion-label>
<ion-grid>
<ion-row>
<ion-col>
<h1>
<ion-icon
[color]="(last_scan.status)? 'success' : 'danger'"
[name]="(last_scan.status)? 'checkmark-circle-outline' : 'alert-circle-outline'">
</ion-icon>
<ion-text *ngIf="last_scan.status"> All good attendee has access!</ion-text>
<ion-text *ngIf="!last_scan.status"> Entry not permitted</ion-text>
</h1>
</ion-col>
</ion-row>
</ion-grid>
</ion-label>
</ion-item>
</ion-card>
<ion-toolbar class="footer-toolbar">
<ion-buttons class="footer-buttons">
<ion-button fill="solid" color="success" class="footer-button" (click)="startScan()" [style.visibility]="scan_start_button_visibility">
Start Scanner!
</ion-button>
<ion-button fill="solid" color="danger" class="footer-button" (click)="stopScan()" [style.visibility]="scan_stop_button_visibility">
Stop Scanner
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-footer>
26 changes: 26 additions & 0 deletions src/app/pages/door-check/door-check.page.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.footer-buttons {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100%;
}

.footer-button {
position: absolute;
}
.footer-toolbar {
padding-top: 1em;
padding-bottom: 1em;
}

.header-info {
font-size: .6em;
padding-bottom: .5em;
}

::ng-deep .mycomponent-wider-popover
{
--width: 95%;
--max-width: 400px;
}
24 changes: 24 additions & 0 deletions src/app/pages/door-check/door-check.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { DoorCheckPage } from './door-check.page';

describe('DoorCheckPage', () => {
let component: DoorCheckPage;
let fixture: ComponentFixture<DoorCheckPage>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ DoorCheckPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(DoorCheckPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading