Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #956 from egovernments/ISTE-463
Browse files Browse the repository at this point in the history
Added primary village option in Employee Details
  • Loading branch information
pradeepkumarcm-egov authored Sep 16, 2024
2 parents 0c08591 + 2ae9838 commit 55f4d62
Showing 1 changed file with 44 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const Details = () => {
const [successData, setsuccessData, clearSuccessData] = Digit.Hooks.useSessionStorage("EMPLOYEE_HRMS_MUTATION_SUCCESS_DATA", false);
const isMobile = window.Digit.Utils.browser.isMobile();
const STATE_ADMIN = Digit.UserService.hasAccess(["STATE_ADMIN"]);
const DIVISION_ADMIN = Digit.UserService.hasAccess(["DIV_ADMIN"]);

const { data: mdmsData = {} } = Digit.Hooks.hrms.useHrmsMDMS(tenantId, "egov-hrms", "HRMSRolesandDesignation") || {};

mdmsData?.MdmsRes?.["tenant"]["tenants"]?.map((items) => {
Expand All @@ -42,7 +44,6 @@ const Details = () => {
}
});
});
// console.log(data, "data");

useEffect(() => {
setMutationHappened(false);
Expand All @@ -65,7 +66,7 @@ const Details = () => {
window.open(documentLink, "_blank");
};

const submitAction = (data) => { };
const submitAction = (data) => {};

useEffect(() => {
switch (selectedAction) {
Expand Down Expand Up @@ -117,14 +118,9 @@ const Details = () => {
<Row label={t("HR_MOB_NO_LABEL")} text={data?.Employees?.[0]?.user?.mobileNumber || "NA"} textStyle={{ whiteSpace: "pre" }} />
<Row label={t("HR_GENDER_LABEL")} text={t(data?.Employees?.[0]?.user?.gender) || "NA"} />
<Row label={t("HR_EMAIL_LABEL")} text={data?.Employees?.[0]?.user?.emailId || "NA"} />
<Row label={t("HR_COMMON_DEPARTMENT")} text={

t(data?.Employees?.[0]?.assignments[0]?.department)
|| "NA"} />
<Row label={t("HR_COMMON_USER_DESIGNATION")} text={
t(data?.Employees?.[0]?.assignments[0]?.designation)

|| "NA"} />
<Row label={t("HR_COMMON_DEPARTMENT")} text={t(data?.Employees?.[0]?.assignments[0]?.department) || "NA"} />
<Row label={t("HR_COMMON_USER_DESIGNATION")} text={t(data?.Employees?.[0]?.assignments[0]?.designation) || "NA"} />
{DIVISION_ADMIN === 1 && <Row label={t("HR_COMMON_USER_PRIMARY_VILLAGE")} text={t(data?.Employees?.[0]?.tenantId) || "NA"} />}
</StatusTable>
{data?.Employees?.[0]?.isActive == false ? (
<StatusTable>
Expand All @@ -139,8 +135,8 @@ const Details = () => {
text={
t(
"EGOV_HRMS_DEACTIVATIONREASON_" +
data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0]
.reasonForDeactivation
data?.Employees?.[0]?.deactivationDetails?.sort((a, b) => new Date(a.effectiveFrom) - new Date(b.effectiveFrom))[0]
.reasonForDeactivation
) || "NA"
}
/>
Expand Down Expand Up @@ -183,41 +179,41 @@ const Details = () => {

{data?.Employees?.[0]?.jurisdictions?.length > 0
? data?.Employees?.[0]?.jurisdictions?.map((element, index) => {
return (
<StatusTable
key={index}
style={{
maxWidth: "640px",
border: "1px solid rgb(214, 213, 212)",
inset: "0px",
width: "auto",
padding: ".2rem",
marginBottom: "2rem",
}}
>
<div style={{ paddingBottom: "2rem" }}>
{" "}
{t("HR_JURISDICTION")} {index + 1}
</div>
{STATE_ADMIN ? (
<Row
label={t("HR_DIVISIONS_LABEL")}
text={t(Digit.Utils.locale.convertToLocale(element?.division, "EGOV_LOCATION_BOUNDARYTYPE"))}
textStyle={{ whiteSpace: "pre" }}
/>
) : null}
<Row label={t("HR_BOUNDARY_LABEL")} text={t(element?.boundary)} />
{!STATE_ADMIN ? (
<Row
label={t("HR_ROLE_LABEL")}
text={data?.Employees?.[0]?.user.roles
.filter((ele) => ele.tenantId == element?.boundary)
?.map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))}
/>
) : null}
</StatusTable>
);
})
return (
<StatusTable
key={index}
style={{
maxWidth: "640px",
border: "1px solid rgb(214, 213, 212)",
inset: "0px",
width: "auto",
padding: ".2rem",
marginBottom: "2rem",
}}
>
<div style={{ paddingBottom: "2rem" }}>
{" "}
{t("HR_JURISDICTION")} {index + 1}
</div>
{STATE_ADMIN ? (
<Row
label={t("HR_DIVISIONS_LABEL")}
text={t(Digit.Utils.locale.convertToLocale(element?.division, "EGOV_LOCATION_BOUNDARYTYPE"))}
textStyle={{ whiteSpace: "pre" }}
/>
) : null}
<Row label={t("HR_BOUNDARY_LABEL")} text={t(element?.boundary)} />
{!STATE_ADMIN ? (
<Row
label={t("HR_ROLE_LABEL")}
text={data?.Employees?.[0]?.user.roles
.filter((ele) => ele.tenantId == element?.boundary)
?.map((ele) => t(`ACCESSCONTROL_ROLES_ROLES_` + ele?.code))}
/>
) : null}
</StatusTable>
);
})
: null}
</Card>
</div>
Expand All @@ -240,4 +236,4 @@ const Details = () => {
);
};

export default Details;
export default Details;

0 comments on commit 55f4d62

Please sign in to comment.