src/pages/results/results.ts
Generated class for the ResultsPage page.
See https://ionicframework.com/docs/components/#navigation for more info on Ionic pages and navigation.
selector | page-results |
templateUrl | results.html |
Properties |
|
Methods |
constructor(toastCtrl: ToastController, renderer: Renderer, navCtrl: NavController, modalCtrl: ModalController, navParams: NavParams, viewCtrl: ViewController, modelLoader: ModelLoaderProvider)
|
||||||||||||||||||||||||||||||||
Defined in src/pages/results/results.ts:44
|
||||||||||||||||||||||||||||||||
Fetches the resultPreds from the model loader provider
Parameters :
|
Public closeModal |
closeModal()
|
Defined in src/pages/results/results.ts:67
|
Closes the modal when the back button is pressed
Returns :
void
|
openBrowserToBramhope | ||||||
openBrowserToBramhope(url: )
|
||||||
Defined in src/pages/results/results.ts:75
|
||||||
Opens a link to the Bramhope store for the corresponding item that was pressed
Parameters :
Returns :
boolean
|
openQuoteDialog | ||||
openQuoteDialog(elName: )
|
||||
Defined in src/pages/results/results.ts:84
|
||||
Parameters :
Returns :
void
|
Public modalCtrl |
modalCtrl:
|
Type : ModalController
|
Defined in src/pages/results/results.ts:53
|
Public modelLoader |
modelLoader:
|
Type : ModelLoaderProvider
|
Defined in src/pages/results/results.ts:53
|
The ModelLoader provider that handles all image classification requests
|
Public navCtrl |
navCtrl:
|
Type : NavController
|
Defined in src/pages/results/results.ts:53
|
Controls navigation
|
Public navParams |
navParams:
|
Type : NavParams
|
Defined in src/pages/results/results.ts:53
|
Controls parameters passed in during navigation
|
Public renderer |
renderer:
|
Type : Renderer
|
Defined in src/pages/results/results.ts:53
|
Public resultPreds |
resultPreds:
|
Type : []
|
Default value : []
|
Defined in src/pages/results/results.ts:44
|
Array of result objects, which contain the category name, likeliness, and item web links, if specified. This array is used to display the list of results in the page |
Public viewCtrl |
viewCtrl:
|
Type : ViewController
|
Defined in src/pages/results/results.ts:53
|
Controls the current view
|
import { Dialogs } from '@ionic-native/dialogs';
import { Component, Renderer } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { ModalController } from 'ionic-angular';
import { ViewController } from 'ionic-angular';
import { ModelLoaderProvider } from './../../providers/model-loader/model-loader';
import { QuoteBuilderPage } from '../quote-builder/quote-builder';
import { ToastController } from 'ionic-angular';
/**
* Generated class for the ResultsPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@Component({
selector: 'page-results',
templateUrl: 'results.html',
})
export class ResultsPage {
/**
* Array of result objects, which contain the category name, likeliness, and item web links, if specified.
* This array is used to display the list of results in the page
*/
public resultPreds = [];
/**
* Fetches the resultPreds from the model loader provider
* @param navCtrl Controls navigation
* @param navParams Controls parameters passed in during navigation
* @param viewCtrl Controls the current view
* @param modelLoader The ModelLoader provider that handles all image classification requests
*/
constructor(private toastCtrl: ToastController, public renderer: Renderer,public navCtrl: NavController, public modalCtrl: ModalController, public navParams: NavParams, public viewCtrl: ViewController, public modelLoader : ModelLoaderProvider) {
this.resultPreds= modelLoader.getResults();
// this.renderer.setElementClass(viewCtrl.pageRef().nativeElement, 'custom-popup', true);
}
/**
* @ignore
*/
ionViewDidLoad() {
console.log('ionViewDidLoad ResultsPage');
}
/**
* Closes the modal when the back button is pressed
*/
public closeModal(){
this.viewCtrl.dismiss();
}
/**
* Opens a link to the Bramhope store for the corresponding item that was pressed
* @param url Passed in from the item that is clicked. The corresponding URL is stored in the classes JSON file
*/
openBrowserToBramhope(url) {
if (url == '') {
return false;
}
window.open(url, '_system', 'location=yes');
return false;
}
openQuoteDialog(elName) {
elName = elName || 'There is no item in store that matches your selection';
let resultsModal = this.modalCtrl.create(QuoteBuilderPage, {data: elName});
resultsModal.present();
/* this.navCtrl.push(QuoteBuilderPage, {
data: elName
});*/
}
}
<!-- /**
* File Name: results.html
* Version Number: v1.1
* Author: Tobias Bester
* Project Name: Ninshiki
* Organization: Software Sharks
* User Manual: Refer to https://github.com/OrishaOrrie/SoftwareSharks/blob/master/Documentation/User%20Manual.pdf
* Update History:
* ------------------------------------------
* Date Author Description
* 20/07/2018 Tobias Created component
* 18/09/2018 Tobias Added functionality
* 18/09/2018 Tobias Fixed layout
* ------------------------------------------
* Functional Description:
* The page that will display the results of the image prediction as well as a link to the store and an
* option to add it to their basket for a quotation
*/ -->
<!--
Generated template for the ResultsPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<!--display the results modal with all the likelihoods-->
<ion-navbar>
<ion-buttons end>
<button ion-button style="color: rgb(50, 150, 231)" (click)="closeModal()">Close</button>
</ion-buttons>
<ion-title>Results</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<h6 class="instructions">Select the store link option to go to the Bramhope Website or the Add to Quote option to add the object to the contact us page to request a quote</h6>
<div class="row header">
<div class="cname">Class Name</div>
<div class="like">Likelihood</div>
<div class="col">Store Link</div>
<div class="col">Add to quote</div>
</div>
<div class="row" *ngFor="let result of resultPreds">
<div class="cname" >{{ result.name }}</div>
<div class="like" >{{ result.likeliness }}%</div>
<div class="col"><button item-right clear style = "background-color: transparent" (click)=" openBrowserToBramhope( result.link )">
<ion-icon *ngIf="result.link" name="open" ></ion-icon>
</button></div>
<div class="col"><button item-right clear style = "background-color: transparent" (click)="openQuoteDialog(result.name)">
<ion-icon *ngIf="result.link" name="cart" ></ion-icon>
</button></div>
</div>
</ion-content>