- @if (balance()) {
+ @if (balance() !== undefined) {
Dein aktuelles Guthaben betrÃĪgt:
{{ balance() | currency: "EUR" : "symbol" : "1.2-2" : "de" }}
diff --git a/src/app/modules/canteen/components/canteen-card-balance-modal/canteen-card-balance-modal.component.ts b/src/app/modules/canteen/components/canteen-card-balance-modal/canteen-card-balance-modal.component.ts
index 74b9121..c8575cc 100644
--- a/src/app/modules/canteen/components/canteen-card-balance-modal/canteen-card-balance-modal.component.ts
+++ b/src/app/modules/canteen/components/canteen-card-balance-modal/canteen-card-balance-modal.component.ts
@@ -43,6 +43,7 @@ export class CanteenCardBalanceModalComponent {
public async startScanSession(): Promise {
this.isScanSessionActive.set(true);
+ this.balance.set(undefined);
try {
await this.nfcService.startScanSession();
} catch (error) {
@@ -74,7 +75,8 @@ export class CanteenCardBalanceModalComponent {
// 4. Parse the balance
const balance = this.convertBytesToBalance(response);
this.balance.set(balance);
- // 5. Stop the scan session
+ // 5. Close the connection
+ await this.nfcService.close();
} finally {
await this.stopScanSession();
}
@@ -88,6 +90,7 @@ export class CanteenCardBalanceModalComponent {
trimmedBytes.reverse();
const hex = this.nfcHelperService.convertBytesToHex(trimmedBytes);
const balance = this.nfcHelperService.convertHexToNumber(hex);
+ console.log({ bytes, trimmedBytes, hex, balance });
return balance;
}
@@ -116,9 +119,6 @@ export class CanteenCardBalanceModalComponent {
this.isScanSessionActive.set(false);
void this.activeWriterAlert?.dismiss();
this.cancelSubject.next(undefined);
- await this.nfcService.close().catch(() => {
- // Ignore errors
- });
await this.nfcService.stopScanSession();
}
}
diff --git a/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.html b/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.html
index a13d707..01e320d 100644
--- a/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.html
+++ b/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.html
@@ -1,5 +1,5 @@
- Guthaben auslesen
+ Kartenguthaben
diff --git a/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.ts b/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.ts
index 8e62f1c..4b6688c 100644
--- a/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.ts
+++ b/src/app/modules/canteen/components/canteen-menu-popover/canteen-menu-popover.component.ts
@@ -15,5 +15,6 @@ export class CanteenMenuPopoverComponent {
await this.dialogService.showModal({
component: CanteenCardBalanceModalComponent,
});
+ await this.dialogService.dismissPopover();
}
}