fix : added ' F 'logic for 1st 5
This commit is contained in:
parent
0e453136e6
commit
8586ed0780
@ -34,14 +34,20 @@ export class SelectionService {
|
||||
|
||||
updated.total = 0;
|
||||
|
||||
if (numbers.length > 0 && value > 0 && label) {
|
||||
if ((numbers.length > 0 || updated.numbers.includes('F')) && value > 0 && label) {
|
||||
switch (label) {
|
||||
case 'WIN':
|
||||
case 'SHP':
|
||||
case 'THP':
|
||||
case 'PLC':
|
||||
case 'SHW': {
|
||||
if (updated.numbers.includes('F')) {
|
||||
updated.total = 12 * value * 10; // 'F' represents 12 runners
|
||||
} else {
|
||||
updated.total = numbers.length * value * 10;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'FOR': {
|
||||
const dashIndex = updated.numbers.indexOf('-');
|
||||
|
||||
@ -42,8 +42,10 @@
|
||||
|
||||
<!-- Label Section -->
|
||||
<div class="col-3">
|
||||
<div class="p-2 rounded wrapper-pad"
|
||||
[ngStyle]="{ 'background-color': ticketingActive ? '#d0ddf5' : '#f1f1f1df', border: ticketingActive ? '3px solid #050505' : 'none' }">
|
||||
<div
|
||||
class="p-2 rounded wrapper-pad"
|
||||
[ngStyle]="{ 'background-color': ticketingActive ? '#d0ddf5' : '#f1f1f1df', border: ticketingActive ? '3px solid #050505' : 'none' }"
|
||||
>
|
||||
<div class="row gx-1 gy-1 custom-touchpad">
|
||||
<div class="col-4" *ngFor="let label of labelRowsFlat; let i = index">
|
||||
<button
|
||||
@ -66,7 +68,7 @@
|
||||
<div class="col-2" *ngFor="let number of numbersFlat">
|
||||
<button
|
||||
class="btn btn-light w-100 number-button"
|
||||
[disabled]="!selectedLabel || isNumberDisabled(number)"
|
||||
[disabled]="!selectedLabel || isNumberDisabled(number) || (selectedNumbers.includes('F') && allowedFieldLabels.includes(selectedLabel || ''))"
|
||||
(click)="selectNumber(number)"
|
||||
>
|
||||
{{ number }}
|
||||
|
||||
@ -14,6 +14,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
|
||||
public twoGroupLabels = ['FOR', 'QUI'];
|
||||
public multiLegLabels = ['TRE', 'MJP', 'JKP'];
|
||||
public allowedFieldLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW'];
|
||||
|
||||
labels: string[] = [
|
||||
'WIN', 'SHP', 'THP', 'PLC', 'SHW', 'FOR',
|
||||
@ -74,7 +75,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
}
|
||||
|
||||
get numericPadEnabled() {
|
||||
return this.selectedLabel !== null && this.selectedNumbers.length > 0;
|
||||
return this.selectedLabel !== null && (this.selectedNumbers.length > 0 || this.selectedNumbers.includes('F'));
|
||||
}
|
||||
|
||||
get showShashEnter(): boolean {
|
||||
@ -105,7 +106,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
|
||||
get showBackspace(): boolean {
|
||||
return this.selectedLabel !== null &&
|
||||
this.selectedNumbers.length > 0 &&
|
||||
(this.selectedNumbers.length > 0 || this.selectedNumbers.includes('F')) &&
|
||||
this.padValue.length === 0;
|
||||
}
|
||||
|
||||
@ -286,9 +287,9 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
if (!this.numericPadEnabled) return;
|
||||
|
||||
if (key === 'X') {
|
||||
this.padValue = ''; // Clear the pad value
|
||||
this.padValue = '';
|
||||
} else if (/[0-9]/.test(key)) {
|
||||
this.padValue += key; // Append numeric key
|
||||
this.padValue += key;
|
||||
}
|
||||
|
||||
this.updateCanPrint();
|
||||
@ -357,9 +358,18 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
}
|
||||
|
||||
removeLastNumber() {
|
||||
if (!this.selectedLabel || this.selectedNumbers.length === 0) return;
|
||||
if (!this.selectedLabel || (this.selectedNumbers.length === 0 && !this.selectedNumbers.includes('F'))) return;
|
||||
|
||||
if (this.selectedNumbers.includes('F') && this.allowedFieldLabels.includes(this.selectedLabel || '')) {
|
||||
this.selectedNumbers = [];
|
||||
this.selectionService.updatePartial({
|
||||
numbers: [],
|
||||
isBoxed: false,
|
||||
label: this.selectedLabel || ''
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// TAN Box mode: remove last number and rebuild dash-separated format
|
||||
if (this.selectedLabel === 'TAN' && this.isBoxed) {
|
||||
const currentNumbers = this.selectedNumbers.filter(n => typeof n === 'number') as number[];
|
||||
if (currentNumbers.length > 0) {
|
||||
@ -448,8 +458,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
}
|
||||
|
||||
canUseField(): boolean {
|
||||
const allowedLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW'];
|
||||
return this.selectedLabel !== null && allowedLabels.includes(this.selectedLabel) && this.selectedNumbers.length === 0;
|
||||
return this.selectedLabel !== null && this.allowedFieldLabels.includes(this.selectedLabel) && this.selectedNumbers.length === 0;
|
||||
}
|
||||
|
||||
openFieldModal() { this.fieldModalOpen = true; this.fieldInput = ''; this.fieldFEntered = false; }
|
||||
@ -463,7 +472,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
if (key === 'F') {
|
||||
if (!this.fieldFEntered) {
|
||||
this.fieldFEntered = true;
|
||||
this.fieldInput += 'F';
|
||||
this.fieldInput = 'F';
|
||||
}
|
||||
} else {
|
||||
this.fieldInput += key;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user