fix : tre {tre1 and trre2} displaying
This commit is contained in:
parent
7fd671e3ab
commit
7143b72407
@ -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
|
||||
@ -1158,7 +1163,6 @@ const winLabels = allRows.map(row => {
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user