Horse-Betting/src/app/components/sidebar/sidebar.component.ts
2025-06-21 11:58:08 +05:30

114 lines
2.4 KiB
TypeScript

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; // Required for ngModel
@Component({
selector: 'app-sidebar',
templateUrl: './sidebar.component.html',
styleUrls: ['./sidebar.component.css'],
standalone: true,
imports: [CommonModule, FormsModule]
})
export class SidebarComponent {
// Cancel Modal
showCancel: boolean = false;
ticketNo: string = '';
openCancelPopup() {
this.showCancel = true;
}
closeCancelPopup() {
this.showCancel = false;
this.ticketNo = '';
}
printTicket() {
alert(`Printing Ticket No: ${this.ticketNo}`);
this.closeCancelPopup();
}
// Pay-out Modal
showPayout: boolean = false;
payoutTicketNo: string = '';
openPayoutPopup() {
this.showPayout = true;
}
closePayoutPopup() {
this.showPayout = false;
this.payoutTicketNo = '';
}
erasePayoutTicket() {
this.payoutTicketNo = '';
}
printPayoutTicket() {
alert(`Printing Payout Ticket No: ${this.payoutTicketNo}`);
this.closePayoutPopup();
}
// Deposit Modal
showDeposit: boolean = false;
depositOperatorId = '';
depositShroffId = '';
depositAmount = '';
openDepositPopup() {
this.showDeposit = true;
}
closeDepositPopup() {
this.showDeposit = false;
this.depositOperatorId = '';
this.depositShroffId = '';
this.depositAmount = '';
}
printDeposit() {
alert(`Deposit: ₹${this.depositAmount}`);
this.closeDepositPopup();
}
// Withdraw Modal
showWithdraw: boolean = false;
withdrawOperatorId = '';
withdrawShroffId = '';
withdrawAmount = '';
openWithdrawPopup() {
this.showWithdraw = true;
}
closeWithdrawPopup() {
this.showWithdraw = false;
this.withdrawOperatorId = '';
this.withdrawShroffId = '';
this.withdrawAmount = '';
}
printWithdraw() {
alert(`Withdraw: ₹${this.withdrawAmount}`);
this.closeWithdrawPopup();
}
// Numpad handlers for Deposit and Withdraw modals
onNumpadClick(value: string, type: 'deposit' | 'withdraw') {
if (type === 'deposit') {
this.depositAmount += value;
} else if (type === 'withdraw') {
this.withdrawAmount += value;
}
}
onBackspace(type: 'deposit' | 'withdraw') {
if (type === 'deposit') {
this.depositAmount = this.depositAmount.slice(0, -1);
} else if (type === 'withdraw') {
this.withdrawAmount = this.withdrawAmount.slice(0, -1);
}
}
}