Merge branch 'zgo-test' of gitlab.com:pitmutt/zgo into zgo-test
This commit is contained in:
commit
f4d8619239
12 changed files with 451 additions and 239 deletions
|
@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- (2022-07-14) Order list reformated - some unused css classes removed.
|
||||||
- Added viewing key field to owner model
|
- Added viewing key field to owner model
|
||||||
- (2022-07-11) Order's list UI updated (Alpha version)
|
- (2022-07-11) Order's list UI updated (Alpha version)
|
||||||
+ Paid status icons added to order's title
|
+ Paid status icons added to order's title
|
||||||
|
|
|
@ -35,17 +35,15 @@ p.price{
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Style buttons */
|
.buttons-class-cart{
|
||||||
.btn {
|
background-color: #ff4700;
|
||||||
background-color: DodgerBlue; /* Blue background */
|
color: white;
|
||||||
border: none; /* Remove borders */
|
font-size: 18px;
|
||||||
color: white; /* White text */
|
font-weight: 700;
|
||||||
padding: 12px 16px; /* Some padding */
|
height: 25px !important;
|
||||||
font-size: 16px; /* Set a font size */
|
width: 50px !important;
|
||||||
cursor: pointer; /* Mouse pointer on hover */
|
display: flex;
|
||||||
}
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
/* Darker background on mouse-over */
|
cursor: pointer;
|
||||||
.btn:hover {
|
|
||||||
background-color: RoyalBlue;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,10 @@
|
||||||
</fa-icon>
|
</fa-icon>
|
||||||
</button>
|
</button>
|
||||||
-->
|
-->
|
||||||
<button mat-raised-button color="primary" class="icons" (click)="addToOrder(item._id!)">
|
<button mat-raised-button color="primary"
|
||||||
<mat-icon>shopping_cart</mat-icon>
|
class="buttons-class-cart"
|
||||||
|
(click)="addToOrder(item._id!)">
|
||||||
|
<mat-icon [inline]="true">shopping_cart</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -61,5 +63,9 @@
|
||||||
</div>
|
</div>
|
||||||
<p *ngIf = "items.length <= 0">No items yet!</p>
|
<p *ngIf = "items.length <= 0">No items yet!</p>
|
||||||
<br>
|
<br>
|
||||||
<button class="text" mat-raised-button (click)="openDialog()">
|
<button class="text"
|
||||||
<mat-icon class="icon">add</mat-icon>Add item</button>
|
mat-raised-button
|
||||||
|
(click)="openDialog()">
|
||||||
|
<mat-icon class="icon">add</mat-icon>
|
||||||
|
Add item
|
||||||
|
</button>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
||||||
|
|
||||||
|
import { faCartShopping } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Item } from '../item.model';
|
import { Item } from '../item.model';
|
||||||
import { Owner } from '../../owner.model';
|
import { Owner } from '../../owner.model';
|
||||||
|
@ -20,10 +23,12 @@ import { ItemAddComponent } from '../item-add/item-add.component';
|
||||||
|
|
||||||
export class ItemListComponent implements OnInit{
|
export class ItemListComponent implements OnInit{
|
||||||
|
|
||||||
@Input()
|
@Input() zecPrice: number = 1;
|
||||||
zecPrice: number = 1;
|
|
||||||
|
|
||||||
public items: Item[] = [];
|
public items: Item[] = [];
|
||||||
|
|
||||||
|
faCartShopping = faCartShopping;
|
||||||
|
|
||||||
owner: Owner = {
|
owner: Owner = {
|
||||||
_id: '',
|
_id: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -50,6 +55,7 @@ export class ItemListComponent implements OnInit{
|
||||||
payconf: false,
|
payconf: false,
|
||||||
viewkey: ''
|
viewkey: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
public ownerUpdate: Observable<Owner>;
|
public ownerUpdate: Observable<Owner>;
|
||||||
public itemsUpdate: Observable<Item[]>;
|
public itemsUpdate: Observable<Item[]>;
|
||||||
|
|
||||||
|
|
6
src/app/items/newlineitem.model.ts
Normal file
6
src/app/items/newlineitem.model.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export interface newLineItem {
|
||||||
|
line_id: number;
|
||||||
|
qty: number;
|
||||||
|
name: string;
|
||||||
|
cost: number;
|
||||||
|
}
|
|
@ -51,15 +51,58 @@ img.icon{
|
||||||
}
|
}
|
||||||
|
|
||||||
.total{
|
.total{
|
||||||
font-size: 15px;
|
font-family: Roboto Mono;
|
||||||
font-family: 'Roboto Mono', monospace;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.total{
|
.tbheader {
|
||||||
margin-bottom: -15px !important;
|
font-family: Roboto Mono;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.central{
|
.tbdetail {
|
||||||
max-width: 450px;
|
font-family: Roboto Mono;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totalsTbl {
|
||||||
|
margin-top: 15px;
|
||||||
|
border-bottom: solid;
|
||||||
|
border-color: lightgray;
|
||||||
|
border-width: 2px;
|
||||||
|
background: lightcyan;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totalsHdr {
|
||||||
|
font-family: Roboto Mono !important;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totalsHdrTitle {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.totalsHdrDetail {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orderList {
|
||||||
|
font-family: Roboto Mono !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orderListTitle {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orderListTitleDescr {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: justify;
|
||||||
}
|
}
|
|
@ -5,73 +5,63 @@
|
||||||
Back to Shop
|
Back to Shop
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<mat-divider></mat-divider>
|
<table class="totalsTbl" width="100%">
|
||||||
<div align="center">
|
<tr class="totalsHdr">
|
||||||
<div class="central">
|
<td width="10%"></td>
|
||||||
<table class="text" style="font-size: 12px !important;" width="75%">
|
<td width="40%" >
|
||||||
<tr>
|
<div class="totalsHdrTitle">Today's Total:</div>
|
||||||
<td width="50%" align="center">
|
<div class="totalsHdrDetail">
|
||||||
<h3>Today's Total:</h3>
|
|
||||||
<div class="total">
|
|
||||||
<img src="/assets/zec_rv.png"
|
<img src="/assets/zec_rv.png"
|
||||||
style='height: 16px !important;
|
style="height: 16px !important;
|
||||||
margin: -2px;'/>
|
margin-bottom: -2px;">{{todayTotal | number: '1.06'}}
|
||||||
{{todayTotal | number: '1.06'}}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td width="50%" align="center">
|
<td width="40%" >
|
||||||
<h3>Overall Total:</h3>
|
<div class="totalsHdrTitle">Overall Total:</div>
|
||||||
<div class="total">
|
<div class="totalsHdrDetail">
|
||||||
<img src="/assets/zec_rv.png"
|
<img src="/assets/zec_rv.png"
|
||||||
style='height: 16px !important;
|
style="height: 16px !important;
|
||||||
margin: -2px;'/>
|
margin-bottom: -2px;">{{total | number: '1.06'}}
|
||||||
{{total | number: '1.06'}}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td width="10%"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="orderList">
|
||||||
|
<mat-accordion *ngIf = "orders.length > 0">
|
||||||
|
<mat-expansion-panel *ngFor = "let order of orders">
|
||||||
|
<mat-expansion-panel-header [collapsedHeight]="'30px'" [expandedHeight]="'30px'" >
|
||||||
|
<mat-panel-title>
|
||||||
|
<div class="orderListTitle">
|
||||||
|
<img src="/assets/zec_rv.png"
|
||||||
|
style="height: 16px;
|
||||||
|
margin-bottom: -2px;"
|
||||||
|
>{{order.totalZec | number: '1.06'}}
|
||||||
|
</div>
|
||||||
|
</mat-panel-title>
|
||||||
|
<mat-panel-description>
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<fa-icon [icon]="getIcon(order)" [style]="getIconStyle(order)" ></fa-icon>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
{{order.timestamp | date: 'short'}}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<mat-divider></mat-divider>
|
|
||||||
<div align="center">
|
|
||||||
<div class="central">
|
|
||||||
<mat-accordion *ngIf = "orders.length > 0">
|
|
||||||
<mat-expansion-panel class="text" *ngFor = "let order of orders">
|
|
||||||
<mat-expansion-panel-header class="text" >
|
|
||||||
<mat-panel-title>
|
|
||||||
<span class="price"
|
|
||||||
style='font-family: Roboto Mono !important;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: strong;
|
|
||||||
color: black !important;
|
|
||||||
margin: auto;'>
|
|
||||||
<img src="/assets/zec_rv.png"
|
|
||||||
style='height: 16px;
|
|
||||||
margin: auto; '/> {{order.totalZec | number: '1.06'}}
|
|
||||||
</span>
|
|
||||||
</mat-panel-title>
|
|
||||||
<mat-panel-description>
|
|
||||||
<fa-icon [icon]="getIcon(order)" [style]="getIconStyle(order)" ></fa-icon>
|
|
||||||
<div style='font-family: Roboto Mono !important;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: strong;
|
|
||||||
color: black !important;
|
|
||||||
margin: auto;'>
|
|
||||||
{{order.timestamp | date: 'short'}}
|
|
||||||
</div>
|
|
||||||
</mat-panel-description>
|
</mat-panel-description>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div class='orderheader'>
|
<div class='orderheader'>
|
||||||
<div class="text2"> <b>Order Id</b>: {{order._id}}</div>
|
<div class="text2"> <b>Order Id</b>: {{order._id}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
order header
|
|
||||||
-->
|
|
||||||
<table style="width: 100%;"
|
<table style="width: 100%;"
|
||||||
cellspacing="0">
|
cellspacing="0">
|
||||||
<tr style="font-family: Roboto Mono;
|
<tr style="font-family: Roboto Mono;
|
||||||
font-size: 19px;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
font-size: 16px;
|
||||||
height: 20px;">
|
height: 20px;">
|
||||||
<td width="50%">Order Total:</td>
|
<td width="50%">Order Total:</td>
|
||||||
<td align="right"
|
<td align="right"
|
||||||
|
@ -81,7 +71,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-family: Roboto Mono;
|
<tr style="font-family: Roboto Mono;
|
||||||
font-size: 16px;
|
font-size: 15px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
height: 18px;">
|
height: 18px;">
|
||||||
<td width="50%">
|
<td width="50%">
|
||||||
|
@ -92,44 +82,31 @@
|
||||||
>1.0 = {{ order.price | currency: order.currency.toUpperCase()}}
|
>1.0 = {{ order.price | currency: order.currency.toUpperCase()}}
|
||||||
</td>
|
</td>
|
||||||
<td width="50%" align="right">
|
<td width="50%" align="right">
|
||||||
{{ order.total | number: '1.02' | currency: order.currency.toUpperCase()}}
|
{{ order.total | currency: order.currency.toUpperCase()}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table style="width: 100%;">
|
<table style="width: 100%;">
|
||||||
<!--
|
|
||||||
<div style="display: block;">
|
|
||||||
-->
|
|
||||||
<thead style="width: 100%;">
|
<thead style="width: 100%;">
|
||||||
<tr style="background: lightblue;">
|
<tr style="background: lightblue;">
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="tbheader"
|
||||||
font-size: 14px;
|
style="text-align: left;"
|
||||||
font-weight: 700;
|
|
||||||
text-align: left;"
|
|
||||||
width="55%">Item
|
width="55%">Item
|
||||||
</th>
|
</th>
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="tbheader"
|
||||||
font-size: 14px;
|
style="text-align: left;"
|
||||||
font-weight: 700;
|
|
||||||
text-align: left;"
|
|
||||||
width="15%">Qty.
|
width="15%">Qty.
|
||||||
</th>
|
</th>
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="tbheader"
|
||||||
font-size: 14px;
|
style="text-align: right;"
|
||||||
font-weight: 700;
|
|
||||||
text-align: right;"
|
|
||||||
width="30%">Total
|
width="30%">Total
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<!--
|
|
||||||
</div>
|
<tbody>
|
||||||
-->
|
<tr *ngFor="let item of order.lines">
|
||||||
<tbody style="overflow-y: auto;
|
|
||||||
overflow-x: hidden;">
|
|
||||||
<tr style="height: 20px !important;"
|
|
||||||
*ngFor="let item of order.lines">
|
|
||||||
<td class="tbdetail"
|
<td class="tbdetail"
|
||||||
style="text-align: left;"
|
style="text-align: left;"
|
||||||
width="55%">{{item.name}}
|
width="55%">{{item.name}}
|
||||||
|
@ -145,17 +122,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<!--
|
|
||||||
<mat-list>
|
|
||||||
<mat-list-item class="text small" *ngFor="let item of order.lines">{{item.qty}} x {{item.name}}</mat-list-item>
|
|
||||||
|
|
||||||
<div class="orderdetail" *ngFor="let item of order.lines">
|
|
||||||
{{ item.name }} Qty.: {{ item.qty }}
|
|
||||||
</div>
|
|
||||||
</mat-list>
|
|
||||||
-->
|
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
<p class="text" *ngIf = "orders.length <= 0">No orders</p>
|
<p class="text" *ngIf = "orders.length <= 0">No orders</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,11 +6,12 @@ import { UserService } from '../user.service';
|
||||||
import {Owner} from '../owner.model';
|
import {Owner} from '../owner.model';
|
||||||
import { OrderService } from '../order/order.service';
|
import { OrderService } from '../order/order.service';
|
||||||
|
|
||||||
import { faTimes } from '@fortawesome/free-solid-svg-icons'
|
import { faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faTimesCircle } from '@fortawesome/free-solid-svg-icons'
|
import { faTimesCircle } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faCheck } from '@fortawesome/free-solid-svg-icons'
|
import { faCheck } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faCheckCircle } from '@fortawesome/free-solid-svg-icons'
|
import { faCheckCircle } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { faHourglass } from '@fortawesome/free-solid-svg-icons'
|
import { faHourglass } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list-orders',
|
selector: 'app-list-orders',
|
||||||
|
@ -32,6 +33,7 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
|
||||||
faCheck = faCheck;
|
faCheck = faCheck;
|
||||||
faCheckCircle = faCheckCircle;
|
faCheckCircle = faCheckCircle;
|
||||||
faHourglass = faHourglass;
|
faHourglass = faHourglass;
|
||||||
|
faTrash = faTrash;
|
||||||
// -------------------------------------
|
// -------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,64 @@ img.icon{
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tbheader {
|
.noOrderMsg {
|
||||||
font-family: Roboto Mono;
|
font-family: Roboto Mono;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
margin-top: 5px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newOrder {
|
||||||
|
font-family: Roboto Mono !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newOrderTitle1 {
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: 700;
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newOrderTitle2 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.newOrdertbheader {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tbdetail {
|
.newOrdertbdetail {
|
||||||
font-family: Roboto Mono;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lineTrashCan {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttons-class {
|
||||||
|
background-color: #ff4700;
|
||||||
|
color: white;
|
||||||
|
font-weight: 700;
|
||||||
|
height: 25px !important;
|
||||||
|
width: 80px !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-cancel-class {
|
||||||
|
font-weight: 700;
|
||||||
|
height: 25px !important;
|
||||||
|
width: 80px !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
<div align="center"
|
<div class="noOrderMsg"
|
||||||
style="font-family: Roboto Mono;
|
*ngIf="order.address.length == 0">
|
||||||
font-size: 14PX;
|
|
||||||
font-weight: 700;
|
|
||||||
margin-top: 5px;" *ngIf="order.address.length == 0">
|
|
||||||
No open order!
|
No open order!
|
||||||
</div>
|
</div>
|
||||||
<mat-card style="margin-top: 10px;" *ngIf="order.address.length" >
|
<mat-card style="margin-top: 10px;" *ngIf="order.address.length" >
|
||||||
|
|
||||||
<div>
|
<div class="newOrder">
|
||||||
<mat-card-title>
|
<mat-card-title>
|
||||||
<table style="width: 100%;"
|
<table style="width: 100%;"
|
||||||
cellspacing="0">
|
cellspacing="0">
|
||||||
<tr style="font-family: Roboto Mono;
|
<tr class="newOrderTitle1">
|
||||||
font-size: 19px;
|
|
||||||
font-weight: 700;
|
|
||||||
height: 20px;">
|
|
||||||
<td width="50%">Order Total:</td>
|
<td width="50%">Order Total:</td>
|
||||||
<td align="right"
|
<td align="right"
|
||||||
width="50%">
|
width="50%">
|
||||||
|
@ -22,17 +16,13 @@
|
||||||
>{{(total/price) | number: '1.0-6'}}
|
>{{(total/price) | number: '1.0-6'}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style="font-family: Roboto Mono;
|
<tr class="newOrderTitle2">
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 400;
|
|
||||||
height: 18px;">
|
|
||||||
<td width="50%">
|
<td width="50%">
|
||||||
<img class="icon"
|
<img class="icon"
|
||||||
style="color: lightgray;
|
style="color: lightgray;
|
||||||
margin-bottom: -3px;"
|
margin-bottom: -3px;"
|
||||||
src="/assets/zec_rv.png"
|
src="/assets/zec_rv.png"
|
||||||
>1.0 ≅ {{ price | currency: getCurrency()}}
|
>1.0 ≅ {{ price | currency: getCurrency()}}
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td width="50%" align="right">
|
<td width="50%" align="right">
|
||||||
{{total | currency: getCurrency()}}
|
{{total | currency: getCurrency()}}
|
||||||
|
@ -41,69 +31,97 @@
|
||||||
</table>
|
</table>
|
||||||
</mat-card-title>
|
</mat-card-title>
|
||||||
<table style="width: 100%;">
|
<table style="width: 100%;">
|
||||||
<!--
|
|
||||||
<div style="display: block;">
|
|
||||||
-->
|
|
||||||
<thead style="width: 100%;">
|
<thead style="width: 100%;">
|
||||||
<tr style="background: lightblue;">
|
<tr style="background: lightblue;">
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="newOrdertbheader"
|
||||||
font-size: 14px;
|
style="text-align: left;"
|
||||||
font-weight: 700;
|
width="50%">Item
|
||||||
text-align: left;"
|
|
||||||
width="55%">Item
|
|
||||||
</th>
|
</th>
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="newOrdertbheader"
|
||||||
font-size: 14px;
|
style="text-align: left;"
|
||||||
font-weight: 700;
|
|
||||||
text-align: left;"
|
|
||||||
width="15%">Qty.
|
width="15%">Qty.
|
||||||
</th>
|
</th>
|
||||||
<th style= "font-family: Roboto Mono;
|
<th class="newOrdertbheader"
|
||||||
font-size: 14px;
|
style="text-align: right;"
|
||||||
font-weight: 700;
|
|
||||||
text-align: right;"
|
|
||||||
width="30%">Total
|
width="30%">Total
|
||||||
</th>
|
</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<!--
|
|
||||||
</div>
|
<tbody>
|
||||||
-->
|
<tr style="height: 30px;"
|
||||||
<tbody style="overflow-y: auto;
|
*ngFor="let item of oLines">
|
||||||
overflow-x: hidden;">
|
<td class="newOrdertbdetail"
|
||||||
<tr style="height: 20px !important;"
|
|
||||||
*ngFor="let item of order.lines">
|
|
||||||
<td class="tbdetail"
|
|
||||||
style="text-align: left;"
|
style="text-align: left;"
|
||||||
width="55%">{{item.name}}
|
width="50%">{{item.name}}
|
||||||
</td>
|
</td>
|
||||||
<td class="tbdetail"
|
<td class="newOrdertbdetail"
|
||||||
style="text-align: left;"
|
style="text-align: left;"
|
||||||
width="15%">{{item.qty}}
|
width="15%">{{item.qty}}
|
||||||
</td>
|
</td>
|
||||||
<td class="tbdetail"
|
<td class="newOrdertbdetail"
|
||||||
style="text-align: right;"
|
style="text-align: right;"
|
||||||
width="30%">{{item.qty * item.cost | number:'1.02' | currency: getCurrency() }}
|
width="30%">{{item.qty * item.cost | number:'1.02' | currency: getCurrency() }}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="lineTrashCan">
|
||||||
|
<a (click)='trashCanClicked(item,oLines)' >
|
||||||
|
<fa-icon [icon]="faTrashAlt"
|
||||||
|
style="color: lightslategrey;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: auto;">
|
||||||
|
</fa-icon>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container" style="margin: 2px;
|
||||||
|
height: 35px;
|
||||||
|
background: lightblue;
|
||||||
|
border-top: 2px solid lightgray;
|
||||||
|
border-bottom: 2px solid lightgray;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;">
|
||||||
|
<!--
|
||||||
<mat-card-actions>
|
<mat-card-actions>
|
||||||
<table cellspacing="0" width="100%">
|
-->
|
||||||
<tr>
|
<table style="margin-top: 4px;" cellspacing="0" width="100%">
|
||||||
|
<tr style="height: 16px;
|
||||||
|
margin-top: 10px">
|
||||||
<td>
|
<td>
|
||||||
<button mat-raised-button class="text" (click)="cancelOrder()">Cancel</button>
|
<button mat-raised-button
|
||||||
|
class="button-cancel-class"
|
||||||
|
(click)="cancelOrder()">
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button mat-raised-button class="text" (click)="invoice()"><fa-icon [icon]="faInvoice" size="2x"></fa-icon> Invoice</button>
|
<button mat-raised-button
|
||||||
|
class="buttons-class"
|
||||||
|
(click)="invoice()">
|
||||||
|
<fa-icon [icon]="faInvoice" ></fa-icon> Invoice
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
|
|
||||||
|
<button mat-raised-button
|
||||||
|
class="buttons-class"
|
||||||
|
(click)="checkout()">
|
||||||
|
Checkout
|
||||||
|
</button>
|
||||||
|
<!--
|
||||||
<button mat-raised-button class="text" color="primary" (click)="checkout()">Checkout</button>
|
<button mat-raised-button class="text" color="primary" (click)="checkout()">Checkout</button>
|
||||||
|
-->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<!--
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<div style="font-family: Roboto Mono;
|
<div style="font-family: Roboto Mono;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { LineItem } from '../items/lineitem.model';
|
||||||
|
import { newLineItem } from '../items/newlineitem.model';
|
||||||
import { Order } from './order.model';
|
import { Order } from './order.model';
|
||||||
import { FullnodeService } from '../fullnode.service';
|
import { FullnodeService } from '../fullnode.service';
|
||||||
import { OrderService } from './order.service';
|
import { OrderService } from './order.service';
|
||||||
|
@ -10,6 +12,12 @@ import { PromptInvoiceComponent } from '../prompt-invoice/prompt-invoice.compone
|
||||||
import { ReceiptQRComponent} from '../receipt-qr/receipt-qr.component';
|
import { ReceiptQRComponent} from '../receipt-qr/receipt-qr.component';
|
||||||
import { faFileInvoiceDollar } from '@fortawesome/free-solid-svg-icons';
|
import { faFileInvoiceDollar } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { faTrashAlt } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { faChevronRight } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import { faSignOut } from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-order',
|
selector: 'app-order',
|
||||||
templateUrl: './order.component.html',
|
templateUrl: './order.component.html',
|
||||||
|
@ -17,6 +25,10 @@ import { faFileInvoiceDollar } from '@fortawesome/free-solid-svg-icons';
|
||||||
})
|
})
|
||||||
|
|
||||||
export class OrderComponent implements OnInit{
|
export class OrderComponent implements OnInit{
|
||||||
|
|
||||||
|
public oLines : newLineItem[] = [];
|
||||||
|
public myLines : LineItem[] = [];
|
||||||
|
|
||||||
faInvoice = faFileInvoiceDollar;
|
faInvoice = faFileInvoiceDollar;
|
||||||
public order: Order = {
|
public order: Order = {
|
||||||
address: '',
|
address: '',
|
||||||
|
@ -42,6 +54,15 @@ export class OrderComponent implements OnInit{
|
||||||
public priceUpdate: Observable<number>;
|
public priceUpdate: Observable<number>;
|
||||||
public totalUpdate: Observable<number>;
|
public totalUpdate: Observable<number>;
|
||||||
|
|
||||||
|
// ------------------------------------
|
||||||
|
//
|
||||||
|
faTrash = faTrash;
|
||||||
|
faTrashAlt = faTrashAlt;
|
||||||
|
faChevronRight = faChevronRight;
|
||||||
|
faSignOut = faSignOut;
|
||||||
|
// -------------------------------------
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public fullnodeService: FullnodeService,
|
public fullnodeService: FullnodeService,
|
||||||
public orderService: OrderService,
|
public orderService: OrderService,
|
||||||
|
@ -54,11 +75,32 @@ export class OrderComponent implements OnInit{
|
||||||
this.orderUpdate = orderService.orderUpdate;
|
this.orderUpdate = orderService.orderUpdate;
|
||||||
this.orderUpdate.subscribe((order) => {
|
this.orderUpdate.subscribe((order) => {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
|
// ------------------------------------------------
|
||||||
|
this.oLines = [];
|
||||||
|
this.myLines = this.order.lines;
|
||||||
|
var nl = {} as newLineItem;
|
||||||
|
|
||||||
|
for ( let i = 0; i < this.myLines.length; i++ )
|
||||||
|
{
|
||||||
|
// console.log("Loop : " + i + " - name : " + this.myLines[i].name);
|
||||||
|
nl = this.fillLineData(i,this.myLines[i].name,
|
||||||
|
this.myLines[i].qty,
|
||||||
|
this.myLines[i].cost) ;
|
||||||
|
// console.log(">> line_id: " + nl.line_id +
|
||||||
|
// " name: " + nl.name +
|
||||||
|
// " qty: " + nl.qty +
|
||||||
|
// " cost: " + nl.cost + " <<"
|
||||||
|
// )
|
||||||
|
this.oLines.push(nl);
|
||||||
|
// this.oLines[i].cost = this.myLines[i].cost;
|
||||||
|
}
|
||||||
|
// ------------------------------------------------
|
||||||
});
|
});
|
||||||
this.totalUpdate = orderService.totalUpdate;
|
this.totalUpdate = orderService.totalUpdate;
|
||||||
this.totalUpdate.subscribe((total) => {
|
this.totalUpdate.subscribe((total) => {
|
||||||
this.total = total;
|
this.total = total;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -82,6 +124,7 @@ export class OrderComponent implements OnInit{
|
||||||
console.log('Returning to page');
|
console.log('Returning to page');
|
||||||
}
|
}
|
||||||
this.orderService.getOrder();
|
this.orderService.getOrder();
|
||||||
|
this.oLines = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +156,7 @@ export class OrderComponent implements OnInit{
|
||||||
dialogRef2.afterClosed().subscribe( val => {
|
dialogRef2.afterClosed().subscribe( val => {
|
||||||
if (val) {
|
if (val) {
|
||||||
console.log('Receipt closed.');
|
console.log('Receipt closed.');
|
||||||
|
this.oLines = [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,6 +180,7 @@ export class OrderComponent implements OnInit{
|
||||||
dialogRef.afterClosed().subscribe((val) => {
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.orderService.closeOrder(false);
|
this.orderService.closeOrder(false);
|
||||||
|
this.oLines = [];
|
||||||
} else {
|
} else {
|
||||||
console.log('Returning to order');
|
console.log('Returning to order');
|
||||||
}
|
}
|
||||||
|
@ -145,4 +190,44 @@ export class OrderComponent implements OnInit{
|
||||||
getCurrency(){
|
getCurrency(){
|
||||||
return this.order.currency.toUpperCase();
|
return this.order.currency.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fillLineData(i: number,
|
||||||
|
iname: string,
|
||||||
|
iqty: number,
|
||||||
|
icost: number) : newLineItem {
|
||||||
|
|
||||||
|
const a = { line_id: i,
|
||||||
|
name: iname,
|
||||||
|
qty: iqty,
|
||||||
|
cost: icost } as newLineItem;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
trashCanClicked(item : newLineItem, lines: newLineItem[]) {
|
||||||
|
|
||||||
|
const dialogConfig = new MatDialogConfig();
|
||||||
|
|
||||||
|
dialogConfig.disableClose = true;
|
||||||
|
dialogConfig.autoFocus = true;
|
||||||
|
dialogConfig.data = {title: 'Remove Item?',
|
||||||
|
msg: 'Are you sure you want to remove <<' +
|
||||||
|
item.name + ' x ' + item.qty +
|
||||||
|
'>> from this order?'};
|
||||||
|
const dialogRef = this.dialog.open(CancelComponent, dialogConfig);
|
||||||
|
dialogRef.afterClosed().subscribe((val) => {
|
||||||
|
if (val) {
|
||||||
|
// console.log('Deleting item at line: '
|
||||||
|
// + (item.line_id +1)
|
||||||
|
// + " => (" + item.name +")");
|
||||||
|
this.orderService.updateOrder(item.line_id,lines);
|
||||||
|
this.orderService.getOrder();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log('Returning to order');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { UserService } from '../user.service';
|
||||||
import { FullnodeService } from '../fullnode.service';
|
import { FullnodeService } from '../fullnode.service';
|
||||||
import { User } from '../user.model';
|
import { User } from '../user.model';
|
||||||
import { Owner } from '../owner.model';
|
import { Owner } from '../owner.model';
|
||||||
import { LineItem} from '../items/lineitem.model';
|
import { LineItem } from '../items/lineitem.model';
|
||||||
|
import { newLineItem } from '../items/newlineitem.model';
|
||||||
|
|
||||||
import { ConfigData } from '../configdata';
|
import { ConfigData } from '../configdata';
|
||||||
|
|
||||||
|
@ -235,4 +236,34 @@ export class OrderService {
|
||||||
return obs;
|
return obs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateOrder(itemid: number, iLines : newLineItem[]) {
|
||||||
|
if(this.dataStore.order._id != null) {
|
||||||
|
|
||||||
|
var item = {} as LineItem;
|
||||||
|
this.dataStore.order.lines = [];
|
||||||
|
for ( let i = 0; i < iLines.length; i++)
|
||||||
|
{
|
||||||
|
if ( i !== itemid )
|
||||||
|
{
|
||||||
|
item = this.fillItemData(iLines[i].name, iLines[i].qty, iLines[i].cost);
|
||||||
|
// console.log("Push => ", item);
|
||||||
|
this.dataStore.order.lines.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let obs = this.http.post(this.beUrl+'api/order', { payload: this.dataStore.order }, { headers: this.reqHeaders });
|
||||||
|
obs.subscribe((orderData) => {
|
||||||
|
this.getOrder();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fillItemData(iname:string, iqty: number, icost: number) : LineItem {
|
||||||
|
|
||||||
|
const a = { name: iname,
|
||||||
|
qty: iqty,
|
||||||
|
cost: icost } as LineItem;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue