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
|
# typescript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
next.config.mjs
|
||||||
|
|
||||||
# .vscode
|
# .vscode
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
1
TODO.md
1
TODO.md
@@ -21,6 +21,7 @@
|
|||||||
- >give rights
|
- >give rights
|
||||||
- >view rights
|
- >view rights
|
||||||
- Forget Password
|
- Forget Password
|
||||||
|
- For Migration if user not have password
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
UAT (IB- frontend) : i-0b55435e15425f1c3
|
UAT (IB- frontend) : i-0b55435e15425f1c3
|
||||||
Linux : i-0c850dcf8b85b1447
|
Linux : i-0c850dcf8b85b1447
|
||||||
|
Prod : i-088e64c3435cb5078
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. Port Forwarding
|
## 2. Port Forwarding
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ const nextConfig = {
|
|||||||
{
|
{
|
||||||
source:'/api/:path*',
|
source:'/api/:path*',
|
||||||
destination: 'http://localhost:8080/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);
|
setAccountOptions(options);
|
||||||
|
|
||||||
|
|
||||||
if (passedAccNo) {
|
if (passedAccNo) {
|
||||||
setSelectedAccNo(passedAccNo);
|
setSelectedAccNo(passedAccNo);
|
||||||
//Automatically fetch last 5 transactions if accNo is passed
|
//Automatically fetch last 5 transactions if accNo is passed
|
||||||
@@ -50,6 +49,15 @@ export default function AccountStatementPage() {
|
|||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
const last5 = data.slice(0, 5);
|
const last5 = data.slice(0, 5);
|
||||||
setTransactions(last5);
|
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(() => {
|
.catch(() => {
|
||||||
@@ -208,7 +216,7 @@ export default function AccountStatementPage() {
|
|||||||
style={{ cursor: "pointer" }}
|
style={{ cursor: "pointer" }}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
generatePDF(selectedAccNo || "", availableBalance || "0", transactions,
|
generatePDF(selectedAccNo || "", availableBalance || "0", transactions,
|
||||||
localStorage.getItem("remitter_name") || "",
|
localStorage.getItem("remitter_name") || "",
|
||||||
startDate ? dayjs(startDate).format("DD/MM/YYYY") : "",
|
startDate ? dayjs(startDate).format("DD/MM/YYYY") : "",
|
||||||
endDate ? dayjs(endDate).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%' }}>
|
<Table style={{ borderCollapse: "collapse", width: '100%' }}>
|
||||||
<thead style={{ backgroundColor: "#3385ff" }}>
|
<thead style={{ backgroundColor: "#3385ff" }}>
|
||||||
{/* <tr>
|
{/* <tr>
|
||||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Name</th>
|
<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" }}>Date</th>
|
||||||
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Type</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" }}>Amount(₹)</th>
|
||||||
</tr> */}
|
<th style={{ ...cellStyle, position: 'sticky', textAlign: "left" }}>Available Balance(₹)</th>
|
||||||
|
</tr> */}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody style={{ maxHeight: '250px', overflowY: 'auto', width: '100%' }}>
|
<tbody style={{ maxHeight: '250px', overflowY: 'auto', width: '100%' }}>
|
||||||
{transactions.map((txn, i) => (
|
{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.name || "—"}</td>
|
||||||
<td style={{ ...cellStyle, textAlign: "left" }}>{txn.date || "—"}</td>
|
<td style={{ ...cellStyle, textAlign: "left" }}>{txn.date || "—"}</td>
|
||||||
{/* <td style={{ ...cellStyle, textAlign: "left" }}>{txn.type}</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", {
|
{parseFloat(txn.amount).toLocaleString("en-IN", {
|
||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
})} <span style={{ fontSize: '10px' }}>{txn.type === "DR" ? "Dr." : "Cr."}</span>
|
})} <span style={{ fontSize: '10px' }}>{txn.type === "DR" ? "Dr." : "Cr."}</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td style={{ ...cellStyle, textAlign: "right", color: "blue", fontSize: '12px' }}>₹{txn.balance || "—"}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export const generatePDF = (
|
|||||||
minimumFractionDigits: 2,
|
minimumFractionDigits: 2,
|
||||||
})} ${t.type === "DR" ? "dr." : "cr."}
|
})} ${t.type === "DR" ? "dr." : "cr."}
|
||||||
</td>
|
</td>
|
||||||
|
<td style="border:1px solid #ccc; padding:6px; text-align:right; color: blue;">${t.balance}</td>
|
||||||
</tr>
|
</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: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: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;">Amount (₹)</th>
|
||||||
|
<th style="border:1px solid #ccc;padding:6px;text-align:right;">Available Amount (₹)</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user