Skip to content

Commit

Permalink
automatic-commit-alias
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianobapo committed Mar 12, 2017
1 parent 2284340 commit 3928e3c
Show file tree
Hide file tree
Showing 24 changed files with 496 additions and 107 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ npm install font-awesome --save-dev
php artisan vendor:publish --tag=erpnetWidgetResourceGulpfile
gulp --gulpfile=gulpfileErpnetWidgetResource.js
```
***plugins***
```shell
ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"
ionic plugin add cordova-plugin-googleplus --variable REVERSED_CLIENT_ID=
```

***Updating run***
```shell
Expand Down
2 changes: 2 additions & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@
<plugin name="cordova-plugin-statusbar" spec="2.2.1"/>
<plugin name="cordova-plugin-device" spec="1.1.4"/>
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1"/>
<allow-navigation href="http://192.168.0.110:8000"/>
<allow-navigation href="http://192.168.0.110:8001"/>
</widget>
23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "delivery-v3",
"author": "Luciano Porto",
"homepage": "http://ionicframework.com/",
"homepage": "http://ilhanet.com/",
"private": true,
"config": {
"ionic_copy": "./src/config/copy.config.js"
Expand Down Expand Up @@ -35,6 +35,10 @@
},
"devDependencies": {
"@ionic/app-scripts": "^1.0.0",
"@types/fb": "0.0.22",
"@types/gapi": "0.0.30",
"@types/gapi.auth2": "0.0.34",
"@types/node": "^7.0.8",
"font-awesome": "^4.7.0",
"gulp": "^3.9.1",
"gulp-htmlmin": "^3.0.0",
Expand All @@ -49,7 +53,22 @@
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
"ionic-plugin-keyboard",
{
"id": "cordova-plugin-facebook4",
"locator": "cordova-plugin-facebook4",
"variables": {
"APP_ID": "1630647053816087",
"APP_NAME": "delivery-v3"
}
},
{
"id": "cordova-plugin-googleplus",
"locator": "cordova-plugin-googleplus",
"variables": {
"REVERSED_CLIENT_ID": "4910560041-697h1bpjt70pranrevpdihn9g0unurog.apps.googleusercontent.com"
}
}
],
"cordovaPlatforms": [
{
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {CepService} from "../providers/cep-service";
import {AnalyticsService} from "../providers/analytics-service";
import {ConnectivityMonitorService} from "../providers/connectivity-monitor-service";
import {ServiceWorker} from "../providers/service-worker";
import {FacebookService} from "../providers/facebook-service";
import {GoogleService} from "../providers/google-service";

@Component({
templateUrl: 'app.html',
Expand All @@ -25,6 +27,8 @@ import {ServiceWorker} from "../providers/service-worker";
ProductService,
AnalyticsService,
ConnectivityMonitorService,
FacebookService,
GoogleService,
ServiceWorker
]
})
Expand Down
25 changes: 25 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,29 @@ <h2 style="text-align: center" *ngIf="false">Carregando...</h2>
// })
// .catch(err => console.log('Error', err));
// }
window.fbAsyncInit = function() {
FB.init({
appId : '1630647053816087',
status : true,
xfbml : true,
version : 'v2.8'
});
FB.AppEvents.logPageView();
};

window.___gcfg = {
lang: 'pt-BR',
parsetags: 'onload'
};

window.gapiOnLoadCallback = function() {
gapi.load('auth2', ()=> {
gapi.auth2.init({
client_id: '4910560041-g7fqeg0ibo10eid6q4c0qn1jqnk3airq.apps.googleusercontent.com'
}).then((...params)=>{}, (...params)=>console.error('gapi error:', params));
});

};

(function(doc, elementName) {
var elToInsert,
Expand All @@ -126,6 +149,8 @@ <h2 style="text-align: center" *ngIf="false">Carregando...</h2>
<!-- @if CORDOVA -->
addScript('cordova.js');
<!-- @endif -->
addScript('https://connect.facebook.net/pt_BR/sdk.js', 'facebook-jssdk');
addScript('https://apis.google.com/js/platform.js?publisherid=103256085356577396632&onload=gapiOnLoadCallback');
// addScript('https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js');
// addScript('https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/shim.min.js');
// addScript('build/polyfills.js');
Expand Down
8 changes: 6 additions & 2 deletions src/pages/checkout/checkout.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ <h1>Pedido nº {{ id }} criado</h1>
<ion-item *ngFor="let item of order_items">
<ion-badge color="secondary" item-left>{{ item.quantidade }} x</ion-badge>
<h2>{{ item.valor_unitario | currency:'BRL':true:'1.2-2' }}</h2>
<p style="white-space: normal;">{{ cartService.getNome(item.product_id) }}</p>
<p style="white-space: normal;">{{ item.product.nome }}</p>
</ion-item>
<ion-item text-right>
Valor Total: {{ cartService.getTotalCart() | currency:'BRL':true:'1.2-2' }}
Valor Total: {{ valor_total | currency:'BRL':true:'1.2-2' }}
</ion-item>

<ion-item-divider color="light">Forma de pagamento</ion-item-divider>
Expand All @@ -50,7 +50,11 @@ <h2>{{ item.valor_unitario | currency:'BRL':true:'1.2-2' }}</h2>

<ion-item-divider color="light" *ngIf="observacao">Observação</ion-item-divider>
<ion-item *ngIf="observacao">{{ observacao }}</ion-item>

</ion-list>
<button ion-button full type="button" color="secondary" (click)="goToHome()">
Voltar ao início
</button>
</ion-content>

<ion-footer *ngIf="connectivityMonitorService.isOffline()">
Expand Down
21 changes: 19 additions & 2 deletions src/pages/checkout/checkout.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
import {NavController, NavParams, ViewController} from 'ionic-angular';
import {CartService} from "../../providers/cart-service";
import {LogService} from "../../providers/log-service";
import {AnalyticsService} from "../../providers/analytics-service";
Expand All @@ -21,6 +21,7 @@ export class CheckoutPage implements OnInit {
public pagamento;
public observacao;
public order_items;
public valor_total;
public contacts;
public address = {
cep:'',
Expand All @@ -34,11 +35,16 @@ export class CheckoutPage implements OnInit {
protected cartService: CartService,
protected navParams: NavParams,
protected analyticsService: AnalyticsService,
protected viewCtrl: ViewController,
protected log: LogService,
protected connectivityMonitorService: ConnectivityMonitorService) {
this.fillOrder();
}

ionViewWillEnter() {
this.viewCtrl.showBackButton(false);
}

ionViewDidLoad() {
this.log.l('ionViewDidLoad CheckoutPage');
this.analyticsService.sendPageviewGa('/checkout');
Expand All @@ -48,6 +54,10 @@ export class CheckoutPage implements OnInit {
this.fillOrder();
}

goToHome(){
this.navCtrl.popToRoot();
}

protected fillOrder(){
let order = this.cartService.getOrderCreated();

Expand All @@ -61,7 +71,14 @@ export class CheckoutPage implements OnInit {
if (order.partner.hasOwnProperty('contacts'))
this.contacts = order.partner.contacts;
}
if (order.hasOwnProperty('order_items')) this.order_items = order.order_items;
if (order.hasOwnProperty('order_items')) {
let soma = 0;
order.order_items.map(item=>{
soma = soma + (item.quantidade*item.valor_unitario);
});
this.valor_total = soma;
this.order_items = order.order_items;
}
}
}

Expand Down
21 changes: 16 additions & 5 deletions src/pages/home/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,34 @@
<ion-icon name="cart"></ion-icon>
<ion-badge color="secondary" *ngIf="hasCartValue()">{{ getTotalCart() | currency:'BRL':true:'1.2-2' }}</ion-badge>
</button>
<button ion-button icon-only (click)="startSearch($event)">
<ion-icon name="search"></ion-icon>
</button>
<!--<button ion-button icon-only (click)="startSearch($event)">-->
<!--<ion-icon name="search"></ion-icon>-->
<!--</button>-->
</ion-buttons>

<ion-searchbar #search *ngIf="isSearching()" placeholder="Busca de produtos"
animated="true" showCancelButton="false"
(ionBlur)="onBlur($event)" (ionInput)="onInput($event)"
(ionCancel)="onCancel($event)" (ionClear)="onClear($event)">

</ion-searchbar>

</ion-navbar>
</ion-header>

<ion-content padding>

<ion-fab top right>
<button ion-fab mini>
<ion-icon name="log-in"></ion-icon>
</button>
<ion-fab-list>
<button ion-fab (click)="presentPrompt()"><ion-icon name="person"></ion-icon></button>
<button ion-fab (click)="facebookService.login()"><ion-icon name="logo-facebook"></ion-icon></button>
<!--<button ion-fab><ion-icon name="logo-twitter"></ion-icon></button>-->
<!--<button ion-fab><ion-icon name="logo-vimeo"></ion-icon></button>-->
<button ion-fab (click)="googleService.login()"><ion-icon name="logo-googleplus"></ion-icon></button>
</ion-fab-list>
</ion-fab>

<ion-grid>
<ion-row>
<ion-col text-center>.
Expand Down
64 changes: 62 additions & 2 deletions src/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Component, ViewChild, OnInit} from '@angular/core';

import {NavController} from 'ionic-angular';
import {NavController, AlertController} from 'ionic-angular';

import {CategoriesService} from '../../providers/categories-service';
import {LogService} from "../../providers/log-service";
Expand All @@ -11,6 +11,8 @@ import {CartService} from "../../providers/cart-service";
import {CartPage} from "../cart/cart";
import {AnalyticsService} from "../../providers/analytics-service";
import {ConnectivityMonitorService} from "../../providers/connectivity-monitor-service";
import {FacebookService} from "../../providers/facebook-service";
import {GoogleService} from "../../providers/google-service";

@Component({
selector: 'page-home',
Expand All @@ -27,8 +29,12 @@ export class HomePage extends BasePage implements OnInit {
protected categoriesService: CategoriesService,
protected analyticsService: AnalyticsService,
protected cartService: CartService,
protected connectivityMonitorService: ConnectivityMonitorService) {
protected facebookService: FacebookService,
protected googleService: GoogleService,
protected connectivityMonitorService: ConnectivityMonitorService,
protected alertCtrl: AlertController) {
super();

}

ionViewDidLoad() {
Expand Down Expand Up @@ -56,4 +62,58 @@ export class HomePage extends BasePage implements OnInit {
this.navCtrl.push(CartPage);
}

presentPrompt() {
let alert = this.alertCtrl.create({
title: 'Login',
subTitle: 'Delivery 24 Horas',
message: 'Digite seu email e senha. Caso nao tenha senha você pode criar um usuário',
inputs: [
{
name: 'email',
placeholder: 'Email',
type: 'email'
},
{
name: 'password',
placeholder: 'Senha',
type: 'password'
}
],
buttons: [
{
text: 'Cancel',
role: 'cancel',
handler: data => {
console.log('Cancel clicked');
}
},
{
text: 'Criar',
handler: data => {
if (false) {
// if (User.isValid(data.username, data.password)) {
// logged in!
} else {
// invalid login
return false;
}
}
},
{
text: 'Login',
handler: data => {
if (false) {
// if (User.isValid(data.username, data.password)) {
// logged in!
} else {
// invalid login
return false;
}
}
}
]
});
alert.present();
}

}
7 changes: 3 additions & 4 deletions src/pages/product/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
<ion-icon name="cart"></ion-icon>
<ion-badge color="secondary" *ngIf="hasCartValue()">{{ getTotalCart() | currency:'BRL':true:'1.2-2' }}</ion-badge>
</button>
<button ion-button icon-only (click)="startSearch($event)">
<ion-icon name="search"></ion-icon>
</button>
<!--<button ion-button icon-only (click)="startSearch($event)">-->
<!--<ion-icon name="search"></ion-icon>-->
<!--</button>-->
</ion-buttons>

<ion-searchbar #search *ngIf="isSearching()" placeholder="Busca de produtos"
animated="true" showCancelButton="false"
(ionBlur)="onBlur($event)" (ionInput)="onInput($event)"
(ionCancel)="onCancel($event)" (ionClear)="onClear($event)">

</ion-searchbar>
</ion-navbar>

Expand Down
9 changes: 9 additions & 0 deletions src/providers/analytics-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,13 @@ export class AnalyticsService {
private renewTransactionId() {
this.transactionId = Date.now();
}

sendLoginGa(provider: string) {
if (this.connectivityMonitorService.isOffline()) return;
this.googleAnalytics('send', 'event', {
'eventCategory': 'Pages',
'eventAction': 'Login',
'eventLabel': provider
});
}
}
Loading

0 comments on commit 3928e3c

Please sign in to comment.