feat : add available balance in account statement
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -38,6 +38,7 @@ package-lock.json
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
next.config.mjs
|
||||
|
||||
# .vscode
|
||||
.vscode
|
||||
|
||||
1
TODO.md
1
TODO.md
@@ -21,6 +21,7 @@
|
||||
- >give rights
|
||||
- >view rights
|
||||
- Forget Password
|
||||
- For Migration if user not have password
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
UAT (IB- frontend) : i-0b55435e15425f1c3
|
||||
Linux : i-0c850dcf8b85b1447
|
||||
Prod : i-088e64c3435cb5078
|
||||
```
|
||||
|
||||
## 2. Port Forwarding
|
||||
|
||||
@@ -10,6 +10,11 @@ const nextConfig = {
|
||||
{
|
||||
source:'/api/:path*',
|
||||
destination: 'http://localhost:8080/api/:path*',
|
||||
// prod
|
||||
// destination : 'http://lb-kccb-mobile-banking-app-848675342.ap-south-1.elb.amazonaws.com:8080/api/:path*',
|
||||
// Testing
|
||||
// destination: 'http://lb-test-mobile-banking-app-192209417.ap-south-1.elb.amazonaws.com:8080/api/:path*',
|
||||
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
@@ -32,7 +32,6 @@ export default function AccountStatementPage() {
|
||||
}));
|
||||
setAccountOptions(options);
|
||||
|
||||
|
||||
if (passedAccNo) {
|
||||
setSelectedAccNo(passedAccNo);
|
||||
//Automatically fetch last 5 transactions if accNo is passed
|
||||
@@ -50,6 +49,15 @@ export default function AccountStatementPage() {
|
||||
if (Array.isArray(data)) {
|
||||
const last5 = data.slice(0, 5);
|
||||
setTransactions(last5);
|
||||
// Reuse balance logic
|
||||
const saved = sessionStorage.getItem("accountData");
|
||||
if (saved) {
|
||||
const parsed = JSON.parse(saved);
|
||||
const acc = parsed.find((a: any) => a.stAccountNo === passedAccNo);
|
||||
if (acc) {
|
||||
setAvailableBalance(acc.stAvailableBalance);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -208,7 +216,7 @@ export default function AccountStatementPage() {
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() =>
|
||||
generatePDF(selectedAccNo || "", availableBalance || "0", transactions,
|
||||
localStorage.getItem("remitter_name") || "",
|
||||
localStorage.getItem("remitter_name") || "",
|
||||
startDate ? dayjs(startDate).format("DD/MM/YYYY") : "",
|
||||
endDate ? dayjs(endDate).format("DD/MM/YYYY") : "")
|
||||
}
|
||||
@@ -246,11 +254,12 @@ export default function AccountStatementPage() {
|
||||
<Table style={{ borderCollapse: "collapse", width: '100%' }}>
|
||||
<thead style={{ backgroundColor: "#3385ff" }}>
|
||||
{/* <tr>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Name</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Date</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Type</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Amount(₹)</th>
|
||||
</tr> */}
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Name</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Date</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Type</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Amount(₹)</th>
|
||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Available Balance(₹)</th>
|
||||
</tr> */}
|
||||
</thead>
|
||||
<tbody style={{ maxHeight: '250px', overflowY: 'auto', width: '100%' }}>
|
||||
{transactions.map((txn, i) => (
|
||||
@@ -258,11 +267,12 @@ export default function AccountStatementPage() {
|
||||
<td style={{ ...cellStyle, textAlign: "left" }}> {txn.name || "—"}</td>
|
||||
<td style={{ ...cellStyle, textAlign: "left" }}>{txn.date || "—"}</td>
|
||||
{/* <td style={{ ...cellStyle, textAlign: "left" }}>{txn.type}</td> */}
|
||||
<td style={{ ...cellStyle, textAlign: "left", color: txn.type === "DR" ? "#e03131" : "#2f9e44" }}>
|
||||
<td style={{ ...cellStyle, textAlign: "right", color: txn.type === "DR" ? "#e03131" : "#2f9e44" }}>
|
||||
{parseFloat(txn.amount).toLocaleString("en-IN", {
|
||||
minimumFractionDigits: 2,
|
||||
})} <span style={{ fontSize: '10px' }}>{txn.type === "DR" ? "Dr." : "Cr."}</span>
|
||||
</td>
|
||||
<td style={{ ...cellStyle, textAlign: "right", color: "blue", fontSize: '12px' }}>₹{txn.balance || "—"}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -23,6 +23,7 @@ export const generatePDF = (
|
||||
minimumFractionDigits: 2,
|
||||
})} ${t.type === "DR" ? "dr." : "cr."}
|
||||
</td>
|
||||
<td style="border:1px solid #ccc; padding:6px; text-align:right; color: blue;">${t.balance}</td>
|
||||
</tr>
|
||||
`
|
||||
);
|
||||
@@ -56,6 +57,7 @@ export const generatePDF = (
|
||||
<th style="border:1px solid #ccc;padding:6px;text-align:center;">Date</th>
|
||||
<th style="border:1px solid #ccc;padding:6px;text-align:left;">Description</th>
|
||||
<th style="border:1px solid #ccc;padding:6px;text-align:right;">Amount (₹)</th>
|
||||
<th style="border:1px solid #ccc;padding:6px;text-align:right;">Available Amount (₹)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user