|
@@ -1,5 +1,5 @@
|
|
|
import { Component } from '@angular/core';
|
|
|
-import { NavController, NavParams, ActionSheetController, ToastController } from 'ionic-angular';
|
|
|
+import { NavController, NavParams, ActionSheetController, ToastController, LoadingController } from 'ionic-angular';
|
|
|
import { Shake, BarcodeScanner } from 'ionic-native';
|
|
|
// import { Product } from '../../models/product'
|
|
|
import { DataProvider } from '../../providers/data-provider'
|
|
@@ -34,54 +34,7 @@ export class ProductDetailsPage {
|
|
|
attribute_line_ids: []
|
|
|
}
|
|
|
|
|
|
- attributes = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "Talle",
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "Color",
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "Género",
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- name: "Marca",
|
|
|
- }
|
|
|
- ];
|
|
|
-
|
|
|
- values = [
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "36",
|
|
|
- attr_id: 1
|
|
|
- },
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "40",
|
|
|
- attr_id: 1
|
|
|
- },
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "Azul Prelavado",
|
|
|
- attr_id: 2
|
|
|
- },
|
|
|
- {
|
|
|
- id: 4,
|
|
|
- name: "Femenino",
|
|
|
- attr_id: 3
|
|
|
- },
|
|
|
- {
|
|
|
- id: 5,
|
|
|
- name: "RI19",
|
|
|
- attr_id: 4
|
|
|
- }
|
|
|
- ];
|
|
|
-
|
|
|
-
|
|
|
+ attributes: Array<any> = [];
|
|
|
view: string = "information";
|
|
|
watcher: any;
|
|
|
|
|
@@ -91,15 +44,22 @@ export class ProductDetailsPage {
|
|
|
public data: DataProvider,
|
|
|
public toastCtrl: ToastController,
|
|
|
public actionSheetCtrl: ActionSheetController,
|
|
|
+ public loadingCtrl: LoadingController,
|
|
|
public cameraProvider: CameraProvider,
|
|
|
public preferencesPreferences: PreferencesProvider
|
|
|
- ) { }
|
|
|
+ ) {
|
|
|
+ if (!(this.params.data instanceof Array)) {
|
|
|
+ this.product = this.params.data;
|
|
|
+ this.product.doc_state = "updated";
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
ionViewDidLoad() {
|
|
|
this.initialize();
|
|
|
+
|
|
|
this.watcher = Shake.startWatch(40).subscribe(() => {
|
|
|
BarcodeScanner.scan().then(bar => {
|
|
|
this.product.ean13 = bar.cancelled ? null : bar.text;
|
|
@@ -125,13 +85,14 @@ export class ProductDetailsPage {
|
|
|
*
|
|
|
*/
|
|
|
private initialize() {
|
|
|
- if (!(this.params.data instanceof Array)) {
|
|
|
- this.product = this.params.data;
|
|
|
- this.product.doc_state = "updated";
|
|
|
- }
|
|
|
+ let loader = this.loadingCtrl.create({
|
|
|
+ content: "Cargando, espere..."
|
|
|
+ });
|
|
|
+ loader.present();
|
|
|
|
|
|
- this.data.getAll('product_attribute_line').then(lines => {
|
|
|
- console.log(lines);
|
|
|
+ this.data.getAll('product_attribute_line').then(attributes => {
|
|
|
+ this.attributes = attributes.product_attribute_lines;
|
|
|
+ loader.dismiss();
|
|
|
}).catch(e => {
|
|
|
console.log(e);
|
|
|
});
|