Merge branch 'dev' of https://7o9o-lb-526275444.ap-south-1.elb.amazonaws.com/tomosa.sarkar/IB into dev
This commit is contained in:
@@ -390,9 +390,9 @@ export default function AddBeneficiaryOthers() {
|
||||
maxLength={17}
|
||||
readOnly={isVisibilityLocked}
|
||||
withAsterisk
|
||||
// onCopy={(e) => e.preventDefault()}
|
||||
// onPaste={(e) => e.preventDefault()}
|
||||
// onCut={(e) => e.preventDefault()}
|
||||
onCopy={(e) => e.preventDefault()}
|
||||
onPaste={(e) => e.preventDefault()}
|
||||
onCut={(e) => e.preventDefault()}
|
||||
/>
|
||||
|
||||
{validationStatus === "error" && (
|
||||
@@ -454,7 +454,7 @@ export default function AddBeneficiaryOthers() {
|
||||
maxLength={6}
|
||||
disabled={otpVerified}
|
||||
withAsterisk
|
||||
style={{ flex: 1 }}
|
||||
style={{ flex: 1 }}
|
||||
/>
|
||||
|
||||
{!otpVerified && (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Center, Group, Loader, Paper, ScrollArea, Table, Text, Title } from "@mantine/core";
|
||||
import { Center, Group, Loader, Paper, ScrollArea, Table, Text, Title, TextInput, Button, } from "@mantine/core";
|
||||
import { notifications } from "@mantine/notifications";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Image from "next/image";
|
||||
@@ -68,6 +68,63 @@ export default function ViewBeneficiary() {
|
||||
}
|
||||
|
||||
if (!authorized) return null;
|
||||
|
||||
//add delete beneficiary
|
||||
|
||||
|
||||
async function handleDeleteBeneficiary(accountNo: string) {
|
||||
const isConfirmed = window.confirm("Are you sure you want to delete this beneficiary?");
|
||||
if (!isConfirmed) return;
|
||||
|
||||
try {
|
||||
const token = localStorage.getItem("access_token");
|
||||
|
||||
// Step 1: generate OTP
|
||||
await fetch("/api/otp/generate", {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
const otp = prompt("An OTP has been sent to your registered number. Please enter it:");
|
||||
|
||||
if (!otp) return; // cancelled
|
||||
|
||||
// Step 2: verify OTP
|
||||
const verify = await fetch("/api/otp/verify", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
body: JSON.stringify({ otp }),
|
||||
});
|
||||
if (!verify.ok) {
|
||||
alert("Invalid OTP!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 3: delete beneficiary
|
||||
const res = await fetch(`/api/beneficiary/${accountNo}`, {
|
||||
method: "DELETE",
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
setBeneficiaries((prev) => prev.filter((b) => b.accountNo !== accountNo));
|
||||
alert("Beneficiary deleted successfully.");
|
||||
} else {
|
||||
alert("Error deleting beneficiary.");
|
||||
}
|
||||
} catch (err) {
|
||||
alert("Something went wrong. Please try again.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//add delete beneficiary
|
||||
|
||||
|
||||
return (
|
||||
<Paper shadow="sm" radius="md" p="md" withBorder h={400}>
|
||||
<Title order={3} mb="md">My Beneficiaries</Title>
|
||||
@@ -105,7 +162,16 @@ export default function ViewBeneficiary() {
|
||||
<Table.Td>{b.name}</Table.Td>
|
||||
<Table.Td>{b.accountType}</Table.Td>
|
||||
<Table.Td style={{ textAlign: "center" }}>{b.ifscCode}</Table.Td>
|
||||
<Table.Td style={{ textAlign: "center" }}><IconTrash color="red" /></Table.Td>
|
||||
{/* <Table.Td style={{ textAlign: "center" }}><IconTrash color="red" /></Table.Td> */}
|
||||
|
||||
<Table.Td style={{ textAlign: "center" }}>
|
||||
<IconTrash
|
||||
color="red"
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => handleDeleteBeneficiary(b.accountNo)}
|
||||
/>
|
||||
</Table.Td>
|
||||
|
||||
</Table.Tr>
|
||||
))}
|
||||
</Table.Tbody>
|
||||
|
||||
@@ -306,6 +306,10 @@ export default function ChangePassword() {
|
||||
withAsterisk
|
||||
rightSection={icon}
|
||||
readOnly={step !== "form"}
|
||||
|
||||
onCopy={(e) => e.preventDefault()}
|
||||
onPaste={(e) => e.preventDefault()}
|
||||
onCut={(e) => e.preventDefault()}
|
||||
/>
|
||||
|
||||
{/* Captcha */}
|
||||
|
||||
Reference in New Issue
Block a user