feat : "View Race cart Dta fetching is done."
This commit is contained in:
parent
d93596b12f
commit
c1405df5f9
@ -20,7 +20,7 @@ function createWindows() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.loadURL('http://192.168.0.100:4200/login');
|
mainWindow.loadURL('http://192.168.0.103:4200/login');
|
||||||
|
|
||||||
screenWindow = new BrowserWindow({
|
screenWindow = new BrowserWindow({
|
||||||
x: secondary.bounds.x,
|
x: secondary.bounds.x,
|
||||||
@ -35,7 +35,7 @@ function createWindows() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
screenWindow.loadURL('http://192.168.0.100:4200/shared-display');
|
screenWindow.loadURL('http://192.168.0.103:4200/shared-display');
|
||||||
|
|
||||||
ipcMain.on('open-second-screen', () => screenWindow.show());
|
ipcMain.on('open-second-screen', () => screenWindow.show());
|
||||||
ipcMain.on('close-second-screen', () => screenWindow.hide());
|
ipcMain.on('close-second-screen', () => screenWindow.hide());
|
||||||
|
|||||||
@ -400,9 +400,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* View RC Modal Body */
|
/* View RC Modal Body */
|
||||||
|
/* .viewrc-modal-body {
|
||||||
|
flex: 1;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
} */
|
||||||
.viewrc-modal-body {
|
.viewrc-modal-body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
overflow-y: auto; /* 👈 Adds scroll when needed */
|
||||||
|
max-height: 350px; /* 👈 Limit the height to leave space for footer */
|
||||||
|
padding-right: 10px; /* Optional: avoids content touching scrollbar */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* View RC Modal Footer */
|
/* View RC Modal Footer */
|
||||||
@ -431,3 +438,30 @@
|
|||||||
background-color: #2980b9;
|
background-color: #2980b9;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.rc-table-container {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-table th,
|
||||||
|
.rc-table td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 6px 10px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rc-table th {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-text {
|
||||||
|
color: red;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|||||||
@ -204,17 +204,60 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- View RC Modal -->
|
<!-- View RC Modal -->
|
||||||
<div class="viewrc-modal-overlay" *ngIf="showViewRc">
|
<div class="viewrc-modal-overlay" *ngIf="showViewRc">
|
||||||
<div class="viewrc-modal-box">
|
<div class="viewrc-modal-box">
|
||||||
<h3 class="viewrc-modal-title">VIEW RC</h3>
|
<h3 class="viewrc-modal-title">VIEW RC</h3>
|
||||||
<div class="viewrc-modal-body">
|
<div class="viewrc-modal-body">
|
||||||
<!-- Add any fields or content for View RC here if needed -->
|
<ng-container *ngIf="raceCardData && !raceCardData.error; else errorTpl">
|
||||||
|
<p><strong>📍 Venue:</strong> {{ raceCardData.Venue }}</p>
|
||||||
|
<p><strong>📅 Date:</strong> {{ raceCardData.date }}</p>
|
||||||
|
|
||||||
|
<div class="rc-table-container">
|
||||||
|
<h4>🏇 Race Lists</h4>
|
||||||
|
<table class="rc-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Races</th>
|
||||||
|
<th>Race Numbers</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let races of raceCardData.raceVenueRaces.races; let i = index">
|
||||||
|
<td>Race {{ i + 1 }}</td>
|
||||||
|
<td>{{ races.join(', ') }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="rc-table-container" *ngIf="raceCardData.pools?.comboRaces">
|
||||||
|
<h4>🎯 Combo Races</h4>
|
||||||
|
<table class="rc-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Pool</th>
|
||||||
|
<th>Races</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let pool of objectKeys(raceCardData.pools.comboRaces)">
|
||||||
|
<td>{{ pool }}</td>
|
||||||
|
<td>{{ raceCardData.pools.comboRaces[pool].join(', ') }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-template #errorTpl>
|
||||||
|
<p class="error-text">❌ {{ raceCardData?.error }}</p>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="viewrc-modal-footer">
|
<div class="viewrc-modal-footer">
|
||||||
<button class="viewrc-cancel-btn" (click)="closeViewRcPopup()">
|
<button class="viewrc-cancel-btn" (click)="closeViewRcPopup()">CANCEL</button>
|
||||||
CANCEL
|
|
||||||
</button>
|
|
||||||
<button class="viewrc-print-btn" (click)="printViewRc()">PRINT</button>
|
<button class="viewrc-print-btn" (click)="printViewRc()">PRINT</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Component, Output, EventEmitter } from '@angular/core';
|
import { Component, Output, EventEmitter } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { BtcService } from '../../service/btc.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-sidebar',
|
selector: 'app-sidebar',
|
||||||
@ -103,10 +104,31 @@ export class SidebarComponent {
|
|||||||
this.closeWithdrawPopup();
|
this.closeWithdrawPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
raceCardData: any = null; // ✅ Hold fetched data
|
||||||
|
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private btcService: BtcService
|
||||||
|
|
||||||
|
) {}
|
||||||
|
|
||||||
openViewRcPopup() {
|
openViewRcPopup() {
|
||||||
this.showViewRc = true;
|
const cachedData = localStorage.getItem('raceCardData');
|
||||||
|
|
||||||
|
if (cachedData) {
|
||||||
|
this.raceCardData = JSON.parse(cachedData);
|
||||||
|
console.log('📦 Loaded race card from localStorage:', this.raceCardData);
|
||||||
|
} else {
|
||||||
|
this.raceCardData = { error: 'Race card not available locally' };
|
||||||
|
console.warn('⚠️ No race card data found in localStorage.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.showViewRc = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
objectKeys = Object.keys;
|
||||||
|
|
||||||
closeViewRcPopup() {
|
closeViewRcPopup() {
|
||||||
this.showViewRc = false;
|
this.showViewRc = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export class ApplicationHttpRouts {
|
export class ApplicationHttpRouts {
|
||||||
private static readonly PROTOCOL: string = 'http';
|
private static readonly PROTOCOL: string = 'http';
|
||||||
private static readonly BACKEND_SERVER: string = '192.168.0.100';
|
private static readonly BACKEND_SERVER: string = '192.168.0.103';
|
||||||
private static readonly FRONT_PORT_NUMBER: string = '4200';
|
private static readonly FRONT_PORT_NUMBER: string = '4200';
|
||||||
private static readonly PORT_NUMBER: string = '8083';
|
private static readonly PORT_NUMBER: string = '8083';
|
||||||
private static readonly SOCKET: string = `${this.PROTOCOL}://${this.BACKEND_SERVER}:${this.PORT_NUMBER}`;
|
private static readonly SOCKET: string = `${this.PROTOCOL}://${this.BACKEND_SERVER}:${this.PORT_NUMBER}`;
|
||||||
@ -11,6 +11,8 @@ export class ApplicationHttpRouts {
|
|||||||
static readonly PING: string = this.SOCKET + '/user/ping';
|
static readonly PING: string = this.SOCKET + '/user/ping';
|
||||||
static readonly RACE_EVENTS_TODAY: string =
|
static readonly RACE_EVENTS_TODAY: string =
|
||||||
this.SOCKET + '/btc/get_all_races_by_today';
|
this.SOCKET + '/btc/get_all_races_by_today';
|
||||||
|
static readonly RACE_CARD: string =
|
||||||
|
this.SOCKET + '/btc/get_race_card';
|
||||||
|
|
||||||
static readonly UI_PING: string = `${this.PROTOCOL}://${this.BACKEND_SERVER}:${this.FRONT_PORT_NUMBER}`;
|
static readonly UI_PING: string = `${this.PROTOCOL}://${this.BACKEND_SERVER}:${this.FRONT_PORT_NUMBER}`;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,103 @@
|
|||||||
|
|
||||||
|
// import {
|
||||||
|
// Component,
|
||||||
|
// ChangeDetectorRef,
|
||||||
|
// OnInit,
|
||||||
|
// OnDestroy,
|
||||||
|
// } from '@angular/core';
|
||||||
|
// import { SidebarComponent } from '../components/sidebar/sidebar.component';
|
||||||
|
// import { NavbarComponent } from '../components/navbar/navbar.component';
|
||||||
|
// import { MiddleSectionComponent } from '../components/middle-section/middle-section.component';
|
||||||
|
// import { TouchPadMenuComponent } from '../components/touch-pad-menu/touch-pad-menu.component';
|
||||||
|
// import { CommonModule } from '@angular/common';
|
||||||
|
// import { BtcService } from '../service/btc.service';
|
||||||
|
// import { HttpResponse } from '@angular/common/http';
|
||||||
|
// import { HorseService } from '../service/horseData.service';
|
||||||
|
// import { HorseRaceModel } from '../model/horseRaceData';
|
||||||
|
// import { SharedStateService } from '../service/shared-state.service';
|
||||||
|
|
||||||
|
// @Component({
|
||||||
|
// selector: 'app-home',
|
||||||
|
// standalone: true,
|
||||||
|
// imports: [
|
||||||
|
// CommonModule,
|
||||||
|
// SidebarComponent,
|
||||||
|
// NavbarComponent,
|
||||||
|
// MiddleSectionComponent,
|
||||||
|
// TouchPadMenuComponent,
|
||||||
|
// ],
|
||||||
|
// templateUrl: './home.component.html',
|
||||||
|
// styleUrls: ['./home.component.css'],
|
||||||
|
// })
|
||||||
|
// export class HomeComponent implements OnInit, OnDestroy {
|
||||||
|
// isTabletView = false;
|
||||||
|
// isTicketingActive = false;
|
||||||
|
// private resizeObserver!: () => void;
|
||||||
|
|
||||||
|
// constructor(
|
||||||
|
// private cdr: ChangeDetectorRef,
|
||||||
|
// private btcService: BtcService,
|
||||||
|
// private horseService: HorseService,
|
||||||
|
// private sharedStateService: SharedStateService,
|
||||||
|
// ) {}
|
||||||
|
|
||||||
|
// ngOnInit() {
|
||||||
|
// this.updateView();
|
||||||
|
|
||||||
|
// this.resizeObserver = () => {
|
||||||
|
// this.updateView();
|
||||||
|
// this.cdr.detectChanges();
|
||||||
|
// };
|
||||||
|
// window.addEventListener('resize', this.resizeObserver);
|
||||||
|
|
||||||
|
// console.log('Hit hitttt');
|
||||||
|
|
||||||
|
// // Fetch race data and push to shared screen
|
||||||
|
// this.btcService.getAllRaceEventsToday().subscribe({
|
||||||
|
// next: (response: HttpResponse<HorseRaceModel[]>) => {
|
||||||
|
// const horseRaceData = response.body;
|
||||||
|
// this.horseService.HorseData.next(horseRaceData);
|
||||||
|
|
||||||
|
// // 🔁 Push to shared screen
|
||||||
|
// this.sharedStateService.updateSharedData({
|
||||||
|
// type: 'horseData',
|
||||||
|
// value: horseRaceData,
|
||||||
|
// });
|
||||||
|
// },
|
||||||
|
// error: (error) => {
|
||||||
|
// console.log('Error fetching race data');
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ngOnDestroy() {
|
||||||
|
// window.removeEventListener('resize', this.resizeObserver);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private updateView() {
|
||||||
|
// this.isTabletView = window.innerWidth <= 800;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// onTicketingClicked() {
|
||||||
|
// this.isTicketingActive = true;
|
||||||
|
|
||||||
|
// // 🔁 Push ticketing state to shared screen
|
||||||
|
// this.sharedStateService.updateSharedData({
|
||||||
|
// type: 'ticketing',
|
||||||
|
// value: true,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// onOtherActionClicked() {
|
||||||
|
// this.isTicketingActive = false;
|
||||||
|
|
||||||
|
// // 🔁 Push ticketing state to shared screen
|
||||||
|
// this.sharedStateService.updateSharedData({
|
||||||
|
// type: 'ticketing',
|
||||||
|
// value: false,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
@ -38,7 +137,7 @@ export class HomeComponent implements OnInit, OnDestroy {
|
|||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private btcService: BtcService,
|
private btcService: BtcService,
|
||||||
private horseService: HorseService,
|
private horseService: HorseService,
|
||||||
private sharedStateService: SharedStateService
|
private sharedStateService: SharedStateService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -50,9 +149,9 @@ export class HomeComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
window.addEventListener('resize', this.resizeObserver);
|
window.addEventListener('resize', this.resizeObserver);
|
||||||
|
|
||||||
console.log('Hit hitttt');
|
console.log('🏠 HomeComponent loaded');
|
||||||
|
|
||||||
// Fetch race data and push to shared screen
|
// ✅ Fetch & push horse race data
|
||||||
this.btcService.getAllRaceEventsToday().subscribe({
|
this.btcService.getAllRaceEventsToday().subscribe({
|
||||||
next: (response: HttpResponse<HorseRaceModel[]>) => {
|
next: (response: HttpResponse<HorseRaceModel[]>) => {
|
||||||
const horseRaceData = response.body;
|
const horseRaceData = response.body;
|
||||||
@ -65,9 +164,26 @@ export class HomeComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.log('Error fetching race data');
|
console.error('❌ Error fetching race data:', error);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ✅ Preload Race Card if not cached
|
||||||
|
const raceCardCached = localStorage.getItem('raceCardData');
|
||||||
|
if (!raceCardCached) {
|
||||||
|
this.btcService.getRaceCard().subscribe({
|
||||||
|
next: (res) => {
|
||||||
|
const raceCardData = res.body;
|
||||||
|
console.log('📦 Race card preloaded:', raceCardData);
|
||||||
|
localStorage.setItem('raceCardData', JSON.stringify(raceCardData));
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.error('❌ Failed to preload race card:', err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('📦 Race card already cached');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scan Enable/Disable Toggle Button -->
|
<!-- Scan Enable/Disable Toggle Button -->
|
||||||
<!-- <button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="scan-toggle-btn"
|
class="scan-toggle-btn"
|
||||||
(click)="toggleScan()"
|
(click)="toggleScan()"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
style="margin-bottom: 10px"
|
style="margin-bottom: 10px"
|
||||||
>
|
>
|
||||||
Scanner: {{ scanningEnabled ? "ON" : "OFF" }}
|
Scanner: {{ scanningEnabled ? "ON" : "OFF" }}
|
||||||
</button> -->
|
</button>
|
||||||
<!-- End Scan Toggle Button -->
|
<!-- End Scan Toggle Button -->
|
||||||
|
|
||||||
<!-- Login Form -->
|
<!-- Login Form -->
|
||||||
|
|||||||
@ -513,26 +513,26 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
|
|
||||||
private async printAndRedirect(printData: { name: string; employeeId: string; action: string }) {
|
private async printAndRedirect(printData: { name: string; employeeId: string; action: string }) {
|
||||||
try {
|
// try {
|
||||||
const res = await fetch('http://localhost:9100/print', {
|
// const res = await fetch('http://localhost:9100/print', {
|
||||||
method: 'POST',
|
// method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
// headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify(printData),
|
// body: JSON.stringify(printData),
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (!res.ok) throw new Error('Print failed');
|
// if (!res.ok) throw new Error('Print failed');
|
||||||
|
|
||||||
console.log('🖨️ Print successful');
|
// console.log('🖨️ Print successful');
|
||||||
|
|
||||||
// ✅ Open second screen
|
// // ✅ Open second screen
|
||||||
(window as any).electronAPI?.openSecondScreen?.();
|
(window as any).electronAPI?.openSecondScreen?.();
|
||||||
|
|
||||||
// ✅ Navigate to home screen
|
// // ✅ Navigate to home screen
|
||||||
this.router.navigate(['/home']);
|
this.router.navigate(['/home']);
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
console.error('‼️ Print failed', err);
|
// console.error('‼️ Print failed', err);
|
||||||
this.loginError = 'Login OK, but printing failed. Please check the printer.';
|
// this.loginError = 'Login OK, but printing failed. Please check the printer.';
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
showConfirmModal : boolean = false;
|
showConfirmModal : boolean = false;
|
||||||
|
|||||||
@ -49,4 +49,12 @@ export class BtcService {
|
|||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getRaceCard(){
|
||||||
|
return this.http.get<any>(ApplicationHttpRouts.RACE_CARD, {
|
||||||
|
withCredentials: true,
|
||||||
|
observe: 'response',
|
||||||
|
responseType: 'json',
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,9 @@ public class CezenRoutsSecurityChain {
|
|||||||
"http://192.168.208.167:4200",
|
"http://192.168.208.167:4200",
|
||||||
"http://172.16.11.60:4200",
|
"http://172.16.11.60:4200",
|
||||||
"http://192.168.0.103:4200",
|
"http://192.168.0.103:4200",
|
||||||
"http://192.168.1.110:4200"
|
"http://192.168.1.110:4200",
|
||||||
|
"http://192.168.1.12:4200",
|
||||||
|
"http://192.168.0.103:4200"
|
||||||
));
|
));
|
||||||
//config.setAllowedOrigins(Collections.singletonList("*"));
|
//config.setAllowedOrigins(Collections.singletonList("*"));
|
||||||
config.setAllowedMethods(Collections.singletonList("*"));
|
config.setAllowedMethods(Collections.singletonList("*"));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user