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 d3adbd6..14b056b 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 @@ -1103,9 +1103,14 @@ printTicket() { //----------------------------------------WINLABELS START HERE ------------------------------------------------------ - const winLabels = allRows.map(row => { let displayNumbers = row.numbers; + let displayLabel = row.label; // Use row.label by default + + // Override label for TRE to use currentPool (trb1 or trb2) + if (row.label === 'TRE' && this.currentPool) { + displayLabel = this.currentPool; // Use trb1 or trb2 + } // --- Multi-leg pools: Expand 'F' for each leg --- if (['TRE', 'MJP', 'JKP'].includes(row.label)) { @@ -1123,7 +1128,7 @@ const winLabels = allRows.map(row => { if (currentLeg.length) legs.push(currentLeg); // For each leg, expand 'F' to correct horse numbers for that leg - const poolName = row.label === 'MJP' ? 'mjp1' : row.label === 'JKP' ? 'jkp1' : row.label === 'TRE' ? 'trb1' : row.label; + const poolName = row.label === 'MJP' ? 'mjp1' : row.label === 'JKP' ? 'jkp1' : this.currentPool || 'trb1'; const raceCardData = JSON.parse(localStorage.getItem('raceCardData') || '{}'); const poolRaces = raceCardData?.raceVenueRaces?.pools?.[poolName] || []; // Fallback to hardcoded mapping if needed @@ -1146,18 +1151,17 @@ const winLabels = allRows.map(row => { // : [n] // ); let expanded = leg.flatMap((n, idx) => { - if (n === 'F') { - const horses = this.getHorseNumbersForRaceIdx(raceIdx).map(num => num.toString()).join(','); - const isFirst = idx === 0; - const isLast = idx === leg.length - 1; - if (isFirst && !isLast) return [`${horses}-`]; - if (!isFirst && isLast) return [`-${horses}`]; - if (isFirst && isLast) return [horses]; // only F in the leg - return [`-${horses}-`]; - } - return [n]; -}); - + if (n === 'F') { + const horses = this.getHorseNumbersForRaceIdx(raceIdx).map(num => num.toString()).join(','); + const isFirst = idx === 0; + const isLast = idx === leg.length - 1; + if (isFirst && !isLast) return [`${horses}-`]; + if (!isFirst && isLast) return [`-${horses}`]; + if (isFirst && isLast) return [horses]; // only F in the leg + return [`-${horses}-`]; + } + return [n]; + }); // Remove '-' and '#' for display return expanded.filter(n => n !== '-' && n !== '#').join(','); @@ -1166,7 +1170,7 @@ const winLabels = allRows.map(row => { // Join legs with '/' let numbersStr = expandedLegs.join(' / '); - const label = row.label.padEnd(10); + const label = displayLabel.padEnd(10); const numbers = numbersStr.padEnd(15); const value = (`*${row.value || 0}`).padEnd(8); return `${label}${numbers} ${value}`; @@ -1207,14 +1211,13 @@ const winLabels = allRows.map(row => { numbersStr = displayNumbers.filter(n => n !== '#' && n !== '-').join(','); } - const label = row.label.padEnd(10); + const label = displayLabel.padEnd(10); const numbers = numbersStr.padEnd(15); const value = (`*${row.value || 0}`).padEnd(8); const total = `Rs ${row.total || 0}`.padStart(8); return `${label}${numbers} ${value} ${total}`; }).join('\n'); - //------------------------------------WIN LABELS ENDS HERE -------------------------------- // ✅ Print preview