fix : added copy logic
This commit is contained in:
parent
0fb75efe61
commit
6df4c49d65
@ -26,7 +26,7 @@
|
||||
>
|
||||
shash ENTER
|
||||
</button>
|
||||
<button class="btn btn-dark">COPY</button>
|
||||
<button class="btn btn-dark" (click)="copyNumbers()">COPY</button>
|
||||
<button class="btn btn-danger btn-bkp" *ngIf="showBackspace" (click)="removeLastNumber()">BKP</button>
|
||||
<button class="btn btn-dark">CLEAR</button>
|
||||
<button class="btn btn-info pool-replace-btn" (click)="openPoolReplaceModal()">PR</button>
|
||||
|
||||
@ -1241,4 +1241,42 @@ printTicket() {
|
||||
closeLimitPopup() {
|
||||
this.showLimitPopup = false;
|
||||
}
|
||||
copyNumbers() {
|
||||
if (!this.selectedLabel) {
|
||||
console.warn('Please select a label before copying numbers.');
|
||||
return;
|
||||
}
|
||||
|
||||
const selections = this.selectionService.getSelections();
|
||||
if (selections.length === 0) {
|
||||
console.warn('No previous rows to copy from.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy numbers from the most recent finalized row
|
||||
const lastRow = selections[selections.length - 1];
|
||||
const numbersToCopy = [...lastRow.numbers];
|
||||
|
||||
// Apply the copied numbers directly
|
||||
this.selectedNumbers = numbersToCopy;
|
||||
|
||||
// Validate against actual runners
|
||||
const validNumbers = this.selectedNumbers.filter(num => {
|
||||
if (typeof num === 'string') return num === 'F' || num === '-';
|
||||
return this.actualRunners.has(num);
|
||||
});
|
||||
|
||||
this.selectedNumbers = validNumbers;
|
||||
|
||||
// Update the current row in the selection service
|
||||
this.selectionService.updatePartial({
|
||||
label: this.selectedLabel,
|
||||
numbers: [...this.selectedNumbers],
|
||||
isBoxed: this.isBoxed,
|
||||
value: parseFloat(this.padValue) || 0
|
||||
});
|
||||
|
||||
this.updateCanPrint();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user