fix : added copy logic

This commit is contained in:
karthik 2025-08-05 17:07:31 +05:30
parent 0fb75efe61
commit 6df4c49d65
2 changed files with 39 additions and 1 deletions

View File

@ -26,7 +26,7 @@
> >
shash ENTER shash ENTER
</button> </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-danger btn-bkp" *ngIf="showBackspace" (click)="removeLastNumber()">BKP</button>
<button class="btn btn-dark">CLEAR</button> <button class="btn btn-dark">CLEAR</button>
<button class="btn btn-info pool-replace-btn" (click)="openPoolReplaceModal()">PR</button> <button class="btn btn-info pool-replace-btn" (click)="openPoolReplaceModal()">PR</button>

View File

@ -1241,4 +1241,42 @@ printTicket() {
closeLimitPopup() { closeLimitPopup() {
this.showLimitPopup = false; 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();
}
} }