From 66cca728aa77ec3fdb6888d29d52eaafbe72a691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81dler=20Neves?= Date: Sat, 20 May 2017 21:16:17 -0300 Subject: [PATCH] parcial --- .gitignore | 1 + runLocalhostSonar.sh | 2 +- sonar-project.properties | 2 +- src/app/app.component.ts | 18 +-- src/app/app.module.ts | 52 +++----- src/entities/Consulta.ts | 18 +++ src/entities/EntidadeAbstrata.ts | 7 + src/entities/Necessidade.ts | 22 ++++ src/entities/Planejamento.ts | 21 +++ src/entities/Produto.ts | 15 +++ src/entities/Supermercado.ts | 15 +++ src/entities/UnidadeMedida.ts | 11 ++ src/models/IDao.ts | 20 --- src/models/class/Item.spec.ts | 23 ---- src/models/class/Item.ts | 24 ---- src/models/class/List.spec.ts | 23 ---- src/models/class/List.ts | 17 --- src/models/class/ListItem.spec.ts | 23 ---- src/models/class/ListProduct.ts | 21 --- src/models/class/Market.spec.ts | 23 ---- src/models/class/Market.ts | 13 -- src/models/class/Product.spec.ts | 23 ---- src/models/class/Product.ts | 14 -- src/models/class/Survey.spec.ts | 23 ---- src/models/class/Survey.ts | 21 --- src/models/class/Unit.spec.ts | 23 ---- src/models/class/Unit.ts | 16 --- .../{home/home.html => inicio/main.html} | 0 .../{home/home.scss => inicio/main.scss} | 2 +- .../home.spec.ts => inicio/main.spec.ts} | 8 +- src/pages/{home/home.ts => inicio/main.ts} | 10 +- .../list-item-create-page.html | 34 ----- .../list-item-create-page.module.ts | 16 --- .../list-item-create-page.scss | 3 - .../list-item-create-page.spec.ts | 24 ---- .../list-item-create-page.ts | 82 ------------ .../list-item-list-page.html | 21 --- .../list-item-list-page.module.ts | 16 --- .../list-item-list-page.scss | 3 - .../list-item-list-page.spec.ts | 24 ---- .../list-item-list-page.ts | 114 ----------------- .../market-create-page.html | 24 ---- .../market-create-page.module.ts | 16 --- .../market-create-page.scss | 3 - .../market-create-page/market-create-page.ts | 72 ----------- .../market-list-page/market-list-page.html | 19 --- .../market-list-page.module.ts | 16 --- .../market-list-page/market-list-page.scss | 3 - .../market-list-page/market-list-page.spec.ts | 24 ---- .../market-list-page/market-list-page.ts | 113 ---------------- .../product-create-page.html | 24 ---- .../product-create-page.module.ts | 16 --- .../product-create-page.scss | 3 - .../product-create-page.ts | 72 ----------- .../product-list-page/product-list-page.html | 19 --- .../product-list-page.module.ts | 16 --- .../product-list-page/product-list-page.scss | 3 - .../product-list-page.spec.ts | 24 ---- .../product-list-page/product-list-page.ts | 115 ----------------- src/pages/unit/unit-create/unit-create.html | 28 ---- .../unit/unit-create/unit-create.module.ts | 16 --- src/pages/unit/unit-create/unit-create.scss | 3 - src/pages/unit/unit-create/unit-create.ts | 71 ---------- .../unit/unit-list-page/unit-list-page.html | 19 --- .../unit-list-page/unit-list-page.module.ts | 16 --- .../unit/unit-list-page/unit-list-page.scss | 3 - .../unit-list-page/unit-list-page.spec.ts | 24 ---- .../unit/unit-list-page/unit-list-page.ts | 121 ------------------ src/test.ts | 6 - 69 files changed, 143 insertions(+), 1594 deletions(-) create mode 100644 src/entities/Consulta.ts create mode 100644 src/entities/EntidadeAbstrata.ts create mode 100644 src/entities/Necessidade.ts create mode 100644 src/entities/Planejamento.ts create mode 100644 src/entities/Produto.ts create mode 100644 src/entities/Supermercado.ts create mode 100644 src/entities/UnidadeMedida.ts delete mode 100644 src/models/IDao.ts delete mode 100644 src/models/class/Item.spec.ts delete mode 100644 src/models/class/Item.ts delete mode 100644 src/models/class/List.spec.ts delete mode 100644 src/models/class/List.ts delete mode 100644 src/models/class/ListItem.spec.ts delete mode 100644 src/models/class/ListProduct.ts delete mode 100644 src/models/class/Market.spec.ts delete mode 100644 src/models/class/Market.ts delete mode 100644 src/models/class/Product.spec.ts delete mode 100644 src/models/class/Product.ts delete mode 100644 src/models/class/Survey.spec.ts delete mode 100644 src/models/class/Survey.ts delete mode 100644 src/models/class/Unit.spec.ts delete mode 100644 src/models/class/Unit.ts rename src/pages/{home/home.html => inicio/main.html} (100%) rename src/pages/{home/home.scss => inicio/main.scss} (93%) rename src/pages/{home/home.spec.ts => inicio/main.spec.ts} (72%) rename src/pages/{home/home.ts => inicio/main.ts} (51%) delete mode 100644 src/pages/listitem/list-item-create-page/list-item-create-page.html delete mode 100644 src/pages/listitem/list-item-create-page/list-item-create-page.module.ts delete mode 100644 src/pages/listitem/list-item-create-page/list-item-create-page.scss delete mode 100644 src/pages/listitem/list-item-create-page/list-item-create-page.spec.ts delete mode 100644 src/pages/listitem/list-item-create-page/list-item-create-page.ts delete mode 100644 src/pages/listitem/list-item-list-page/list-item-list-page.html delete mode 100644 src/pages/listitem/list-item-list-page/list-item-list-page.module.ts delete mode 100644 src/pages/listitem/list-item-list-page/list-item-list-page.scss delete mode 100644 src/pages/listitem/list-item-list-page/list-item-list-page.spec.ts delete mode 100644 src/pages/listitem/list-item-list-page/list-item-list-page.ts delete mode 100644 src/pages/market/market-create-page/market-create-page.html delete mode 100644 src/pages/market/market-create-page/market-create-page.module.ts delete mode 100644 src/pages/market/market-create-page/market-create-page.scss delete mode 100644 src/pages/market/market-create-page/market-create-page.ts delete mode 100644 src/pages/market/market-list-page/market-list-page.html delete mode 100644 src/pages/market/market-list-page/market-list-page.module.ts delete mode 100644 src/pages/market/market-list-page/market-list-page.scss delete mode 100644 src/pages/market/market-list-page/market-list-page.spec.ts delete mode 100644 src/pages/market/market-list-page/market-list-page.ts delete mode 100644 src/pages/product/product-create-page/product-create-page.html delete mode 100644 src/pages/product/product-create-page/product-create-page.module.ts delete mode 100644 src/pages/product/product-create-page/product-create-page.scss delete mode 100644 src/pages/product/product-create-page/product-create-page.ts delete mode 100644 src/pages/product/product-list-page/product-list-page.html delete mode 100644 src/pages/product/product-list-page/product-list-page.module.ts delete mode 100644 src/pages/product/product-list-page/product-list-page.scss delete mode 100644 src/pages/product/product-list-page/product-list-page.spec.ts delete mode 100644 src/pages/product/product-list-page/product-list-page.ts delete mode 100644 src/pages/unit/unit-create/unit-create.html delete mode 100644 src/pages/unit/unit-create/unit-create.module.ts delete mode 100644 src/pages/unit/unit-create/unit-create.scss delete mode 100644 src/pages/unit/unit-create/unit-create.ts delete mode 100644 src/pages/unit/unit-list-page/unit-list-page.html delete mode 100644 src/pages/unit/unit-list-page/unit-list-page.module.ts delete mode 100644 src/pages/unit/unit-list-page/unit-list-page.scss delete mode 100644 src/pages/unit/unit-list-page/unit-list-page.spec.ts delete mode 100644 src/pages/unit/unit-list-page/unit-list-page.ts diff --git a/.gitignore b/.gitignore index c30fd75..d46f669 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ npm-debug.log* .tmp/ .versions/ .scannerwork/ +.toDelete/ coverage/ dist/ node_modules/ diff --git a/runLocalhostSonar.sh b/runLocalhostSonar.sh index b340014..56481c0 100644 --- a/runLocalhostSonar.sh +++ b/runLocalhostSonar.sh @@ -1,5 +1,5 @@ #!/bin/bash ~/tocompile/sonarqube/bin/linux-x86-64/sonar.sh start -~/tocompile/sonar-scanner/bin/sonar-scanner -Dsonar.language=ts -Dsonar.sources=src -Dsonar.projectKey=EconoCart_v2 +~/tocompile/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=http://127.0.0.1:9000 diff --git a/sonar-project.properties b/sonar-project.properties index 45973fe..84b07c7 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,6 +3,6 @@ sonar.projectName = EconoCart sonar.host.url=https://sonarqube.adlerneves.com.br/ sonar.projectVersion = 1 sonar.sources = src +sonar.language = ts sonar.exclusions = **/node_modules/**,**/*.spec.ts -sonar.language=ts sonar.ts.coverage.lcovReportPath=coverage/lcov.info diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3a930d8..ed9b667 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,13 +3,7 @@ import { Nav, Platform } from 'ionic-angular'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; - -import { HomePage } from '../pages/home/home'; -import { UnitListPage } from "../pages/unit/unit-list-page/unit-list-page"; -import { StartService } from "../providers/start/start-service.service"; -import { ProductListPage } from "../pages/product/product-list-page/product-list-page"; -import { MarketListPage } from "../pages/market/market-list-page/market-list-page"; -import { ListItemListPage } from "../pages/listitem/list-item-list-page/list-item-list-page"; +import { PageInicio } from '../pages/inicio/main'; @Component({ templateUrl: 'app.html' @@ -17,20 +11,21 @@ import { ListItemListPage } from "../pages/listitem/list-item-list-page/list-ite export class MyApp { @ViewChild(Nav) nav: Nav; - rootPage: any = HomePage; + rootPage: any = PageInicio; pages: Array<{ title: string, component: any }>; - constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private _starter: StartService) { + constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) { this.initializeApp(); // used for an example of ngFor and navigation this.pages = [ + /* { title: 'Lista de Itens', component: ListItemListPage }, { title: 'Supermercados', component: MarketListPage }, { title: 'Produtos', component: ProductListPage }, { title: 'Unidades', component: UnitListPage } - + */ ]; } @@ -41,7 +36,6 @@ export class MyApp { // Here you can do any higher level native things you might need. this.statusBar.styleDefault(); this.splashScreen.hide(); - this._starter.start(); }); } @@ -51,6 +45,6 @@ export class MyApp { this.nav.setRoot(page.component); } btnOpenHome(){ - this.openPage({component:HomePage}) + this.openPage({component:PageInicio}) } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9ccc84f..a1ae988 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,52 +2,32 @@ import { BrowserModule } from '@angular/platform-browser'; import { ErrorHandler, NgModule } from '@angular/core'; import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; import { MyApp } from './app.component'; -import { HomePage } from '../pages/home/home'; +import { PageInicio } from '../pages/inicio/main'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic-native/splash-screen'; -import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet'; +import { ActionSheet } from '@ionic-native/action-sheet'; import { Toast } from "@ionic-native/toast"; import { HttpModule } from '@angular/http'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/toPromise'; -import { UnitCreateModule } from "../pages/unit/unit-create/unit-create.module"; - -import { UnitListPageModule } from "../pages/unit/unit-list-page/unit-list-page.module"; - - - import { SQLite } from "@ionic-native/sqlite"; import { SQLjsObject, SQLjs } from "../providers/SQLjsDriver/SQLjs.service"; -import { DaoUnit } from "../providers/dao/dao-unit.service"; -import { StartService } from "../providers/start/start-service.service"; -import { DaoProduct } from "../providers/dao/dao-product.service"; -import { ProductCreatePageModule } from "../pages/product/product-create-page/product-create-page.module"; -import { ProductListPageModule } from "../pages/product/product-list-page/product-list-page.module"; -import { MarketListPage } from "../pages/market/market-list-page/market-list-page"; -import { MarketCreatePage } from "../pages/market/market-create-page/market-create-page"; -import { MarketCreatePageModule } from "../pages/market/market-create-page/market-create-page.module"; -import { MarketListPageModule } from "../pages/market/market-list-page/market-list-page.module"; -import { DaoMarket } from "../providers/dao/dao-market.service"; -import { ListItemListPageModule } from "../pages/listitem/list-item-list-page/list-item-list-page.module"; -import { DaoListItem } from "../providers/dao/dao-listitem.service"; -import { ListItemCreatePageModule } from "../pages/listitem/list-item-create-page/list-item-create-page.module"; - @NgModule({ - declarations: [ - MyApp, HomePage, - ], - imports: [ - BrowserModule, IonicModule.forRoot(MyApp), UnitListPageModule, HttpModule, ListItemListPageModule,ListItemCreatePageModule, - UnitCreateModule, ProductListPageModule, ProductCreatePageModule, MarketListPageModule, MarketCreatePageModule - ], - bootstrap: [IonicApp], - entryComponents: [ - MyApp, HomePage,], - providers: [ - StatusBar, SplashScreen, ActionSheet, DaoUnit, StartService, SQLite, Toast, DaoProduct, DaoMarket, DaoListItem, SQLjs, SQLjsObject, - { provide: ErrorHandler, useClass: IonicErrorHandler } - ] + declarations: [ + MyApp, PageInicio, + ], + imports: [ + BrowserModule, IonicModule.forRoot(MyApp), HttpModule + ], + bootstrap: [IonicApp], + entryComponents: [ + MyApp, PageInicio, + ], + providers: [ + StatusBar, SplashScreen, ActionSheet, SQLite, Toast, SQLjs, SQLjsObject, + { provide: ErrorHandler, useClass: IonicErrorHandler } + ] }) export class AppModule { } diff --git a/src/entities/Consulta.ts b/src/entities/Consulta.ts new file mode 100644 index 0000000..239dad7 --- /dev/null +++ b/src/entities/Consulta.ts @@ -0,0 +1,18 @@ +import { Column, ManyToOne } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { Necessidade } from "./Necessidade"; +import { Supermercado } from "./Supermercado"; + +export class Consulta extends EntidadeAbstrata { + @Column() + modificacao: Date; + + @Column('float') + preco: number; + + @ManyToOne(type => Necessidade, other => other.consultas) + necessidade: Necessidade; + + @ManyToOne(type => Supermercado, other => other.consultas) + supermercado: Supermercado; +} diff --git a/src/entities/EntidadeAbstrata.ts b/src/entities/EntidadeAbstrata.ts new file mode 100644 index 0000000..e247441 --- /dev/null +++ b/src/entities/EntidadeAbstrata.ts @@ -0,0 +1,7 @@ +import {Entity, PrimaryGeneratedColumn} from "typeorm"; + +@Entity() +export abstract class EntidadeAbstrata { + @PrimaryGeneratedColumn() + id: number; +} diff --git a/src/entities/Necessidade.ts b/src/entities/Necessidade.ts new file mode 100644 index 0000000..9d308b5 --- /dev/null +++ b/src/entities/Necessidade.ts @@ -0,0 +1,22 @@ +import { Column, ManyToOne, OneToMany } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { Produto } from "./Produto"; +import { Consulta } from "./Consulta"; +import { Planejamento } from "./Planejamento"; + +export class Necessidade extends EntidadeAbstrata { + @Column('float') + quantidade: number; + + @Column() + satisfeita: boolean; + + @OneToMany(type => Produto, other => other.necessidade) + produtos: Produto[]; + + @OneToMany(type => Consulta, other => other.necessidade) + consultas: Consulta[]; + + @ManyToOne(type => Planejamento, other => other.necessidades) + planejamento: Planejamento; +} diff --git a/src/entities/Planejamento.ts b/src/entities/Planejamento.ts new file mode 100644 index 0000000..c8e04df --- /dev/null +++ b/src/entities/Planejamento.ts @@ -0,0 +1,21 @@ +import { Column, ManyToMany, OneToMany } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { Necessidade } from "./Necessidade"; +import { Supermercado } from "./Supermercado"; + +export class Planejamento extends EntidadeAbstrata { + @Column() + nome: string; + + @Column() + criacao: Date; + + @Column() + modificacao: Date; + + @OneToMany(type => Necessidade, other => other.planejamento) + necessidades: Necessidade[]; + + @ManyToMany(type => Supermercado, other => other.planejamentos) + supermercados: Supermercado[]; +} diff --git a/src/entities/Produto.ts b/src/entities/Produto.ts new file mode 100644 index 0000000..8115c0b --- /dev/null +++ b/src/entities/Produto.ts @@ -0,0 +1,15 @@ +import { Column, ManyToOne } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { UnidadeMedida } from "./UnidadeMedida"; +import { Necessidade } from "./Necessidade"; + +export class Produto extends EntidadeAbstrata { + @Column() + nome: string; + + @ManyToOne(type => UnidadeMedida, other => other.produtos) + unidadeMedida: UnidadeMedida; + + @ManyToOne(type => Necessidade, other => other.produtos) + necessidade: Necessidade; +} diff --git a/src/entities/Supermercado.ts b/src/entities/Supermercado.ts new file mode 100644 index 0000000..11f9559 --- /dev/null +++ b/src/entities/Supermercado.ts @@ -0,0 +1,15 @@ +import { Column, ManyToMany, OneToMany } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { Planejamento } from "./Planejamento"; +import { Consulta } from "./Consulta"; + +export class Supermercado extends EntidadeAbstrata { + @Column() + nome: string; + + @ManyToMany(type => Planejamento, other => other.supermercados) + planejamentos: Planejamento[]; + + @OneToMany(type => Consulta, other => other.supermercado) + consultas: Consulta[]; +} diff --git a/src/entities/UnidadeMedida.ts b/src/entities/UnidadeMedida.ts new file mode 100644 index 0000000..270c2c8 --- /dev/null +++ b/src/entities/UnidadeMedida.ts @@ -0,0 +1,11 @@ +import { Column, OneToMany } from "typeorm"; +import { EntidadeAbstrata } from "./EntidadeAbstrata"; +import { Produto } from "./Produto"; + +export class UnidadeMedida extends EntidadeAbstrata { + @Column() + nome: string; + + @OneToMany(type => Produto, other => other.unidadeMedida) + produtos: Produto[]; +} diff --git a/src/models/IDao.ts b/src/models/IDao.ts deleted file mode 100644 index afc2e5f..0000000 --- a/src/models/IDao.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { SQLiteObject } from '@ionic-native/sqlite'; - -export interface IDao { - - - db: SQLiteObject; - setDatabase(db: SQLiteObject); - - create(element: any); - - createTable(); - - delete(element: any) - - getAll(elements: any); - - update(element: any); - -} - diff --git a/src/models/class/Item.spec.ts b/src/models/class/Item.spec.ts deleted file mode 100644 index e57a46f..0000000 --- a/src/models/class/Item.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { Item } from './Item'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: Item', () => { - - beforeEach(async(() => { - instance = new Item(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/Item.ts b/src/models/class/Item.ts deleted file mode 100644 index 02c2730..0000000 --- a/src/models/class/Item.ts +++ /dev/null @@ -1,24 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from "typeorm"; -import { Product } from "./Product"; -import { Unit } from "./Unit"; - -@Entity() -export class Item { - - @PrimaryGeneratedColumn() - id: number; - - @ManyToOne(type => Product, product => product.items) - product: Product; - - @ManyToOne(type => Unit, unit => unit.items) - unit: Unit; - - @Column("real") - amount: number; - - @Column("real") - price: number; - -} diff --git a/src/models/class/List.spec.ts b/src/models/class/List.spec.ts deleted file mode 100644 index 3c22944..0000000 --- a/src/models/class/List.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { List } from './List'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: List', () => { - - beforeEach(async(() => { - instance = new List(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/List.ts b/src/models/class/List.ts deleted file mode 100644 index f79a582..0000000 --- a/src/models/class/List.ts +++ /dev/null @@ -1,17 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from "typeorm"; -import { Survey } from "./Survey"; - -@Entity() -export class List { - - @PrimaryGeneratedColumn() - id: number; - - @Column() - date: Date; - - @OneToMany(type => Survey, survey => survey.list) - surveys: Survey[]; - -} diff --git a/src/models/class/ListItem.spec.ts b/src/models/class/ListItem.spec.ts deleted file mode 100644 index fc12d47..0000000 --- a/src/models/class/ListItem.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { ListItem } from './ListItem'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: ListItem', () => { - - beforeEach(async(() => { - instance = new ListItem(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/ListProduct.ts b/src/models/class/ListProduct.ts deleted file mode 100644 index 46f609c..0000000 --- a/src/models/class/ListProduct.ts +++ /dev/null @@ -1,21 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from "typeorm"; -import { Product } from "./Product"; - - -@Entity() -export class ListProduct { - - @PrimaryGeneratedColumn() - id: number; - - @Column() - name: string; - - @Column("text") - description: string; - - @OneToMany(type => Product, product => product.listItem) - products: Product[]; - -} diff --git a/src/models/class/Market.spec.ts b/src/models/class/Market.spec.ts deleted file mode 100644 index 432b25a..0000000 --- a/src/models/class/Market.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { Market } from './Market'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: Market', () => { - - beforeEach(async(() => { - instance = new Market(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/Market.ts b/src/models/class/Market.ts deleted file mode 100644 index 1dfc554..0000000 --- a/src/models/class/Market.ts +++ /dev/null @@ -1,13 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from "typeorm"; - -@Entity() -export class Market { - - @PrimaryGeneratedColumn() - id: number; - - @Column() - name: string; - -} diff --git a/src/models/class/Product.spec.ts b/src/models/class/Product.spec.ts deleted file mode 100644 index 189be40..0000000 --- a/src/models/class/Product.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { Product } from './Product'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: Product', () => { - - beforeEach(async(() => { - instance = new Product(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/Product.ts b/src/models/class/Product.ts deleted file mode 100644 index c3078b4..0000000 --- a/src/models/class/Product.ts +++ /dev/null @@ -1,14 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from "typeorm"; - -@Entity() -export class Product { - - @PrimaryGeneratedColumn() - id: number; - - @Column() - name: string; - - items: Item; -} diff --git a/src/models/class/Survey.spec.ts b/src/models/class/Survey.spec.ts deleted file mode 100644 index 24bf028..0000000 --- a/src/models/class/Survey.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { Survey } from './Survey'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: Survey', () => { - - beforeEach(async(() => { - instance = new Survey(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/Survey.ts b/src/models/class/Survey.ts deleted file mode 100644 index 8314e57..0000000 --- a/src/models/class/Survey.ts +++ /dev/null @@ -1,21 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne } from "typeorm"; -import { Item } from "./Item"; -import { Market } from "./Market"; - -@Entity() -export class Survey { - - @PrimaryGeneratedColumn() - id: number; - - @Column('text') - description: string; - - @OneToMany(type => Item , item => item.survey) - items: Item[]; - - @ManyToOne(type => Market, market => market.surveys) - market: Market; - -} diff --git a/src/models/class/Unit.spec.ts b/src/models/class/Unit.spec.ts deleted file mode 100644 index f2182e3..0000000 --- a/src/models/class/Unit.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../test'; -import { Unit } from './Unit'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Model: Unit', () => { - - beforeEach(async(() => { - instance = new Unit(); - })); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/models/class/Unit.ts b/src/models/class/Unit.ts deleted file mode 100644 index b5247e8..0000000 --- a/src/models/class/Unit.ts +++ /dev/null @@ -1,16 +0,0 @@ -import 'rxjs/add/operator/map'; -import { Entity, Column, PrimaryGeneratedColumn, OneToMany, ManyToOne } from "typeorm"; - -@Entity() -export class Unit { - - @PrimaryGeneratedColumn() - id: number; - - @Column() - description: string; - - @Column() - initials: string; - -} diff --git a/src/pages/home/home.html b/src/pages/inicio/main.html similarity index 100% rename from src/pages/home/home.html rename to src/pages/inicio/main.html diff --git a/src/pages/home/home.scss b/src/pages/inicio/main.scss similarity index 93% rename from src/pages/home/home.scss rename to src/pages/inicio/main.scss index 0c0b135..c7ca992 100644 --- a/src/pages/home/home.scss +++ b/src/pages/inicio/main.scss @@ -1,4 +1,4 @@ -page-home { +page-inicio { .btnhome { padding:5%; margin-top:20%; diff --git a/src/pages/home/home.spec.ts b/src/pages/inicio/main.spec.ts similarity index 72% rename from src/pages/home/home.spec.ts rename to src/pages/inicio/main.spec.ts index 49b2c87..55e773b 100644 --- a/src/pages/home/home.spec.ts +++ b/src/pages/inicio/main.spec.ts @@ -1,8 +1,8 @@ import { ComponentFixture, async } from '@angular/core/testing'; import { TestUtils } from '../../test'; -import { HomePage } from './home'; +import { PageInicio } from './main'; -let fixture: ComponentFixture = null; +let fixture: ComponentFixture = null; let instance: any = null; declare var describe: any; @@ -10,9 +10,9 @@ declare var it: any; declare var expect: any; declare var beforeEach: any; -describe('Pages: HomePage', () => { +describe('Pages: PageInicio', () => { - beforeEach(async(() => TestUtils.beforeEachCompiler([HomePage]).then(compiled => { + beforeEach(async(() => TestUtils.beforeEachCompiler([PageInicio]).then(compiled => { fixture = compiled.fixture; instance = compiled.instance; }))); diff --git a/src/pages/home/home.ts b/src/pages/inicio/main.ts similarity index 51% rename from src/pages/home/home.ts rename to src/pages/inicio/main.ts index faeef47..e36a648 100644 --- a/src/pages/home/home.ts +++ b/src/pages/inicio/main.ts @@ -1,13 +1,11 @@ import { Component, ViewChild } from '@angular/core'; import { NavController , Nav} from 'ionic-angular'; -import { ListItemListPage } from "../listitem/list-item-list-page/list-item-list-page"; - @Component({ - selector: 'page-home', - templateUrl: 'home.html' + selector: 'page-inicio', + templateUrl: 'main.html' }) -export class HomePage { +export class PageInicio { @ViewChild(Nav) nav: Nav; @@ -16,7 +14,7 @@ export class HomePage { } openPage() { - return this.navCtrl.setRoot(ListItemListPage); + return this.navCtrl.setRoot(PageInicio); } } diff --git a/src/pages/listitem/list-item-create-page/list-item-create-page.html b/src/pages/listitem/list-item-create-page/list-item-create-page.html deleted file mode 100644 index 2adb705..0000000 --- a/src/pages/listitem/list-item-create-page/list-item-create-page.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - Cadastrar Lista de Itens - - - - - - - - - Nome da Lista - - - - Produtos - - {{product.sName}} - - - - Descrição da Lista - - - - - \ No newline at end of file diff --git a/src/pages/listitem/list-item-create-page/list-item-create-page.module.ts b/src/pages/listitem/list-item-create-page/list-item-create-page.module.ts deleted file mode 100644 index 56ad628..0000000 --- a/src/pages/listitem/list-item-create-page/list-item-create-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { ListItemCreatePage } from './list-item-create-page'; - -@NgModule({ - declarations: [ - ListItemCreatePage, - ], - imports: [ - IonicPageModule.forChild(ListItemCreatePage), - ], - exports: [ - ListItemCreatePage - ] -}) -export class ListItemCreatePageModule {} diff --git a/src/pages/listitem/list-item-create-page/list-item-create-page.scss b/src/pages/listitem/list-item-create-page/list-item-create-page.scss deleted file mode 100644 index b0689c7..0000000 --- a/src/pages/listitem/list-item-create-page/list-item-create-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-list-item-create-page { - -} diff --git a/src/pages/listitem/list-item-create-page/list-item-create-page.spec.ts b/src/pages/listitem/list-item-create-page/list-item-create-page.spec.ts deleted file mode 100644 index 9b6dbf7..0000000 --- a/src/pages/listitem/list-item-create-page/list-item-create-page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../../test'; -import { ListItemCreatePage } from './list-item-create-page'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Pages: ListItemCreatePage', () => { - - beforeEach(async(() => TestUtils.beforeEachCompiler([ListItemCreatePage]).then(compiled => { - fixture = compiled.fixture; - instance = compiled.instance; - }))); - /* - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - */ -}); diff --git a/src/pages/listitem/list-item-create-page/list-item-create-page.ts b/src/pages/listitem/list-item-create-page/list-item-create-page.ts deleted file mode 100644 index 6d95d75..0000000 --- a/src/pages/listitem/list-item-create-page/list-item-create-page.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Component } from '@angular/core'; -import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular'; -import { ListItem } from "../../../models/class/ListItem"; -import { DaoListItem } from "../../../providers/dao/dao-listitem.service"; -import { Toast } from "@ionic-native/toast"; -import { ListItemListPage } from "../list-item-list-page/list-item-list-page"; -import { Product } from "../../../models/class/Product"; -import { DaoProduct } from "../../../providers/dao/dao-product.service"; - -/** - * Generated class for the ListItemCreatePage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-list-item-create-page', - templateUrl: 'list-item-create-page.html', -}) -export class ListItemCreatePage { - _listItem: ListItem; - _listProducts: Product[]; - constructor(public navCtrl: NavController, public navParams: NavParams, - public alert: AlertController, private _daoListItem: DaoListItem, private _daoProduct: DaoProduct, - private _toast: Toast) { - this._listItem = navParams.get("parametro") || new ListItem(); - this._listItem.iListProduct = []; - this._daoProduct.getAll().then((produtos) => { - this._listProducts = produtos; - }); - } - - - salvar() { - if ((typeof (this._listItem.sName) !== 'undefined') && (this._listItem.iListProduct.length > 0)) { - if (this._listItem.nId > 0) { - this._daoListItem.update(this._listItem).then((data) => { - console.log("expected => " + data); - if (data) { - - this._toast.show("Lista de Itens editada com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - this.navCtrl.setRoot(ListItemListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } else { - this._daoListItem.create(this._listItem).then((data) => { - console.log("expected => " + data); - if (data) { - this._listItem.nId = data.insertId; - this._daoListItem.createAux(this._listItem); - this.navCtrl.setRoot(ListItemListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } - this.navCtrl.setRoot(ListItemListPage); - } else { - let confirm = this.alert.create({ - title: "Ops...", - subTitle: "Por favor verifique se a lista tem um nome ou se você escolheu algum produto.", - buttons: [ - { - text: "OK", - handler: () => { - } - } - ] - }); - confirm.present(); - } - } - - -} diff --git a/src/pages/listitem/list-item-list-page/list-item-list-page.html b/src/pages/listitem/list-item-list-page/list-item-list-page.html deleted file mode 100644 index ca6b302..0000000 --- a/src/pages/listitem/list-item-list-page/list-item-list-page.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - Lista de Itens - - - - - - - {{list.sName}} - - - - - - \ No newline at end of file diff --git a/src/pages/listitem/list-item-list-page/list-item-list-page.module.ts b/src/pages/listitem/list-item-list-page/list-item-list-page.module.ts deleted file mode 100644 index 4aff600..0000000 --- a/src/pages/listitem/list-item-list-page/list-item-list-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { ListItemListPage } from './list-item-list-page'; - -@NgModule({ - declarations: [ - ListItemListPage, - ], - imports: [ - IonicPageModule.forChild(ListItemListPage), - ], - exports: [ - ListItemListPage - ] -}) -export class ListItemListPageModule {} diff --git a/src/pages/listitem/list-item-list-page/list-item-list-page.scss b/src/pages/listitem/list-item-list-page/list-item-list-page.scss deleted file mode 100644 index 13e12e3..0000000 --- a/src/pages/listitem/list-item-list-page/list-item-list-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-list-item-list-page { - -} diff --git a/src/pages/listitem/list-item-list-page/list-item-list-page.spec.ts b/src/pages/listitem/list-item-list-page/list-item-list-page.spec.ts deleted file mode 100644 index 99d505a..0000000 --- a/src/pages/listitem/list-item-list-page/list-item-list-page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../../test'; -import { ListItemListPage } from './list-item-list-page'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Pages: ListItemListPage', () => { - - beforeEach(async(() => TestUtils.beforeEachCompiler([ListItemListPage]).then(compiled => { - fixture = compiled.fixture; - instance = compiled.instance; - }))); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/pages/listitem/list-item-list-page/list-item-list-page.ts b/src/pages/listitem/list-item-list-page/list-item-list-page.ts deleted file mode 100644 index 01ca44a..0000000 --- a/src/pages/listitem/list-item-list-page/list-item-list-page.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { IonicPage, NavController, NavParams, ActionSheetController, AlertController } from 'ionic-angular'; -import { ListItem } from "../../../models/class/ListItem"; -import { Toast } from "@ionic-native/toast"; -import { DaoListItem } from "../../../providers/dao/dao-listitem.service"; -import { ListItemCreatePage } from "../list-item-create-page/list-item-create-page"; - -/** - * Generated class for the ListItemListPage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-list-item-list-page', - templateUrl: 'list-item-list-page.html', -}) -export class ListItemListPage implements OnInit { - - ngOnInit(): void { - this.getAllListItem(); - } - - _listItem: ListItem[] = []; - - constructor(public navCtrl: NavController, public navParams: NavParams, public alert: AlertController, - private _daoListItem: DaoListItem, public actionSheetCtrl: ActionSheetController, - private _toast: Toast) { - } - - insert() { - this.navCtrl.push(ListItemCreatePage); - } - - ionViewDidLoad() { - - } - - - getAllListItem() { - this._daoListItem.getAll() - .then(listItem => { - this._listItem = listItem; - }) - .catch(error => { - console.error(error); - }); - } - - options(listItem: ListItem) { - let actionSheet = this.actionSheetCtrl.create({ - title: 'Escolha uma das opções abaixo:', - buttons: [ - { - text: 'Deletar', - role: 'destructive', - icon: 'trash', - handler: () => { - let confirm = this.alert.create({ - title: "Excluir", - subTitle: "Gostaria de realmente excluir a Lista de Itens " + listItem.sName + "?", - buttons: [ - { - text: "Sim", - handler: () => { - let index = this._listItem.indexOf(listItem); - this._daoListItem.delete(listItem) - .then(response => { - console.log(response); - this._daoListItem.deleteAux(listItem); - this._listItem.splice(index, 1); - this._toast.show("Lista de Itens excluído com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - }) - .catch(error => { - console.error(error); - }) - - } - }, - { - text: "Não" - } - ] - }); - confirm.present(); - } - }, - /* { - text: 'Editar', - role: 'edit', - icon: 'create', - handler: () => { - this.navCtrl.push(ListItemCreatePage, { parametro: listItem }); - } - },*/ - { - text: 'Cancelar', - role: 'cancel', - icon: 'close', - handler: () => { - - } - } - ] - }); - - actionSheet.present(); - } -} diff --git a/src/pages/market/market-create-page/market-create-page.html b/src/pages/market/market-create-page/market-create-page.html deleted file mode 100644 index 43c481b..0000000 --- a/src/pages/market/market-create-page/market-create-page.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Cadastrar Supermercado - - - - - - - - - Nome do Supermercado - - - - - \ No newline at end of file diff --git a/src/pages/market/market-create-page/market-create-page.module.ts b/src/pages/market/market-create-page/market-create-page.module.ts deleted file mode 100644 index ca862d0..0000000 --- a/src/pages/market/market-create-page/market-create-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { MarketCreatePage } from './market-create-page'; - -@NgModule({ - declarations: [ - MarketCreatePage, - ], - imports: [ - IonicPageModule.forChild(MarketCreatePage), - ], - exports: [ - MarketCreatePage - ] -}) -export class MarketCreatePageModule {} diff --git a/src/pages/market/market-create-page/market-create-page.scss b/src/pages/market/market-create-page/market-create-page.scss deleted file mode 100644 index 0801580..0000000 --- a/src/pages/market/market-create-page/market-create-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-market-create-page { - -} diff --git a/src/pages/market/market-create-page/market-create-page.ts b/src/pages/market/market-create-page/market-create-page.ts deleted file mode 100644 index ec63c69..0000000 --- a/src/pages/market/market-create-page/market-create-page.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component } from '@angular/core'; -import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular'; -import { Market } from "../../../models/class/Market"; -import { DaoMarket } from "../../../providers/dao/dao-market.service"; -import { Toast } from "@ionic-native/toast"; -import { MarketListPage } from "../market-list-page/market-list-page"; - -/** - * Generated class for the MarketCreatePage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-market-create-page', - templateUrl: 'market-create-page.html', -}) -export class MarketCreatePage { - _market: Market; - constructor(public navCtrl: NavController, public navParams: NavParams, - public alert: AlertController, private _daoMarket: DaoMarket, - private _toast: Toast) { - this._market = navParams.get("parametro") || new Market(); - } - ionViewDidLoad() { - console.log('ionViewDidLoad marketCreatePage'); - } - salvar() { - if ((typeof (this._market.sName) !== 'undefined')) { - if (this._market.nId > 0) { - this._daoMarket.update(this._market).then((data) => { - console.log("expected => " + data); - if (data) { - this._toast.show("Supermercado editado com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - this.navCtrl.setRoot(MarketListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } else { - this._daoMarket.create(this._market).then((data) => { - console.log("expected => " + data); - if (data) { - this.navCtrl.setRoot(MarketListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } - this.navCtrl.setRoot(MarketListPage); - } else { - let confirm = this.alert.create({ - title: "Ops...", - subTitle: "Por favor coloque um nome para o Supermercado.", - buttons: [ - { - text: "OK", - handler: () => { - } - } - ] - }); - confirm.present(); - } - } - -} diff --git a/src/pages/market/market-list-page/market-list-page.html b/src/pages/market/market-list-page/market-list-page.html deleted file mode 100644 index ba0156c..0000000 --- a/src/pages/market/market-list-page/market-list-page.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Lista de Supermercados - - - - - - - {{market.sName}} - - - - - - \ No newline at end of file diff --git a/src/pages/market/market-list-page/market-list-page.module.ts b/src/pages/market/market-list-page/market-list-page.module.ts deleted file mode 100644 index a3ddab9..0000000 --- a/src/pages/market/market-list-page/market-list-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { MarketListPage } from './market-list-page'; - -@NgModule({ - declarations: [ - MarketListPage, - ], - imports: [ - IonicPageModule.forChild(MarketListPage), - ], - exports: [ - MarketListPage - ] -}) -export class MarketListPageModule {} diff --git a/src/pages/market/market-list-page/market-list-page.scss b/src/pages/market/market-list-page/market-list-page.scss deleted file mode 100644 index 2b0fb4a..0000000 --- a/src/pages/market/market-list-page/market-list-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-market-list-page { - -} diff --git a/src/pages/market/market-list-page/market-list-page.spec.ts b/src/pages/market/market-list-page/market-list-page.spec.ts deleted file mode 100644 index b962708..0000000 --- a/src/pages/market/market-list-page/market-list-page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../../test'; -import { MarketListPage } from './market-list-page'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Pages: MarketListPage', () => { - - beforeEach(async(() => TestUtils.beforeEachCompiler([MarketListPage]).then(compiled => { - fixture = compiled.fixture; - instance = compiled.instance; - }))); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/pages/market/market-list-page/market-list-page.ts b/src/pages/market/market-list-page/market-list-page.ts deleted file mode 100644 index 96ee821..0000000 --- a/src/pages/market/market-list-page/market-list-page.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { IonicPage, NavController, NavParams, ActionSheetController, AlertController } from 'ionic-angular'; -import { Market } from "../../../models/class/Market"; -import { Toast } from "@ionic-native/toast"; -import { DaoMarket } from "../../../providers/dao/dao-market.service"; -import { MarketCreatePage } from "../market-create-page/market-create-page"; - -/** - * Generated class for the MarketListPage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-market-list-page', - templateUrl: 'market-list-page.html', -}) -export class MarketListPage implements OnInit { - - ngOnInit(): void { - this.getAllMarketts(); - } - - _markets: Market[] = []; - - constructor(public navCtrl: NavController, public navParams: NavParams, public alert: AlertController, - private _daoMarket: DaoMarket, public actionSheetCtrl: ActionSheetController, - private _toast: Toast) { - } - - insert() { - this.navCtrl.push(MarketCreatePage); - } - - ionViewDidLoad() { - - } - - - getAllMarketts() { - this._daoMarket.getAll() - .then(markets => { - this._markets = markets; - }) - .catch(error => { - console.error(error); - }); - } - - options(market: Market) { - let actionSheet = this.actionSheetCtrl.create({ - title: 'Escolha uma das opções abaixo:', - buttons: [ - { - text: 'Deletar', - role: 'destructive', - icon: 'trash', - handler: () => { - let confirm = this.alert.create({ - title: "Excluir", - subTitle: "Gostaria de realmente excluir o Supermercado " + market.sName + "?", - buttons: [ - { - text: "Sim", - handler: () => { - let index = this._markets.indexOf(market); - this._daoMarket.delete(market) - .then(response => { - console.log(response); - this._markets.splice(index, 1); - this._toast.show("Supermercado excluído com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - }) - .catch(error => { - console.error(error); - }) - - } - }, - { - text: "Não" - } - ] - }); - confirm.present(); - } - }, - { - text: 'Editar', - role: 'edit', - icon: 'create', - handler: () => { - this.navCtrl.push(MarketCreatePage, { parametro: market }); - } - }, - { - text: 'Cancelar', - role: 'cancel', - icon: 'close', - handler: () => { - - } - } - ] - }); - - actionSheet.present(); - } -} diff --git a/src/pages/product/product-create-page/product-create-page.html b/src/pages/product/product-create-page/product-create-page.html deleted file mode 100644 index 5508e68..0000000 --- a/src/pages/product/product-create-page/product-create-page.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Cadastrar Produto - - - - - - - - - Nome do Produto - - - - - \ No newline at end of file diff --git a/src/pages/product/product-create-page/product-create-page.module.ts b/src/pages/product/product-create-page/product-create-page.module.ts deleted file mode 100644 index 4b4ce95..0000000 --- a/src/pages/product/product-create-page/product-create-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { ProductCreatePage } from './product-create-page'; - -@NgModule({ - declarations: [ - ProductCreatePage, - ], - imports: [ - IonicPageModule.forChild(ProductCreatePage), - ], - exports: [ - ProductCreatePage - ] -}) -export class ProductCreatePageModule {} diff --git a/src/pages/product/product-create-page/product-create-page.scss b/src/pages/product/product-create-page/product-create-page.scss deleted file mode 100644 index 6740992..0000000 --- a/src/pages/product/product-create-page/product-create-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-product-create-page { - -} diff --git a/src/pages/product/product-create-page/product-create-page.ts b/src/pages/product/product-create-page/product-create-page.ts deleted file mode 100644 index cd80321..0000000 --- a/src/pages/product/product-create-page/product-create-page.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component } from '@angular/core'; -import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular'; -import { Product } from "../../../models/class/Product"; -import { Toast } from "@ionic-native/toast"; -import { DaoProduct } from "../../../providers/dao/dao-product.service"; -import { ProductListPage } from "../product-list-page/product-list-page"; - -/** - * Generated class for the ProductCreatePage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-product-create-page', - templateUrl: 'product-create-page.html', -}) -export class ProductCreatePage { - _product: Product; - constructor(public navCtrl: NavController, public navParams: NavParams, - public alert: AlertController, private _daoProduct: DaoProduct, - private _toast: Toast) { - this._product = navParams.get("parametro") || new Product(); - } - ionViewDidLoad() { - console.log('ionViewDidLoad ProductCreatePage'); - } - salvar() { - if ((typeof (this._product.sName) !== 'undefined')) { - if (this._product.nId > 0) { - this._daoProduct.update(this._product).then((data) => { - console.log("expected => " + data); - if (data) { - this._toast.show("Produto editado com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - this.navCtrl.setRoot(ProductListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } else { - this._daoProduct.create(this._product).then((data) => { - console.log("expected => " + data); - if (data) { - this.navCtrl.setRoot(ProductListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } - this.navCtrl.setRoot(ProductListPage); - } else { - let confirm = this.alert.create({ - title: "Ops...", - subTitle: "Por favor coloque um nome para o Produto.", - buttons: [ - { - text: "OK", - handler: () => { - } - } - ] - }); - confirm.present(); - } - } - -} diff --git a/src/pages/product/product-list-page/product-list-page.html b/src/pages/product/product-list-page/product-list-page.html deleted file mode 100644 index f138b5b..0000000 --- a/src/pages/product/product-list-page/product-list-page.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Lista de Produtos - - - - - - - {{product.sName}} - - - - - - \ No newline at end of file diff --git a/src/pages/product/product-list-page/product-list-page.module.ts b/src/pages/product/product-list-page/product-list-page.module.ts deleted file mode 100644 index dbbfda5..0000000 --- a/src/pages/product/product-list-page/product-list-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { ProductListPage } from './product-list-page'; - -@NgModule({ - declarations: [ - ProductListPage, - ], - imports: [ - IonicPageModule.forChild(ProductListPage), - ], - exports: [ - ProductListPage - ] -}) -export class ProductListPageModule {} diff --git a/src/pages/product/product-list-page/product-list-page.scss b/src/pages/product/product-list-page/product-list-page.scss deleted file mode 100644 index 8126709..0000000 --- a/src/pages/product/product-list-page/product-list-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-product-list-page { - -} diff --git a/src/pages/product/product-list-page/product-list-page.spec.ts b/src/pages/product/product-list-page/product-list-page.spec.ts deleted file mode 100644 index 94dbcbf..0000000 --- a/src/pages/product/product-list-page/product-list-page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../../test'; -import { ProductListPage } from './product-list-page'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Pages: ProductListPage', () => { - - beforeEach(async(() => TestUtils.beforeEachCompiler([ProductListPage]).then(compiled => { - fixture = compiled.fixture; - instance = compiled.instance; - }))); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/pages/product/product-list-page/product-list-page.ts b/src/pages/product/product-list-page/product-list-page.ts deleted file mode 100644 index 19aa248..0000000 --- a/src/pages/product/product-list-page/product-list-page.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { IonicPage, NavController, NavParams, AlertController, ActionSheetController } from 'ionic-angular'; -import { Product } from "../../../models/class/Product"; - -import { Toast } from "@ionic-native/toast"; -import { DaoProduct } from "../../../providers/dao/dao-product.service"; -import { ProductCreatePage } from "../product-create-page/product-create-page"; - -/** - * Generated class for the ProductListPage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-product-list-page', - templateUrl: 'product-list-page.html', -}) -export class ProductListPage implements OnInit { - - ngOnInit(): void { - this.getAllProducts(); - } - - _products: Product[] = []; - - constructor(public navCtrl: NavController, public navParams: NavParams, public alert: AlertController, - private _daoProduct: DaoProduct, public actionSheetCtrl: ActionSheetController, - private _toast: Toast) { - } - - insert() { - this.navCtrl.push(ProductCreatePage); - } - - ionViewDidLoad() { - console.log('ionViewDidLoad ProductListPage'); - } - - - getAllProducts() { - this._daoProduct.getAll() - .then(products => { - this._products = products; - }) - .catch(error => { - console.error(error); - }); - } - - options(product: Product) { - let actionSheet = this.actionSheetCtrl.create({ - title: 'Escolha uma das opções abaixo:', - buttons: [ - { - text: 'Deletar', - role: 'destructive', - icon: 'trash', - handler: () => { - let confirm = this.alert.create({ - title: "Excluir", - subTitle: "Gostaria de realmente excluir o Produto " + product.sName + "?", - buttons: [ - { - text: "Sim", - handler: () => { - let index = this._products.indexOf(product); - this._daoProduct.delete(product) - .then(response => { - console.log(response); - this._products.splice(index, 1); - this._toast.show("Produto excluído com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - }) - .catch(error => { - console.error(error); - }) - - } - }, - { - text: "Não" - } - ] - }); - confirm.present(); - } - }, - { - text: 'Editar', - role: 'edit', - icon: 'create', - handler: () => { - this.navCtrl.push(ProductCreatePage, { parametro: product }); - } - }, - { - text: 'Cancelar', - role: 'cancel', - icon: 'close', - handler: () => { - - } - } - ] - }); - - actionSheet.present(); - } - -} diff --git a/src/pages/unit/unit-create/unit-create.html b/src/pages/unit/unit-create/unit-create.html deleted file mode 100644 index f626f0c..0000000 --- a/src/pages/unit/unit-create/unit-create.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Cadastrar Unidade - - - - - - - - - Sigla - - - - Descrição - - - - - \ No newline at end of file diff --git a/src/pages/unit/unit-create/unit-create.module.ts b/src/pages/unit/unit-create/unit-create.module.ts deleted file mode 100644 index f7d8562..0000000 --- a/src/pages/unit/unit-create/unit-create.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { UnitCreate } from './unit-create'; - -@NgModule({ - declarations: [ - UnitCreate, - ], - imports: [ - IonicPageModule.forChild(UnitCreate), - ], - exports: [ - UnitCreate - ] -}) -export class UnitCreateModule {} diff --git a/src/pages/unit/unit-create/unit-create.scss b/src/pages/unit/unit-create/unit-create.scss deleted file mode 100644 index 4949b84..0000000 --- a/src/pages/unit/unit-create/unit-create.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-unit-create { - -} diff --git a/src/pages/unit/unit-create/unit-create.ts b/src/pages/unit/unit-create/unit-create.ts deleted file mode 100644 index f4c3274..0000000 --- a/src/pages/unit/unit-create/unit-create.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Component } from '@angular/core'; -import { IonicPage, NavController, NavParams, AlertController } from 'ionic-angular'; -import { Unit } from "../../../models/class/Unit"; -import { UnitListPage } from "../unit-list-page/unit-list-page"; -import { DaoUnit } from "../../../providers/dao/dao-unit.service"; -import { Toast } from '@ionic-native/toast'; -/** - * Generated class for the UnitCreate page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-unit-create', - templateUrl: 'unit-create.html', -}) -export class UnitCreate { - _unit: Unit; - constructor(public navCtrl: NavController, public navParams: NavParams, - public alert: AlertController, private _daoUnit: DaoUnit, - private _toast: Toast) { - this._unit = navParams.get("parametro") || new Unit(); - } - - - salvar() { - if ((typeof (this._unit.sInitials) !== 'undefined')) { - if (this._unit.nId > 0) { - this._daoUnit.update(this._unit).then((data) => { - console.log("expected => " + data); - if (data) { - this._toast.show("Unidade editada com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - this.navCtrl.setRoot(UnitListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } else { - this._daoUnit.create(this._unit).then((data) => { - console.log("expected => " + data); - if (data) { - this.navCtrl.setRoot(UnitListPage); - } - }).catch((erro) => { - console.log("erro => " + erro); - }) - } - this.navCtrl.setRoot(UnitListPage); - } else { - let confirm = this.alert.create({ - title: "Ops...", - subTitle: "Por favor coloque uma sigla para a unidade.", - buttons: [ - { - text: "OK", - handler: () => { - } - } - ] - }); - confirm.present(); - } - } - - -} diff --git a/src/pages/unit/unit-list-page/unit-list-page.html b/src/pages/unit/unit-list-page/unit-list-page.html deleted file mode 100644 index b5455c9..0000000 --- a/src/pages/unit/unit-list-page/unit-list-page.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Lista de Unidades - - - - - - - {{unit.sInitials}} - - - - - - \ No newline at end of file diff --git a/src/pages/unit/unit-list-page/unit-list-page.module.ts b/src/pages/unit/unit-list-page/unit-list-page.module.ts deleted file mode 100644 index 742f99c..0000000 --- a/src/pages/unit/unit-list-page/unit-list-page.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { NgModule } from '@angular/core'; -import { IonicPageModule } from 'ionic-angular'; -import { UnitListPage } from './unit-list-page'; - -@NgModule({ - declarations: [ - UnitListPage, - ], - imports: [ - IonicPageModule.forChild(UnitListPage), - ], - exports: [ - UnitListPage - ] -}) -export class UnitListPageModule {} diff --git a/src/pages/unit/unit-list-page/unit-list-page.scss b/src/pages/unit/unit-list-page/unit-list-page.scss deleted file mode 100644 index 1b8a841..0000000 --- a/src/pages/unit/unit-list-page/unit-list-page.scss +++ /dev/null @@ -1,3 +0,0 @@ -page-unit-list-page { - -} diff --git a/src/pages/unit/unit-list-page/unit-list-page.spec.ts b/src/pages/unit/unit-list-page/unit-list-page.spec.ts deleted file mode 100644 index 059ffb1..0000000 --- a/src/pages/unit/unit-list-page/unit-list-page.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, async } from '@angular/core/testing'; -import { TestUtils } from '../../../test'; -import { UnitListPage } from './unit-list-page'; - -let fixture: ComponentFixture = null; -let instance: any = null; - -declare var describe: any; -declare var it: any; -declare var expect: any; -declare var beforeEach: any; - -describe('Pages: UnitListPage', () => { - - beforeEach(async(() => TestUtils.beforeEachCompiler([UnitListPage]).then(compiled => { - fixture = compiled.fixture; - instance = compiled.instance; - }))); - - it('should create the start page', async(() => { - expect(instance).toBeTruthy(); - })); - -}); diff --git a/src/pages/unit/unit-list-page/unit-list-page.ts b/src/pages/unit/unit-list-page/unit-list-page.ts deleted file mode 100644 index 268719b..0000000 --- a/src/pages/unit/unit-list-page/unit-list-page.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet'; -import { IonicPage, NavController, NavParams, AlertController, ActionSheetController } from 'ionic-angular'; -import { Toast } from '@ionic-native/toast'; - - -import { Unit } from "../../../models/class/Unit"; -import { UnitCreate } from "../unit-create/unit-create"; -import { DaoUnit } from "../../../providers/dao/dao-unit.service"; - -/** - * Generated class for the UnitListPage page. - * - * See http://ionicframework.com/docs/components/#navigation for more info - * on Ionic pages and navigation. - */ -@IonicPage() -@Component({ - selector: 'page-unit-list-page', - templateUrl: 'unit-list-page.html', -}) -export class UnitListPage implements OnInit { - - _units: Unit[] = []; - - - constructor(public navCtrl: NavController, public navParams: NavParams, - public alert: AlertController, - private _daoUnit: DaoUnit, public actionSheetCtrl: ActionSheetController, - private _toast: Toast) { - } - - ionViewDidLoad() { - - } - - ngOnInit() { - this.getAllUnits(); - } - insert() { - this.navCtrl.push(UnitCreate); - } - - - getAllUnits() { - this._daoUnit.getAll() - .then(units => { - this._units = units; - }) - .catch(error => { - console.error(error); - }); - } - - - - options(unit: Unit) { - let actionSheet = this.actionSheetCtrl.create({ - title: 'Escolha uma das opções abaixo:', - buttons: [ - { - text: 'Deletar', - role: 'destructive', - icon: 'trash', - handler: () => { - let confirm = this.alert.create({ - title: "Excluir", - subTitle: "Gostaria de realmente excluir a unidade " + unit.sInitials + "?", - buttons: [ - { - text: "Sim", - handler: () => { - let index = this._units.indexOf(unit); - this._daoUnit.delete(unit) - .then(response => { - console.log(response); - this._units.splice(index, 1); - this._toast.show("Unidade excluída com sucesso", '1500', 'center').subscribe( - toast => { - console.log(toast); - } - ); - }) - .catch(error => { - console.error(error); - }) - - } - }, - { - text: "Não" - } - ] - }); - confirm.present(); - } - }, - { - text: 'Editar', - role: 'edit', - icon: 'create', - handler: () => { - this.navCtrl.push(UnitCreate, { parametro: unit }); - } - }, - { - text: 'Cancelar', - role: 'cancel', - icon: 'close', - handler: () => { - - } - } - ] - }); - - actionSheet.present(); - } - - -} diff --git a/src/test.ts b/src/test.ts index 1a1acf0..15a0b5d 100644 --- a/src/test.ts +++ b/src/test.ts @@ -17,14 +17,8 @@ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@ang import { App, Config, Form, IonicModule, Keyboard, DomController} from 'ionic-angular'; import { MenuController, NavController, Platform, NavParams } from 'ionic-angular'; import { AlertController, ActionSheetController, GestureController } from 'ionic-angular'; -import { ActionSheet } from 'ionic-angular'; import { Toast } from "@ionic-native/toast"; import { ConfigMock, PlatformMock, NavParamsMock, NavMock, AlertMock, daomock } from './mocks'; -import { DaoUnit } from './providers/dao/dao-unit.service' -import { DaoMarket } from './providers/dao/dao-market.service' -import { DaoProduct } from './providers/dao/dao-product.service' -import { DaoListItem } from './providers/dao/dao-listitem.service' -import { StartService } from './providers/start/start-service.service' // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. declare var __karma__: any;