Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer Request #228421 [WEB ADMIN] Benificiary Reject and Dropout conditions changed as per State | Bug #222613 [WEB UI] : Prerak Edit | Aadhar Page | Back Button is not working #2240

Open
wants to merge 2 commits into
base: release-2.7.7
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 70 additions & 55 deletions apps/front-end/src/pages/admin/beneficiaries/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,38 @@ const addressFieldsArray = [
},
];

const GetOptions = ({ t, array, enumType, enumApiData }) => {
return (
<VStack>
{getUniqueArray(array)?.map((item) => (
<Chip
textAlign="center"
key={item}
lineHeight="15px"
label={
<GetEnumValue
fontSize="14px"
t={t}
enumOptionValue={item}
{...{ enumType, enumApiData }}
/>
}
/>
))}
</VStack>
);
};

GetOptions.propTypes = {
t: PropTypes.any,
array: PropTypes.array,
enumType: PropTypes.string,
enumApiData: PropTypes.object,
};

export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
const [modalVisible, setModalVisible] = useState(false);
const [EditButton, setEditButton] = useState(false);
const [editButton, setEditButton] = useState(false);
const [selectData, setSelectData] = useState([]);
const [status, setStatus] = useState({});
const { id } = useParams();
Expand All @@ -183,9 +212,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
const [adhaarModalVisible, setAdhaarModalVisible] = useState(false);
const [aadhaarValue, setAadhaarValue] = useState();
const [duplicateUserList, setDuplicateUserList] = useState();
const [aadhaarerror, setAadhaarError] = useState();
const [aadhaarError, setAadhaarError] = useState();
const [enumOptions, setEnumOptions] = useState({});
const [benificiary, setBeneficiary] = useState();
const [benificiary, setBenificiary] = useState();
const [contextId, setContextId] = useState();
const [auditLogs, setAuditLogs] = useState([]);
const [auditMonth, setAuditMonth] = useState([]);
Expand Down Expand Up @@ -213,6 +242,8 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
const [publishEvent, setPublishEvent] = useState(false);
const [openWarningModal, setOpenWarningModal] = useState(false);

const { state_name } = JSON.parse(localStorage.getItem("program")) || {};

const getSubjectList = async (id) => {
const subjectData = await organisationService.getSubjectList({ id });
if (Array.isArray(subjectData?.data)) {
Expand All @@ -225,28 +256,6 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
}
};

const GetOptions = ({ array, enumType, enumApiData }) => {
return (
<VStack>
{getUniqueArray(array)?.map((item) => (
<Chip
textAlign="center"
key={item}
lineHeight="15px"
label={
<GetEnumValue
fontSize="14px"
t={t}
enumOptionValue={item}
{...{ enumType, enumApiData }}
/>
}
/>
))}
</VStack>
);
};

