fixed : every btid fetching part and seperators for repeat added
This commit is contained in:
parent
0c5a48e8af
commit
66d50a12bc
@ -25,6 +25,7 @@ export class MiddleSectionComponent implements OnInit, OnDestroy {
|
||||
showRepeatTicket: boolean = false;
|
||||
confirmRepeat: boolean = false;
|
||||
showPrintButton: boolean = false;
|
||||
btid: string | null = null;
|
||||
private selections: SelectionData[] = [];
|
||||
private sub1!: Subscription;
|
||||
private sub2!: Subscription;
|
||||
@ -41,6 +42,8 @@ export class MiddleSectionComponent implements OnInit, OnDestroy {
|
||||
this.currentRow = row;
|
||||
this.updateFilledRows(this.selections, row);
|
||||
});
|
||||
|
||||
this.btid = localStorage.getItem('btid');
|
||||
}
|
||||
|
||||
ngOnChanges(changes: any) {
|
||||
@ -164,9 +167,13 @@ export class MiddleSectionComponent implements OnInit, OnDestroy {
|
||||
// If multi-leg ticket, split each part separately
|
||||
let numbers: string[] | string[][];
|
||||
if (numbersRaw.includes('/')) {
|
||||
// numbers = numbersRaw
|
||||
// .split('/')
|
||||
// .map((part) => part.split(',').map((s) => s.trim()).filter(Boolean));
|
||||
numbers = numbersRaw
|
||||
.split('/')
|
||||
.map((part) => part.split(',').map((s) => s.trim()).filter(Boolean));
|
||||
.split(',') // split only on commas
|
||||
.map((s) => s.trim()) // clean up spaces
|
||||
.filter(Boolean);
|
||||
} else {
|
||||
numbers = numbersRaw.split(',').map((s) => s.trim()).filter(Boolean);
|
||||
}
|
||||
@ -199,7 +206,7 @@ export class MiddleSectionComponent implements OnInit, OnDestroy {
|
||||
'0'
|
||||
)}${String(now.getSeconds()).padStart(2, '0')}`;
|
||||
const millis = String(now.getMilliseconds()).padStart(3, '0');
|
||||
const barcodeId = `1111${day}${month}${year}${timeStr}${millis}`;
|
||||
const barcodeId = `${this.btid}${day}${month}${year}${timeStr}${millis}`;
|
||||
|
||||
const printableRows = this.filledRows
|
||||
.filter((row) => row.label && row.numbers.length > 0 && row.total > 0)
|
||||
|
||||
@ -92,6 +92,7 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
|
||||
enabledHorseNumbers: number[] = [];
|
||||
prevEnabledKey: string = '';
|
||||
|
||||
btid: string | null = null;
|
||||
raceCardData: any = {};
|
||||
|
||||
constructor(
|
||||
@ -110,6 +111,8 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
|
||||
this.numbers = Array.from({ length: 30 }, (_, i) => i + 1);
|
||||
this.numbersFlat = this.numberRows.flat();
|
||||
this.updateLegRaceDisplay(this.currentPool || '');
|
||||
|
||||
this.btid = localStorage.getItem('btid');
|
||||
// --- NEW: Update actualRunners when runner count changes ---
|
||||
this.setActualRunners();
|
||||
});
|
||||
@ -1091,6 +1094,7 @@ printTicket() {
|
||||
const fullYear = now.getFullYear();
|
||||
const timeStr = now.toTimeString().slice(0, 8).replace(/:/g, '');
|
||||
const millis = now.getMilliseconds().toString().padStart(3, '0');
|
||||
const btId = this.btid;
|
||||
// const ticketId = `${venue}/${fullYear}${month}${day}/1`;
|
||||
// For multi-leg pools (TRE, MJP, JKP), show the pool name (trb1, trb2, mjp1, jkp1) instead of race number
|
||||
let ticketId: string;
|
||||
@ -1099,7 +1103,7 @@ printTicket() {
|
||||
} else {
|
||||
ticketId = `${venue}/${fullYear}${month}${day}/${this.selectedRaceNumber}`;
|
||||
}
|
||||
const barcodeId = `1111${day}${month}${year}${timeStr}${millis}`;
|
||||
const barcodeId = `${btId}${day}${month}${year}${timeStr}${millis}`;
|
||||
|
||||
|
||||
//----------------------------------------WINLABELS START HERE ------------------------------------------------------
|
||||
@ -1150,17 +1154,24 @@ const winLabels = allRows.map(row => {
|
||||
// ? this.getHorseNumbersForRaceIdx(raceIdx).map(num => num.toString())
|
||||
// : [n]
|
||||
// );
|
||||
let expanded = leg.flatMap((n, idx) => {
|
||||
// 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];
|
||||
// });
|
||||
let expanded = leg.flatMap((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}-`];
|
||||
// Expand F → horse numbers, no extra dashes
|
||||
return this.getHorseNumbersForRaceIdx(raceIdx).map(num => num.toString());
|
||||
}
|
||||
return [n];
|
||||
return [n]; // Keep original (including '-') if user entered
|
||||
});
|
||||
|
||||
// Remove '-' and '#' for display
|
||||
@ -1181,26 +1192,35 @@ const winLabels = allRows.map(row => {
|
||||
// displayNumbers = displayNumbers.flatMap(n =>
|
||||
// n === 'F' ? this.getHorseNumbersForSelectedRace().map(num => num.toString()) : [n]
|
||||
// );
|
||||
displayNumbers = displayNumbers.flatMap((n, idx, arr) => {
|
||||
// displayNumbers = displayNumbers.flatMap((n, idx, arr) => {
|
||||
// if (n === 'F') {
|
||||
// const horses = this.getHorseNumbersForSelectedRace().map(num => num.toString()).join(',');
|
||||
// const isFirst = idx === 0;
|
||||
// const isLast = idx === arr.length - 1;
|
||||
// if (isFirst && !isLast) return [`${horses}-`];
|
||||
// if (!isFirst && isLast) return [`-${horses}`];
|
||||
// if (isFirst && isLast) return [horses]; // only F
|
||||
// return [`-${horses}-`];
|
||||
// }
|
||||
// return [n];
|
||||
// });
|
||||
displayNumbers = displayNumbers.flatMap((n) => {
|
||||
if (n === 'F') {
|
||||
const horses = this.getHorseNumbersForSelectedRace().map(num => num.toString()).join(',');
|
||||
const isFirst = idx === 0;
|
||||
const isLast = idx === arr.length - 1;
|
||||
if (isFirst && !isLast) return [`${horses}-`];
|
||||
if (!isFirst && isLast) return [`-${horses}`];
|
||||
if (isFirst && isLast) return [horses]; // only F
|
||||
return [`-${horses}-`];
|
||||
// Expand F → horse numbers, no extra dashes
|
||||
return this.getHorseNumbersForSelectedRace().map(num => num.toString());
|
||||
}
|
||||
return [n];
|
||||
return [n]; // Keep original (including '-') if user entered
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
let numbersStr = '';
|
||||
|
||||
// 🎯 FOR, QUI, TAN logic with box check
|
||||
if (['FOR', 'QUI'].includes(row.label)) {
|
||||
const actualNumbers = displayNumbers.filter(n => n !== '#' && n !== '-').join(',');
|
||||
// const actualNumbers = displayNumbers.filter(n => n !== '#' && n !== '-').join(',');
|
||||
const actualNumbers = displayNumbers.filter(n => n !== '#').join(',');
|
||||
if (row.numbers.includes('#') || row.isBoxed) { // ✅ box condition
|
||||
numbersStr = `${actualNumbers} - ${actualNumbers}`;
|
||||
} else {
|
||||
@ -1208,7 +1228,9 @@ const winLabels = allRows.map(row => {
|
||||
}
|
||||
} else {
|
||||
// 📝 All other pools
|
||||
numbersStr = displayNumbers.filter(n => n !== '#' && n !== '-').join(',');
|
||||
// numbersStr = displayNumbers.filter(n => n !== '#' && n !== '-').join(',');
|
||||
numbersStr = displayNumbers.filter(n => n !== '#').join(',');
|
||||
|
||||
}
|
||||
|
||||
const label = displayLabel.padEnd(10);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user