123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- import { Component } from '@angular/core';
- import { NavController, NavParams, ActionSheetController, AlertController } from 'ionic-angular';
- import { BaseListView } from "../../base/base-list-view";
- import { ProductTemplate } from "../../odoo/models/product.template";
- import { ProductPage } from "../product/product";
- @Component({
- selector: 'page-products',
- templateUrl: 'products.html'
- })
- export class ProductsPage extends BaseListView<ProductTemplate> {
- constructor(
- public navCtrl: NavController,
- public navParams: NavParams,
- public actionSheetCtrl: ActionSheetController,
- public alertCtrl: AlertController
- ) {
- super(ProductTemplate);
- }
- /**
- *
- */
- ionViewDidLoad() {
- console.log('ionViewDidLoad ProductsPage');
- }
- /**
- *
- */
- ionViewDidEnter() {
- super.unselectItem();
- }
- /**
- *
- * @param item
- */
- openOptions(item: ProductTemplate): void {
- super.setSelectedItem(item);
-
- this.actionSheetCtrl.create({
- title: "Opciones",
- buttons: [
- {
- text: "Abrir",
- icon: "open",
- handler: () => {
- this.goToDetails();
- }
- },
- {
- text: "Eliminar",
- icon: "close",
- role: "destructive",
- handler: () => {
- this.askIfDelete();
- }
- },
- {
- text: "Cancel",
- role: "cancel",
- handler: () => {
- super.unselectItem();
- }
- },
- ]
- }).present();
- }
- /**
- *
- */
- goToDetails(): void {
- this.navCtrl.push(ProductPage, super.getSelectedItem());
- }
- /**
- *
- */
- askIfDelete(): void {
- this.alertCtrl.create({
- title: "Confirmar",
- message: "Quieres eliminar este producto?",
- buttons: [
- {
- text: "Cancelar"
- },
- {
- text: "Aceptar",
- handler: () => {
- super.performDelete();
- }
- }
- ]
- }).present();
- }
- }
|