-
+
-
-
-
+
+
+
+
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -121,23 +83,13 @@
-
+
\ No newline at end of file
diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts
index fb1498b..d4f845b 100755
--- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts
+++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts
@@ -20,12 +20,14 @@ export class TouchPadMenuComponent implements OnInit {
];
numbers: number[] = Array.from({ length: 30 }, (_, i) => i + 1);
- calcKeys: string[] = ['7', '8', '9', '4', '5', '6', '1', '2', '3', '0', '←', 'CLR'];
-
labelRowsFlat: string[] = [];
numbersFlat: number[] = [];
- // Calculator modal state
+ selectedLabel: string | null = null;
+ selectedNumbers: number[] = [];
+ padValue: string = '';
+ canPrint = false;
+
calculatorOpen = false;
calcDisplay = '';
@@ -42,8 +44,8 @@ export class TouchPadMenuComponent implements OnInit {
return this.chunk(this.numbers, 6);
}
- get calcKeyRows() {
- return this.chunk(this.calcKeys, 3);
+ get numericPadEnabled() {
+ return this.selectedLabel !== null && this.selectedNumbers.length > 0;
}
private chunk
(array: T[], size: number): T[][] {
@@ -52,7 +54,56 @@ export class TouchPadMenuComponent implements OnInit {
);
}
- // Calculator methods
+ selectLabel(label: string) {
+ this.selectedLabel = label;
+ this.selectedNumbers = [];
+ this.padValue = '';
+ this.canPrint = false;
+ }
+
+ selectNumber(number: number) {
+ if (!this.selectedLabel) return;
+ if (!this.selectedNumbers.includes(number)) {
+ this.selectedNumbers.push(number);
+ this.padValue = '';
+ this.canPrint = false;
+ }
+ }
+
+ isNumberDisabled(number: number) {
+ return this.selectedNumbers.includes(number);
+ }
+
+ enterPadVal(key: string) {
+ if (!this.numericPadEnabled) return;
+ if (/[0-9]/.test(key)) {
+ this.padValue += key;
+ } else if (key === 'X') {
+ this.padValue += 'X';
+ }
+ this.updateCanPrint();
+ }
+
+ updateCanPrint() {
+ this.canPrint = this.padValue.trim().length > 0;
+ }
+
+ padEnter() {
+ // Optional action on enter
+ }
+
+ print() {
+ alert(`Printing: Label=${this.selectedLabel}, Numbers=${this.selectedNumbers.join(', ')}, Value=${this.padValue}`);
+ this.resetSelections();
+ }
+
+ resetSelections() {
+ this.selectedLabel = null;
+ this.selectedNumbers = [];
+ this.padValue = '';
+ this.canPrint = false;
+ }
+
openCalculator() {
this.calculatorOpen = true;
this.calcDisplay = '';
@@ -72,11 +123,9 @@ export class TouchPadMenuComponent implements OnInit {
}
backspace() {
- if (this.calcDisplay === 'Error') {
- this.calcDisplay = '';
- } else {
- this.calcDisplay = this.calcDisplay.slice(0, -1);
- }
+ this.calcDisplay = this.calcDisplay === 'Error'
+ ? ''
+ : this.calcDisplay.slice(0, -1);
}
calculate() {