Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/console' into facilityMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov committed Oct 21, 2024
2 parents 908c961 + 4594453 commit 43847e3
Show file tree
Hide file tree
Showing 21 changed files with 754 additions and 1,046 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/> -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].3/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].4/dist/index.css" />

<!-- added below css for hcm-workbench module inclusion-->
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
Expand Down
215 changes: 108 additions & 107 deletions health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ export const UICustomizations = {
return (
<span className="link">
<Link
to={`/${window.contextPath
}/employee/attendencemgmt/view-attendance?tenantId=${Digit.ULBService.getCurrentTenantId()}&musterRollNumber=${value}`}
to={`/${
window.contextPath
}/employee/attendencemgmt/view-attendance?tenantId=${Digit.ULBService.getCurrentTenantId()}&musterRollNumber=${value}`}
>
{String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))}
</Link>
Expand Down Expand Up @@ -801,7 +802,6 @@ export const UICustomizations = {
{ code: "1", name: "Edit Setup" },
{ code: "2", name: "View Summary" },
{ code: "3", name: "ACTIVITY" },

]}
select={(e) => {
console.log(e, "event"); // e contains the selected option
Expand All @@ -823,9 +823,7 @@ export const UICustomizations = {
}
if (e.code === "3") {
// Use window.location.href to navigate
window.location.href = `/${window.contextPath
}/employee/microplan/select-activity?microplanId=${row.id}&campaignId=${row.CampaignDetails.id
}`;
window.location.href = `/${window.contextPath}/employee/microplan/select-activity?microplanId=${row.id}&campaignId=${row.CampaignDetails.id}`;
}
}}
optionKey={"name"}
Expand Down Expand Up @@ -893,90 +891,90 @@ export const UICustomizations = {
return data;
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
if (key === "Actions") {
const onActionSelect = (key, row) => {
switch (key) {
case "START":
window.history.pushState(
{
microplanId: row?.id,
campaignId: row?.campaignId,
},
"",
`/${window.contextPath}/employee/microplan/select-activity?microplanId=${row?.id}&campaignId=${row?.campaignId}`
);
const navEvent = new PopStateEvent("popstate");
window.dispatchEvent(navEvent);
break;
case "EDIT":
window.history.pushState(
{
microplanId: row?.id,
campaignId: row?.campaignId,
},
"",
`/${window.contextPath}/employee/microplan/select-activity?microplanId=${row?.id}&campaignId=${row?.campaignId}`
);
const navEvent2 = new PopStateEvent("popstate");
window.dispatchEvent(navEvent2);
break;
default:
console.log(value);
break;
}
};
// `/${window.contextPath}/employee/microplan/setup-microplan?key=${9}&preview=${true}&action=${false}`
return row.status === "EXECUTION_TO_BE_DONE" ? (
<Button
label={t("START")}
variation="secondary"
icon={<ArrowForward styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("START", row)}
/>
) : row.status === "RESOURCE_ESTIMATIONS_APPROVED" ? (
<Button
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={<DownloadIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("DOWNLOAD", row)}
/>
) : (
<Button
label={t("WBH_EDIT")}
variation="secondary"
icon={<EditIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("EDIT", row)}
/>
);
}

if (key === "NAME_OF_MICROPLAN") {
if (value && value !== "NA") {
return (
<div
style={{
maxWidth: "15rem", // Set the desired maximum width
wordWrap: "break-word", // Allows breaking within words
whiteSpace: "normal", // Ensures text wraps normally
overflowWrap: "break-word", // Break long words at the edge
}}
>
<p>{value}</p>
</div>
);
} else {
return (
<div>
<p>NA</p>
</div>
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
switch (key) {
case "START":
window.history.pushState(
{
microplanId: row?.id,
campaignId: row?.campaignId,
},
"",
`/${window.contextPath}/employee/microplan/select-activity?microplanId=${row?.id}&campaignId=${row?.campaignId}`
);
const navEvent = new PopStateEvent("popstate");
window.dispatchEvent(navEvent);
break;
case "EDIT":
window.history.pushState(
{
microplanId: row?.id,
campaignId: row?.campaignId,
},
"",
`/${window.contextPath}/employee/microplan/select-activity?microplanId=${row?.id}&campaignId=${row?.campaignId}`
);
const navEvent2 = new PopStateEvent("popstate");
window.dispatchEvent(navEvent2);
break;
default:
console.log(value);
break;
}
};
return row.status === "EXECUTION_TO_BE_DONE" ? (
<Button
label={t("START")}
variation="secondary"
icon={<ArrowForward styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("START", row)}
/>
) : row.status === "RESOURCE_ESTIMATIONS_APPROVED" ? (
<Button
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={<DownloadIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("DOWNLOAD", row)}
/>
) : (
<Button
label={t("WBH_EDIT")}
variation="secondary"
icon={<EditIcon styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => onActionSelect("EDIT", row)}
/>
);
}
case "NAME_OF_MICROPLAN":
if (value && value !== "NA") {
return (
<div
style={{
maxWidth: "15rem", // Set the desired maximum width
wordWrap: "break-word", // Allows breaking within words
whiteSpace: "normal", // Ensures text wraps normally
overflowWrap: "break-word", // Break long words at the edge
}}
>
<p>{value}</p>
</div>
);
} else {
return (
<div>
<p>NA</p>
</div>
);
}
default:
return t("ES_COMMON_NA");
}
},
},
Expand Down Expand Up @@ -1009,9 +1007,7 @@ export const UICustomizations = {
}
if (Object.keys(roleschosen).length === 0) {
for (const obj of additionalDetails["microplanData"]) {

roleschosen[obj["roleCode"]] = true;

}
}

