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