Update invoice component for Woocommerce
This commit is contained in:
parent
b6502a3f36
commit
d66b956773
2 changed files with 23 additions and 15 deletions
|
@ -136,7 +136,14 @@
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
background-color: lightcyan;"
|
background-color: lightcyan;"
|
||||||
mat-raised-button
|
mat-raised-button
|
||||||
(click)="backToShop()" >Return to Shop</button>
|
(click)="backToShop()" >
|
||||||
|
<fa-icon style="color: #FB4F14;
|
||||||
|
margin-bottom: -2px;
|
||||||
|
margin-right: 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;"
|
||||||
|
[icon]="faArrowUpRightFromSquare"> </fa-icon>
|
||||||
|
Return to Shop</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { ReceiptService } from '../receipt.service';
|
import { ReceiptService } from '../receipt.service';
|
||||||
import { Order} from '../order/order.model';
|
import { Order} from '../order/order.model';
|
||||||
import { Observable } from 'rxjs';
|
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';
|
import { NotifierService } from '../notifier.service';
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ var Buffer = require('buffer/').Buffer;
|
||||||
export class InvoiceComponent implements OnInit {
|
export class InvoiceComponent implements OnInit {
|
||||||
faCheck = faCheck;
|
faCheck = faCheck;
|
||||||
faHourglass = faHourglass;
|
faHourglass = faHourglass;
|
||||||
|
faArrowUpRightFromSquare = faArrowUpRightFromSquare;
|
||||||
orderId;
|
orderId;
|
||||||
public orderUpdate: Observable<Order>;
|
public orderUpdate: Observable<Order>;
|
||||||
public nameUpdate: Observable<string>;
|
public nameUpdate: Observable<string>;
|
||||||
|
@ -95,23 +96,22 @@ export class InvoiceComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
setTimeout(() => this.backToShop(), 10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
backToShop() {
|
backToShop() {
|
||||||
if ( this.isWCOrder ) {
|
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("-"));
|
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 shopURL: string = Buffer.from(b64URL, 'base64').toString();
|
||||||
const tmp_orderid = this.order.externalInvoice.substring(this.order.externalInvoice.indexOf('-')+1);
|
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_order_key = tmp_orderid.substring(tmp_orderid.indexOf('-')+1);
|
||||||
const wc_orderid = tmp_orderid.substring(0,tmp_orderid.indexOf('-'));
|
const wc_orderid = tmp_orderid.substring(0,tmp_orderid.indexOf('-'));
|
||||||
console.log('wc_order_id -> ' + wc_orderid);
|
// console.log('wc_order_id -> ' + wc_orderid);
|
||||||
console.log('wc_order_key -> ' + wc_order_key);
|
// console.log('wc_order_key -> ' + wc_order_key);
|
||||||
console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key);
|
// console.log('new URL -> ' + shopURL + '/checkout/order-received/' + wc_orderid + '/?key=' + wc_order_key);
|
||||||
if ( shopURL ) {
|
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");
|
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) {
|
if (!navigator.clipboard) {
|
||||||
// alert("Copy functionality not supported");
|
// alert("Copy functionality not supported");
|
||||||
this.notifierService
|
this.notifierService
|
||||||
|
@ -137,8 +137,9 @@ export class InvoiceComponent implements OnInit {
|
||||||
.showNotification("Error copying address","Close","error");
|
.showNotification("Error copying address","Close","error");
|
||||||
// console.error("Error", err);
|
// console.error("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
copyAmount() {
|
|
||||||
|
copyAmount() {
|
||||||
if (!navigator.clipboard) {
|
if (!navigator.clipboard) {
|
||||||
// alert("Copy functionality not supported");
|
// alert("Copy functionality not supported");
|
||||||
this.notifierService
|
this.notifierService
|
||||||
|
@ -151,9 +152,9 @@ export class InvoiceComponent implements OnInit {
|
||||||
.showNotification("Error while copying ammount","Close","error");
|
.showNotification("Error while copying ammount","Close","error");
|
||||||
// console.error("Error", err);
|
// console.error("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyMemo() {
|
copyMemo() {
|
||||||
if (!navigator.clipboard) {
|
if (!navigator.clipboard) {
|
||||||
// alert("Copy functionality not supported");
|
// alert("Copy functionality not supported");
|
||||||
this.notifierService
|
this.notifierService
|
||||||
|
@ -166,6 +167,6 @@ export class InvoiceComponent implements OnInit {
|
||||||
.showNotification("Error while copying Memo","Close","error");
|
.showNotification("Error while copying Memo","Close","error");
|
||||||
// console.error("Error", err);
|
// console.error("Error", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue