feat(server): business owned by user data model
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<i class="bi bi-person-circle fs-1 text-primary"></i>
|
||||
</div>
|
||||
<h3 class="mb-1">{{ username }}</h3>
|
||||
<p class="text-muted mb-4">{{ userID }}</p>
|
||||
<p class="text-muted mb-4">{{ this.api.currentUser }}</p>
|
||||
<div class="d-flex align-items-center justify-content-center gap-2 mb-1">
|
||||
<i class="bi bi-wallet2 fs-4"></i>
|
||||
<h3 class="mb-0">{{ balance | currency}}</h3>
|
||||
@@ -31,7 +31,7 @@
|
||||
<i class="bi bi-person-fill fs-4 text-secondary"></i>
|
||||
</div>
|
||||
<div class="text-start">
|
||||
@if (transaction.receiverID == userID) {
|
||||
@if (transaction.receiverID == this.api.currentUser) {
|
||||
<h6 class="mb-0">{{ transaction.senderID }}</h6>
|
||||
}@else {
|
||||
<h6 class="mb-0">{{ transaction.receiverID }}</h6>
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
@if (transaction.receiverID == userID) {
|
||||
@if (transaction.receiverID == this.api.currentUser) {
|
||||
<h6 class="mb-0 text-success">
|
||||
{{ transaction.amount | currency }}
|
||||
</h6>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { APIService } from '../../services/api';
|
||||
import Transaction from '@model/transaction';
|
||||
import { Router } from '@angular/router';
|
||||
@@ -13,12 +13,11 @@ import { Router } from '@angular/router';
|
||||
export class ScreenProfile implements OnInit{
|
||||
// TODO display real data
|
||||
username = 'John Doe';
|
||||
userID = 'testuser';
|
||||
balance = 200;
|
||||
transactions!: Transaction[];
|
||||
|
||||
constructor(
|
||||
private api: APIService,
|
||||
protected api: APIService,
|
||||
private router: Router,
|
||||
){}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
<ng-template #content let-modal>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="modal-basic-title">Pay {{ amount}} to {{ user }}</h4>
|
||||
<h4 class="modal-title" id="modal-basic-title">Pay {{ amount}} to {{ this.api.currentUser }}</h4>
|
||||
<button type="button" class="btn-close" aria-label="Close" (click)="modal.dismiss()"></button>
|
||||
</div>
|
||||
<div class="modal-body text-center">
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Component, inject, TemplateRef } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { QrCodeComponent } from 'ng-qrcode';
|
||||
import { APIService } from '../../services/api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-screen-receive',
|
||||
@@ -11,12 +12,12 @@ import { QrCodeComponent } from 'ng-qrcode';
|
||||
})
|
||||
export class ScreenReceive {
|
||||
private modalService = inject(NgbModal);
|
||||
api = inject(APIService);
|
||||
|
||||
user = 'DemoUser';
|
||||
amount: number = 0;
|
||||
get shareableLink(): string {
|
||||
const currentDomain = window.location.origin;
|
||||
return `${currentDomain}/send/${this.user}?amount=${this.amount}`;
|
||||
return `${currentDomain}/send/${this.api.currentUser}?amount=${this.amount}`;
|
||||
}
|
||||
|
||||
copyLink() {
|
||||
|
||||
@@ -13,6 +13,9 @@ export class APIService {
|
||||
private isAuthenticatedSubject = new BehaviorSubject<boolean>(false);
|
||||
isAuthenticated$ = this.isAuthenticatedSubject.asObservable();
|
||||
|
||||
// TODO use real user here
|
||||
currentUser = 'DemoUser';
|
||||
|
||||
constructor(private http: HttpClient){}
|
||||
|
||||
login(username: string, password: string): Observable<any>{
|
||||
|
||||
Reference in New Issue
Block a user