Merge branch 'zgo-test' of gitlab.com:pitmutt/zgo into zgo-test

This commit is contained in:
Rene Vergara 2022-07-14 15:30:06 -05:00
commit dca862d263
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2
27 changed files with 7615 additions and 5849 deletions

View file

@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
- (2022-07-13) Orders's list UI reviewed and apdated
+ Order generation and Availavle Items form completed
- (2022-07-12) Set configuration global parameters in one place
+ Static class ConfigData created
- configdata.ts created inside "src/app/" folder
+ Services modified to include config data
### Changed ### Changed

View file

@ -105,6 +105,5 @@
} }
} }
} }
}, }
"defaultProject": "zgo"
} }

12837
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,16 +10,16 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "~13.0.2", "@angular/animations": "^14.0.5",
"@angular/cdk": "^12.2.8", "@angular/cdk": "^13.3.9",
"@angular/common": "~13.0.2", "@angular/common": "^14.0.5",
"@angular/compiler": "~13.0.2", "@angular/compiler": "^14.0.5",
"@angular/core": "~13.0.2", "@angular/core": "^14.0.5",
"@angular/forms": "~13.0.2", "@angular/forms": "^14.0.5",
"@angular/material": "^12.2.8", "@angular/material": "^13.3.9",
"@angular/platform-browser": "~13.0.2", "@angular/platform-browser": "^14.0.5",
"@angular/platform-browser-dynamic": "~13.0.2", "@angular/platform-browser-dynamic": "^14.0.5",
"@angular/router": "~13.0.2", "@angular/router": "^14.0.5",
"@fortawesome/angular-fontawesome": "^0.10.2", "@fortawesome/angular-fontawesome": "^0.10.2",
"@fortawesome/fontawesome-free": "^6.1.1", "@fortawesome/fontawesome-free": "^6.1.1",
"@fortawesome/fontawesome-svg-core": "^6.1.0", "@fortawesome/fontawesome-svg-core": "^6.1.0",
@ -41,9 +41,9 @@
"zone.js": "~0.11.4" "zone.js": "~0.11.4"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~13.0.2", "@angular-devkit/build-angular": "^14.0.5",
"@angular/cli": "~13.0.2", "@angular/cli": "^14.0.5",
"@angular/compiler-cli": "~13.0.2", "@angular/compiler-cli": "^14.0.5",
"@types/jasmine": "~3.8.0", "@types/jasmine": "~3.8.0",
"@types/node": "^12.20.33", "@types/node": "^12.20.33",
"@types/urlsafe-base64": "^1.0.28", "@types/urlsafe-base64": "^1.0.28",
@ -54,6 +54,6 @@
"karma-coverage": "~2.0.3", "karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0", "karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0", "karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.4" "typescript": "~4.7.4"
} }
} }

View file

@ -93,15 +93,6 @@ import { PromptInvoiceComponent } from './prompt-invoice/prompt-invoice.componen
MatIconModule MatIconModule
], ],
providers: [], providers: [],
bootstrap: [AppComponent], bootstrap: [AppComponent]
entryComponents: [
ItemCreateComponent,
ItemDeleteComponent,
ItemAddComponent,
CancelComponent,
CheckoutComponent,
SettingsComponent,
ScanComponent
]
}) })
export class AppModule { } export class AppModule { }

