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

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