diff --git a/btc-UI/src/app/components/middle-section/middle-section.component.html b/btc-UI/src/app/components/middle-section/middle-section.component.html index bc1d10b..5e805a7 100755 --- a/btc-UI/src/app/components/middle-section/middle-section.component.html +++ b/btc-UI/src/app/components/middle-section/middle-section.component.html @@ -22,7 +22,7 @@ - + @@ -47,7 +47,7 @@ - + diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css index 90851e6..b4bd4a9 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css @@ -420,4 +420,59 @@ button { .calc-backspace-btn{ margin-right: -120px; background-color: #0077b6; -} \ No newline at end of file +} + +/* 🔹 Highlight selected label */ +.selected-label { + box-shadow: 0 0 0 3px #3a8dd5 inset; + background-color: #1d4f91 !important; + color: #fff !important; +} + +/* 🔹 Highlight selected number */ +.selected-number { + background-color: #b34d4d !important; + color: #fff !important; + font-weight: bold; +} + +/* 🔹 Disabled state for label and number buttons */ +button[disabled] { + opacity: 0.4 !important; + pointer-events: none !important; + cursor: not-allowed !important; +} + +/* 🔹 Pad value display */ +.pad-value-preview { + text-align: center; + font-size: 1.4rem; + font-weight: bold; + padding: 0.5rem 0; + color: #1d1d1d; + background-color: #f9f9f9; + border: 1px solid #ccc; + margin-bottom: 1rem; + border-radius: 8px; +} + +/* 🔹 Active numeric pad key (optional if needed) */ +.active-pad-key { + background-color: #007bff !important; + color: white; +} + +/* 🔹 Print button enabled effect */ +button.ready-to-print { + background-color: #28a745 !important; + border-color: #28a745 !important; + color: white !important; + font-weight: bold; +} + +/* 🔹 Error state (optional for input validation) */ +.input-error { + border: 2px solid #dc3545 !important; + background-color: #f8d7da !important; + color: #721c24; +} diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html index 7fd7dd0..8415d20 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html @@ -2,9 +2,7 @@
-
+
@@ -27,24 +25,10 @@
-
+
-
- +
+
@@ -52,67 +36,45 @@
-
+
-
- -
+ +
+ +
+
-
+
- +
- +
- +
- -
-
- - -
- -
-
- - -
- +
- +
- +
@@ -121,23 +83,13 @@
-
+
×
Calculator
- +
@@ -165,4 +117,4 @@
-
+
\ 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() {