Commit 212d63d0 by Nabil Sadki

QR scanner

parent de1f1d4f
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { IonicStorageModule } from '@ionic/storage';
import { HTTP } from '@ionic-native/http/ngx';
import { HttpClientModule } from '@angular/common/http';
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
import { LocationAccuracy } from '@ionic-native/location-accuracy/ngx';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
IonicStorageModule.forRoot({
name: '__allo_testeurs_app',
driverOrder: ['websql', 'sqlite', 'indexeddb']
}),
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
HTTP,
Diagnostic,
LocationAccuracy,
LocalNotifications,
BackgroundMode,
BackgroundGeolocation
],
bootstrap: [AppComponent]
})
export class AppModule { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { IonicStorageModule } from '@ionic/storage';
import { HTTP } from '@ionic-native/http/ngx';
import { HttpClientModule } from '@angular/common/http';
import { Diagnostic } from '@ionic-native/diagnostic/ngx';
import { LocationAccuracy } from '@ionic-native/location-accuracy/ngx';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { AppVersion } from '@ionic-native/app-version/ngx';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
IonicStorageModule.forRoot({
name: '__allo_testeurs_app',
driverOrder: ['websql', 'sqlite', 'indexeddb']
}),
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
HTTP,
Diagnostic,
LocationAccuracy,
LocalNotifications,
BackgroundMode,
BackgroundGeolocation,
AppVersion
],
bootstrap: [AppComponent]
})
export class AppModule { }
......@@ -748,6 +748,14 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/qr-scanner": {
"version": "5.13.0",
"resolved": "https://registry.npmjs.org/@ionic-native/qr-scanner/-/qr-scanner-5.13.0.tgz",
"integrity": "sha512-sFMksap9RmQm0apX/xuUB+HurBbHpj++7+5PsxN6wHG7Oz1JI6kqcSYfIOM+Vow30L9eXhT8GkAkeyQqi2M+UA==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/splash-screen": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-5.8.0.tgz",
......@@ -2907,6 +2915,15 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-play-games-services/-/cordova-plugin-play-games-services-1.1.2.tgz",
"integrity": "sha512-zVwA+qRzt9+Hlv9t2F8dbLchTyXFx0kS9T1MQ/vBP7IulH6/BL0kUvC120jYZSYcKkBTvusW0FqVvQhMui4gZA=="
},
"cordova-plugin-qrscanner": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-qrscanner/-/cordova-plugin-qrscanner-3.0.1.tgz",
"integrity": "sha512-xrwOP3nD+VmRSiV0w7chZ5PLw2YwpI9vtLdeoGNYLLzmmjjYbyIof+x9vOEOgjtwrg9S61rukmOZhQAmkzaosA==",
"requires": {
"qrcode-reader": "^1.0.4",
"webrtc-adapter": "^3.1.4"
}
},
"cordova-plugin-request-location-accuracy": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-request-location-accuracy/-/cordova-plugin-request-location-accuracy-2.3.0.tgz",
......@@ -7908,6 +7925,11 @@
"resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz",
"integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg=="
},
"qrcode-reader": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/qrcode-reader/-/qrcode-reader-1.0.4.tgz",
"integrity": "sha512-rRjALGNh9zVqvweg1j5OKIQKNsw3bLC+7qwlnead5K/9cb1cEIAGkwikt/09U0K+2IDWGD9CC6SP7tHAjUeqvQ=="
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
......@@ -8390,6 +8412,11 @@
}
}
},
"sdp": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/sdp/-/sdp-1.5.4.tgz",
"integrity": "sha1-jgOPbdsUvXZa4fS1IW4SCUUR4NA="
},
"select-hose": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
......@@ -10475,6 +10502,14 @@
"webpack-core": "^0.6.8"
}
},
"webrtc-adapter": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-3.4.3.tgz",
"integrity": "sha1-tjYGLu6abvFYrNDYUBtnhDS1bxY=",
"requires": {
"sdp": "^1.5.0"
}
},
"websocket-driver": {
"version": "0.7.3",
"resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz",
......
{
"name": "atapp",
"version": "1.0.8.1",
"author": "Allo Testeurs",
"homepage": "http://www.allo-testeurs.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"@angular/common": "^7.2.2",
"@angular/core": "^7.2.2",
"@angular/forms": "^7.2.2",
"@angular/http": "^7.2.2",
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/app-version": "^5.11.0",
"@ionic-native/background-geolocation": "^5.8.0",
"@ionic-native/background-mode": "^5.11.0",
"@ionic-native/camera": "^5.13.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/diagnostic": "^5.8.0",
"@ionic-native/file": "^5.13.0",
"@ionic-native/file-path": "^5.13.0",
"@ionic-native/google-plus": "^5.0.0",
"@ionic-native/http": "^5.8.0",
"@ionic-native/ionic-webview": "^5.13.0",
"@ionic-native/local-notifications": "^5.11.0",
"@ionic-native/location-accuracy": "^5.8.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"@ionic/storage": "^2.2.0",
"@mauron85/cordova-plugin-background-geolocation": "^3.0.3",
"cordova-android": "^8.0.0",
"cordova-plugin-advanced-http": "^2.1.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-background-mode": "git+https://github.com/sercatven/cordova-plugin-background-mode.git",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-background-mode": "^0.7.2",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-googleplus": "^8.0.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-play-games-services": "^1.1.2",
"cordova-plugin-qrscanner": "^3.0.1",
"cordova-plugin-request-location-accuracy": "^2.3.0",
"cordova-sqlite-storage": "^3.2.0",
"cordova.plugins.diagnostic": "^5.0.0",
"core-js": "^2.5.4",
"ionic-image-loader": "^6.3.3",
"leaflet": "^1.5.1",
"leaflet.markercluster": "^1.4.1",
"path": "^0.12.7",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.8.29"
"leaflet": "^1.5.1",
"path": "^0.12.7"
},
"devDependencies": {
"@angular-devkit/architect": "~0.13.8",
"@angular-devkit/build-angular": "~0.13.8",
"@angular-devkit/core": "~7.3.8",
"@angular-devkit/schematics": "~7.3.8",
"@angular/cli": "~7.3.8",
"@angular/compiler": "~7.2.2",
"@angular/compiler-cli": "~7.2.2",
"@angular/language-service": "~7.2.2",
"@ionic/angular-toolkit": "~1.5.1",
"@ionic/lab": "2.0.4",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~12.0.0",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "~3.1.6",
"cordova-plugin-whitelist": "1.3.3",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-ionic-webview": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.0.5"
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"browser": {
"crypto": false,
"fs": false,
"module": false
"repository": {
"type": "git",
"url": "git@versions.feeling-group.com:nabil.sadki/allo-app.git"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-advanced-http": {},
"cordova.plugins.diagnostic": {
"ANDROID_SUPPORT_VERSION": "28.+"
},
"cordova-plugin-request-location-accuracy": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-mauron85-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "@mipmap/ic_launcher",
"SMALL_ICON": "@mipmap/ic_launcher",
"ACCOUNT_NAME": "@string/app_name",
"ACCOUNT_LABEL": "@string/app_name",
"ACCOUNT_TYPE": "$PACKAGE_NAME.account",
"CONTENT_AUTHORITY": "$PACKAGE_NAME"
},
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-background-mode": {},
"@mauron85/cordova-plugin-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "@mipmap/ic_launcher",
"SMALL_ICON": "@mipmap/ic_launcher",
"ACCOUNT_NAME": "@string/app_name",
"ACCOUNT_LABEL": "@string/app_name",
"ACCOUNT_TYPE": "$PACKAGE_NAME.account",
"CONTENT_AUTHORITY": "$PACKAGE_NAME"
},
"cordova-plugin-app-version": {},
"cordova-plugin-file": {},
"cordova-plugin-googleplus": {
"PLAY_SERVICES_VERSION": "11.8.0"
},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-filepath": {}
},
"platforms": [
"android"
]
}
}
\ No newline at end of file
"author": "",
"license": "ISC"
}
......@@ -8,6 +8,7 @@ const routes: Routes = [
{ path: 'mainslider', loadChildren: './pages/mainslider/mainslider.module#MainsliderPageModule' },
{ path: 'app', loadChildren: './pages/menu/menu.module#MenuPageModule' },
{ path: 'offre-details', loadChildren: './pages/offre-details/offre-details.module#OffreDetailsPageModule' },
];
@NgModule({
......
<ion-app>
<div class="start" [class.hide]="appStarted">
<!-- <ion-img src="./assets/rings.svg"></ion-img> -->
<ion-spinner name="dots"></ion-spinner>
</div>
<ion-app [class.hide]="!appStarted">
<ion-router-outlet></ion-router-outlet>
</ion-app>
\ No newline at end of file
......@@ -29,7 +29,7 @@ export class AppComponent {
initializeApp() {
this.platform.ready().then(() => {
this.appStarted = true;
setTimeout(() => this.appStarted = true, 3000);
this.statusBar.styleDefault();
this.splashScreen.hide();
......
......@@ -23,6 +23,7 @@ import { Camera } from '@ionic-native/Camera/ngx';
import { File } from '@ionic-native/File/ngx';
import { WebView } from '@ionic-native/ionic-webview/ngx';
import { FilePath } from '@ionic-native/file-path/ngx';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner/ngx';
@NgModule({
declarations: [AppComponent],
......@@ -52,7 +53,8 @@ import { FilePath } from '@ionic-native/file-path/ngx';
Camera,
File,
WebView,
FilePath
FilePath,
QRScanner
],
bootstrap: [AppComponent]
})
......
......@@ -48,4 +48,7 @@ div.start {
ion-alert{
--width: 90vw !important;
--max-width: 90vw !important;
}
div.hide {
display: none !important;
}
\ No newline at end of file
<ion-header>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-menu-button>
<!-- <ion-icon name="menu" size="large"></ion-icon> -->
</ion-menu-button>
<ion-buttons slot="start">
<ion-back-button defaultHref="/app/mes-merites" text="Retour"></ion-back-button>
</ion-buttons>
</ion-buttons>
<ion-title>Lots à gagner</ion-title>
<ion-button slot="end" color="secondary" size="small">2600 points</ion-button>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item>
<ion-icon name="pin" size="large"></ion-icon>
<ion-label>
<h2>eTicket Allo Testeurs (50 DH)</h2>
<h3>
<ion-badge>5000 points</ion-badge>
</h3>
<p>Un bon d'achat d'une valeur de 50 DH, valable chez tous nos partenaires, et magasin qui acceptent le paiement par eTicket Allo Testeurs</p>
</ion-label>
</ion-item>
</ion-list>
</ion-content>
<ion-list>
<ion-card padding>
<ion-icon name="pin" size="large"></ion-icon>
<ion-label>
<h2>eTicket Allo Testeurs (50 DH)</h2>
<h3>
<ion-badge>5000 points</ion-badge>
</h3>
<p>Un bon d'achat d'une valeur de 50 DH, valable chez tous nos partenaires, et magasin qui acceptent le paiement
par eTicket Allo Testeurs</p>
</ion-label>
</ion-card>
</ion-list>
</ion-content>
\ No newline at end of file
......@@ -65,6 +65,18 @@ const routes: Routes = [
path: 'classement',
loadChildren: '../classement/classement.module#ClassementPageModule'
},
{
path: 'lots-a-gagner',
loadChildren: '../lots-a-gagner/lots-a-gagner.module#LotsAGagnerPageModule'
},
{
path: 'reclamer-merites-qrcode',
loadChildren: '../reclamer-merites-qrcode/reclamer-merites-qrcode.module#ReclamerMeritesQrcodePageModule'
},
{
path: 'reclamer-merites-form',
loadChildren: '../reclamer-merites-form/reclamer-merites-form.module#ReclamerMeritesFormPageModule'
}
]
}
];
......
......@@ -24,7 +24,7 @@
</ion-button>
</ion-col>
<ion-col>
<ion-button expand="block" color="dark" routerLink="/app/reclamer-merites" routerDirection="forward"
<ion-button expand="block" color="dark" routerLink="/app/lots-a-gagner" routerDirection="forward"
routerLinkActive="active">
<ion-icon name="medal"></ion-icon>
Gains
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { ReclamerMeritesFormPage } from './reclamer-merites-form.page';
const routes: Routes = [
{
path: '',
component: ReclamerMeritesFormPage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [ReclamerMeritesFormPage]
})
export class ReclamerMeritesFormPageModule {}
<ion-header>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-back-button defaultHref="/app/reclamer-merites" text="Retour"></ion-back-button>
</ion-buttons>
<ion-title>
Réclamer des mérites
</ion-title>
<ion-buttons slot="end">
<ion-button color="success" fill="solid" size="small">Valider</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-item lines="none" margin-top>
<ion-text class="ion-text-justify">
<small>
Pour récupérer les points de mérites <ion-icon name="ribbon" color="secondary"></ion-icon>, il suffit de
sélectionner l'offre, et présenter une preuve d'achat (ticket de caisse ou autre). Une fois votre demande est
approuvée, les mérites associés à l'offre seront rajoutés immédiatement à votre solde.<br>
On vous rappelle que les mérites vous permettent de gagner des lots si vous êtes un(e) membre fidèle!
</small>
</ion-text>
</ion-item>
<ion-card>
<ion-list>
<ion-list-header color="tertiary">Sélectionnez l'offre concernée</ion-list-header>
<ion-item>
<ion-label>Partenaire</ion-label>
<ion-select placeholder="Sélectionner">
<ion-select-option value="f">The green place</ion-select-option>
<ion-select-option value="m">Hollywood café restaurant</ion-select-option>
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-label>Offre</ion-label>
<ion-select placeholder="Sélectionner">
<ion-select-option value="f">50% sur le second petit-déjeuner</ion-select-option>
<ion-select-option value="m">10% sur le petit-déjeuner</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
</ion-card>
<ion-card>
<ion-list>
<ion-list-header color="tertiary">Preuve(s) d'achat</ion-list-header>
<ion-item *ngFor="let img of images; index as pos" text-wrap>
<ion-thumbnail slot="start">
<ion-img [src]="img.path"></ion-img>
</ion-thumbnail>
<ion-label>
{{ img.name }}
</ion-label>
<ion-button slot="end" fill="clear" (click)="deleteImage(img, pos)">
<ion-icon slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-item>
<ion-text class="ion-padding-horizontal">
<small>La preuve d'achat doit avoir la date d'achat affichée en claire.</small>
</ion-text>
<ion-item no-padding>
<ion-button fill="solid" expand="full" color="success" (click)="selectImage()" class="ion-margin-horizontal">
<ion-icon slot="start" name="camera"></ion-icon>
Preuves d'achat (ticket de caisse, bons, ...)
</ion-button>
</ion-item>
<ion-item lines="none">
<ion-label position="floating">Commentaires</ion-label>
<ion-textarea rows="5" placeholder="Plus d'indications sur l'achat si besoin..."></ion-textarea>
</ion-item>
</ion-list>
</ion-card>
</ion-content>
\ No newline at end of file
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReclamerMeritesFormPage } from './reclamer-merites-form.page';
describe('ReclamerMeritesFormPage', () => {
let component: ReclamerMeritesFormPage;
let fixture: ComponentFixture<ReclamerMeritesFormPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReclamerMeritesFormPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReclamerMeritesFormPage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-reclamer-merites-form',
templateUrl: './reclamer-merites-form.page.html',
styleUrls: ['./reclamer-merites-form.page.scss'],
})
export class ReclamerMeritesFormPage implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { ReclamerMeritesQrcodePage } from './reclamer-merites-qrcode.page';
const routes: Routes = [
{
path: '',
component: ReclamerMeritesQrcodePage
}
];
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [ReclamerMeritesQrcodePage]
})
export class ReclamerMeritesQrcodePageModule {}
<ion-header>
<ion-toolbar color="primary">
<ion-buttons slot="start">
<ion-back-button defaultHref="/app/reclamer-merites" text="Retour"></ion-back-button>
</ion-buttons>
<ion-title>Scannez le QRcode</ion-title>
</ion-toolbar>
</ion-header>
<div class="qrscanner-square"></div>
<ion-content [class.hide]="isOn">
</ion-content>
<ion-footer>
<ion-toolbar color="primary">
<ion-button slot="end" color="tertiary" fill="solid" (click)="hideQRcode()">Annuler</ion-button>
<ion-button slot="end" color="success" fill="solid" (click)="getQRcode()">Scanner</ion-button>
</ion-toolbar>
</ion-footer>
\ No newline at end of file
.hide {
display: none;
}
.qrscanner-square {
position: absolute;
width: 50vw;
height: 50vw;
border: 2px solid var(--ion-color-primary);
z-index: 99999;
top: calc(50vh - 25vw);
left: 25vw;
border-radius: 10px;
}
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReclamerMeritesQrcodePage } from './reclamer-merites-qrcode.page';
describe('ReclamerMeritesQrcodePage', () => {
let component: ReclamerMeritesQrcodePage;
let fixture: ComponentFixture<ReclamerMeritesQrcodePage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReclamerMeritesQrcodePage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReclamerMeritesQrcodePage);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner/ngx';
@Component({
selector: 'app-reclamer-merites-qrcode',
templateUrl: './reclamer-merites-qrcode.page.html',
styleUrls: ['./reclamer-merites-qrcode.page.scss'],
})
export class ReclamerMeritesQrcodePage implements OnInit {
isOn = false;
scanner: any;
constructor(
private qrScanner: QRScanner
) { }
ngOnInit() {
}
getQRcode() {
this.qrScanner.prepare()
.then((status: QRScannerStatus) => {
if (status.authorized) {
this.isOn = true;
this.qrScanner.show();
this.scanner = this.qrScanner.scan().subscribe((text: string) => {
this.hideQRcode();
console.log('Scanned something', text, this.isOn);
// setTimeout(() => {
// alert(text);
// }, 3000);
});
} else if (status.denied) {
// camera permission was permanently denied
// you must use QRScanner.openSettings() method to guide the user to the settings page
// then they can grant the permission from there
} else {
// permission was denied, but not permanently. You can ask for permission again at a later time.
}
})
.catch((e: any) => console.log('Error is', e));
setTimeout(() => {
console.log('Finished', this.isOn);
}, 5000);
}
hideQRcode() {
console.log('hideQRcode start', this.isOn);
this.qrScanner.hide(); // hide camera preview
this.scanner.unsubscribe(); // hide camera preview
this.qrScanner.destroy().then(() => {
this.isOn = false;
console.log('hideQRcode end', this.isOn);
}); // stop scanning
}
}
......@@ -4,11 +4,8 @@
<ion-back-button defaultHref="/app/mes-merites" text="Retour"></ion-back-button>
</ion-buttons>
<ion-title>
Réclamer des mérites
Récupérer des mérites
</ion-title>
<ion-buttons slot="end">
<ion-button color="success" fill="solid" size="small">Valider</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
......@@ -16,59 +13,19 @@
<ion-item lines="none" margin-top>
<ion-text class="ion-text-justify">
<small>
Pour récupérer les points de mérites <ion-icon name="ribbon" color="secondary"></ion-icon>, il suffit de
sélectionner l'offre, et présenter une preuve d'achat (ticket de caisse ou autre). Une fois votre demande est
approuvée, les mérites associés à l'offre seront rajoutés immédiatement à votre solde.<br>
On vous rappelle que les mérites vous permettent de gagner des lots si vous êtes un(e) membre fidèle!
Vous pouvez récupérer vos points de mérites, chez le partenaire directement en scannant le code QR sur sa
tablette( recommandée), ou en faisant une demande directe via le formulaire de récupération des mérites.
</small>
</ion-text>
</ion-item>
<ion-card>
<ion-list>
<ion-list-header color="tertiary">Sélectionnez l'offre concernée</ion-list-header>
<ion-item>
<ion-label>Partenaire</ion-label>
<ion-select placeholder="Sélectionner">
<ion-select-option value="f">The green place</ion-select-option>
<ion-select-option value="m">Hollywood café restaurant</ion-select-option>
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-label>Offre</ion-label>
<ion-select placeholder="Sélectionner">
<ion-select-option value="f">50% sur le second petit-déjeuner</ion-select-option>
<ion-select-option value="m">10% sur le petit-déjeuner</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
<ion-card class="ion-text-center" padding>
<ion-icon name="barcode"></ion-icon>
<ion-button expand="block" color="dark" routerLink="/app/reclamer-merites-qrcode" routerDirection="forward"
routerLinkActive="active"> Scanner le code QR </ion-button>
</ion-card>
<ion-card>
<ion-list>
<ion-list-header color="tertiary">Preuve(s) d'achat</ion-list-header>
<ion-item *ngFor="let img of images; index as pos" text-wrap>
<ion-thumbnail slot="start">
<ion-img [src]="img.path"></ion-img>
</ion-thumbnail>
<ion-label>
{{ img.name }}
</ion-label>
<ion-button slot="end" fill="clear" (click)="deleteImage(img, pos)">
<ion-icon slot="icon-only" name="trash"></ion-icon>
</ion-button>
</ion-item>
<ion-text class="ion-padding-horizontal">
<small>La preuve d'achat doit avoir la date d'achat affichée en claire.</small>
</ion-text>
<ion-item no-padding>
<ion-button fill="solid" expand="full" color="success" (click)="selectImage()" class="ion-margin-horizontal">
<ion-icon slot="start" name="camera"></ion-icon>
Preuves d'achat (ticket de caisse, bons, ...)
</ion-button>
</ion-item>
<ion-item lines="none">
<ion-label position="floating">Commentaires</ion-label>
<ion-textarea rows="5" placeholder="Plus d'indications sur l'achat si besoin..."></ion-textarea>
</ion-item>
</ion-list>
<ion-card class="ion-text-center" padding>
<ion-icon name="list-box"></ion-icon>
<ion-button expand="block" color="dark" routerLink="/app/reclamer-merites-form" routerDirection="forward"
routerLinkActive="active"> Formulaire de récupération </ion-button>
</ion-card>
</ion-content>
\ No newline at end of file
ion-icon {
font-size: 20vw;
}
\ No newline at end of file
......@@ -22,10 +22,6 @@
</head>
<body>
<div class="start" *ngIf="!appStarted">
<!-- <ion-img src="./assets/rings.svg"></ion-img> -->
<ion-spinner name="dots"></ion-spinner>
</div>
<app-root></app-root>
<script src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js" crossorigin=""></script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment