From d66b956773940a6e774723f9bd1befb48e2aefb3 Mon Sep 17 00:00:00 2001 From: Rene Vergara A Date: Sat, 17 Dec 2022 19:18:28 -0500 Subject: [PATCH] Update invoice component for Woocommerce --- src/app/invoice/invoice.component.html | 9 +++++++- src/app/invoice/invoice.component.ts | 29 +++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/app/invoice/invoice.component.html b/src/app/invoice/invoice.component.html index c64927a..23f8302 100644 --- a/src/app/invoice/invoice.component.html +++ b/src/app/invoice/invoice.component.html @@ -136,7 +136,14 @@ font-weight: 700; background-color: lightcyan;" mat-raised-button - (click)="backToShop()" >Return to Shop + (click)="backToShop()" > + + Return to Shop diff --git a/src/app/invoice/invoice.component.ts b/src/app/invoice/invoice.component.ts index 77489e5..2cc3223 100644 --- a/src/app/invoice/invoice.component.ts +++ b/src/app/invoice/invoice.component.ts @@ -4,7 +4,7 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; import { ReceiptService } from '../receipt.service'; import { Order} from '../order/order.model'; import { Observable } from 'rxjs'; -import { faCheck, faHourglass } from '@fortawesome/free-solid-svg-icons'; +import { faCheck, faHourglass, faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'; import { NotifierService } from '../notifier.service'; @@ -20,6 +20,7 @@ var Buffer = require('buffer/').Buffer; export class InvoiceComponent implements OnInit { faCheck = faCheck; faHourglass = faHourglass; + faArrowUpRightFromSquare = faArrowUpRightFromSquare; orderId; public orderUpdate: Observable; public nameUpdate: Observable; @@ -95,23 +96,22 @@ export class InvoiceComponent implements OnInit { } ngOnInit(): void { - setTimeout(() => this.backToShop(), 10000); } backToShop() { if ( this.isWCOrder ) { - console.log('External Invoice -> ' + this.order.externalInvoice ); +// console.log('External Invoice -> ' + this.order.externalInvoice ); const b64URL:string = this.order.externalInvoice.substring(0,this.order.externalInvoice.indexOf("-")); - console.log('encodedURL -> ' + b64URL ); +// console.log('encodedURL -> ' + b64URL ); const shopURL: string = Buffer.from(b64URL, 'base64').toString(); const tmp_orderid = this.order.externalInvoice.substring(this.order.externalInvoice.indexOf('-')+1); const wc_order_key = tmp_orderid.substring(tmp_orderid.indexOf('-')+1); const wc_orderid = tmp_orderid.substring(0,tmp_orderid.indexOf('-')); - console.log('wc_order_id -> ' + wc_orderid); - console.log('wc_order_key -> ' + wc_order_key); - console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key); +// console.log('wc_order_id -> ' + wc_orderid); +// console.log('wc_order_key -> ' + wc_order_key); +// console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key); if ( shopURL ) { - console.log('Opening URL....' + shopURL); +// console.log('Opening URL....' + shopURL); window.open( shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key,"_blank"); } } @@ -124,7 +124,7 @@ export class InvoiceComponent implements OnInit { } - copyAddress() { + copyAddress() { if (!navigator.clipboard) { // alert("Copy functionality not supported"); this.notifierService @@ -137,8 +137,9 @@ export class InvoiceComponent implements OnInit { .showNotification("Error copying address","Close","error"); // console.error("Error", err); } - } - copyAmount() { + } + + copyAmount() { if (!navigator.clipboard) { // alert("Copy functionality not supported"); this.notifierService @@ -151,9 +152,9 @@ export class InvoiceComponent implements OnInit { .showNotification("Error while copying ammount","Close","error"); // console.error("Error", err); } - } + } - copyMemo() { + copyMemo() { if (!navigator.clipboard) { // alert("Copy functionality not supported"); this.notifierService @@ -166,6 +167,6 @@ export class InvoiceComponent implements OnInit { .showNotification("Error while copying Memo","Close","error"); // console.error("Error", err); } - } + } }