View file

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'; import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
import { MatDialog, MatDialogConfig} from '@angular/material/dialog'; import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
import { ProgressBarMode } from '@angular/material/progress-bar'; import { ProgressBarMode } from '@angular/material/progress-bar';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -38,8 +38,8 @@ export class BusinessComponent implements OnInit {
viewValue: '1 month: 0.1 ZEC' viewValue: '1 month: 0.1 ZEC'
} }
]; ];
bizForm: FormGroup; bizForm: UntypedFormGroup;
payForm: FormGroup; payForm: UntypedFormGroup;
barMessage = 'Awaiting for transaction'; barMessage = 'Awaiting for transaction';
barMode: ProgressBarMode = 'indeterminate'; barMode: ProgressBarMode = 'indeterminate';
barValue = 0; barValue = 0;
@ -77,7 +77,7 @@ export class BusinessComponent implements OnInit {
termsChecked = false; termsChecked = false;
constructor( constructor(
private fb: FormBuilder, private fb: UntypedFormBuilder,
private userService: UserService, private userService: UserService,
private fullnodeService: FullnodeService, private fullnodeService: FullnodeService,
private dialog: MatDialog, private dialog: MatDialog,

4
src/app/configdata.ts Normal file
View file

@ -0,0 +1,4 @@
export class ConfigData {
public static Be_URL : string = 'https://test.zgo.cash/';
public static UsrPwd : string = 'user:superSecret2';
}

View file

@ -4,12 +4,14 @@ import {HttpClient, HttpParams, HttpHeaders} from '@angular/common/http';
import {UserService} from './user.service'; import {UserService} from './user.service';
import { Owner } from './owner.model'; import { Owner } from './owner.model';
import { ConfigData } from './configdata';
var Buffer = require('buffer/').Buffer; var Buffer = require('buffer/').Buffer;
//import {User} from './user.model'; //import {User} from './user.model';
@Injectable({providedIn: 'root'}) @Injectable({providedIn: 'root'})
export class FullnodeService{ export class FullnodeService{
beUrl = 'https://test.zgo.cash/'; beUrl = ConfigData.Be_URL;
private dataStore: { height: number, memoList: string[], addr: string, price: number } = { height: 0, memoList: [], addr: '', price:0 }; private dataStore: { height: number, memoList: string[], addr: string, price: number } = { height: 0, memoList: [], addr: '', price:0 };
private _heightUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.height); private _heightUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.height);
private _memoUpdated: BehaviorSubject<string[]> = new BehaviorSubject(this.dataStore.memoList); private _memoUpdated: BehaviorSubject<string[]> = new BehaviorSubject(this.dataStore.memoList);
@ -49,7 +51,7 @@ export class FullnodeService{
}; };
constructor(private http: HttpClient, public userService: UserService){ constructor(private http: HttpClient, public userService: UserService){
var auth = 'Basic ' + Buffer.from('user:superSecret2').toString('base64'); var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
this.reqHeaders = new HttpHeaders().set('Authorization', auth); this.reqHeaders = new HttpHeaders().set('Authorization', auth);
this.ownerUpdate = userService.ownerUpdate; this.ownerUpdate = userService.ownerUpdate;
this.getAddr(); this.getAddr();

View file

@ -1,6 +1,6 @@
import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
import { LineItem } from '../lineitem.model'; import { LineItem } from '../lineitem.model';
import { Order } from '../../order/order.model'; import { Order } from '../../order/order.model';
@ -12,12 +12,12 @@ import { Order } from '../../order/order.model';
export class ItemAddComponent implements OnInit { export class ItemAddComponent implements OnInit {
orderForm: FormGroup; orderForm: UntypedFormGroup;
lineItem: LineItem; lineItem: LineItem;
//order: Order; //order: Order;
constructor( constructor(
private fb: FormBuilder, private fb: UntypedFormBuilder,
private dialogRef: MatDialogRef<ItemAddComponent>, private dialogRef: MatDialogRef<ItemAddComponent>,
@Inject(MAT_DIALOG_DATA) public data: LineItem @Inject(MAT_DIALOG_DATA) public data: LineItem
) { ) {

View file

@ -1,6 +1,6 @@
import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import { UntypedFormBuilder, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
import { Item } from '../item.model'; import { Item } from '../item.model';
@ -12,12 +12,12 @@ import { Item } from '../item.model';
export class ItemCreateComponent implements OnInit { export class ItemCreateComponent implements OnInit {
form: FormGroup; form: UntypedFormGroup;
id: string | undefined = ''; id: string | undefined = '';
numberRegEx = /\d*\.?\d{1,2}/; numberRegEx = /\d*\.?\d{1,2}/;
constructor( constructor(
private fb: FormBuilder, private fb: UntypedFormBuilder,
private dialogRef: MatDialogRef<ItemCreateComponent>, private dialogRef: MatDialogRef<ItemCreateComponent>,
@Inject(MAT_DIALOG_DATA) public data: Item @Inject(MAT_DIALOG_DATA) public data: Item
){ ){
@ -26,7 +26,7 @@ export class ItemCreateComponent implements OnInit {
id: [''], id: [''],
name: [null, Validators.required], name: [null, Validators.required],
description: [null, Validators.required], description: [null, Validators.required],
cost: new FormControl('', { cost: new UntypedFormControl('', {
validators: [Validators.required, Validators.pattern(this.numberRegEx)], validators: [Validators.required, Validators.pattern(this.numberRegEx)],
updateOn: "blur" updateOn: "blur"
}) })
@ -37,7 +37,7 @@ export class ItemCreateComponent implements OnInit {
id: [data._id], id: [data._id],
name: [data.name, Validators.required], name: [data.name, Validators.required],
description: [data.description, Validators.required], description: [data.description, Validators.required],
cost: new FormControl(data.cost, { cost: new UntypedFormControl(data.cost, {
validators: [Validators.required, Validators.pattern(this.numberRegEx)], validators: [Validators.required, Validators.pattern(this.numberRegEx)],
updateOn: "blur" updateOn: "blur"
}) })

View file

@ -25,6 +25,27 @@ div.card{
} }
p.price{ p.price{
font-family: 'Roboto-Mono', monospace; font-family: 'Roboto Mono', monospace;
margin: 0px; margin: 0px;
} }
.rv_price {
font-family: Roboto Mono;
font-size: 16px;
text-align: right;
}
/* Style buttons */
.btn {
background-color: DodgerBlue; /* Blue background */
border: none; /* Remove borders */
color: white; /* White text */
padding: 12px 16px; /* Some padding */
font-size: 16px; /* Set a font size */
cursor: pointer; /* Mouse pointer on hover */
}
/* Darker background on mouse-over */
.btn:hover {
background-color: RoyalBlue;
}

View file

@ -1,19 +1,35 @@
<div *ngIf="items.length > 0"> <div *ngIf="items.length > 0">
<div class="card" *ngFor="let item of itemsUpdate | async"> <div class="card" *ngFor="let item of itemsUpdate | async">
<mat-card> <mat-card>
<table cellspacing="0" width="100%" class="text"> <table cellspacing="0" width="100%" >
<tr> <tr>
<td>{{item.name}}</td> <td style="font-family: Roboto Mono;
<td align="right"> font-size: 16px;
<p class="price">{{item.cost | currency: getCurrency() }}</p> font-weight: 700;
<p class="price" *ngIf="!owner.zats"><img class="icon" src="/assets/spartan-zec.png" width="12px" />{{(item.cost/zecPrice) | number: '1.0-6'}}</p> height: 20px;">
<p class="price" *ngIf="owner.zats">&#x24e9; {{(item.cost/zecPrice)*100000000 | number: '1.0-0'}}</p> {{item.name}}
</td>
<td></td>
</tr>
<tr>
<td style="font-family: Roboto Mono;
font-size: 16px;
font-weight: 400;
height: 20px;">
{{item.description}}
</td>
<td>
<div class="rv_price" *ngIf="!owner.zats">
<img class="icon"
src="/assets/zec_rv.png"
height="16px">{{(item.cost/price) | number: '1.06'}}
[{{item.cost | number: '1.02' | currency: getCurrency() }}]
</div>
<p class="price" *ngIf="owner.zats"> &#x24e9;(item.cost/price)*100000000 | number: '1.0-0'}}</p>
</td> </td>
</tr> </tr>
</table> </table>
<div align="center">
<p class="text small">{{item.description}}</p>
</div>
<mat-card-actions> <mat-card-actions>
<table cellspacing="0" width="100%"> <table cellspacing="0" width="100%">
<tr> <tr>
@ -26,6 +42,13 @@
</button> </button>
</td> </td>
<td align="right"> <td align="right">
<!--
<button class="btn">
<fa-icon [icon]="getIcon(order)" >
</fa-icon>
</button>
-->
<button mat-raised-button color="primary" class="icons" (click)="addToOrder(item._id!)"> <button mat-raised-button color="primary" class="icons" (click)="addToOrder(item._id!)">
<mat-icon>shopping_cart</mat-icon> <mat-icon>shopping_cart</mat-icon>
</button> </button>

View file

@ -3,12 +3,19 @@ import { Injectable } from '@angular/core';
import { Subject, BehaviorSubject, Observable } from 'rxjs'; import { Subject, BehaviorSubject, Observable } from 'rxjs';
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { ConfigData } from '../configdata';
var Buffer = require('buffer/').Buffer; var Buffer = require('buffer/').Buffer;
@Injectable({providedIn: 'root'}) @Injectable({providedIn: 'root'})
export class ItemService{ export class ItemService{
beUrl = 'https://test.zgo.cash/'; // beUrl = 'https://test.zgo.cash/';
beUrl = ConfigData.Be_URL;
// console.log(ConfigData.Be_URL);
private dataStore: { items: Item[] } = { items: [] } ; private dataStore: { items: Item[] } = { items: [] } ;
private _itemsUpdated: BehaviorSubject<Item[]> = new BehaviorSubject(this.dataStore.items); private _itemsUpdated: BehaviorSubject<Item[]> = new BehaviorSubject(this.dataStore.items);
public readonly itemsUpdated: Observable<Item[]> = this._itemsUpdated.asObservable(); public readonly itemsUpdated: Observable<Item[]> = this._itemsUpdated.asObservable();
@ -16,7 +23,7 @@ export class ItemService{
private reqHeaders: HttpHeaders; private reqHeaders: HttpHeaders;
constructor(private http: HttpClient){ constructor(private http: HttpClient){
var auth = 'Basic ' + Buffer.from('user:superSecret2').toString('base64'); var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
this.reqHeaders = new HttpHeaders().set('Authorization', auth); this.reqHeaders = new HttpHeaders().set('Authorization', auth);
} }

View file

@ -3,9 +3,9 @@
} }
.text2 { .text2 {
font-family: 'Noto sans'; font-family: 'Roboto Mono';
font-size: 15px; font-size: 14px;
color: #000080; color: #000000;
text-align: left; text-align: left;
margin-left: 5px; margin-left: 5px;
background: lightgray; background: lightgray;
@ -16,12 +16,12 @@
} }
.orderdetail { .orderdetail {
font-family: 'Noto sans'; font-family: 'Roboto Mono';
font-size: 15px; font-size: 12px;
color: #000080; color: #000000;
text-align: left; text-align: left;
margin-left: 5px; margin-left: 5px;
background: lightyellow; background: lightcyan;
} }
@ -31,6 +31,7 @@
img.icon{ img.icon{
margin-bottom: -2px; margin-bottom: -2px;
height: 18px;
} }
.price{ .price{
@ -50,12 +51,13 @@ img.icon{
} }
.total{ .total{
font-size: large; font-size: 15px;
font-family: 'Roboto Mono', monospace; font-family: 'Roboto Mono', monospace;
margin: auto;
} }
img.total{ img.total{
margin-bottom:-2px; margin-bottom: -15px !important;
} }
.central{ .central{

View file

@ -8,25 +8,25 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<div align="center"> <div align="center">
<div class="central"> <div class="central">
<table class="text" width="75%"> <table class="text" style="font-size: 12px !important;" width="75%">
<tr> <tr>
<td width="50%" align="center"> <td width="50%" align="center">
<h3>Today's Total:</h3> <h3>Today's Total:</h3>
<p class="total"> <div class="total">
<img src="/assets/zcash.png" <img src="/assets/zec_rv.png"
style='height: 18px; style='height: 16px !important;
margin: auto;'/> margin: -2px;'/>
{{todayTotal | number: '1.0-6'}} {{todayTotal | number: '1.06'}}
</p> </div>
</td> </td>
<td width="50%" align="center"> <td width="50%" align="center">
<h3>Overall Total:</h3> <h3>Overall Total:</h3>
<p class="total"> <div class="total">
<img src="/assets/zcash.png" <img src="/assets/zec_rv.png"
style='height: 18px; style='height: 16px !important;
margin: auto;'/> margin: -2px;'/>
{{total | number: '1.0-6'}} {{total | number: '1.06'}}
</p> </div>
</td> </td>
</tr> </tr>
</table> </table>
@ -40,20 +40,20 @@
<mat-expansion-panel-header class="text" > <mat-expansion-panel-header class="text" >
<mat-panel-title> <mat-panel-title>
<span class="price" <span class="price"
style='font-family: Noto sans !important; style='font-family: Roboto Mono !important;
font-size: 15px; font-size: 14px;
font-weight: strong; font-weight: strong;
color: black !important; color: black !important;
margin: auto;'> margin: auto;'>
<img src="/assets/zcash.png" <img src="/assets/zec_rv.png"
style='height: 18px; style='height: 16px;
margin: auto; '/>&nbsp;{{order.totalZec | number: '1.0-6'}} margin: auto; '/>&nbsp;{{order.totalZec | number: '1.06'}}
</span> </span>
</mat-panel-title> </mat-panel-title>
<mat-panel-description> <mat-panel-description>
<fa-icon [icon]="getIcon(order)" [style]="getIconStyle(order)" ></fa-icon> <fa-icon [icon]="getIcon(order)" [style]="getIconStyle(order)" ></fa-icon>
<div style='font-family: Noto sans !important; <div style='font-family: Roboto Mono !important;
font-size: 15px; font-size: 14px;
font-weight: strong; font-weight: strong;
color: black !important; color: black !important;
margin: auto;'> margin: auto;'>
@ -63,17 +63,97 @@
</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 class="text2"><b>ZCash price</b>: {{order.price | currency: order.currency.toUpperCase()}}
</div> </div>
</div>
<mat-list>
<!-- <!--
<mat-list-item class="text small" *ngFor="let item of order.lines">{{item.qty}} x {{item.name}}</mat-list-item> order header
--> -->
<table style="width: 100%;"
cellspacing="0">
<tr style="font-family: Roboto Mono;
font-size: 19px;
font-weight: 700;
height: 20px;">
<td width="50%">Order Total:</td>
<td align="right"
width="50%">
<img class="icon" src="/assets/zec_rv.png"
>{{ order.totalZec | number: '1.06'}}
</td>
</tr>
<tr style="font-family: Roboto Mono;
font-size: 16px;
font-weight: 400;
height: 18px;">
<td width="50%">
<img class="icon"
style="color: lightgray;
margin-bottom: -3px;"
src="/assets/zec_rv.png"
>1.0 = {{ order.price | currency: order.currency.toUpperCase()}}
</td>
<td width="50%" align="right">
{{ order.total | number: '1.02' | currency: order.currency.toUpperCase()}}
</td>
</tr>
</table>
<table style="width: 100%;">
<!--
<div style="display: block;">
-->
<thead style="width: 100%;">
<tr style="background: lightblue;">
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: left;"
width="55%">Item
</th>
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: left;"
width="15%">Qty.
</th>
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: right;"
width="30%">Total
</th>
</tr>
</thead>
<!--
</div>
-->
<tbody style="overflow-y: auto;
overflow-x: hidden;">
<tr style="height: 20px !important;"
*ngFor="let item of order.lines">
<td class="tbdetail"
style="text-align: left;"
width="55%">{{item.name}}
</td>
<td class="tbdetail"
style="text-align: left;"
width="15%">{{item.qty}}
</td>
<td class="tbdetail"
style="text-align: right;"
width="30%">{{item.qty * item.cost | number:'1.02' | currency: order.currency.toUpperCase() }}
</td>
</tr>
</tbody>
</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"> <div class="orderdetail" *ngFor="let item of order.lines">
{{ item.name }} Qty.: {{ item.qty }} {{ item.name }} Qty.: {{ item.qty }}
</div> </div>
</mat-list> </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>

View file

@ -76,8 +76,8 @@ export class ListOrdersComponent implements OnInit, OnDestroy{
getIconStyle(order : Order) { getIconStyle(order : Order) {
if( order.paid ) if( order.paid )
return "font-size: 16px; color: #72cc50; margin: auto;"; return "font-size: 14px; color: #72cc50; margin-bottom: -2px;";
return "color: #88293d; cursor: pointer;"; return "color: #FB4F14; margin-bottom: -2px; cursor: pointer;";
} }

View file

@ -1,7 +1,7 @@
import { Component, OnInit, OnDestroy, Injectable, ChangeDetectorRef, ViewChild, AfterViewInit } from '@angular/core'; import { Component, OnInit, OnDestroy, Injectable, ChangeDetectorRef, ViewChild, AfterViewInit } from '@angular/core';
import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot, ActivatedRoute } from '@angular/router'; import { CanActivate, Router, RouterStateSnapshot, ActivatedRouteSnapshot, ActivatedRoute } from '@angular/router';
import { MatDialog, MatDialogConfig} from '@angular/material/dialog'; import { MatDialog, MatDialogConfig} from '@angular/material/dialog';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
import { ProgressBarMode } from '@angular/material/progress-bar'; import { ProgressBarMode } from '@angular/material/progress-bar';
import { MatStepper } from '@angular/material/stepper'; import { MatStepper } from '@angular/material/stepper';
import { UserService } from '../user.service'; import { UserService } from '../user.service';
@ -89,12 +89,12 @@ export class LoginComponent implements OnInit, AfterViewInit {
barMessage = 'Scanning blockchain for login memo, please wait.'; barMessage = 'Scanning blockchain for login memo, please wait.';
@ViewChild('stepper') private myStepper?: MatStepper; @ViewChild('stepper') private myStepper?: MatStepper;
entryForm: FormGroup; entryForm: UntypedFormGroup;
pinForm: FormGroup; pinForm: UntypedFormGroup;
constructor( constructor(
private fb: FormBuilder, private fb: UntypedFormBuilder,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
public fullnodeService: FullnodeService, public fullnodeService: FullnodeService,
private router: Router, private router: Router,

View file

@ -5,6 +5,20 @@
.number{ .number{
font-family: 'Roboto Mono', monospace; font-family: 'Roboto Mono', monospace;
} }
img.icon{ img.icon{
margin-bottom: -3px; margin-bottom: -2px;
height: 18px;
}
.tbheader {
font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
}
.tbdetail {
font-family: Roboto Mono;
font-size: 14px;
font-weight: 400;
} }

View file

@ -1,28 +1,92 @@
<div align="center"> <div align="center"
<p *ngIf="order.address.length == 0">No open order!</p> style="font-family: Roboto Mono;
font-size: 14PX;
font-weight: 700;
margin-top: 5px;" *ngIf="order.address.length == 0">
No open order!
</div> </div>
<mat-card class="text" *ngIf="order.address.length > 0"> <mat-card style="margin-top: 10px;" *ngIf="order.address.length" >
<div align="center">
<div>
<mat-card-title> <mat-card-title>
<table cellspacing="0" width="100%"> <table style="width: 100%;"
<tr> cellspacing="0">
<td>Order Total:</td> <tr style="font-family: Roboto Mono;
<td align="right"> font-size: 19px;
<p class="number">{{total | currency: getCurrency()}}</p> font-weight: 700;
<p class="number"><img class="icon" src="/assets/spartan-zec.png" width="15px" />{{(total/price) | number: '1.0-6'}}</p> height: 20px;">
<td width="50%">Order Total:</td>
<td align="right"
width="50%">
<img class="icon" src="/assets/zec_rv.png"
>{{(total/price) | number: '1.0-6'}}
</td>
</tr>
<tr style="font-family: Roboto Mono;
font-size: 16px;
font-weight: 400;
height: 18px;">
<td width="50%">
<img class="icon"
style="color: lightgray;
margin-bottom: -3px;"
src="/assets/zec_rv.png"
>1.0 &cong; {{ price | currency: getCurrency()}}
</td>
<td width="50%" align="right">
{{total | currency: getCurrency()}}
</td> </td>
</tr> </tr>
</table> </table>
</mat-card-title> </mat-card-title>
<table> <table style="width: 100%;">
<tr> <!--
<th>Qty.</th> <div style="display: block;">
<th>Items</th> -->
<thead style="width: 100%;">
<tr style="background: lightblue;">
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: left;"
width="55%">Item
</th>
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: left;"
width="15%">Qty.
</th>
<th style= "font-family: Roboto Mono;
font-size: 14px;
font-weight: 700;
text-align: right;"
width="30%">Total
</th>
</tr> </tr>
<tr *ngFor="let item of order.lines"> </thead>
<td align="right">{{item.qty}}</td> <!--
<td>{{item.name}}</td> </div>
-->
<tbody style="overflow-y: auto;
overflow-x: hidden;">
<tr style="height: 20px !important;"
*ngFor="let item of order.lines">
<td class="tbdetail"
style="text-align: left;"
width="55%">{{item.name}}
</td>
<td class="tbdetail"
style="text-align: left;"
width="15%">{{item.qty}}
</td>
<td class="tbdetail"
style="text-align: right;"
width="30%">{{item.qty * item.cost | number:'1.02' | currency: getCurrency() }}
</td>
</tr> </tr>
</tbody>
</table> </table>
</div> </div>
<mat-card-actions> <mat-card-actions>
@ -41,4 +105,11 @@
</table> </table>
</mat-card-actions> </mat-card-actions>
</mat-card> </mat-card>
<div style="font-family: Roboto Mono;
font-size: 18px;
font-weight: 700;
margin-left: 10px;
margin-top: 5px;" >
Available Items:
</div>

View file

@ -8,12 +8,14 @@ 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 { ConfigData } from '../configdata';
var Buffer = require('buffer/').Buffer; var Buffer = require('buffer/').Buffer;
@Injectable({providedIn: 'root'}) @Injectable({providedIn: 'root'})
export class OrderService { export class OrderService {
beUrl = 'https://test.zgo.cash/'; beUrl = ConfigData.Be_URL;
private dataStore: {allOrders: Order[], user: User, order: Order, owner: Owner } = { private dataStore: {allOrders: Order[], user: User, order: Order, owner: Owner } = {
allOrders: [], allOrders: [],
user:{ user:{
@ -82,7 +84,7 @@ export class OrderService {
public fullnodeService: FullnodeService, public fullnodeService: FullnodeService,
public userService: UserService public userService: UserService
) { ) {
var auth = 'Basic ' + Buffer.from('user:superSecret2').toString('base64'); var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
this.reqHeaders = new HttpHeaders().set('Authorization', auth); this.reqHeaders = new HttpHeaders().set('Authorization', auth);
this.userUpdate = userService.userUpdate; this.userUpdate = userService.userUpdate;
this.ownerUpdate = userService.ownerUpdate; this.ownerUpdate = userService.ownerUpdate;

View file

@ -5,13 +5,15 @@ import { Order } from './order/order.model';
import { Owner } from './owner.model'; import { Owner } from './owner.model';
import { UserService } from './user.service'; import { UserService } from './user.service';
import { ConfigData } from './configdata';
var Buffer = require('buffer/').Buffer; var Buffer = require('buffer/').Buffer;
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ReceiptService { export class ReceiptService {
beUrl = 'https://test.zgo.cash/'; beUrl = ConfigData.Be_URL;
private dataStore: {order: Order, owner: Owner } = { private dataStore: {order: Order, owner: Owner } = {
owner: { owner: {
_id: '', _id: '',
@ -68,7 +70,7 @@ export class ReceiptService {
private http: HttpClient, private http: HttpClient,
public userService: UserService public userService: UserService
) { ) {
var auth = 'Basic ' + Buffer.from('user:superSecret2').toString('base64'); var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
this.reqHeaders = new HttpHeaders().set('Authorization', auth); this.reqHeaders = new HttpHeaders().set('Authorization', auth);
this.ownerUpdate = userService.ownerUpdate; this.ownerUpdate = userService.ownerUpdate;
} }

View file

@ -1,7 +1,7 @@
import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core'; import { Inject, Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSlideToggleChange } from '@angular/material/slide-toggle'; import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms'; import { UntypedFormBuilder, Validators, UntypedFormGroup, FormControl } from '@angular/forms';
import {User} from '../user.model'; import {User} from '../user.model';
import {Owner} from '../owner.model'; import {Owner} from '../owner.model';
@ -13,7 +13,7 @@ import {Owner} from '../owner.model';
export class SettingsComponent implements OnInit { export class SettingsComponent implements OnInit {
settingsForm: FormGroup; settingsForm: UntypedFormGroup;
owner: Owner; owner: Owner;
useZats: boolean; useZats: boolean;
coins = [ coins = [
@ -36,7 +36,7 @@ export class SettingsComponent implements OnInit {
]; ];
constructor( constructor(
private fb: FormBuilder, private fb: UntypedFormBuilder,
private dialogRef: MatDialogRef<SettingsComponent>, private dialogRef: MatDialogRef<SettingsComponent>,
@Inject(MAT_DIALOG_DATA) public data: Owner @Inject(MAT_DIALOG_DATA) public data: Owner
) { ) {

View file

@ -6,12 +6,14 @@ import {Owner} from './owner.model';
import { Country } from './country.model'; import { Country } from './country.model';
import {Tx} from './tx.model'; import {Tx} from './tx.model';
import { ConfigData } from './configdata';
var Buffer = require('buffer/').Buffer; var Buffer = require('buffer/').Buffer;
@Injectable({providedIn: 'root'}) @Injectable({providedIn: 'root'})
export class UserService{ export class UserService{
beUrl = 'https://test.zgo.cash/'; beUrl = ConfigData.Be_URL;
private dataStore: { user: User, owner: Owner, txs: Tx[], countries: Country[]} = { private dataStore: { user: User, owner: Owner, txs: Tx[], countries: Country[]} = {
user: { user: {
address: '', address: '',
@ -67,7 +69,7 @@ export class UserService{
private reqHeaders: HttpHeaders; private reqHeaders: HttpHeaders;
constructor(private http: HttpClient){ constructor(private http: HttpClient){
var auth = 'Basic ' + Buffer.from('user:superSecret2').toString('base64'); var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
this.reqHeaders = new HttpHeaders().set('Authorization', auth); this.reqHeaders = new HttpHeaders().set('Authorization', auth);
//console.log('US:', this.reqHeaders); //console.log('US:', this.reqHeaders);
this.session = localStorage.getItem('s4z_token'); this.session = localStorage.getItem('s4z_token');

BIN
src/assets/zec_rv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View file

@ -1,4 +1,4 @@
@import "~@angular/material/_theming.scss"; @import "@angular/material/_theming";
@include mat-core(); @include mat-core();

View file

@ -2,7 +2,7 @@
/*@import '@angular/material/prebuilt-themes/indigo-pink.css';*/ /*@import '@angular/material/prebuilt-themes/indigo-pink.css';*/
/*@use '~@angular/material' as mat;*/ /*@use '@angular/material' as mat;*/
/*@include mat.core();*/ /*@include mat.core();*/

View file

@ -14,7 +14,7 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,
"target": "es2017", "target": "es2020",
"module": "es2020", "module": "es2020",
"lib": [ "lib": [
"es2018", "es2018",