diff --git a/btc-UI/electron/main.js b/btc-UI/electron/main.js
index 51fb62f..d1ed9bf 100644
--- a/btc-UI/electron/main.js
+++ b/btc-UI/electron/main.js
@@ -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({
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('close-second-screen', () => screenWindow.hide());
diff --git a/btc-UI/src/app/components/sidebar/sidebar.component.css b/btc-UI/src/app/components/sidebar/sidebar.component.css
index 6a13dbf..c93e85a 100755
--- a/btc-UI/src/app/components/sidebar/sidebar.component.css
+++ b/btc-UI/src/app/components/sidebar/sidebar.component.css
@@ -400,9 +400,16 @@
}
/* View RC Modal Body */
+/* .viewrc-modal-body {
+ flex: 1;
+ margin-bottom: 20px;
+} */
.viewrc-modal-body {
flex: 1;
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 */
@@ -431,3 +438,30 @@
background-color: #2980b9;
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;
+}
diff --git a/btc-UI/src/app/components/sidebar/sidebar.component.html b/btc-UI/src/app/components/sidebar/sidebar.component.html
index cb282b9..f017338 100755
--- a/btc-UI/src/app/components/sidebar/sidebar.component.html
+++ b/btc-UI/src/app/components/sidebar/sidebar.component.html
@@ -204,17 +204,60 @@
+
VIEW RC
-
+
+ 📍 Venue: {{ raceCardData.Venue }}
+ 📅 Date: {{ raceCardData.date }}
+
+
+
🏇 Race Lists
+
+
+
+ | Races |
+ Race Numbers |
+
+
+
+
+ | Race {{ i + 1 }} |
+ {{ races.join(', ') }} |
+
+
+
+
+
+
+
🎯 Combo Races
+
+
+
+ | Pool |
+ Races |
+
+
+
+
+ | {{ pool }} |
+ {{ raceCardData.pools.comboRaces[pool].join(', ') }} |
+
+
+
+
+
+
+
+ ❌ {{ raceCardData?.error }}
+
+
diff --git a/btc-UI/src/app/components/sidebar/sidebar.component.ts b/btc-UI/src/app/components/sidebar/sidebar.component.ts
index 66c3e24..2b6d215 100755
--- a/btc-UI/src/app/components/sidebar/sidebar.component.ts
+++ b/btc-UI/src/app/components/sidebar/sidebar.component.ts
@@ -1,6 +1,7 @@
import { Component, Output, EventEmitter } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
+import { BtcService } from '../../service/btc.service';
@Component({
selector: 'app-sidebar',
@@ -103,10 +104,31 @@ export class SidebarComponent {
this.closeWithdrawPopup();
}
+
+ raceCardData: any = null; // ✅ Hold fetched data
+
+
+ constructor(
+ private btcService: BtcService
+
+ ) {}
+
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() {
this.showViewRc = false;
}
diff --git a/btc-UI/src/app/constants/http-routs.ts b/btc-UI/src/app/constants/http-routs.ts
index b7f8554..8d37273 100755
--- a/btc-UI/src/app/constants/http-routs.ts
+++ b/btc-UI/src/app/constants/http-routs.ts
@@ -1,6 +1,6 @@
export class ApplicationHttpRouts {
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 PORT_NUMBER: string = '8083';
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 RACE_EVENTS_TODAY: string =
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}`;
}
diff --git a/btc-UI/src/app/home/home.component.ts b/btc-UI/src/app/home/home.component.ts
index 7e2b2a8..e6bc444 100755
--- a/btc-UI/src/app/home/home.component.ts
+++ b/btc-UI/src/app/home/home.component.ts
@@ -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
) => {
+// 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 {
Component,
ChangeDetectorRef,
@@ -38,7 +137,7 @@ export class HomeComponent implements OnInit, OnDestroy {
private cdr: ChangeDetectorRef,
private btcService: BtcService,
private horseService: HorseService,
- private sharedStateService: SharedStateService
+ private sharedStateService: SharedStateService,
) {}
ngOnInit() {
@@ -50,9 +149,9 @@ export class HomeComponent implements OnInit, OnDestroy {
};
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({
next: (response: HttpResponse) => {
const horseRaceData = response.body;
@@ -65,9 +164,26 @@ export class HomeComponent implements OnInit, OnDestroy {
});
},
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() {
diff --git a/btc-UI/src/app/login/login.component.html b/btc-UI/src/app/login/login.component.html
index d9c908d..f7aa531 100755
--- a/btc-UI/src/app/login/login.component.html
+++ b/btc-UI/src/app/login/login.component.html
@@ -19,7 +19,7 @@
-
+
diff --git a/btc-UI/src/app/login/login.component.ts b/btc-UI/src/app/login/login.component.ts
index d8dad41..3ab7f94 100755
--- a/btc-UI/src/app/login/login.component.ts
+++ b/btc-UI/src/app/login/login.component.ts
@@ -513,26 +513,26 @@ export class LoginComponent implements OnInit, OnDestroy {
private async printAndRedirect(printData: { name: string; employeeId: string; action: string }) {
- try {
- const res = await fetch('http://localhost:9100/print', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(printData),
- });
+ // try {
+ // const res = await fetch('http://localhost:9100/print', {
+ // method: 'POST',
+ // headers: { 'Content-Type': 'application/json' },
+ // 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
- (window as any).electronAPI?.openSecondScreen?.();
+ // // ✅ Open second screen
+ (window as any).electronAPI?.openSecondScreen?.();
- // ✅ Navigate to home screen
+ // // ✅ Navigate to home screen
this.router.navigate(['/home']);
- } catch (err) {
- console.error('‼️ Print failed', err);
- this.loginError = 'Login OK, but printing failed. Please check the printer.';
- }
+ // } catch (err) {
+ // console.error('‼️ Print failed', err);
+ // this.loginError = 'Login OK, but printing failed. Please check the printer.';
+ // }
}
showConfirmModal : boolean = false;
diff --git a/btc-UI/src/app/service/btc.service.ts b/btc-UI/src/app/service/btc.service.ts
index adfdd8f..cd4e4e4 100755
--- a/btc-UI/src/app/service/btc.service.ts
+++ b/btc-UI/src/app/service/btc.service.ts
@@ -49,4 +49,12 @@ export class BtcService {
responseType: 'json',
});
}
+
+ public getRaceCard(){
+ return this.http.get