fix : venue fixed in ui

This commit is contained in:
karthik 2025-09-18 12:50:56 +05:30
parent f00629cf45
commit d9d73426fa
3 changed files with 32 additions and 21 deletions

View File

@ -365,6 +365,7 @@
.modal-box {
background: #fff;
color: black;
font-weight: bold;
padding: 30px;
border-radius: 6px;
width: 800px;

View File

@ -259,12 +259,17 @@
<div class="modal-overlay" *ngIf="showVenueModal" (click)="closeModals()">
<div class="modal-box" (click)="$event.stopPropagation()">
<h5>Select Venue</h5>
<div
class="modal-option"
*ngIf="raceCardData?.raceVenueRaces?.races?.length > 0"
(click)="selectVenue(0)"
>
{{ raceCardData?.Venue }}
<div class="modal-options">
<div
class="modal-option"
*ngIf="raceCardData?.venue || raceCardData?.Venue"
(click)="selectVenue(0)"
>
{{ raceCardData?.venue ?? raceCardData?.Venue }}
</div>
<div class="modal-option" *ngIf="!raceCardData?.venue && !raceCardData?.Venue" (click)="selectVenue(0)">
No Venue Available
</div>
</div>
</div>
</div>

View File

@ -476,25 +476,30 @@ export class NavbarComponent implements OnInit, OnDestroy {
}
openVenueModal() {
if (!this.raceCardData || Object.keys(this.raceCardData).length === 0) {
const cachedData = localStorage.getItem('raceCardData');
if (cachedData) {
try {
const parsed = JSON.parse(cachedData);
this.raceCardData = parsed?.structuredRaceCard ?? parsed ?? { raceVenueRaces: { races: [] }, pools: {} };
} catch {
this.raceCardData = { raceVenueRaces: { races: [] }, pools: {} };
}
} else {
this.raceCardData = { raceVenueRaces: { races: [] }, pools: {} };
if (!this.raceCardData || Object.keys(this.raceCardData).length === 0) {
const cachedData = localStorage.getItem('raceCardData');
if (cachedData) {
try {
const parsed = JSON.parse(cachedData);
this.raceCardData = parsed?.structuredRaceCard ?? parsed ?? { raceVenueRaces: { races: [] }, venue: 'Unknown Venue' };
console.log('[VENUE MODAL] Loaded cached raceCardData:', this.raceCardData);
} catch (e) {
console.error('[VENUE MODAL] Failed to parse cached raceCardData:', e);
this.raceCardData = { raceVenueRaces: { races: [] }, venue: 'Unknown Venue' };
}
} else {
this.raceCardData = { raceVenueRaces: { races: [] }, venue: 'Unknown Venue' };
console.log('[VENUE MODAL] No cached data, using default raceCardData:', this.raceCardData);
}
this.selectedVenue = this.raceCardData?.venue ?? this.raceCardData?.Venue ?? 'Select Venue';
this.updateEnabledHorseNumbers();
this.showVenueModal = true;
}
// Set selectedVenue based on raceCardData
this.selectedVenue = this.raceCardData?.venue ?? this.raceCardData?.Venue ?? 'Select Venue';
console.log('[VENUE MODAL] Setting selectedVenue:', this.selectedVenue);
this.updateEnabledHorseNumbers(); // Ensure this is called if needed
this.showVenueModal = true;
}
openRaceModal() {
this.showRaceModal = true;