Expand Down Expand Up @@ -1119,40 +1115,45 @@ export const UICustomizations = {
iconFill=""
isSuffix
label={t("MICROPLAN_ASSIGN")}
onClick={
() => setShowPopup(true)
}
onClick={() => setShowPopup(true)}
options={[]}
optionsKey=""
size="medium"
style={{}}
title=""
variation="secondary"
/>
{showPopup && <FacilityPopUp details={row} onClose={() => { setShowPopup(false) }} />}
{showPopup && (
<FacilityPopUp
details={row}
onClose={() => {
setShowPopup(false);
}}
/>
)}
</>
);
default:
return null;
}
},
},
MyMicroplanSearchConfigExample:{
test:"yes"
MyMicroplanSearchConfigExample: {
test: "yes",
},
FacilityMappingConfigExample:{
test:"yes"
FacilityMappingConfigExample: {
test: "yes",
},
UserManagementConfigExample:{
test:"yes"
UserManagementConfigExample: {
test: "yes",
},
MyMicroplanSearchConfigPlan:{
test:"no"
MyMicroplanSearchConfigPlan: {
test: "no",
},
FacilityMappingConfigPlan:{
test:"no"
FacilityMappingConfigPlan: {
test: "no",
},
UserManagementConfigPlan:{
test:"no"
UserManagementConfigPlan: {
test: "no",
},
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-health-css",
"version": "0.1.3",
"version": "0.1.4",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1146,5 +1146,5 @@ tbody {
}

.digit-action-bar-wrap div {
width: 100%;
width: unset;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,20 @@

.middle-child {
margin-bottom: 1.5rem;
}

.comment-label {
margin-bottom: .25rem;
@extend .typography.label;
color: theme(digitv2.lightTheme.text-primary);
}

.comment-label .required {
color: theme(digitv2.alert.error);
}

.security-question-label {
margin-bottom: 1rem;
@extend .typography.heading-m;
color: theme(digitv2.lightTheme.text-primary);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,20 @@ const UploadData = ({ formData, onSelect, ...props }) => {
else setKey(12);
};

const getDownloadLabel = () => {
if (parentId) {
if (type === "boundary") {
return t("WBH_DOWNLOAD_CURRENT_TARGET");
} else if (type === "facilityWithBoundary") {
return t("WBH_DOWNLOAD_CURRENT_FACILITY");
} else {
return t("WBH_DOWNLOAD_CURRENT_USER");
}
} else {
return t("WBH_DOWNLOAD_TEMPLATE");
}
};

return (
<>
<div className="container-full">
Expand Down Expand Up @@ -1072,7 +1086,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
{type === "boundary" ? t("WBH_UPLOAD_TARGET") : type === "facilityWithBoundary" ? t("WBH_UPLOAD_FACILITY") : t("WBH_UPLOAD_USER")}
</Header>
<Button
label={t("WBH_DOWNLOAD_TEMPLATE")}
label={getDownloadLabel()}
variation="secondary"
icon={"FileDownload"}
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export const UICustomizations = {
data: row,
},
"",
`/${window.contextPath}/employee/campaign/boundary/update-boundary?key=1&parentId=${row?.id}`
`/${window.contextPath}/employee/campaign/update-campaign?key=1&parentId=${row?.id}`
);
const nav = new PopStateEvent("popstate");
window.dispatchEvent(nav);
Expand Down Expand Up @@ -641,7 +641,7 @@ export const UICustomizations = {
data: row,
},
"",
`/${window.contextPath}/employee/campaign/boundary/update-boundary?key=1&parentId=${row?.id}`
`/${window.contextPath}/employee/campaign/update-campaign?key=1&parentId=${row?.id}`
);
const nav = new PopStateEvent("popstate");
window.dispatchEvent(nav);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const MyCampaign = () => {
break;
case "CAMPAIGN_DRAFTS":
if (row?.parentId) {
history.push(`/${window.contextPath}/employee/campaign/boundary/update-boundary?parentId=${row.parentId}&id=${row.id}&draft=${true}`);
history.push(`/${window.contextPath}/employee/campaign/update-campaign?parentId=${row.parentId}&id=${row.id}&draft=${true}`);
} else {
history.push(
`/${window.contextPath}/employee/campaign/setup-campaign?id=${row.id}&draft=${true}&fetchBoundary=${true}&draftBoundary=${true}`
Expand Down
Loading

0 comments on commit 43847e3

Please sign in to comment.