fix : added racenumbers in navbar
This commit is contained in:
parent
2a3af535aa
commit
21d4e6e809
@ -211,26 +211,7 @@
|
|||||||
<div class="viewlog-modal-overlay" *ngIf="showLogModal" (click)="closeModals()">
|
<div class="viewlog-modal-overlay" *ngIf="showLogModal" (click)="closeModals()">
|
||||||
<div class="viewlog-modal-box" (click)="$event.stopPropagation()">
|
<div class="viewlog-modal-box" (click)="$event.stopPropagation()">
|
||||||
<h5>VIEW-LOG</h5>
|
<h5>VIEW-LOG</h5>
|
||||||
<!-- <table class="viewlog-table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Description</th>
|
|
||||||
<th>Venue</th>
|
|
||||||
<th>Ticket Number</th>
|
|
||||||
<th>Pool Name</th>
|
|
||||||
<th>Total Amount</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr *ngFor="let log of logs">
|
|
||||||
<td>{{ log.description }}</td>
|
|
||||||
<td>{{ log.venue }}</td>
|
|
||||||
<td>{{ log.ticketNumber }}</td>
|
|
||||||
<td>{{ log.poolName }}</td>
|
|
||||||
<td>{{ log.totalAmount }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table> -->
|
|
||||||
<button class="cancel-btn" (click)="closeModals()">CANCEL</button>
|
<button class="cancel-btn" (click)="closeModals()">CANCEL</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -239,25 +220,40 @@
|
|||||||
<div class="modal-overlay" *ngIf="showVenueModal" (click)="closeModals()">
|
<div class="modal-overlay" *ngIf="showVenueModal" (click)="closeModals()">
|
||||||
<div class="modal-box" (click)="$event.stopPropagation()">
|
<div class="modal-box" (click)="$event.stopPropagation()">
|
||||||
<h5>Select Venue</h5>
|
<h5>Select Venue</h5>
|
||||||
|
<!-- <div
|
||||||
|
class="modal-option"
|
||||||
|
*ngFor="let races of raceCardData?.raceVenueRaces?.races; let i = index"
|
||||||
|
(click)="selectVenue(i)"
|
||||||
|
>
|
||||||
|
{{ raceCardData?.Venue }} - Group {{ i + 1 }}
|
||||||
|
</div> -->
|
||||||
<div
|
<div
|
||||||
class="modal-option"
|
class="modal-option"
|
||||||
*ngFor="let venue of horseDataAndProgramData"
|
*ngIf="raceCardData?.raceVenueRaces?.races?.length > 0"
|
||||||
(click)="selectVenue(venue.raceId)"
|
(click)="selectVenue(0)"
|
||||||
>
|
>
|
||||||
{{ venue?.raceVenue?.venue }}
|
{{ raceCardData?.Venue }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- this.raceData -->
|
<!-- this.raceData -->
|
||||||
|
|
||||||
<!-- Race Modal (click)="selectRace(race)"-->
|
<!-- Race Modal (click)="selectRace(race)"-->
|
||||||
|
<!-- Race Modal -->
|
||||||
<div class="modal-overlay" *ngIf="showRaceModal" (click)="closeModals()">
|
<div class="modal-overlay" *ngIf="showRaceModal" (click)="closeModals()">
|
||||||
<div class="modal-box" (click)="$event.stopPropagation()">
|
<div class="modal-box" (click)="$event.stopPropagation()">
|
||||||
<h5>Select Race</h5>
|
<h5>Select Race</h5>
|
||||||
<div class="modal-option" *ngFor="let race of raceData">
|
<div
|
||||||
<span> Number of races is {{ race.numberOfRace }} </span>
|
class="modal-option"
|
||||||
<span> Race id is {{ race.raceId }} </span>
|
*ngFor="let races of raceCardData.raceVenueRaces.races; let i = index"
|
||||||
<span> Date of race {{ race.sysDataOnly }} </span>
|
(click)="selectRace(i + 1)"
|
||||||
</div>
|
>
|
||||||
|
Race {{ i + 1 }}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
|
import { Component, OnInit, HostListener, OnDestroy } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { BtcService } from '../../service/btc.service';
|
import { BtcService } from '../../service/btc.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { catchError, interval, of, Subscription, switchMap } from 'rxjs';
|
import { catchError, interval, of, Subscription, switchMap } from 'rxjs';
|
||||||
import { HorseService } from '../../service/horseData.service';
|
// import { HorseService } from '../../service/horseData.service';
|
||||||
import { HorseRaceModel } from '../../model/horseRaceData';
|
// import { HorseRaceModel } from '../../model/horseRaceData';
|
||||||
import { SharedStateService } from '../../service/shared-state.service';
|
import { SharedStateService } from '../../service/shared-state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -20,22 +19,28 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
isMenuOpen: boolean = false;
|
isMenuOpen: boolean = false;
|
||||||
screenWidth: number = window.innerWidth;
|
screenWidth: number = window.innerWidth;
|
||||||
private subscription!: Subscription;
|
private subscription!: Subscription;
|
||||||
public horseDataAndProgramData: HorseRaceModel[] = [];
|
// public horseDataAndProgramData: HorseRaceModel[] = [];
|
||||||
public raceData: HorseRaceModel[] = [];
|
// public raceData: HorseRaceModel[] = [];
|
||||||
private selectedRaceId: number = 0;
|
//private selectedRaceId: number = 0;
|
||||||
|
|
||||||
liveStatusOk: boolean = true;
|
liveStatusOk: boolean = true;
|
||||||
|
|
||||||
showVenueModal = false;
|
showVenueModal = false;
|
||||||
showRaceModal = false;
|
showRaceModal = false;
|
||||||
selectedVenue = 'Select Venue';
|
selectedVenue = 'Select Venue';
|
||||||
selectedRace = '1';
|
selectedRace : number =1;
|
||||||
|
|
||||||
showWalletModal = false;
|
showWalletModal = false;
|
||||||
showResultModal = false;
|
showResultModal = false;
|
||||||
showMessagesModal = false;
|
showMessagesModal = false;
|
||||||
showLogModal = false;
|
showLogModal = false;
|
||||||
|
|
||||||
|
raceCardData: any = {};
|
||||||
|
raceData: any[] = [];
|
||||||
|
objectKeys = Object.keys;
|
||||||
|
|
||||||
|
selectedRaceId: number = 0;
|
||||||
|
|
||||||
wallet = {
|
wallet = {
|
||||||
withdraw: 0,
|
withdraw: 0,
|
||||||
deposit: 0,
|
deposit: 0,
|
||||||
@ -63,7 +68,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
constructor(
|
constructor(
|
||||||
private btcService: BtcService,
|
private btcService: BtcService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private horseService: HorseService,
|
// private horseService: HorseService,
|
||||||
private sharedStateService: SharedStateService
|
private sharedStateService: SharedStateService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
@ -80,26 +85,37 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
this.liveStatusOk = false;
|
this.liveStatusOk = false;
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
)
|
))
|
||||||
)
|
).subscribe((response) => {
|
||||||
)
|
|
||||||
.subscribe((response) => {
|
|
||||||
if (response !== null) {
|
if (response !== null) {
|
||||||
console.log('[LIVE STATUS] OK');
|
console.log('[LIVE STATUS] OK');
|
||||||
this.liveStatusOk = true;
|
this.liveStatusOk = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.horseService.HorseData.subscribe({
|
// this.horseService.HorseData.subscribe({
|
||||||
next: (data) => {
|
// next: (data) => {
|
||||||
if (data === null) return;
|
// if (data === null) return;
|
||||||
console.log('[HORSE DATA] Received:', data);
|
// console.log('[HORSE DATA] Received:', data);
|
||||||
this.horseDataAndProgramData = data;
|
// this.horseDataAndProgramData = data;
|
||||||
},
|
// },
|
||||||
error: (err) => {
|
// error: (err) => {
|
||||||
console.error('[HORSE DATA] Error:', err);
|
// console.error('[HORSE DATA] Error:', err);
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
const cachedData = localStorage.getItem('raceCardData');
|
||||||
|
if (cachedData) {
|
||||||
|
this.raceCardData = JSON.parse(cachedData);
|
||||||
|
console.log('📦 Loaded race card from localStorage:', this.raceCardData);
|
||||||
|
|
||||||
|
// ✅ Pre-fill the venue name directly
|
||||||
|
this.selectedVenue = this.raceCardData?.Venue || 'Select Venue';
|
||||||
|
} else {
|
||||||
|
this.raceCardData = { raceVenueRaces: { races: [] }, pools: {} };
|
||||||
|
console.warn('⚠️ No race card data found in localStorage.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDateTime() {
|
updateDateTime() {
|
||||||
@ -124,16 +140,28 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
this.showVenueModal = true;
|
this.showVenueModal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// openRaceModal() {
|
||||||
|
// console.log('[MODAL] Opening race modal');
|
||||||
|
// this.showRaceModal = true;
|
||||||
|
|
||||||
|
// this.horseDataAndProgramData.map((data) => {
|
||||||
|
// if (data.raceId === this.selectedRaceId) {
|
||||||
|
// this.raceData = [data];
|
||||||
|
// }
|
||||||
|
// return data;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
openRaceModal() {
|
openRaceModal() {
|
||||||
console.log('[MODAL] Opening race modal');
|
console.log('[MODAL] Opening race modal');
|
||||||
this.showRaceModal = true;
|
this.showRaceModal = true;
|
||||||
|
|
||||||
this.horseDataAndProgramData.map((data) => {
|
const venueIndex = Object.keys(this.raceCardData?.raceVenueRaces?.races || [])
|
||||||
if (data.raceId === this.selectedRaceId) {
|
.findIndex((_, idx) => idx === this.selectedRaceId);
|
||||||
this.raceData = [data];
|
|
||||||
|
if (venueIndex !== -1) {
|
||||||
|
this.raceData = this.raceCardData.raceVenueRaces.races[venueIndex] || [];
|
||||||
}
|
}
|
||||||
return data;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeModals() {
|
closeModals() {
|
||||||
@ -146,17 +174,29 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
this.showLogModal = false;
|
this.showLogModal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectVenue(venue: number) {
|
// selectVenue(venue: number) {
|
||||||
console.log('[VENUE] User selected raceId:', venue);
|
// console.log('[VENUE] User selected raceId:', venue);
|
||||||
this.selectedRaceId = venue;
|
// this.selectedRaceId = venue;
|
||||||
|
|
||||||
this.horseDataAndProgramData.map((data) => {
|
// this.horseDataAndProgramData.map((data) => {
|
||||||
if (data.raceId === venue) {
|
// if (data.raceId === venue) {
|
||||||
this.selectedVenue = data.raceVenue?.venue || 'Unknown Venue';
|
// this.selectedVenue = data.raceVenue?.venue || 'Unknown Venue';
|
||||||
}
|
// }
|
||||||
return data;
|
// return data;
|
||||||
|
// });
|
||||||
|
|
||||||
|
selectVenue(index: number) {
|
||||||
|
const venue = this.raceCardData?.Venue || 'Unknown Venue';
|
||||||
|
const venueKeys = Object.keys(this.raceCardData?.raceVenueRaces?.races || {});
|
||||||
|
this.selectedVenue = venue;
|
||||||
|
this.selectedRaceId = index;
|
||||||
|
|
||||||
|
this.sharedStateService.updateSharedData({
|
||||||
|
type: 'selectedVenue',
|
||||||
|
value: this.selectedVenue,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
console.log('[VENUE] Venue resolved to:', this.selectedVenue);
|
console.log('[VENUE] Venue resolved to:', this.selectedVenue);
|
||||||
|
|
||||||
this.sharedStateService.updateSharedData({
|
this.sharedStateService.updateSharedData({
|
||||||
@ -169,7 +209,19 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
this.closeModals();
|
this.closeModals();
|
||||||
}
|
}
|
||||||
|
|
||||||
selectRace(race: string) {
|
// selectRace(race: string) {
|
||||||
|
// this.selectedRace = race;
|
||||||
|
|
||||||
|
// this.sharedStateService.updateSharedData({
|
||||||
|
// type: 'selectedRace',
|
||||||
|
// value: this.selectedRace,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log('[RACE] Race selected:', this.selectedRace);
|
||||||
|
// this.closeModals();
|
||||||
|
// }
|
||||||
|
|
||||||
|
selectRace(race: number) {
|
||||||
this.selectedRace = race;
|
this.selectedRace = race;
|
||||||
|
|
||||||
this.sharedStateService.updateSharedData({
|
this.sharedStateService.updateSharedData({
|
||||||
@ -181,6 +233,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
|
|||||||
this.closeModals();
|
this.closeModals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
openWalletModal() {
|
openWalletModal() {
|
||||||
console.log('[MODAL] Opening wallet modal');
|
console.log('[MODAL] Opening wallet modal');
|
||||||
this.showWalletModal = true;
|
this.showWalletModal = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user