const getAuditData = useCallback(async () => {
const result = await benificiaryRegistoryService.getAuditLogs(contextId);
if (result && result.length > 0) {
Expand Down Expand Up @@ -330,7 +339,7 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
setEnrollmentSubjects(subjectNames);
}
setContextId(newData?.result?.program_beneficiaries?.id);
setBeneficiary(newData);
setBenificiary(newData);
if (newData?.result?.program_beneficiaries?.documents_status) {
setStatus(
JSON.parse(newData?.result?.program_beneficiaries?.documents_status),
Expand Down Expand Up @@ -454,15 +463,18 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {

const renderDropoutButton = useMemo(() => {
const status = benificiary?.result?.program_beneficiaries?.status;
switch (status) {
case "identified":
case "ready_to_enroll":
case "enrolled":
case "approved_ip":
switch (true) {
case status === "identified":
case status === "ready_to_enroll":
case status === "enrolled" && state_name !== "RAJASTHAN":
case status === "approved_ip":
// case "registered_in_camp":
// case "pragati_syc":
case "activate":
case "enrolled_ip_verified":
case status === "activate":
case status === "enrolled_ip_verified" && state_name !== "RAJASTHAN":
case status === "sso_id_enrolled" && state_name === "RAJASTHAN":
case status === "sso_id_verified" && state_name === "RAJASTHAN":

case null:
return (
<AdminTypo.Dangerbutton
Expand Down Expand Up @@ -494,15 +506,17 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {

const renderRejectButton = useMemo(() => {
const status = benificiary?.result?.program_beneficiaries?.status;
switch (status) {
case "identified":
case "ready_to_enroll":
case "enrolled":
case "approved_ip":
switch (true) {
case status === "identified":
case status === "ready_to_enroll":
case status === "enrolled" && state_name !== "RAJASTHAN":
case status === "approved_ip":
// case "registered_in_camp":
// case "pragati_syc":
case "activate":
case "enrolled_ip_verified":
case status === "activate":
case status === "enrolled_ip_verified" && state_name !== "RAJASTHAN":
case status === "sso_id_enrolled" && state_name === "RAJASTHAN":
case status === "sso_id_verified" && state_name === "RAJASTHAN":
case null:
return (
<AdminTypo.Dangerbutton
Expand Down Expand Up @@ -1074,6 +1088,7 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
{data?.program_beneficiaries
?.learning_motivation ? (
<GetOptions
t={t}
array={
data?.program_beneficiaries
?.learning_motivation
Expand Down Expand Up @@ -1171,7 +1186,7 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H4 color="textGreyColor.800" bold>
{t("DOCUMENTATION_DETAILS")}
</AdminTypo.H4>
{EditButton === true ? (
{editButton === true ? (
<IconByName
name="CloseCircleLineIcon"
color="iconColor.200"
Expand Down Expand Up @@ -1207,7 +1222,7 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
{t("JAN_AADHAAR_CARD")}:
</AdminTypo.H5>

{EditButton === true ? (
{editButton === true ? (
<Select
selectedValue={status?.jan_aadhaar_card || ""}
accessibilityLabel="Select"
Expand Down Expand Up @@ -1250,7 +1265,7 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("AADHAAR_CARD")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
selectedValue={status?.aadhaar_card || ""}
accessibilityLabel="Select"
Expand Down Expand Up @@ -1289,9 +1304,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("PHOTO")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
isDisabled={EditButton === false}
isDisabled={editButton === false}
selectedValue={status?.photo || ""}
accessibilityLabel="Select"
placeholder={status?.photo || "Select"}
Expand Down Expand Up @@ -1329,9 +1344,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("MOBILE_NUMBER")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
isDisabled={EditButton === false}
isDisabled={editButton === false}
selectedValue={status?.mobile_number || ""}
accessibilityLabel="Select"
placeholder={status?.mobile_number || "Select"}
Expand Down Expand Up @@ -1369,9 +1384,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("MARKSHEET")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
isDisabled={EditButton === false}
isDisabled={editButton === false}
selectedValue={status?.marksheet || ""}
accessibilityLabel="Select"
placeholder={status?.marksheet || "Select"}
Expand Down Expand Up @@ -1409,9 +1424,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("BANK_PASSBOOK")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
isDisabled={EditButton === false}
isDisabled={editButton === false}
selectedValue={status?.bank_passbook || ""}
accessibilityLabel="Select"
placeholder={status?.bank_passbook || "Select"}
Expand Down Expand Up @@ -1450,9 +1465,9 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
<AdminTypo.H5 bold flex="1" color="textGreyColor.550">
{t("BIRTH_CERTIFICATE")}:
</AdminTypo.H5>
{EditButton === true ? (
{editButton === true ? (
<Select
isDisabled={EditButton === false}
isDisabled={editButton === false}
selectedValue={status?.birth_certificate || ""}
accessibilityLabel="Select"
placeholder={status?.birth_certificate || "Select"}
Expand Down Expand Up @@ -1671,10 +1686,10 @@ export default function AgAdminProfile({ footerLinks, userTokenInfo }) {
/>
</HStack>
<AdminTypo.H5 mt={3} ml={4} color={"textMaroonColor.400"}>
{aadhaarerror ? t(aadhaarerror) : ""}
{aadhaarError ? t(aadhaarError) : ""}
</AdminTypo.H5>

{aadhaarerror === "AADHAAR_NUMBER_ALREADY_EXISTS" && (
{aadhaarError === "AADHAAR_NUMBER_ALREADY_EXISTS" && (
<DataTable
customStyles={tableCustomStyles}
columns={[...columns(t)]}
Expand Down