fixed : encrypted barcode id in viewlog
This commit is contained in:
parent
66d50a12bc
commit
38e709842a
@ -240,6 +240,7 @@
|
||||
<th>Tickets</th>
|
||||
<th>Count</th>
|
||||
<th>Amount</th>
|
||||
<th>Barcode</th> <!-- ✅ New Column -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -250,6 +251,7 @@
|
||||
<td>{{ log.ticketCountLabel }}</td>
|
||||
<td>{{ log.count }}</td>
|
||||
<td>{{ log.amount }}</td>
|
||||
<td>{{ log.displayBarcode }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@ -32,7 +32,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
||||
showResultModal = false;
|
||||
showMessagesModal = false;
|
||||
showLogModal = false;
|
||||
|
||||
raceCardData: any = {};
|
||||
raceData: any[] = [];
|
||||
objectKeys = Object.keys;
|
||||
@ -359,58 +358,6 @@ formattedTicketLogs: {
|
||||
|
||||
|
||||
|
||||
// openViewLog() {
|
||||
// const storedTickets = localStorage.getItem('localTicketsViewlog');
|
||||
// //console.log('Stored Tickets (raw JSON):', storedTickets);
|
||||
|
||||
// if (storedTickets) {
|
||||
// const tickets = JSON.parse(storedTickets);
|
||||
// // console.log('Parsed Tickets:', tickets);
|
||||
|
||||
// this.formattedTicketLogs = tickets.map((ticket: any, index: number) => {
|
||||
// const rawLabel = ticket.winLabels || '';
|
||||
// const numbers = ticket.numbers || [];
|
||||
// const count = ticket.ticketCount || 0;
|
||||
// const amount = ticket.totalAmount || 0;
|
||||
|
||||
// let pool = '', horses = '', ticketCountLabel = '', price = '';
|
||||
|
||||
// // 🧠 Extract parts from rawLabel using RegExp
|
||||
// const labelMatch = rawLabel.match(/^(\w+)\s+([\d,]+)\s+(\*\d+)\s+(Rs\s*\d+)/);
|
||||
// if (labelMatch) {
|
||||
// pool = labelMatch[1];
|
||||
// horses = labelMatch[2];
|
||||
// ticketCountLabel = labelMatch[3];
|
||||
// price = labelMatch[4];
|
||||
// }
|
||||
|
||||
// console.log(`--- Ticket ${index + 1} ---`);
|
||||
// console.log('Pool:', pool);
|
||||
// console.log('Horses:', horses);
|
||||
// console.log('Ticket Label:', ticketCountLabel);
|
||||
// console.log('Price:', price);
|
||||
// console.log('Numbers:', numbers);
|
||||
// console.log('Count:', count);
|
||||
// console.log('Amount:', amount);
|
||||
|
||||
// return {
|
||||
// pool,
|
||||
// horses,
|
||||
// ticketCountLabel,
|
||||
// price,
|
||||
// numbers,
|
||||
// count,
|
||||
// amount
|
||||
// };
|
||||
// });
|
||||
// } else {
|
||||
// console.log('No tickets found in localStorage.');
|
||||
// this.formattedTicketLogs = [];
|
||||
// }
|
||||
|
||||
// this.showLogModal = true;
|
||||
// console.log('Log modal opened. Final formattedTicketLogs:', this.formattedTicketLogs);
|
||||
// }
|
||||
|
||||
openViewLog() {
|
||||
const storedTickets = localStorage.getItem('localTicketsViewlog');
|
||||
@ -423,8 +370,8 @@ openViewLog() {
|
||||
const numbers = ticket.numbers || [];
|
||||
const count = ticket.ticketCount || 0;
|
||||
const amount = ticket.totalAmount || 0;
|
||||
|
||||
let pool = '', horses = '', horsesArray: string[][] = [], ticketCountLabel = '', price = '';
|
||||
const barcodeId = ticket.barcodeId || '';
|
||||
let pool = '', horses = '', horsesArray: string[][] = [], ticketCountLabel = '', price = '', maskedBarcode = '' , displayBarcode = '';
|
||||
|
||||
if (rawLabel) {
|
||||
// 1️⃣ Extract pool (first word)
|
||||
@ -454,15 +401,23 @@ openViewLog() {
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(`--- Ticket ${index + 1} ---`);
|
||||
// console.log('Pool:', pool);
|
||||
// console.log('Horses (raw):', horses);
|
||||
// console.log('Horses (array):', horsesArray);
|
||||
// console.log('Ticket Label:', ticketCountLabel);
|
||||
// console.log('Price:', price);
|
||||
// console.log('Numbers:', numbers);
|
||||
// console.log('Count:', count);
|
||||
// console.log('Amount:', amount);
|
||||
if (barcodeId) {
|
||||
const last4 = barcodeId.slice(-4);
|
||||
|
||||
// Encrypt everything except last4
|
||||
const encryptedPart = btoa(barcodeId.slice(0, -4));
|
||||
|
||||
// Store masked barcode (if you still need encrypted form)
|
||||
maskedBarcode = encryptedPart;
|
||||
|
||||
// For GUI → show ******** + last4
|
||||
displayBarcode = '********' + last4;
|
||||
}
|
||||
|
||||
|
||||
console.log(maskedBarcode);
|
||||
console.log('Decoded:', atob(maskedBarcode));
|
||||
|
||||
|
||||
return {
|
||||
pool,
|
||||
@ -472,7 +427,9 @@ openViewLog() {
|
||||
price,
|
||||
numbers,
|
||||
count,
|
||||
amount
|
||||
amount,
|
||||
maskedBarcode,
|
||||
displayBarcode
|
||||
};
|
||||
});
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user