Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User download changes #1559

Merged
merged 9 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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].84-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].85-campaign/dist/index.css" />


<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
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.84-campaign",
"version": "1.0.85-campaign",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,11 @@
left: 36rem;
}

.mc_back{
display:flex;
justify-content: right;
align-items: center;
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved


Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React, { useState, Fragment } from "react";
import { Link, useHistory, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { ActionBar, SubmitBar, Button,ArrowLeft, ArrowForward } from "@egovernments/digit-ui-react-components";
import { PanelCard } from "@egovernments/digit-ui-components";
// console.log(state," ssssssssssssssssssssssssss")
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
const Response = () => {

const { t } = useTranslation();
const history = useHistory();
const queryStrings = Digit.Hooks.useQueryParams();
const [campaignId, setCampaignId] = useState(queryStrings?.campaignId);
const [isResponseSuccess, setIsResponseSuccess] = useState(
queryStrings?.isSuccess === "true" ? true : queryStrings?.isSuccess === "false" ? false : true
);
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
const { state } = useLocation();
console.log(state, " ssssssssssssssssssssssssss")
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

const isMobile = window.Digit.Utils.browser.isMobile();

const navigate = (page) => {
switch (page) {
case "contracts-inbox": {
history.push(`/${window.contextPath}/employee/tqm/summary`);
}
}
};
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

const children = [
<div style={{ display: "flex" }} key="response-text">
{state?.boldText ? (
<p style={{ margin: "0rem" }}>
{t(state?.preText)}
<b> {t(state?.boldText)} </b>
{t(state?.postText)}
</p>
) : (
t(state?.text, { CAMPAIGN_ID: campaignId })
)}
</div>,
];
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
<PanelCard
animationProps={{
loop: false,
noAutoplay: false
}}
cardClassName=""
cardStyles={{}}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
className=""
customIcon=""
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
description="The user data uploaded will be available in your microplan user assignment section"
// footerChildren={[
// <Button label="OK" onClick={function noRefCheck() { }} type="button" />
// ]}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
footerStyles={{}}
iconFill=""
info=""
maxFooterButtonsAllowed={5}
message={state.message}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
multipleResponses={[]}
props={{}}
response={state.fileName}
sortFooterButtons
style={{}}
type="success"
>

</PanelCard>
<ActionBar className="mc_back">
<Link to={`/${window.contextPath}/employee/microplan/upload-user`}>
<Button
label={t("GO_BACK_TO_USER_MANAGEMENT")}
variation="secondary"
icon={<ArrowLeft styles={{ height: "1.25rem", width: "2.5rem" }} />}
type="button"
className="dm-workbench-download-template-btn dm-hover"
onButtonClick={(e) => {

}}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
/>
</Link>
</ActionBar>
</>
);
};

export default Response;
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ const UserUpload = React.memo(() => {
setDownloadTemplateLoader(false);
return;
}
history.push(`/${window.contextPath}/employee/microplan/upload-user-success`);
history.push(`/${window.contextPath}/employee/microplan/upload-user-success`, { fileName: fileName,message:"User data upload successful" });
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
}
else {
setShowToast({ key: "error", label: t("ERROR_MANDATORY_FIELDS_FOR_SUBMIT") });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,13 @@ export const UICustomizations = {
if (!roleschosen) {
roleschosen = {};
}
// if(Object.keys(roleschosen).length === 0){
// for(const obj of additionalDetails["microplanData"]){
if(Object.keys(roleschosen).length === 0){
for(const obj of additionalDetails["microplanData"]){

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

// }
// }
}
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

let rolesString = "";
if (roleschosen) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const UserManagementConfig = {
"primaryLabel": "Filter",
"minReqFields": 0,
"defaultValues": {
"roleschosen": [],
"roleschosen": '',
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
},
"fields": [

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,8 @@ import HeaderComp from '../../components/HeaderComp';
import { TextBlock } from '@egovernments/digit-ui-components';

const UserDownload = () => {

abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
const [Files, setFile] = useState(""); // Initialize as an empty string
const reqCriteriaResource = {
url: "/project-factory/v1/data/_search",
body: {
"SearchCriteria": {
"tenantId": Digit.ULBService.getCurrentTenantId(),
"source": "microplan",
"status": "completed"
}
},
config: {
enabled: true,
select: data => {
return data;
}
}
};



const { data, isFetching, isLoading } = Digit.Hooks.microplanv1.useFileDownload({
Expand Down Expand Up @@ -55,7 +39,7 @@ const UserDownload = () => {
}
}, [data]); // Only run this effect when `data` changes





Expand All @@ -74,24 +58,30 @@ const UserDownload = () => {
<Card>
<HeaderComp title="DOWNLOAD_USER_DATA" styles={{ color: "black" }} />
<TextBlock body="DOWNLOAD_DESC" />
{data?.ResourceDetails &&
data?.ResourceDetails.map((item, index) => {
return (
<FileComponent
title=""
fileName={`FileNo${item?.fileStoreId.slice(0, 4)}`}
downloadHandler={() => {
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: item?.fileStoreId, customName: `FileNo${item?.fileStoreId.slice(0, 4)}`
});
}} // Passing the download function
auditDetails={{userName:item?.username,lastmodTime:item?.auditDetails?.lastmodtime}}
/>
)

})

}
{data?.ResourceDetails &&
[...data?.ResourceDetails].reverse().map((item, index) => {
let fileName=`FileNo${item?.processedFilestoreId.slice(0, 4)}`
if ((data?.ResourceDetails?.additionalDetails?.fileName)){
fileName=data?.ResourceDetails?.additionalDetails?.fileName;

}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

return (
<FileComponent
title=""
fileName={`FileNo${item?.fileStoreId.slice(0, 4)}`}
downloadHandler={() => {
Digit.Utils.campaign.downloadExcelWithCustomName({
fileStoreId: fileName
});
}} // Passing the download function
auditDetails={{userName:item?.username,lastmodTime:item?.auditDetails?.lastmodtime}}
/>
)
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

})

}
</Card>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import UserDownload from "./UserDownload";
import VillageView from "./viewVillage";
import MyMicroplans from "./MyMicroplans";
import ChooseActivity from "./ChooseActivity";
import Response from "../../components/Response";
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

import FacilityCatchmentMapping from "./FacilityCatchmentMapping";


Expand Down Expand Up @@ -187,6 +189,8 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier
<PrivateRoute path={`${path}/upload-user`} component={() => <UserUpload />} />
<PrivateRoute path={`${path}/village-view`} component={() => <VillageView />} />
<PrivateRoute path={`${path}/my-microplans`} component={() => <MyMicroplans/>} />
<PrivateRoute path={`${path}/upload-user-success`} component={() => <Response/>} />
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

<PrivateRoute path={`${path}/assign-facilities-to-villages`} component={() => <FacilityCatchmentMapping/>} />


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 @@ -12,7 +12,7 @@
<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].84-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].85-campaign/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down