From ae4396f6b444ee98328ad866f708408a6cbbb51d Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Sat, 29 Apr 2023 09:21:40 -0500 Subject: [PATCH 1/4] Starting enhancement for buying sessions early --- src/app/app.module.ts | 2 + src/app/sessionpay/sessionpay.component.css | 0 src/app/sessionpay/sessionpay.component.html | 13 ++++ .../sessionpay/sessionpay.component.spec.ts | 23 +++++++ src/app/sessionpay/sessionpay.component.ts | 61 +++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 src/app/sessionpay/sessionpay.component.css create mode 100644 src/app/sessionpay/sessionpay.component.html create mode 100644 src/app/sessionpay/sessionpay.component.spec.ts create mode 100644 src/app/sessionpay/sessionpay.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b7e22c6..7c9d67a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -51,6 +51,7 @@ import { NotifierComponent } from './notifier/notifier.component'; import { PmtserviceComponent } from './pmtservice/pmtservice.component'; import { XeroRegComponent } from './xeroreg/xeroreg.component'; import { DbExportComponent } from './db-export/db-export.component'; +import { SessionpayComponent } from './sessionpay/sessionpay.component'; @NgModule({ declarations: [ @@ -81,6 +82,7 @@ import { DbExportComponent } from './db-export/db-export.component'; PmtserviceComponent, XeroRegComponent, DbExportComponent, + SessionpayComponent, ], imports: [ BrowserModule, diff --git a/src/app/sessionpay/sessionpay.component.css b/src/app/sessionpay/sessionpay.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/sessionpay/sessionpay.component.html b/src/app/sessionpay/sessionpay.component.html new file mode 100644 index 0000000..92be1f4 --- /dev/null +++ b/src/app/sessionpay/sessionpay.component.html @@ -0,0 +1,13 @@ + + + Select session: + + + {{ticket.viewValue}} + + + + + + + diff --git a/src/app/sessionpay/sessionpay.component.spec.ts b/src/app/sessionpay/sessionpay.component.spec.ts new file mode 100644 index 0000000..e68f0ce --- /dev/null +++ b/src/app/sessionpay/sessionpay.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SessionpayComponent } from './sessionpay.component'; + +describe('SessionpayComponent', () => { + let component: SessionpayComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ SessionpayComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SessionpayComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/sessionpay/sessionpay.component.ts b/src/app/sessionpay/sessionpay.component.ts new file mode 100644 index 0000000..21f6435 --- /dev/null +++ b/src/app/sessionpay/sessionpay.component.ts @@ -0,0 +1,61 @@ +import { Inject, Component } from '@angular/core'; +import { ScanComponent } from '../scan/scan.component'; +import { Validators, UntypedFormGroup, FormBuilder } from '@angular/forms'; +import { MatDialog, MatDialogConfig, MAT_DIALOG_DATA} from '@angular/material/dialog'; + +@Component({ + selector: 'app-sessionpay', + templateUrl: './sessionpay.component.html', + styleUrls: ['./sessionpay.component.css'] +}) +export class SessionpayComponent { + + nodeAddress: string = ''; + zecPrice: number = 1; + tickets = [ + { + value: 1, + viewValue: '1 day: USD $1' + },{ + value: 6, + viewValue: '1 week: USD $6' + },{ + value: 22, + viewValue: '1 month: USD $22' + },{ + value: 30, + viewValue: '1 month Pro: USD $30' + } + ]; + payForm: UntypedFormGroup; + session: string; + zecPrice: number; + + constructor( + private dialog: MatDialog, + private fb: FormBuilder, + @Inject(MAT_DIALOG_DATA) public data: { addr: string, session: string, zecPrice: number } + ) { + this.payForm= fb.group({ + session: ['', Validators.required] + }); + this.session = data.session; + this.zecPrice = data.zecPrice; + this.nodeAddress = data.addr; + } + + pay(){ + const dialogConfig = new MatDialogConfig(); + + dialogConfig.disableClose = true; + dialogConfig.autoFocus = true; + dialogConfig.data = { + totalZec: (this.payForm.get('session')!.value)/this.zecPrice, + addr: this.nodeAddress, + session: this.session, + pay: true + }; + + const dialogRef = this.dialog.open(ScanComponent, dialogConfig); + } +} From 53ba8bdce2a1c53096bbee59cefb86ce13f37538 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 2 May 2023 09:08:42 -0500 Subject: [PATCH 2/4] Add dialog to purchase sessions --- src/app/listorders/listorders.component.html | 2 +- src/app/listorders/listorders.component.ts | 34 ++++++++++++++++++++ src/app/sessionpay/sessionpay.component.css | 20 ++++++++++++ src/app/sessionpay/sessionpay.component.html | 6 ++-- src/app/sessionpay/sessionpay.component.ts | 13 ++++++-- 5 files changed, 69 insertions(+), 6 deletions(-) diff --git a/src/app/listorders/listorders.component.html b/src/app/listorders/listorders.component.html index a267f68..63bbd6d 100644 --- a/src/app/listorders/listorders.component.html +++ b/src/app/listorders/listorders.component.html @@ -8,7 +8,7 @@ {{ vE.listordersEndDate }}{{(ownerUpdate | async)!.expiration | date: 'YYYY-MM-dd'}} - diff --git a/src/app/listorders/listorders.component.ts b/src/app/listorders/listorders.component.ts index 0accc90..64afc8b 100644 --- a/src/app/listorders/listorders.component.ts +++ b/src/app/listorders/listorders.component.ts @@ -4,6 +4,7 @@ import { Order } from '../order/order.model'; import { FullnodeService } from '../fullnode.service'; import { UserService } from '../user.service'; import { Owner } from '../owner.model'; +import { User } from '../user.model'; import { OrderService } from '../order/order.service'; import { MatDialog, MatDialogConfig} from '@angular/material/dialog'; @@ -20,6 +21,7 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons'; import { LanguageService } from '../language.service'; import { LanguageData } from '../language.model'; +import {SessionpayComponent} from '../sessionpay/sessionpay.component'; @Component({ selector: 'app-list-orders', @@ -71,6 +73,12 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ viewkey: '', crmToken: '' }; + zecPrice: number = 1; + nodeAddress: string = ''; + session: string = ''; + addrUpdate: Observable; + priceUpdate: Observable; + userUpdate: Observable; // ------------------------------------- // ------------------------------------- // @@ -97,11 +105,24 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ private languageService : LanguageService, public orderService: OrderService, public userService: UserService, + public fullnodeService: FullnodeService, private dialog: MatDialog) { this.ownerUpdate = userService.ownerUpdate; + this.userUpdate = userService.userUpdate; this.orderService.getAllOrders(); this.ordersUpdate = orderService.allOrdersUpdate; + this.addrUpdate = fullnodeService.addrUpdate; + this.priceUpdate = fullnodeService.priceUpdate; + this.priceUpdate.subscribe(price => { + this.zecPrice = price; + }); + this.addrUpdate.subscribe(nAddress => { + this.nodeAddress = nAddress; + }); + this.userUpdate.subscribe(user => { + this.session = user.session; + }); } ngOnInit(){ @@ -237,4 +258,17 @@ export class ListOrdersComponent implements OnInit, OnDestroy{ ); } + paySession() { + const dialogConfig = new MatDialogConfig(); + + dialogConfig.disableClose = true; + dialogConfig.autoFocus = true; + dialogConfig.data = { + addr: this.nodeAddress, + session: this.session, + zecPrice: this.zecPrice + }; + + const dialogRef = this.dialog.open(SessionpayComponent, dialogConfig); + } } diff --git a/src/app/sessionpay/sessionpay.component.css b/src/app/sessionpay/sessionpay.component.css index e69de29..a203629 100644 --- a/src/app/sessionpay/sessionpay.component.css +++ b/src/app/sessionpay/sessionpay.component.css @@ -0,0 +1,20 @@ + +* { + font-family: 'Spartan', sans-serif; +} + +.settings-title { + font-family: 'Spartan', sans-serif; + background: #ff5722; + color: white; + font-size: 30px; + text-align: center; + padding: 5px; + margin-bottom: 10px; +} + +.container { + display: flex; + justify-content: space-between; + align-items: center; +} diff --git a/src/app/sessionpay/sessionpay.component.html b/src/app/sessionpay/sessionpay.component.html index 92be1f4..bc1ce7d 100644 --- a/src/app/sessionpay/sessionpay.component.html +++ b/src/app/sessionpay/sessionpay.component.html @@ -1,3 +1,4 @@ +
Purchase Session
Select session: @@ -7,7 +8,8 @@ - +
+ - +
diff --git a/src/app/sessionpay/sessionpay.component.ts b/src/app/sessionpay/sessionpay.component.ts index 21f6435..bd2c100 100644 --- a/src/app/sessionpay/sessionpay.component.ts +++ b/src/app/sessionpay/sessionpay.component.ts @@ -1,7 +1,7 @@ import { Inject, Component } from '@angular/core'; import { ScanComponent } from '../scan/scan.component'; import { Validators, UntypedFormGroup, FormBuilder } from '@angular/forms'; -import { MatDialog, MatDialogConfig, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; @Component({ selector: 'app-sessionpay', @@ -29,10 +29,10 @@ export class SessionpayComponent { ]; payForm: UntypedFormGroup; session: string; - zecPrice: number; constructor( private dialog: MatDialog, + private dialogRef: MatDialogRef, private fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: { addr: string, session: string, zecPrice: number } ) { @@ -56,6 +56,13 @@ export class SessionpayComponent { pay: true }; - const dialogRef = this.dialog.open(ScanComponent, dialogConfig); + const dialogRef1 = this.dialog.open(ScanComponent, dialogConfig); + dialogRef1.afterClosed().subscribe(val => { + this.dialogRef.close(); + }); + } + + close(){ + this.dialogRef.close(); } } From df8244f882850a4dee7751b0715187e9c17780c2 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 2 May 2023 09:11:58 -0500 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/app/app.component.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfa9150..523ce58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ 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). +## [2.1.0] + +### Added + +- New dialog to purchase sessions ahead of expiration. + ## [2.0.0] - 2023-03-16 ### Added diff --git a/package.json b/package.json index 8672f5f..390ffa2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zgo", - "version": "2.0.0-beta", + "version": "2.1.0", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/src/app/app.component.html b/src/app/app.component.html index 710c5fc..edb451e 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -45,7 +45,7 @@ style="margin-top: 10px; margin-bottom: 20px;">
© 2023 Vergara Technologies LLC
-
Version 2.0.0
+
Version 2.1.0
{{ vE.mainPriceData }}
From 225a4ae881a1c07111f2b2cd53d819b744da4200 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 2 May 2023 18:00:18 -0500 Subject: [PATCH 4/4] Release prep --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 523ce58..883aaa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ 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). -## [2.1.0] +## [2.1.0] - 2023-05-02 ### Added