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 { .modal-box {
background: #fff; background: #fff;
color: black; color: black;
font-weight: bold;
padding: 30px; padding: 30px;
border-radius: 6px; border-radius: 6px;
width: 800px; width: 800px;

View File

@ -259,12 +259,17 @@
<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 <div class="modal-options">
class="modal-option" <div
*ngIf="raceCardData?.raceVenueRaces?.races?.length > 0" class="modal-option"
(click)="selectVenue(0)" *ngIf="raceCardData?.venue || raceCardData?.Venue"
> (click)="selectVenue(0)"
{{ raceCardData?.Venue }} >
{{ raceCardData?.venue ?? raceCardData?.Venue }}
</div>
<div class="modal-option" *ngIf="!raceCardData?.venue && !raceCardData?.Venue" (click)="selectVenue(0)">
No Venue Available
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -476,25 +476,30 @@ export class NavbarComponent implements OnInit, OnDestroy {
} }
openVenueModal() { openVenueModal() {
if (!this.raceCardData || Object.keys(this.raceCardData).length === 0) { if (!this.raceCardData || Object.keys(this.raceCardData).length === 0) {
const cachedData = localStorage.getItem('raceCardData'); const cachedData = localStorage.getItem('raceCardData');
if (cachedData) { if (cachedData) {
try { try {
const parsed = JSON.parse(cachedData); const parsed = JSON.parse(cachedData);
this.raceCardData = parsed?.structuredRaceCard ?? parsed ?? { raceVenueRaces: { races: [] }, pools: {} }; this.raceCardData = parsed?.structuredRaceCard ?? parsed ?? { raceVenueRaces: { races: [] }, venue: 'Unknown Venue' };
} catch { console.log('[VENUE MODAL] Loaded cached raceCardData:', this.raceCardData);
this.raceCardData = { raceVenueRaces: { races: [] }, pools: {} }; } catch (e) {
} console.error('[VENUE MODAL] Failed to parse cached raceCardData:', e);
} else { this.raceCardData = { raceVenueRaces: { races: [] }, venue: 'Unknown Venue' };
this.raceCardData = { raceVenueRaces: { races: [] }, pools: {} };
} }
} 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() { openRaceModal() {
this.showRaceModal = true; this.showRaceModal = true;