Skip to content

Commit

Permalink
Primeira versão usável
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerosn committed May 28, 2017
1 parent 5e38f54 commit 6228816
Show file tree
Hide file tree
Showing 23 changed files with 410 additions and 104 deletions.
10 changes: 5 additions & 5 deletions old/pmdsys/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar, Splashscreen } from 'ionic-native';
import { Component } from "@angular/core";
import { Platform } from "ionic-angular";
import { StatusBar, Splashscreen } from "ionic-native";

import { TabsPage } from '../pages/tabs/tabs';
import { TabsPage } from "../pages/tabs/tabs";


@Component({
templateUrl: 'app.html'
templateUrl: "app.html"
})
export class MyApp {
rootPage = TabsPage;
Expand Down
14 changes: 7 additions & 7 deletions old/pmdsys/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { NgModule, ErrorHandler } from "@angular/core";
import { IonicApp, IonicModule, IonicErrorHandler } from "ionic-angular";
import { MyApp } from "./app.component";
import { AboutPage } from "../pages/about/about";
import { ContactPage } from "../pages/contact/contact";
import { HomePage } from "../pages/home/home";
import { TabsPage } from "../pages/tabs/tabs";

@NgModule({
declarations: [
Expand Down
4 changes: 2 additions & 2 deletions old/pmdsys/src/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";

import { AppModule } from './app.module';
import { AppModule } from "./app.module";

platformBrowserDynamic().bootstrapModule(AppModule);
8 changes: 4 additions & 4 deletions old/pmdsys/src/pages/about/about.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component } from '@angular/core';
import { Component } from "@angular/core";

import { NavController } from 'ionic-angular';
import { NavController } from "ionic-angular";

@Component({
selector: 'page-about',
templateUrl: 'about.html'
selector: "page-about",
templateUrl: "about.html"
})
export class AboutPage {

Expand Down
8 changes: 4 additions & 4 deletions old/pmdsys/src/pages/contact/contact.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component } from '@angular/core';
import { Component } from "@angular/core";

import { NavController } from 'ionic-angular';
import { NavController } from "ionic-angular";

@Component({
selector: 'page-contact',
templateUrl: 'contact.html'
selector: "page-contact",
templateUrl: "contact.html"
})
export class ContactPage {

Expand Down
8 changes: 4 additions & 4 deletions old/pmdsys/src/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Component } from '@angular/core';
import { Component } from "@angular/core";

import { NavController } from 'ionic-angular';
import { NavController } from "ionic-angular";

@Component({
selector: 'page-home',
templateUrl: 'home.html'
selector: "page-home",
templateUrl: "home.html"
})
export class HomePage {

Expand Down
10 changes: 5 additions & 5 deletions old/pmdsys/src/pages/tabs/tabs.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component } from '@angular/core';
import { Component } from "@angular/core";

import { HomePage } from '../home/home';
import { AboutPage } from '../about/about';
import { ContactPage } from '../contact/contact';
import { HomePage } from "../home/home";
import { AboutPage } from "../about/about";
import { ContactPage } from "../contact/contact";

@Component({
templateUrl: 'tabs.html'
templateUrl: "tabs.html"
})
export class TabsPage {
// this tells the tabs component which Pages
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@ionic-native/toast": "^3.6.1",
"@ionic/storage": "^2.0.1",
"@types/node": "^7.0.18",
"chart.js": "^2.6.0",
"ionic-angular": "^3.2.1",
"ionic-orm": "0.0.5",
"ionic-typeorm": "^0.0.15",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { PageFormItensCompra } from '../pages/FormItensCompra/main';
import { PageListaPrecos } from '../pages/ListaPrecos/main';
import { PageFormPrecos } from '../pages/FormPrecos/main';
import { PageRelatorioEscolhe } from '../pages/RelatorioEscolhe/main';
import { PageRelatorioExibe } from '../pages/RelatorioExibe/main';

import { OrmDatabase } from '../persistence/OrmDatabase.service';
import { Relatorios } from '../providers/Relatorios.service';
Expand Down Expand Up @@ -51,6 +52,7 @@ import { CrudSupermercado } from '../providers/CrudSupermercado.service';
PageListaPrecos,
PageFormPrecos,
PageRelatorioEscolhe,
PageRelatorioExibe,
],
imports: [
BrowserModule,
Expand All @@ -76,6 +78,7 @@ import { CrudSupermercado } from '../providers/CrudSupermercado.service';
PageListaPrecos,
PageFormPrecos,
PageRelatorioEscolhe,
PageRelatorioExibe,
],
providers: [
StatusBar,
Expand All @@ -91,6 +94,7 @@ import { CrudSupermercado } from '../providers/CrudSupermercado.service';
CrudNecessidade,
CrudPlanejamento,
CrudSupermercado,
PageRelatorioExibe,
]
})
export class AppModule { }
7 changes: 7 additions & 0 deletions src/app/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@
// To declare rules for a specific mode, create a child rule
// for the .md, .ios, or .wp mode classes. The mode class is
// automatically applied to the <body> element in the app.

.deleteToast{
color: #cc3333 !important;
}
.cancelToast{
color: #387ef5 !important;
}
29 changes: 18 additions & 11 deletions src/pages/RelatorioEscolhe/main.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
<ion-header>
<ion-navbar color="logotipoCesta">
<ion-title>
Relatorios
Ir às compras
</ion-title>
</ion-navbar>
</ion-header>

<ion-content>
<ion-list>
<ion-item>
Item 1
</ion-item>
<ion-item>
Item 2
</ion-item>
<ion-item>
Item 3
</ion-item>
<ion-list class="noHSpace">
<ion-list ion-item class="noHSpace">
<ion-item class="fundoEspecial">
...no menor preço...
</ion-item>
<ion-list ion-item>
<button ion-item (click)="menorPrecoTodos()">
...visitando todos os supermercados
</button>
<button ion-item (click)="menorPrecoUm()">
...visitando um único supermercado
</button>
<button ion-item (click)="menorPrecoMedio()">
...médio
</button>
</ion-list>
</ion-list>
</ion-list>
</ion-content>
33 changes: 13 additions & 20 deletions src/pages/RelatorioEscolhe/main.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
page-inicio {
.btnhome {
padding:5%;
.fundoEspecial{
background: color($colors, logotipoFundo, secondary);
background: linear-gradient(to right, color($colors, logotipoFundo, secondary), $background-color);
border-width: 1pt;
border-style: solid;
border-image: linear-gradient(to right, color($colors, logotipoFundoEscuroEscuro, secondary), $background-color) 100% 1;
border-left-style: none;
border-right-style: none;
}
.h1home{
font-size:16vw;
text-align: center;
}
.h3home{
text-align: center;
margin-bottom: 10vh;
}
.cont{
display: flex;
align-content: space-around;
align-items: center;
width: 100%;
height: 100%;
}
.el{
display: block;
width: 100%;
.noHSpace{
padding-left: 0px !important;
padding-right: 0px !important;
margin-left: 0px !important;
margin-right: 0px !important;
}
}
5 changes: 1 addition & 4 deletions src/pages/RelatorioEscolhe/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,5 @@ describe('Pages: Relatorio: Escolhe', () => {
it('should create the start page', async(() => {
expect(instance).toBeTruthy();
}));

it('should have a clickable button to another page', async(() => {
expect(instance.openPage()).toBeTruthy();
}));

});
52 changes: 48 additions & 4 deletions src/pages/RelatorioEscolhe/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,59 @@
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { NavParams } from 'ionic-angular';
import { Consulta } from '../../entities/Consulta';
import { Planejamento } from '../../entities/Planejamento';
import { Relatorios } from '../../providers/Relatorios.service';

import { PageListaCompras } from '../ListaCompras/main'
import { PageRelatorioExibe } from '../RelatorioExibe/main'

@Component({
selector: 'page-inicio',
templateUrl: 'main.html'
})
export class PageRelatorioEscolhe {
constructor(public navCtrl: NavController){}
openPage() {
return this.navCtrl.setRoot(PageListaCompras);
constructor(
public navCtrl: NavController,
public navParams: NavParams,
public relatorioService: Relatorios,
){
this.planejamento = this.navParams.get('sujeito')
}
planejamento: Planejamento;
menorPrecoMedio(){
this.relatorioService.menorPrecoMedio(
this.planejamento
).then(
(consultas:Consulta[]) => {
this.navCtrl.push(PageRelatorioExibe,{
titulo: 'O menor preço médio',
consultas: consultas,
})
}
)
}
menorPrecoUm(){
this.relatorioService.menorPrecoEmUmSupermercado(
this.planejamento
).then(
(consultas:Consulta[]) => {
this.navCtrl.push(PageRelatorioExibe,{
titulo: 'O mais barato',
consultas: consultas,
})
}
)
}
menorPrecoTodos(){
this.relatorioService.menorPrecoEmTodosSupermercados(
this.planejamento
).then(
(consultas:Consulta[]) => {
this.navCtrl.push(PageRelatorioExibe,{
titulo: 'O menor orçamento',
consultas: consultas,
})
}
)
}
}
22 changes: 22 additions & 0 deletions src/pages/RelatorioExibe/main.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, async } from '@angular/core/testing';
import { TestUtils } from '../../test';
import { PageRelatorioExibe } from './main';

let fixture: ComponentFixture<PageRelatorioExibe> = null;
let instance: any = null;

declare var describe: any;
declare var it: any;
declare var expect: any;
declare var beforeEach: any;

describe('Pages: Relatorios: Exibe', () => {
beforeEach(async(() => TestUtils.beforeEachCompiler([PageRelatorioExibe]).then(compiled => {
fixture = compiled.fixture;
instance = compiled.instance;
})));

it('should create the page', async(() => {
expect(instance).toBeTruthy();
}));
});

0 comments on commit 6228816

Please sign in to comment.