瀏覽代碼

all pagelist implemented

robert2206 8 年之前
父節點
當前提交
4379f3dba8

+ 41 - 2
src/app/app.component.ts

@@ -6,7 +6,10 @@ import { LoginPage } from "../pages/login/login";
 import { HomePage } from "../pages/home/home";
 import { CustomersPage } from "../pages/customers/customers";
 import { ProductsPage } from "../pages/products/products";
+import { VariantsPage } from "../pages/variants/variants";
 import { OrdersPage } from "../pages/orders/orders";
+import { LeadsPage } from "../pages/leads/leads"; 
+import { PhonecallsPage } from "../pages/phonecalls/phonecalls";
 import { ToolsPage } from "../pages/tools/tools";
 import { AboutPage } from "../pages/about/about";
 
@@ -48,7 +51,7 @@ export class MyApp {
                     {
                         visible: true,
                         title: "Ventas",
-                        icon: "basket",
+                        icon: "cart",
                         component: OrdersPage,
                         params: {
                             filters: [["state", "!=", "draft"]]
@@ -60,6 +63,42 @@ export class MyApp {
                         icon: "cube",
                         component: ProductsPage
                     },
+                    {
+                        visible: true,
+                        title: 'Variantes',
+                        icon: "list-box",
+                        component: VariantsPage
+                    },
+                ]
+            },
+            {
+                visible: true,
+                title: "CRM",
+                pages: [
+                    {
+                        visible: true,
+                        title: 'Iniciativas',
+                        icon: "flag",
+                        component: LeadsPage,
+                        params: {
+                            filters: [["type", "=", "lead"]]
+                        }
+                    },
+                    {
+                        visible: true,
+                        title: "Oportunidades",
+                        icon: "bonfire",
+                        component: LeadsPage,
+                        params: {
+                            filters: [["type", "=", "opportunity"]]
+                        }
+                    },
+                    {
+                        visible: true,
+                        title: "Llamadas",
+                        icon: "call",
+                        component: PhonecallsPage
+                    }
                 ]
             },
             {
@@ -97,6 +136,6 @@ export class MyApp {
      *
      */
     openPage(page) {
-        this.nav.setRoot(page.component, page.params);
+        this.nav.setRoot(page.component, page);
     }
 }

+ 9 - 0
src/app/app.module.ts

@@ -13,7 +13,10 @@ import { LoginPage } from "../pages/login/login";
 import { HomePage } from "../pages/home/home";
 import { CustomersPage } from "../pages/customers/customers";
 import { ProductsPage } from "../pages/products/products";
+import { VariantsPage } from "../pages/variants/variants";
 import { OrdersPage } from "../pages/orders/orders";
+import { LeadsPage } from "../pages/leads/leads";
+import { PhonecallsPage } from "../pages/phonecalls/phonecalls";
 import { ToolsPage } from "../pages/tools/tools";
 import { AboutPage } from "../pages/about/about";
 
@@ -39,7 +42,10 @@ import { DoubleTap } from "../directives/double-tap";
         HomePage,
         CustomersPage,
         ProductsPage,
+        VariantsPage,
         OrdersPage,
+        LeadsPage,
+        PhonecallsPage,
         ToolsPage,
         AboutPage,
         // Components
@@ -63,7 +69,10 @@ import { DoubleTap } from "../directives/double-tap";
         HomePage,
         CustomersPage,
         ProductsPage,
+        VariantsPage,
         OrdersPage,
+        LeadsPage,
+        PhonecallsPage,
         ToolsPage,
         AboutPage
     ],

+ 17 - 0
src/base/base-view.ts

@@ -6,11 +6,13 @@ export class BaseView<T> {
     type: T = {} as T;
     model: any = {};
     injector: any = {};
+    title: string;
 
     constructor(c: { new (): T; }, ...injectables: any[]) {
         this.type = new c();
         this.model = getMetadataStorage().models.filterByTarget(this.type.constructor).items.shift();
         this.injector = ReflectiveInjector.resolveAndCreate(injectables);
+        this.title = "Sin título";
     }
 
     /**
@@ -21,6 +23,21 @@ export class BaseView<T> {
         return this.injector.get(injectable);
     }
 
+    /**
+     * 
+     */
+    getTitle(): string {
+        return this.title;
+    }
+
+    /**
+     * 
+     * @param title 
+     */
+    setTitle(title: string): void {
+        this.title = title;
+    }
+
     /**
      * 
      */

+ 1 - 0
src/odoo/utils/import-models.ts

@@ -33,6 +33,7 @@ export function importModels(): void {
         CaseStage,
         Currency,
         Lead,
+        Partner,
         Phonecall,
         PriceList,
         ProductTemplate,

+ 32 - 0
src/pages/leads/leads.html

@@ -0,0 +1,32 @@
+<ion-header>
+    <ion-navbar>
+        <button ion-button menuToggle>
+            <ion-icon name="menu"></ion-icon>
+        </button>
+        <ion-title>{{ getTitle() }}</ion-title>
+    </ion-navbar>
+</ion-header>
+<ion-content>
+   <ion-list [virtualScroll]="getItems()" approxItemHeight="35px">
+		<ion-item *virtualItem="let item">
+			<h2>{{ item.contact_name }}</h2>
+            <p>{{ item.name }}</p>
+            <p>
+                <strong>Probabilidad:</strong>
+                {{ item.probability }}
+            </p>
+            <p>
+                <strong>Celular:</strong>
+                {{ item.mobile }}
+            </p>
+            <p>
+                <strong>Teléfono:</strong>
+                {{ item.phone }}
+            </p>
+            <p>
+                <strong>Dirección:</strong>
+                {{ item.street }}
+            </p>
+		</ion-item>
+	</ion-list>
+</ion-content>

+ 3 - 0
src/pages/leads/leads.scss

@@ -0,0 +1,3 @@
+page-leads {
+
+}

+ 26 - 0
src/pages/leads/leads.ts

@@ -0,0 +1,26 @@
+import { Component } from '@angular/core';
+import { NavController, NavParams } from 'ionic-angular';
+
+import { BaseListView } from "../../base/base-list-view";
+import { Lead } from "../../odoo/models/crm.lead";
+
+@Component({
+    selector: 'page-leads',
+    templateUrl: 'leads.html'
+})
+export class LeadsPage extends BaseListView<Lead> {
+
+    constructor(
+        public navCtrl: NavController,
+        public navParams: NavParams
+    ) { 
+        super(Lead);
+
+        this.setTitle(navParams.data.title);
+        this.setFilters(navParams.data.params.filters);
+    }
+
+    ionViewDidLoad() {
+        console.log('ionViewDidLoad LeadsPage');
+    }
+}

+ 1 - 12
src/pages/orders/orders.html

@@ -1,46 +1,35 @@
 <ion-header>
-
     <ion-navbar>
         <button ion-button menuToggle>
             <ion-icon name="menu"></ion-icon>
         </button>
-        
-        <ion-title>Presupuestos</ion-title>
+        <ion-title>{{ getTitle() }}</ion-title>
     </ion-navbar>
-
 </ion-header>
-
 <ion-content>
     <ion-list [virtualScroll]="getItems()" approxItemHeight="35px">
-
 		<ion-item *virtualItem="let item">
 			<h2>{{ item.name }}</h2>
-
             <p>
                 <strong>Cantidad:</strong>
                 {{ item.cart_quantity }}
             </p>
-
             <p>
                 <strong>Subtotal:</strong>
                 {{ item.amount_untaxed }}
             </p>
-            
             <p>
                 <strong>Impuestos:</strong>
                 {{ item.amount_tax }}
             </p>
-            
             <p>
                 <strong>Total:</strong>
                 {{ item.amount_total }}
             </p>
-
             <p>
                 <strong>Fecha:</strong>
                 {{ item.date_order }}
             </p>
 		</ion-item>
-
 	</ion-list>
 </ion-content>

+ 6 - 1
src/pages/orders/orders.ts

@@ -15,9 +15,14 @@ export class OrdersPage extends BaseListView<SaleOrder> {
         public navParams: NavParams
     ) { 
         super(SaleOrder);
-        // this.setFilters(navParams.data.filters);
+
+        this.setTitle(navParams.data.title);
+        this.setFilters(navParams.data.params.filters);
     }
 
+    /**
+     * 
+     */
     ionViewDidLoad() {
         console.log('ionViewDidLoad OrdersPage');
     }

+ 24 - 0
src/pages/phonecalls/phonecalls.html

@@ -0,0 +1,24 @@
+<ion-header>
+    <ion-navbar>
+        <button ion-button menuToggle>
+            <ion-icon name="menu"></ion-icon>
+        </button>
+        <ion-title>Llamadas</ion-title>
+    </ion-navbar>
+</ion-header>
+<ion-content>
+  <ion-list [virtualScroll]="getItems()" approxItemHeight="35px">
+		<ion-item *virtualItem="let item">
+			<h2>{{ item.date }}</h2>
+            <p>{{ item.name }}</p>
+            <p>
+                <strong>Celular:</strong>
+                {{ item.partner_mobile }}
+            </p>
+            <p>
+                <strong>Teléfono:</strong>
+                {{ item.partner_phone }}
+            </p>
+		</ion-item>
+	</ion-list>
+</ion-content>

+ 3 - 0
src/pages/phonecalls/phonecalls.scss

@@ -0,0 +1,3 @@
+page-phonecalls {
+
+}

+ 26 - 0
src/pages/phonecalls/phonecalls.ts

@@ -0,0 +1,26 @@
+import { Component } from '@angular/core';
+import { NavController, NavParams } from 'ionic-angular';
+
+import { BaseListView } from "../../base/base-list-view";
+import { Phonecall } from "../../odoo/models/crm.phonecall";
+
+@Component({
+    selector: 'page-phonecalls',
+    templateUrl: 'phonecalls.html'
+})
+export class PhonecallsPage extends BaseListView<Phonecall> {
+
+    constructor(
+        public navCtrl: NavController,
+        public navParams: NavParams
+    ) { 
+        super(Phonecall);
+    }
+
+    /**
+     * 
+     */
+    ionViewDidLoad() {
+        console.log('ionViewDidLoad PhonecallsPage');
+    }
+}

+ 0 - 5
src/pages/tools/tools.scss

@@ -3,9 +3,4 @@ page-tools {
     h2 {
         padding-top: 10px;
     }
-
-    p {
-        word-break: keep-all;
-        white-space: normal;
-    }
 }

+ 38 - 0
src/pages/variants/variants.html

@@ -0,0 +1,38 @@
+<ion-header>
+
+    <ion-navbar>
+
+        <button ion-button menuToggle>
+            <ion-icon name="menu"></ion-icon>
+        </button>
+
+        <ion-title>Variantes</ion-title>
+    </ion-navbar>
+
+</ion-header>
+
+
+<ion-content>
+    <ion-list [virtualScroll]="getItems()" approxItemHeight="35px">
+
+		<ion-item *virtualItem="let item">
+
+			<ion-thumbnail item-left>
+                <img src="./assets/images/product.png" *ngIf="!item.image_medium"/>
+				<img [src]="item.image_medium | sanitizeUrl" *ngIf="item.image_medium"/>
+			</ion-thumbnail>
+
+			<h2>{{ item.name }}</h2>
+			<p>
+				<strong>Precio:</strong>
+				{{ item.list_price }}
+			</p>
+            <p>
+				<strong>Cantidad:</strong>
+				{{ item.qty_available }}
+			</p>
+		</ion-item>
+
+	</ion-list>
+
+</ion-content>

+ 3 - 0
src/pages/variants/variants.scss

@@ -0,0 +1,3 @@
+page-variants {
+
+}

+ 24 - 0
src/pages/variants/variants.ts

@@ -0,0 +1,24 @@
+import { Component } from '@angular/core';
+import { NavController, NavParams } from 'ionic-angular';
+
+import { BaseListView } from "../../base/base-list-view";
+import { ProductProduct } from "../../odoo/models/product.product";
+
+@Component({
+    selector: 'page-variants',
+    templateUrl: 'variants.html'
+})
+export class VariantsPage extends BaseListView<ProductProduct> {
+
+    constructor(
+        public navCtrl: NavController,
+        public navParams: NavParams
+    ) { 
+        super(ProductProduct);
+    }
+
+    ionViewDidLoad() {
+        console.log('ionViewDidLoad VariantsPage');
+    }
+
+}

+ 4 - 0
src/theme/odoo.scss

@@ -0,0 +1,4 @@
+p {
+    word-break: keep-all;
+    white-space: normal;
+}

+ 1 - 0
src/theme/variables.scss

@@ -76,3 +76,4 @@ $colors: (
 
 @import "roboto";
 @import "noto-sans";
+@import "odoo";