|
@@ -3,6 +3,7 @@ import { NavController, NavParams, ActionSheetController } from 'ionic-angular';
|
|
import { Product } from '../../models/product'
|
|
import { Product } from '../../models/product'
|
|
import { DataProvider } from '../../providers/data-provider'
|
|
import { DataProvider } from '../../providers/data-provider'
|
|
import { CameraProvider } from '../../providers/camera-provider';
|
|
import { CameraProvider } from '../../providers/camera-provider';
|
|
|
|
+import { PreferencesProvider } from '../../providers/preferences-provider';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'page-product-details',
|
|
selector: 'page-product-details',
|
|
@@ -12,7 +13,7 @@ import { CameraProvider } from '../../providers/camera-provider';
|
|
export class ProductDetailsPage {
|
|
export class ProductDetailsPage {
|
|
|
|
|
|
product = {
|
|
product = {
|
|
- company_id: false,
|
|
|
|
|
|
+ company_id: 0,
|
|
default_code: false,
|
|
default_code: false,
|
|
description: false,
|
|
description: false,
|
|
ean13: false,
|
|
ean13: false,
|
|
@@ -35,7 +36,8 @@ export class ProductDetailsPage {
|
|
public params: NavParams,
|
|
public params: NavParams,
|
|
public data: DataProvider,
|
|
public data: DataProvider,
|
|
public actionSheetCtrl: ActionSheetController,
|
|
public actionSheetCtrl: ActionSheetController,
|
|
- private cameraProvider: CameraProvider
|
|
|
|
|
|
+ private cameraProvider: CameraProvider,
|
|
|
|
+ private preferencesPreferences: PreferencesProvider
|
|
) {
|
|
) {
|
|
this.initialize();
|
|
this.initialize();
|
|
}
|
|
}
|
|
@@ -110,14 +112,17 @@ export class ProductDetailsPage {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this.product.company_id = this.preferencesPreferences.getCompany();
|
|
|
|
+
|
|
this.data.save('product', this.product).then(result => {
|
|
this.data.save('product', this.product).then(result => {
|
|
if (this.params.data instanceof Array) {
|
|
if (this.params.data instanceof Array) {
|
|
this.params.data.push(result.products[0]);
|
|
this.params.data.push(result.products[0]);
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
this.navCtrl.pop(this);
|
|
this.navCtrl.pop(this);
|
|
}).catch(e => {
|
|
}).catch(e => {
|
|
console.log(e);
|
|
console.log(e);
|
|
});
|
|
});
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|