Skip to content

Commit

Permalink
fatture async from ascom
Browse files Browse the repository at this point in the history
  • Loading branch information
riczorn committed May 28, 2020
1 parent 16eeaa0 commit 08c3516
Show file tree
Hide file tree
Showing 13 changed files with 534 additions and 66 deletions.
11 changes: 8 additions & 3 deletions HappyOrder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ id: app.happyorder.it
Bumped ionic and updated css to handle new behaviour or Chrome for android.

- 1.4.13 (25/3/2019)

Online demo user logs in to the same-named account in the json and inherits privileges
Added bluetooth serial printer support (alpha, add a custom button in config with code Fbixolon)

- 1.4.32
Expand All @@ -330,8 +330,13 @@ id: app.happyorder.it
- 1.5.05
app: added +- buttons on the fidelity pages

---
#NO:now online demo user logs in to the same-named account in the json and inherits privileges
- 1.5.06
exit from table : fixed message;

- 1.6
funzioni reportistica fattura elettronica




[logo]: https://github.com/riczorn/happyorder/raw/master/HappyOrder/resources/android/icon/drawable-xxxhdpi-icon.png "HappyOrder logo"
17 changes: 11 additions & 6 deletions HappyOrder/src/components/cart/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,28 @@ export class CartComponent {
// }

/* mostra un menù contestuale su action hold, da testare */
showContext(event, item, childParentItem: any) {
async showContext(event, item, childParentItem: any) {
let self = this;
let cart = self.cart;
if (event && event.stopPropagation) {
event.stopPropagation();
}

let popover = this.popoverCtrl.create(PopoverCartComponent, {
item: item,
cart: self.cart
});
const popover = await this.popoverCtrl.create(PopoverCartComponent,
{
item: item,
cart: self.cart,
},
{
cssClass: 'item-edit-pop krz-item',
});
// console.log('popover',popover);
// popover.item = item;
// popover.cart = this.cart;
popover.present({
await popover.present({
ev: event
});

popover.onDidDismiss((popoverData) => {
// console.log('popoverData',popoverData);
switch (popoverData) {
Expand Down
8 changes: 8 additions & 0 deletions HappyOrder/src/components/popover-cart/popover-cart.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.item-edit-pop .popover-content {
top: unset !important;
bottom: 0 !important;
}
.popover-content {
/*top:unset!important;*/
}

popover-cart {
.editing {
.input-wrapper{
Expand Down
13 changes: 9 additions & 4 deletions HappyOrder/src/components/popover-cart/popover-cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ElementRef } from '@angular/core';
import { ViewController, NavParams } from 'ionic-angular';// , Platform, NavController, NavParams


Expand All @@ -20,7 +20,7 @@ export class PopoverCartComponent implements OnInit {
private editing: boolean;
private percentPrice: number;

constructor(public viewCtrl: ViewController, public navParams: NavParams) {
constructor(private hostElement: ElementRef, public viewCtrl: ViewController, public navParams: NavParams) {
this.item = navParams.data.item;
this.cart = navParams.data.cart;
this.editing = false;
Expand All @@ -38,16 +38,21 @@ export class PopoverCartComponent implements OnInit {
this.viewCtrl.dismiss(param);
}

toggleEdit() {
toggleEdit(event) {
event = event ? event : window.event;
console.log('toggleEdit event:', event);
this.editing = !this.editing;
if (this.editing) {
this.item.changedPrezzo = 1 * this.item.prezzo;
// this.hostElement.nativeElement.offsetTop = -54;
console.warn('popover component:', this.hostElement.nativeElement);
// this.hostElement.nativeElement.outerHTML
}
}


pricePercent() {
console.log('pricePercent!');
this.item.changedPrezzo = this.item.prezzo * (1 + (this.percentPrice / 100));
this.item.changedPrezzo = Math.round(this.item.prezzo * (100 + this.percentPrice)) / 100;
}
}
77 changes: 38 additions & 39 deletions HappyOrder/src/pages/order/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { Component, ViewChild, OnInit } from '@angular/core';
import { NavController, Content } from 'ionic-angular';
import { Platform } from 'ionic-angular';

import { LiveService } from '../../services/live.service';
import { CartService } from '../../services/cart.service';
import { LiveService } from '../../services/live.service';
import { CartService } from '../../services/cart.service';

import { TavoliPage } from '../../pages/tavoli/tavoli';
import { OrderPageButtons } from '../../components/order-page/order-page';
Expand All @@ -21,7 +21,7 @@ import { ConnectionStatusComponent } from '../../components/connection-status/co

// import { OrderButtons } from '../../components/order-buttons/order-buttons';
// import { CartComponent } from '../../components/cart/cart';
import {Cart} from '../../models/cart';
import { Cart } from '../../models/cart';

@Component({
selector: 'page-order',
Expand All @@ -34,19 +34,19 @@ export class OrderPage implements OnInit {
// debugText: string;
private cart: Cart;
private visible: any;
constructor(public liveService:LiveService,
private cartService: CartService,
public navCtrl: NavController,
public platform: Platform ) {
this.cart = this.liveService.cart;
this.visible = {cart:1, order:1, cssClass:'default', active:1};
constructor(public liveService: LiveService,
private cartService: CartService,
public navCtrl: NavController,
public platform: Platform) {
this.cart = this.liveService.cart;
this.visible = { cart: 1, order: 1, cssClass: 'default', active: 1 };
}
ngOnInit() {
let selfOrder = this;
this.doFlex(this.visible.order, this.visible.cart);
this.content.resize();

this.cartComponent.resetFunction = function(data) {
this.cartComponent.resetFunction = function (data) {
// console.log('order.resetOrder Screen ',data);

// now reset the first page of the buttonbar:
Expand All @@ -73,32 +73,31 @@ export class OrderPage implements OnInit {
if (event && event.stopPropagation) {
event.stopPropagation();
}
if (self.cart.items.length == 0 || !self.cart.hasNewItemsThatNeedSending())
{
if (self.cart.items.length == 0 || !self.cart.hasNewItemsThatNeedSending()) {
self.navCtrl.setRoot(TavoliPage);
return false;
}

if (event && event.target) {
event.target.disabled = true;
}
let action = self.cart.getAction();
if (self.liveService.user.defaultTableId == self.liveService.user.tableId) {
// su asporto, conferma elimina è il default.
// quindi, il primo getAction senza parametri invoca flagsToAction(true,false,false)
action = self.cart.flagsToAction(true, true, false);
}
self.cartService.sendCart(self.cart, action, function (data: any) {
// console.log('Cart Sent!', data);
// magari vediamo che risponde?

if (event && event.target) {
event.target.disabled = true;
event.target.disabled = false;
}
let action = self.cart.getAction();
if (self.liveService.user.defaultTableId == self.liveService.user.tableId) {
// su asporto, conferma elimina è il default.
// quindi, il primo getAction senza parametri invoca flagsToAction(true,false,false)
action = self.cart.flagsToAction(true, true, false);
}
self.cartService.sendCart(self.cart, action, function(data:any) {
// console.log('Cart Sent!', data);
// magari vediamo che risponde?

if (event && event.target) {
event.target.disabled = false;
}

self.afterOrder(action);
self.afterOrder(action);

});
});

}

Expand All @@ -114,7 +113,7 @@ export class OrderPage implements OnInit {
}
}

doFlex(order:number,cart:number) {
doFlex(order: number, cart: number) {
this.visible.order = order;
this.visible.cart = cart;
// if (order+cart>1)
Expand All @@ -125,31 +124,31 @@ export class OrderPage implements OnInit {
// this.visible.active = 2;
// }
this.visible.cssClass = this.liveService.options.Style;
if ((order+cart)>=2) {
if ((order + cart) >= 2) {
this.visible.cssClass += ' half';
}
// redundant, using css queries for flex-direction on #orderPage
// if (this.platform.isPortrait()) {
// this.visible.cssClass = 'portrait';
// } else {
// this.visible.cssClass = 'landscape'
// }
// if (this.platform.isPortrait()) {
// this.visible.cssClass = 'portrait';
// } else {
// this.visible.cssClass = 'landscape'
// }

}

/**
* return an appropriate css class based on the current options:
*/
getStyle() {
let style='';
let style = '';
let opts = this.liveService.options;
if (opts.PagesVertical) {
style = 'vertical';
}

style += ' cols-'+opts.ColumnCount;
style += ' font-'+opts.FontSize;
style += ' bheight-'+opts.ButtonHeight;
style += ' cols-' + opts.ColumnCount;
style += ' font-' + opts.FontSize;
style += ' bheight-' + opts.ButtonHeight;
return style;
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ The app is also published as a .tar.gz on https://happyorder.it/files/happyorder

[Electron Readme](electron/README.md)


[logo]: https://github.com/riczorn/happyorder/raw/master/HappyOrder/resources/android/icon/drawable-xxxhdpi-icon.png "HappyOrder logo"
2 changes: 1 addition & 1 deletion node/config/id.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"showComplete": true
},
"fatturaElettronica": {
"endpoint": "http://fattext.seac.it/test/invoice",
"endpoint": "http://fattext.seac.it/test",
"auth": {
"Username": "3200CRCPGV72",
"Password": "2SX7IG9IX1MY"
Expand Down
7 changes: 4 additions & 3 deletions node/config/id.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"web": {
"port": 8080,
"remoteHost": "192.168.10.130",
"remoteHost": "192.168.10.171",
"localMask": "0.0.0.0"
},
"identification": {
Expand All @@ -13,14 +13,15 @@
"showComplete": true
},
"fatturaElettronica": {
"sdiURI": "http://fattext.seac.it/test/invoice",
"sdiURI": "http://fattext.seac.it",
"auth": {
"username": "3200CRCPGV72",
"password": "2SX7IG9IX1MY"
},
"params": {
"ClientId": "GKoUyagOtRfkdW5l1GtDseDQ2URcbTIV",
"Content-Type": "application/xml"
"Content-Type": "application/xml",
"PartitaIva": "01094360250"
}
}
}
25 changes: 25 additions & 0 deletions node/lib/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,31 @@ class App {
this.error(res, 'fatturaElettronica not initialized');
}
});

router.get('/fatture', (req: any, res: any, next: any) => {

fs.readFile('www/fatture.html',
(err: any, data: any) => {
if (err) {
self.error(res, 'Error loading fatture.html');
}
else {
res.writeHead(200);
res.end(data);
}
});

});

router.get('/fatturelist', (req: any, res: any, next: any) => {
console.log('enter fatture - list (Fattura Elettronica)', req.query);
if (webservice) {
webservice.fattureList(res, req.query);
}
else {
this.error(res, 'fatture not initialized');
}
});
this.express.use('/', router);
}

Expand Down
Loading

0 comments on commit 08c3516

Please sign in to comment.