Skip to content

Commit

Permalink
Hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
iwokonl committed Apr 18, 2024
1 parent 9de05bb commit 292e878
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ <h5 class="card-title">
<button class="btn btn-outline-primary withdraw" (click)="createPayout(account)">Wypłać fundusze</button>

<input class="form-control" type="text" placeholder="Wprowadź kwotę do wpłaty/wypłaty" [(ngModel)]="account.amount">

<div class="loading-overlay" *ngIf="isLoading">
<div class="spinner-border text-primary" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@
transform: scale(1.1);
}
}
.loading-overlay{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.5);
display: flex;
justify-content: center;
align-items: center;

}
.withdraw{

padding: 3px 1px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class CurrencyAccountComponent implements OnInit {
{}).then((response) => {
this.accounts = response.data;
this.accounts.forEach(account => {
account.isLoading = false; // Initialize isLoading for each account
if (account.curencyCode !== 'PLN') {
this.currencyService.getCurrencyDetails(account.curencyCode).subscribe(details => {
account.balanceInPLN = account.balance * details.rates[0].mid;
Expand Down Expand Up @@ -54,6 +55,12 @@ export class CurrencyAccountComponent implements OnInit {
}

onAddMoney(account: any) {
console.log(account.amount);
let regExp:RegExp = /[a-zA-Z]/g;
if (account.amount === undefined || regExp.test(account.amount)) {
console.log("Invalid amount");
return;
}
this.isLoading = true;
this.axiosService.request("POST",
"/api/payment/create",
Expand All @@ -71,10 +78,19 @@ export class CurrencyAccountComponent implements OnInit {
window.location.href = response.data.url;
this.getCurrencyAccounts();
this.isLoading = false;// Refresh the accounts list after creating a new account
}).catch((error) => {
this.isLoading = false;
});
}

createPayout(account: any) {
console.log(account.amount);
let regExp:RegExp = /[a-zA-Z]/g;
if (account.amount === undefined || regExp.test(account.amount)) {
console.log("Invalid amount");
return;
}
this.isLoading = true;
this.axiosService.request("POST",
"/api/payment/createPayout",
{
Expand All @@ -84,6 +100,11 @@ export class CurrencyAccountComponent implements OnInit {
}).then((response) => {
console.log(response.data);
this.getCurrencyAccounts(); // Refresh the accounts list after creating a new account
});
this.isLoading = false;//
window.location.href = response.data.url;
}).catch((error) => {
this.isLoading = false;
});;

}
}

0 comments on commit 292e878

Please sign in to comment.