Skip to content

Commit

Permalink
Merge branch 'console' into abi-18-11
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekTa-egov committed Nov 21, 2024
2 parents 2414749 + cc683ed commit dc8860f
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<title>DIGIT</title>
<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].38/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].37/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
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,18 @@ export const UICustomizations = {
}

const handleDownload = () => {
Digit.Utils.campaign.downloadExcelWithCustomName({ fileStoreId: microplanFileId, customName: t("Microplan Final Sheet") });
const files = row?.files;
const file = files.find((item) => item.templateIdentifier === "Population");
const fileId = file?.filestoreId;
const campaignName = row?.name || "";
if (!fileId) {
console.error("Population template file not found");
return;
}
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileId,
customName: campaignName
});
};

return (
Expand Down Expand Up @@ -945,6 +956,19 @@ export const UICustomizations = {
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 === "POPULATION_DATA_APPROVER");
const handleFileDownload=()=>{
const fileId = row?.files.find((item) => item.templateIdentifier === "Population")?.filestoreId;
if (!fileId) {
console.error("Population template file not found");
return;
}
const campaignName = row?.name || "";
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileId,
customName: campaignName
});

}
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
Expand Down Expand Up @@ -973,6 +997,10 @@ export const UICustomizations = {
const navEvent2 = new PopStateEvent("popstate");
window.dispatchEvent(navEvent2);
break;
case "DOWNLOAD":
handleFileDownload();
break;

default:
console.log(value);
break;
Expand All @@ -983,8 +1011,8 @@ export const UICustomizations = {
label={t("START")}
variation="primary"
icon={"ArrowForward"}
style={{minWidth:"240px"}}
type="button"
style={{width:"290px"}}
isDisabled={!hasRequiredRole}
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("START", row)}
Expand All @@ -994,7 +1022,7 @@ export const UICustomizations = {
label={t("WBH_DOWNLOAD_MICROPLAN")}
variation="primary"
icon={"FileDownload"}
style={{minWidth:"240px"}}
style={{width:"290px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("DOWNLOAD", row)}
Expand All @@ -1004,7 +1032,7 @@ export const UICustomizations = {
label={t("WBH_EDIT")}
variation="primary"
icon={"Edit"}
style={{minWidth:"240px"}}
style={{width:"290px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("EDIT", row)}
Expand Down Expand Up @@ -1219,6 +1247,30 @@ export const UICustomizations = {
preProcess: (data) => {
return data;
},
getFacilitySearchRequest: ( prop) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const {campaignId} = Digit.Hooks.useQueryParams();
return {
url: `/project-factory/v1/project-type/search`,
params: { },
body: {
CampaignDetails: {
"tenantId": tenantId,
"ids": [
campaignId
]
}
},
changeQueryName: `boundarySearchForPlanFacility`,
config: {
enabled: true,
select: (data) => {
const result = data?.CampaignDetails?.[0]?.boundaries?.filter((item) => item.type == prop.lowestHierarchy) || [];
return result
},
},
};
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const [showPopup, setShowPopup] = useState(false);
const FacilityPopUp = Digit.ComponentRegistryService.getComponent("FacilityPopup");
Expand Down Expand Up @@ -1252,7 +1304,7 @@ export const UICustomizations = {
size="medium"
style={{}}
title=""
variation="secondary"
variation="primary"
/>
{showPopup && (
<FacilityPopUp
Expand All @@ -1268,30 +1320,6 @@ export const UICustomizations = {
return null;
}
},
getFacilitySearchRequest: ( prop) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const {campaignId} = Digit.Hooks.useQueryParams();
return {
url: `/project-factory/v1/project-type/search`,
params: { },
body: {
CampaignDetails: {
"tenantId": tenantId,
"ids": [
campaignId
]
}
},
changeQueryName: `boundarySearchForPlanFacility`,
config: {
enabled: true,
select: (data) => {
const result = data?.CampaignDetails?.[0]?.boundaries?.filter((item) => item.type == prop.lowestHierarchy) || [];
return result
},
},
};
}
},
MyMicroplanSearchConfigExample: {
test: "yes",
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.38",
"version": "0.1.37",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
.as-label-field {
display: grid; /* Enable grid layout */
grid-template-columns: 1fr 2fr; /* Define two columns with different widths */
gap: 0rem; /* Space between items (adjust as needed) */
gap: 1rem; /* Space between items (adjust as needed) */
overflow: auto; /* Allow overflow if content is larger */
align-items: center;
border-bottom: '1px solid #e0e0e0' /* Align items vertically in the center */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ export const UICustomizations = {
}

const handleDownload = () => {
Digit.Utils.campaign.downloadExcelWithCustomName({ fileStoreId: microplanFileId, customName: t("Microplan Final Sheet") });
const files = row?.files;
const file = files.find((item) => item.templateIdentifier === "Population");
const fileId = file?.filestoreId;
if (!fileId) {
console.error("Population template file not found");
return;
}
const campaignName = row?.name || "";
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileId,
customName: campaignName
});
};

return (
Expand Down Expand Up @@ -228,6 +239,19 @@ export const UICustomizations = {
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 === "POPULATION_DATA_APPROVER");
const handleFileDownload=()=>{
const fileId = row?.files.find((item) => item.templateIdentifier === "Population")?.filestoreId;
if (!fileId) {
console.error("Population template file not found");
return;
}
const campaignName = row?.name || "";
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileId,
customName: campaignName
});

}
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
Expand Down Expand Up @@ -256,6 +280,10 @@ export const UICustomizations = {
const navEvent2 = new PopStateEvent("popstate");
window.dispatchEvent(navEvent2);
break;
case "DOWNLOAD":
handleFileDownload();
break;

default:
console.log(value);
break;
Expand All @@ -267,7 +295,7 @@ export const UICustomizations = {
variation="primary"
icon={"ArrowForward"}
type="button"
style={{minWidth:"240px"}}
style={{ width: "290px" }}
isDisabled={!hasRequiredRole}
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("START", row)}
Expand All @@ -277,7 +305,7 @@ export const UICustomizations = {
label={t("WBH_DOWNLOAD_MICROPLAN")}
variation="primary"
icon={"FileDownload"}
style={{minWidth:"240px"}}
style={{ width: "290px" }}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("DOWNLOAD", row)}
Expand All @@ -287,7 +315,7 @@ export const UICustomizations = {
label={t("WBH_EDIT")}
variation="primary"
icon={"Edit"}
style={{minWidth:"240px"}}
style={{ width: "290px" }}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("EDIT", row)}
Expand Down Expand Up @@ -502,19 +530,19 @@ export const UICustomizations = {
preProcess: (data) => {
return data;
},
getFacilitySearchRequest: ( prop) => {
getFacilitySearchRequest: (prop) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const {campaignId} = Digit.Hooks.useQueryParams();
const { campaignId } = Digit.Hooks.useQueryParams();
return {
url: `/project-factory/v1/project-type/search`,
params: { },
params: {},
body: {
CampaignDetails: {
"tenantId": tenantId,
"ids": [
campaignId
]
}
}
},
changeQueryName: `boundarySearchForPlanFacility`,
config: {
Expand All @@ -535,10 +563,10 @@ export const UICustomizations = {
case "MICROPLAN_FACILITY_SERVINGPOPULATION":
return row?.additionalDetails?.servingPopulation;
case "MICROPLAN_FACILITY_RESIDINGVILLAGE":
return <div style={{display:"flex", gap:".5rem"}}>
{t(row?.residingBoundary)}
<VillageHierarchyTooltipWrapper boundaryCode={row?.residingBoundary}/>
</div>
return <div style={{ display: "flex", gap: ".5rem" }}>
{t(row?.residingBoundary)}
<VillageHierarchyTooltipWrapper boundaryCode={row?.residingBoundary} />
</div>
case "MICROPLAN_FACILITY_ASSIGNED_VILLAGES":
const assignedVillages = row?.serviceBoundaries;
return assignedVillages ? assignedVillages.length : null;
Expand All @@ -559,7 +587,7 @@ export const UICustomizations = {
size="medium"
style={{}}
title=""
variation="secondary"
variation="primary"
/>
{showPopup && (
<FacilityPopUp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ const PlanInbox = () => {
},
{
code: "ASSIGNED_TO_ALL",
name: `${`${t(`ASSIGNED_TO_ALL`)} (${assignedToAllCount})`}`,
name: `${`${t(`MP_PLAN_ASSIGNED_TO_ALL`)} (${assignedToAllCount})`}`,
},
]}
navStyles={{}}
Expand Down
2 changes: 1 addition & 1 deletion health/micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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" />
<!-- added below css for hcm-workbench module inclusion-->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].38/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].37/dist/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
<title>DIGIT HCM</title>
Expand Down

0 comments on commit dc8860f

Please sign in to comment.