Fix : sidebar button enabling and disabling based on user inputs means functinal shcecking of fields is done
This commit is contained in:
parent
102b6d57df
commit
68d3ff34da
@ -539,3 +539,19 @@ strong{
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deposit-print-btn[disabled]{
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deposit-cancel-btn[disabled]{
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.erase-btn[disabled],.withdraw-print-btn[disabled] {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,15 +42,13 @@
|
|||||||
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="modal-footer">
|
|
||||||
<button class="cancel-btn" (click)="closeCancelPopup()">CANCEL</button>
|
|
||||||
<button class="print-btn" (click)="printTicketCancel()">PRINT</button>
|
|
||||||
</div> -->
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="cancel-btn" (click)="closeCancelPopup()">CANCEL</button>
|
<button class="cancel-btn" (click)="closeCancelPopup()" [disabled]="!!loadingMessage">CANCEL</button>
|
||||||
<button class="print-btn"
|
<button class="print-btn"
|
||||||
(click)="printTicketCancel()"
|
(click)="printTicketCancel()"
|
||||||
[disabled]="!!loadingMessage">PRINT</button>
|
[disabled]="!!loadingMessage"
|
||||||
|
[disabled]="!!loadingMessage || !( (ticketNo || '').trim() )">PRINT</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -67,26 +65,22 @@
|
|||||||
id="payoutTicketNo"
|
id="payoutTicketNo"
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
[(ngModel)]="payoutTicketNo"
|
[(ngModel)]="payoutTicketNo"
|
||||||
/>
|
(ngModelChange)="onPayoutTicketChange($event)"
|
||||||
|
maxlength="16"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="warning-message" *ngIf="payoutWarning">{{ payoutWarning }}</div>
|
<div class="warning-message" *ngIf="payoutWarning">{{ payoutWarning }}</div>
|
||||||
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
||||||
|
|
||||||
<!-- <div class="modal-footer">
|
|
||||||
<button class="cancel-btn" (click)="closePayoutPopup()">CANCEL</button>
|
|
||||||
<button class="erase-btn" (click)="erasePayoutTicket()">ERASE</button>
|
|
||||||
<button class="print-btn" (click)="printPayoutTicket()">PRINT</button>
|
|
||||||
</div> -->
|
|
||||||
<!-- inside PAY-OUT modal-footer -->
|
<!-- inside PAY-OUT modal-footer -->
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="cancel-btn" (click)="closePayoutPopup()">CANCEL</button>
|
<button class="cancel-btn" (click)="closePayoutPopup()" [disabled]="!!loadingMessage">CANCEL</button>
|
||||||
<button class="erase-btn" (click)="erasePayoutTicket()" [disabled]="!!loadingMessage">ERASE</button>
|
<button class="erase-btn" (click)="erasePayoutTicket()" [disabled]="!!loadingMessage">ERASE</button>
|
||||||
<!-- safe: coerce to '' before trim -->
|
<!-- safe: coerce to '' before trim -->
|
||||||
<button
|
<button
|
||||||
class="print-btn"
|
class="print-btn"
|
||||||
(click)="printPayoutTicket()"
|
(click)="printPayoutTicket()"
|
||||||
[disabled]="!!loadingMessage || !( (payoutTicketNo || '') .trim() )"
|
[disabled]="!!loadingMessage || (payoutTicketNo?.length !== 16)"
|
||||||
>
|
>
|
||||||
PRINT
|
PRINT
|
||||||
</button>
|
</button>
|
||||||
@ -95,7 +89,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Deposit Modal -->
|
<!-- ------------------------------------------DEPOSIT MODAL ------------------------------------------------->
|
||||||
<div class="deposit-modal-overlay" *ngIf="showDeposit">
|
<div class="deposit-modal-overlay" *ngIf="showDeposit">
|
||||||
<div class="deposit-modal-box">
|
<div class="deposit-modal-box">
|
||||||
<h3 class="deposit-modal-title">DEPOSIT</h3>
|
<h3 class="deposit-modal-title">DEPOSIT</h3>
|
||||||
@ -162,11 +156,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="deposit-footer">
|
<div class="deposit-footer">
|
||||||
<button class="deposit-cancel-btn" (click)="closeDepositPopup()">
|
<button class="deposit-cancel-btn" (click)="closeDepositPopup()" [disabled]="!!loadingMessage">
|
||||||
CANCEL
|
CANCEL
|
||||||
</button>
|
</button>
|
||||||
<button class="deposit-print-btn" (click)="printDeposit()">PRINT</button>
|
<button class="deposit-print-btn" (click)="printDeposit()"
|
||||||
|
[disabled]="
|
||||||
|
!!loadingMessage ||
|
||||||
|
(depositOperatorId?.length !== 12) ||
|
||||||
|
(depositShroffId?.length !== 12) ||
|
||||||
|
!(depositAmount?.trim())
|
||||||
|
"
|
||||||
|
>
|
||||||
|
PRINT
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -243,13 +247,20 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="withdraw-footer">
|
<div class="withdraw-footer">
|
||||||
<button class="withdraw-cancel-btn" (click)="closeWithdrawPopup()">
|
<button class="withdraw-cancel-btn" (click)="closeWithdrawPopup()" [disabled]="!!loadingMessage">
|
||||||
CANCEL
|
CANCEL
|
||||||
</button>
|
</button>
|
||||||
<button class="withdraw-print-btn" (click)="printWithdraw()">
|
<button class="withdraw-print-btn" (click)="printWithdraw()"
|
||||||
|
[disabled]="
|
||||||
|
!!loadingMessage ||
|
||||||
|
(withdrawOperatorId?.length !== 12) ||
|
||||||
|
(withdrawShroffId?.length !== 12) ||
|
||||||
|
!(withdrawAmount?.trim())
|
||||||
|
">
|
||||||
PRINT
|
PRINT
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-loading" *ngIf="loadingMessage">{{ loadingMessage }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -289,6 +289,19 @@ Original Total: ₹${cancelTicketData.totalAmount}
|
|||||||
payoutWarning = ''; // show GUI message when payout response is not as expected
|
payoutWarning = ''; // show GUI message when payout response is not as expected
|
||||||
|
|
||||||
|
|
||||||
|
onPayoutTicketChange(value: string) {
|
||||||
|
if (value.length > 16) {
|
||||||
|
this.payoutTicketNo = value.slice(0, 16); // trim to 16
|
||||||
|
} else {
|
||||||
|
this.payoutTicketNo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if not exactly 16 chars, you can clear it completely:
|
||||||
|
if (this.payoutTicketNo.length !== 16) {
|
||||||
|
this.payoutTicketNo = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async printPayoutTicket() {
|
async printPayoutTicket() {
|
||||||
console.log("🖨️ Print payout clicked");
|
console.log("🖨️ Print payout clicked");
|
||||||
@ -471,7 +484,7 @@ async printDeposit() {
|
|||||||
btId: btid,
|
btId: btid,
|
||||||
btMake: btMake
|
btMake: btMake
|
||||||
};
|
};
|
||||||
|
this.loadingMessage = 'Printing Deposit — please wait...';
|
||||||
console.log("📡 Sending deposit API request:", apiPayload);
|
console.log("📡 Sending deposit API request:", apiPayload);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -633,6 +646,9 @@ ${content}
|
|||||||
console.error("❌ Deposit API call failed:", err);
|
console.error("❌ Deposit API call failed:", err);
|
||||||
this.depositWarning = '❌ Deposit API call failed. Please try again.';
|
this.depositWarning = '❌ Deposit API call failed. Please try again.';
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
this.loadingMessage = ''; // ALWAYS clear loading message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//--------------------------------------PRINT DEPOSIT TICKET ENDS HERE -------------------------------------------------------------
|
//--------------------------------------PRINT DEPOSIT TICKET ENDS HERE -------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user