File

src/pages/results/results.ts

Description

Generated class for the ResultsPage page.

See https://ionicframework.com/docs/components/#navigation for more info on Ionic pages and navigation.

Metadata

selector page-results
templateUrl results.html

Index

Properties
Methods

Constructor

constructor(toastCtrl: ToastController, renderer: Renderer, navCtrl: NavController, modalCtrl: ModalController, navParams: NavParams, viewCtrl: ViewController, modelLoader: ModelLoaderProvider)

Fetches the resultPreds from the model loader provider

Parameters :
Name Type Optional Description
toastCtrl ToastController No
renderer Renderer No
navCtrl NavController No

Controls navigation

modalCtrl ModalController No
navParams NavParams No

Controls parameters passed in during navigation

viewCtrl ViewController No

Controls the current view

modelLoader ModelLoaderProvider No

The ModelLoader provider that handles all image classification requests

Methods

Public closeModal
closeModal()

Closes the modal when the back button is pressed

Returns : void
openBrowserToBramhope
openBrowserToBramhope(url: )

Opens a link to the Bramhope store for the corresponding item that was pressed

Parameters :
Name Optional Description
url No

Passed in from the item that is clicked. The corresponding URL is stored in the classes JSON file

Returns : boolean
openQuoteDialog
openQuoteDialog(elName: )
Parameters :
Name Optional
elName No
Returns : void

Properties

Public modalCtrl
modalCtrl: ModalController
Type : ModalController
Public modelLoader
modelLoader: ModelLoaderProvider
Type : ModelLoaderProvider
The ModelLoader provider that handles all image classification requests
Public navCtrl
navCtrl: NavController
Type : NavController
Controls navigation
Public navParams
navParams: NavParams
Type : NavParams
Controls parameters passed in during navigation
Public renderer
renderer: Renderer
Type : Renderer
Public resultPreds
resultPreds: []
Type : []
Default value : []

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: ViewController
Type : ViewController
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>


Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""