Skip to content

Commit

Permalink
myMicroplanFixes (#1708)
Browse files Browse the repository at this point in the history
* My microplan data fixes, localisation fixes

* setup response screen fixes, breadcrumb localisation code correctify

* search bar fix

* fixes

* ADD NEW LOCALE

* roletable fixes for mobile number search, qa issue fix

* FIXES

* quickfixes

* quick fixes/ Tagging UI UX fixes

* fix

* added locale

---------

Co-authored-by: NabeelAyubee <[email protected]>
  • Loading branch information
nabeelmd-eGov and NabeelAyubee authored Oct 30, 2024
1 parent 222a160 commit 8881f19
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const rolesCodes = Digit.Hooks.useSessionStorage("User", {})[0]?.info?.roles;
const roles = rolesCodes.map((item) => item.code);
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "ROOT_POPULATION_APPROVER");
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "POPULATION_DATA_APPROVER");
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-health-css",
"version": "0.1.13",
"version": "0.1.14",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
a{
text-decoration: none !important;
}
.search-tabs-container {
display: flex;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const MicroplanDetails = ({ onSelect, props: customProps, ...props }) => {
<Row
key={idx}
label={row?.label}
text={row?.value}
text={t(row?.value)}
rowContainerStyle={{ margin: "0", padding: "0", height: "2.4rem", justifyContent: "flex-start" }}
className="border-none"
last={idx === campaignCard?.length - 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ function RoleTableComposer({ nationalRoles }) {
: false;
return (
<MultiSelectDropdown
disabled={isUserAlreadyAssignedActive || nationalRoles?.includes(category) ? true : false}
disabled={
isUserAlreadyAssignedActive ||
nationalRoles?.includes(category) ||
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedHierarchy
? true
: false
}
props={{ className: "roleTableCell" }}
t={t}
options={rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.boundaryOptions || []}
Expand Down Expand Up @@ -407,6 +413,10 @@ function RoleTableComposer({ nationalRoles }) {

return (
<Button
isDisabled={
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedBoundaries ||
rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedBoundaries?.length === 0
}
className={"roleTableCell"}
variation={isUserAlreadyAssignedActive ? "secondary" : "primary"}
label={isUserAlreadyAssignedActive ? t(`UNASSIGN`) : t(`ASSIGN`)}
Expand All @@ -429,11 +439,10 @@ function RoleTableComposer({ nationalRoles }) {
refetchHrms(); // Fetch the updated data with the new rows per page
};
const handleSearchSubmit = (e) => {
if (number?.length > 0 && number?.length <= 10) {
if (number?.length > 0 && number?.length !== 10) {
setShowToast({ key: "error", label: t("INVALID_MOBILE_NUMBER_LENGTH") });
return;
}

setCurrentPage(1);
setFilters({
name: name,
Expand Down Expand Up @@ -492,7 +501,7 @@ function RoleTableComposer({ nationalRoles }) {
<CardLabel style={{ marginBottom: "0.4rem" }}>{t("Number")}</CardLabel>
<TextInput
value={number}
type={"number"}
type={"text"}
name={"number"}
onChange={(e) => {
const newValue = e.target.value.replace(/\D/g, ""); // Remove non-numeric characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function UserAccess({ category, setData, nationalRoles }) {
</Card>

<Card>
{planEmployee?.data?.length > 0 ? (
{planEmployee?.data?.length > 0 || searchQuery ? (
<div style={styles.container}>
<TableSearchField onSearch={handleSearch} />
<Button
Expand All @@ -248,7 +248,7 @@ function UserAccess({ category, setData, nationalRoles }) {
</div>
) : null}
{!isPlanEmpSearchLoading && (!planEmployee?.data || planEmployee?.data?.length === 0) ? (
<Card>
<Card style={{ boxShadow: "none" }}>
<NoResultsFound />
<Button
variation="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultSearchValues = {
showTab: true, // setting true will enable tab screen
TabSearchconfig: [ // all tab config should be added in json array
{
label: "MY_MICROPLANS",
label: "ALL",
type: "search",
apiDetails: {
serviceName: "/plan-service/config/_search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const rolesCodes = Digit.Hooks.useSessionStorage("User", {})[0]?.info?.roles;
const roles = rolesCodes.map((item) => item.code);
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "ROOT_POPULATION_APPROVER");
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "POPULATION_DATA_APPROVER");
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ const createUpdatePlanProject = async (req) => {
backlink: `/${window.contextPath}/employee`,
responseId: planResForCompleteSetup?.PlanConfiguration?.[0]?.name,
info: "SETUP_MICROPLAN_SUCCESS_NAME",
description: "SETUP_MICROPLAN_SUCCESS_RESPONSE_DESC",
// description: "SETUP_MICROPLAN_SUCCESS_RESPONSE_DESC",
},
};
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const searchPlanWithCensus = async ({ tenantId, microplanId, body, limit, offset
CensusSearchCriteria: {
tenantId: tenantId,
source: microplanId,
limit: body?.PlanSearchCriteria?.limit,
jurisdiction: localityArray,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const PlanInbox = () => {
);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
}
Expand Down Expand Up @@ -102,8 +102,7 @@ const PlanInbox = () => {
active: true,
jurisdiction: jurisdiction,
status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "",
assignee: activeLink.code === "ASSIGNED_TO_ME" && selectedFilter !== "PENDING_FOR_VALIDATION" ? user?.info?.uuid : "",
// assignee: activeLink.code === "ASSIGNED_TO_ME" ? user?.info?.uuid : "",
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "VALIDATED" ? "" : user?.info?.uuid,
planConfigurationId: microplanId, //list of plan ids
limit: limitAndOffset?.limit,
offset: limitAndOffset?.offset,
Expand Down Expand Up @@ -269,16 +268,16 @@ const PlanInbox = () => {
}, [selectedFilter, activeLink, jurisdiction, limitAndOffset]);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
} else {
if (!showTab) {
setShowTab(true);
setActiveLink({
code: "ASSIGNED_TO_ME",
name: "ASSIGNED_TO_ME",
});
setShowTab(true);
}
}
}, [selectedFilter]);
Expand All @@ -288,8 +287,8 @@ const PlanInbox = () => {
};

const clearFilters = () => {
if (selectedFilter !== Object.entries(planWithCensus?.StatusCount)?.[0]?.[0]) {
setSelectedFilter(Object.entries(planWithCensus?.StatusCount)?.[0]?.[0]);
if (selectedFilter !== Object.entries(activeFilter)?.[0]?.[0]) {
setSelectedFilter(Object.entries(activeFilter)?.[0]?.[0]);
}
};

Expand Down Expand Up @@ -465,7 +464,7 @@ const PlanInbox = () => {
variation="secondary"
label={t(action.action)}
type="button"
onClick={(action) => handleActionClick(action?.target?.textContent)}
onClick={(curr) => handleActionClick(action?.action)}
size={"large"}
/>
))}
Expand Down Expand Up @@ -544,7 +543,7 @@ const PlanInbox = () => {
commentPath="workflow.comments"
onSuccess={(data) => {
history.push(`/${window.contextPath}/employee/microplan/microplan-success`, {
fileName: data?.PlanConfiguration?.[0]?.name,
responseId: data?.PlanConfiguration?.[0]?.name,
message: t(`FINALISED_MICROPLAN_SUCCESSFUL`),
back: t(`GO_BACK_TO_HOME`),
backlink: `/${window.contextPath}/employee`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const PopInbox = () => {
tenantId: tenantId,
source: microplanId,
status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "",
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "PENDING_FOR_VALIDATION" ? "" : user?.info?.uuid,
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "VALIDATED" ? "" : user?.info?.uuid,
jurisdiction: jurisdiction,
limit: limitAndOffset?.limit,
offset: limitAndOffset?.offset
Expand Down Expand Up @@ -278,7 +278,7 @@ const PopInbox = () => {
}, [selectedFilter, jurisdiction, limitAndOffset, activeLink]);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ const SummaryScreen = ({ props: customProps }) => {
{
key: t("CAMPAIGN_TYPE"),
// value: totalFormData.CAMPAIGN_DETAILS?.campaignDetails?.campaignType?.code || "NA",
value: campaignDetails?.campaignType?.code || "NA",
value: t(Digit.Utils.locale.getTransformedLocale(`CAMPAIGN_TYPE_` + campaignDetails?.campaignType?.code)) || "NA",
},
{
key: t("CMAPAIGN_DISEASE"),
// value: totalFormData.CAMPAIGN_DETAILS?.campaignDetails?.disease?.code || "NA",
value: campaignDetails?.disease?.code || "NA",
value: t(campaignDetails?.disease?.code) || "NA",
},
{
key: t("RESOURCE_DISTRIBUTION_STRATEGY"),
// value: Digit.Utils.date.convertEpochToDate(data?.[0]?.startDate) || t("CAMPAIGN_SUMMARY_NA"),
// value: totalFormData.CAMPAIGN_DETAILS?.campaignDetails?.distributionStrat?.resourceDistributionStrategyCode || "NA",
value: campaignDetails?.distributionStrat?.resourceDistributionStrategyCode || "NA",
value: t(campaignDetails?.distributionStrat?.resourceDistributionStrategyCode) || "NA",
},
],
inlineStyles: {
Expand Down

0 comments on commit 8881f19

Please sign in to comment.