fix : disabled box for MJP,JKP,TRE

This commit is contained in:
karthik 2025-07-29 14:46:32 +05:30
parent 15c9ba411f
commit 2669f234dd

View File

@ -113,20 +113,19 @@ export class TouchPadMenuComponent implements OnInit {
get isBoxToggleDisabled(): boolean {
if (!this.selectedLabel) return true;
// ❌ Disallow box mode for these labels
const disallowedBoxLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW'];
// Disable box mode for these labels
const disallowedBoxLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW', 'TRE', 'MJP', 'JKP'];
if (disallowedBoxLabels.includes(this.selectedLabel)) {
return true;
}
// ❌ Disallow box toggle if FIELD (F) is selected
// Disable box toggle if FIELD (F) is selected
if (this.selectedNumbers.includes('F')) {
return true;
}
return false;
}
}
private chunk<T>(array: T[], size: number): T[][] {
return Array.from({ length: Math.ceil(array.length / size) }, (_, i) =>
@ -145,16 +144,16 @@ export class TouchPadMenuComponent implements OnInit {
this.canPrint = false;
this.isBoxed = false;
// Reset TAN
// Reset TAN
this.tanGroupStage = 0;
this.tanGroups = [[], [], []];
// Reset FOR/QUI
// Reset FOR/QUI
this.isFirstGroupComplete = false;
this.firstGroup = [];
this.secondGroup = [];
// Reset Multi-leg
// Reset Multi-leg
this.multiLegStage = 0;
this.multiLegGroups = [[], [], [], [], []];
@ -485,8 +484,11 @@ export class TouchPadMenuComponent implements OnInit {
}
return false;
}
if (this.selectedLabel === 'TAN') {
if (this.tanGroups[this.tanGroupStage].length === 0) {
if (this.selectedLabel === 'TAN' || this.multiLegLabels.includes(this.selectedLabel || '')) {
if (this.selectedLabel === 'TAN' && this.tanGroups[this.tanGroupStage].length === 0) {
return true;
}
if (this.multiLegLabels.includes(this.selectedLabel || '') && this.multiLegGroups[this.multiLegStage].length === 0) {
return true;
}
return false;
@ -563,6 +565,15 @@ export class TouchPadMenuComponent implements OnInit {
value: 1
});
}
} else if (this.multiLegLabels.includes(this.selectedLabel)) {
this.multiLegGroups[this.multiLegStage] = ['F'];
this.updateMultiLegSelection();
this.selectionService.updatePartial({
label: this.selectedLabel,
numbers: [...this.selectedNumbers],
isBoxed: false,
value: 1
});
} else {
this.selectedNumbers = ['F'];
this.selectionService.updatePartial({