Unverified Commit 9aeafe93 authored by devendra-tarento's avatar devendra-tarento Committed by GitHub
Browse files

Merge pull request #2 from UPHRH-platform/cards-value-changes

card names healpers function
Showing with 35 additions and 25 deletions
+35 -25
......@@ -57,6 +57,14 @@ export const LANG = {
FORM_STATUS_TEXT: {
SENT_FOR_INSPECTION:"Sent for assessment",
INSPECTION_COMPLETED: "Assessment completed",
INSPECTOR_TOTAL_PENDING:"Assessment total pending",
UNDER_REVIEW:"Under review"
},
SEND_FOR_INSPECTION:"Send for assessment"
SEND_FOR_INSPECTION:"Send for assessment",
METRIC_LABEL_KEY: {
UNDER_REVIEW:"Underreview",
SENT_FOR_INS:"Sentforins",
INS_COMPLETED:"Inscompleted",
INSPECTOR_TOTAL_PENDING:"Inspector total pending"
}
};
import { APP } from "../constants";
import { APP, LANG } from "../constants";
const getRoleLabel = (roleName: string) => {
......@@ -13,5 +13,25 @@ const getRoleLabel = (roleName: string) => {
return APP.ROLE_LABEL.SUPER_ADMIN;
}
}
export default { getRoleLabel };
\ No newline at end of file
// Function to format the status label
export const formatLabel = (labelStatus: string) => {
let lowerLabel = labelStatus.toLowerCase();
lowerLabel = lowerLabel.charAt(0).toUpperCase() + lowerLabel.slice(1);
switch (lowerLabel) {
case `${LANG.METRIC_LABEL_KEY.UNDER_REVIEW}`:
lowerLabel = `${LANG.FORM_STATUS_TEXT.UNDER_REVIEW}`;
return lowerLabel;
case `${LANG.METRIC_LABEL_KEY.SENT_FOR_INS}`:
lowerLabel = `${LANG.FORM_STATUS_TEXT.SENT_FOR_INSPECTION}`;
return lowerLabel;
case `${LANG.METRIC_LABEL_KEY.INS_COMPLETED}`:
lowerLabel = `${LANG.FORM_STATUS_TEXT.INSPECTION_COMPLETED}`;
return lowerLabel;
case `${LANG.METRIC_LABEL_KEY.INSPECTOR_TOTAL_PENDING}`:
lowerLabel = `${LANG.FORM_STATUS_TEXT.INSPECTOR_TOTAL_PENDING}`;
return lowerLabel;
default:
return lowerLabel;
}
}
export default { getRoleLabel, formatLabel };
\ No newline at end of file
......@@ -7,6 +7,7 @@ import { FormService } from "./../../services/form.service";
import { APP, LANG } from "./../../constants";
import Notify from "./../../helpers/notify";
import moment from "moment";
import { formatLabel } from "../../helpers/util";
/**
* Inspector component renders
......@@ -174,7 +175,7 @@ export const InspectorHome = ({ data }: InspectorProps) => {
className="col-sm-12 col-md-4 col-lg-2 col-xl-2 col-xxl-2 mt-2 mt-sm-2 mt-md-2 mt-lg-0 mt-xl-0 mt-xxl-0"
key={j}
>
<CardOne count={i.value} title={i.key} />
<CardOne count={i.value} title={formatLabel(i.key)} />
</div>
);
})}
......
......@@ -6,6 +6,7 @@ import { FormService } from "../../services/form.service";
import { APP, LANG } from "../../constants";
import { BtnOne } from "../../components/buttons";
import { useHistory } from "react-router-dom";
import { formatLabel } from "../../helpers/util";
/**
* Reviewer component renders
......@@ -115,26 +116,6 @@ export const ReviewerHome = ({ data }: ReviewerProps) => {
);
};
// Function to format the status label
const formatLabel = (labelStatus: string) => {
let lowerLabel = labelStatus.toLowerCase();
lowerLabel = lowerLabel.charAt(0).toUpperCase() + lowerLabel.slice(1);
switch (lowerLabel) {
case "Underreview":
lowerLabel = "Under review";
return lowerLabel;
case "Sentforins":
lowerLabel = `${LANG.FORM_STATUS_TEXT.SENT_FOR_INSPECTION}`;
return lowerLabel;
case "Inscompleted":
lowerLabel = `${LANG.FORM_STATUS_TEXT.INSPECTION_COMPLETED}`;
return lowerLabel;
default:
return lowerLabel;
}
};
return (
<Fragment>
<div className="container-fluid">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment