Skip to content

Commit

Permalink
HLM-6179 and HLM-6180 (#777)
Browse files Browse the repository at this point in the history
* HLM-6179 and HLM-6180

* campaign name changes

---------

Co-authored-by: Jagankumar <[email protected]>
  • Loading branch information
Bhavya-egov and jagankumar-egov authored Jun 4, 2024
1 parent 816811b commit 6f6f699
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 29 deletions.
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@egovernments/digit-ui-libraries": "1.8.1-beta.4",
"@egovernments/digit-ui-module-core": "1.8.1-beta.23",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.2",
"@egovernments/digit-ui-components": "0.0.1-beta.31",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"@egovernments/digit-ui-react-components": "1.8.1-beta.25",
"@egovernments/digit-ui-module-workbench": "1.0.1-beta.16",
"@egovernments/digit-ui-module-hcmworkbench":"0.0.38",
Expand Down
3 changes: 1 addition & 2 deletions micro-ui/web/micro-ui-internals/example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
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/digit-ui-css@1.8.2-coreui.22/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.1/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]/dist/index.css" /> -->

<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css/dist/index.css"/> -->
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.25",
"@egovernments/digit-ui-components": "0.0.1-beta.31",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,16 @@
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.infoClass{
margin-bottom: 1.5rem
}
.headerWrapperClassName{
display: none
}
.popup-close-svg{
display: none;
}
.whoLogo{
margin-top: -1rem;
margin-bottom: -1rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ header {
}


.digit-popup-wrap {
/*.digit-popup-wrap {
background: rgba(0, 0, 0, 0.7);
@apply flex fixed w-full h-full overflow-auto top-0 left-0 min-h-screen;
z-index: 10000;
Expand All @@ -153,4 +153,4 @@ header {
.digit-popup-close-icon {
@apply flex justify-end;
}
}*/
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.25",
"@egovernments/digit-ui-components": "0.0.1-beta.31",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect ,Fragment} from "react";
import { Header } from "@egovernments/digit-ui-react-components";
import { useTranslation } from "react-i18next";
import { LabelFieldPair } from "@egovernments/digit-ui-react-components";
Expand Down Expand Up @@ -51,6 +51,7 @@ const CampaignName = ({ onSelect, formData, control, formState, ...props }) => {
error={error?.message ? t(error?.message) : ""}
style={{ width: "40rem", marginBottom: "0" }}
populators={{ name: "campaignName" }}
placeholder={"HCM_CAMPAIGN_NAME_EXAMPLE"}
value={name}
onChange={(event) => {
setStartValidation(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Button, Header, LoaderWithGap } from "@egovernments/digit-ui-react-components";
import { Header, LoaderWithGap } from "@egovernments/digit-ui-react-components";
import React, { useRef, useState, useEffect, Fragment } from "react";
import { useTranslation } from "react-i18next";
import { DownloadIcon, Card } from "@egovernments/digit-ui-react-components";
import { DownloadIcon, Card, Modal, CardText } from "@egovernments/digit-ui-react-components";
import BulkUpload from "./BulkUpload";
import Ajv from "ajv";
import XLSX from "xlsx";
import { InfoCard, Toast } from "@egovernments/digit-ui-components";
import { InfoCard, PopUp, Toast ,Button } from "@egovernments/digit-ui-components";
import { schemaConfig } from "../configs/schemaConfig";
import { headerConfig } from "../configs/headerConfig";
import { PRIMARY_COLOR } from "../utils";
Expand Down Expand Up @@ -50,8 +50,8 @@ const UploadData = ({ formData, onSelect, ...props }) => {
const [translatedSchema, setTranslatedSchema] = useState({});
const [readMeInfo, setReadMeInfo] = useState({});
const [enabled, setEnabled] = useState(false);
const [showPopUp, setShowPopUp] = useState(true);
const currentKey = searchParams.get("key");


useEffect(() => {
if (type === "facilityWithBoundary") {
Expand Down Expand Up @@ -172,6 +172,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
setDownloadError(false);
setIsError(false);
setIsSuccess(props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.isSuccess || null);
setShowPopUp(!props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile.length);
break;
case "facilityWithBoundary":
setUploadedFile(props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile || []);
Expand All @@ -180,6 +181,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
setDownloadError(false);
setIsError(false);
setIsSuccess(props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.isSuccess || null);
setShowPopUp(!props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_FACILITY_DATA?.uploadFacility?.uploadedFile.length);
break;
default:
setUploadedFile(props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile || []);
Expand All @@ -188,6 +190,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
setDownloadError(false);
setIsError(false);
setIsSuccess(props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.isSuccess || null);
setShowPopUp(!props?.props?.sessionData?.HCM_CAMPAIGN_UPLOAD_USER_DATA?.uploadUser?.uploadedFile.length);
break;
}
}, [type, props?.props?.sessionData]);
Expand Down Expand Up @@ -540,6 +543,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
setIsSuccess(false);
setIsValidation(false);
setApiError(null);
setErrorsType({});
// setShowToast(null);
};

Expand All @@ -553,7 +557,7 @@ const UploadData = ({ formData, onSelect, ...props }) => {
useEffect(() => {
const fetchData = async () => {
if (!errorsType[type] && uploadedFile?.length > 0) {
setShowToast({ key: "info", label: t("HCM_VALIDATION_IN_PROGRESS") });
// setShowToast({ key: "info", label: t("HCM_VALIDATION_IN_PROGRESS") });
setIsValidation(true);
setIsError(true);

Expand Down Expand Up @@ -870,6 +874,76 @@ const UploadData = ({ formData, onSelect, ...props }) => {
))}
label={"Info"}
/>
{showPopUp && (
// <Modal
// popupStyles={{
// top: "5rem",
// }}
// popmoduleClassName="campaign-pop-module"
// popupModuleActionBarClass="campaign-pop-action"
// style={{ flex: 1 }}
// popupMainModuleClass="campaign-pop-main"
// headerBarMain={<h1 className="campaign-modal-heading">{type === "boundary" ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_HEADER") : type === "facilityWithBoundary" ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_HEADER") : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_HEADER")}</h1>}

// // {type === "boundary" ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_HEADER") : type === "facilityWithBoundary" ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_HEADER") : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_HEADER")}
// actionCancelLabel={t("HCM_CAMPAIGN_UPLOAD_CANCEL")}
// actionCancelOnSubmit={() => { setShowPopUp(false); }}
// actionSaveLabel={t("HCM_CAMPAIGN_DOWNLOAD_TEMPLATE")}
// actionSaveOnSubmit={() =>{downloadTemplate() ,setShowPopUp(false); }}
// customTheme="v-campaign"
// formId="modal-action"
// >
// <div>
// <CardText style={{ margin: 0 }}>{type === "boundary" ? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_HEADER") : type === "facilityWithBoundary" ? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_HEADER") : t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_HEADER")}</CardText>
// </div>
// </Modal>

<PopUp
type={"default"}
heading = {type === "boundary"
? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_HEADER")
: type === "facilityWithBoundary"
? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_HEADER")
: t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_HEADER")}
children={[
<div>
{type === "boundary"
? t("ES_CAMPAIGN_UPLOAD_BOUNDARY_DATA_MODAL_TEXT")
: type === "facilityWithBoundary"
? t("ES_CAMPAIGN_UPLOAD_FACILITY_DATA_MODAL_TEXT")
: t("ES_CAMPAIGN_UPLOAD_USER_DATA_MODAL_TEXT ")}
</div>,
]}
onOverlayClick={() => {
setShowPopUp(false);
}}

footerChildren={[
<Button
type={"button"}
size={"large"}
variation={"secondary"}
label={t("HCM_CAMPAIGN_UPLOAD_CANCEL")}
// label={t("DOWNLOAD")}
onClick={() => {
setShowPopUp(false);
}}
/>,
<Button
type={"button"}
size={"large"}
variation={"primary"}
icon={<DownloadIcon styles={{ height: "1.25rem", width: "1.25rem" }} fill={"white"} />}
label={t("HCM_CAMPAIGN_DOWNLOAD_TEMPLATE")}
// label={t("TEMPLATE")}
onClick={() => {
downloadTemplate(), setShowPopUp(false);
}}
/>,
]}
sortFooterChildren={true}
></PopUp>
)}
{showToast && (uploadedFile?.length > 0 || downloadError) && (
<Toast
type={showToast?.key === "error" ? "error" : showToast?.key === "info" ? "info" : showToast?.key === "warning" ? "warning" : "success"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const CampaignConfig = (totalFormData, dataParams, isSubmitting) => {
component: "CampaignName",
mandatoryOnAPI: true,
withoutLabel: true,
withoutLabelFieldPair: true,
disable: false,
customProps: {
module: "HCM",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React, { useReducer, Fragment, useEffect, useState } from "react";
import { CardText, LabelFieldPair, Card, CardLabel, CardSubHeader, Paragraph, Header } from "@egovernments/digit-ui-react-components";
import { useTranslation } from "react-i18next";
import { TextInput } from "@egovernments/digit-ui-components";
import { TextInput, InfoCard } from "@egovernments/digit-ui-components";
// import { deliveryConfig } from "../../configs/deliveryConfig";

const initialState = (saved, filteredDeliveryConfig, refetch) => {
const data = {
cycleConfgureDate: {
cycle: saved?.cycleConfgureDate?.cycle && !refetch
? saved?.cycleConfgureDate?.cycle
: filteredDeliveryConfig?.cycleConfig
? filteredDeliveryConfig?.cycleConfig?.cycle
: 1,
deliveries: saved?.cycleConfgureDate?.deliveries && !refetch
? saved?.cycleConfgureDate?.deliveries
: filteredDeliveryConfig?.cycleConfig
? filteredDeliveryConfig?.cycleConfig?.deliveries
: 1,
cycle:
saved?.cycleConfgureDate?.cycle && !refetch
? saved?.cycleConfgureDate?.cycle
: filteredDeliveryConfig?.cycleConfig
? filteredDeliveryConfig?.cycleConfig?.cycle
: 1,
deliveries:
saved?.cycleConfgureDate?.deliveries && !refetch
? saved?.cycleConfgureDate?.deliveries
: filteredDeliveryConfig?.cycleConfig
? filteredDeliveryConfig?.cycleConfig?.deliveries
: 1,
},
cycleData: saved?.cycleData ? [...saved?.cycleData] : [],
};
Expand Down Expand Up @@ -77,7 +79,8 @@ function CycleConfiguration({ onSelect, formData, control, ...props }) {
}
);
const saved = Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA")?.HCM_CAMPAIGN_CYCLE_CONFIGURE?.cycleConfigure;
const refetch = Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA")?.HCM_CAMPAIGN_CYCLE_CONFIGURE?.cycleConfigure?.cycleConfgureDate?.refetch;
const refetch = Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA")?.HCM_CAMPAIGN_CYCLE_CONFIGURE?.cycleConfigure?.cycleConfgureDate
?.refetch;
const tempSession = Digit.SessionStorage.get("HCM_CAMPAIGN_MANAGER_FORM_DATA");
const [state, dispatch] = useReducer(reducer, initialState(saved, filteredDeliveryConfig, refetch));
const { cycleConfgureDate, cycleData } = state;
Expand Down Expand Up @@ -149,6 +152,32 @@ function CycleConfiguration({ onSelect, formData, control, ...props }) {
?.reverse()
?.join("/")} - ${tempSession?.HCM_CAMPAIGN_DATE?.campaignDates?.endDate?.split("-")?.reverse()?.join("/")})`}
/>
<InfoCard
className={"infoClass"}
populators={{
name: "infocard",
}}
variant="default"
style={{ marginBottom : "1.5rem", marginLeft : "0rem", maxWidth: "100%" }}
additionalElements={[
<img className="whoLogo"
// style="display: block;-webkit-user-select: none;margin: auto;cursor: zoom-in;background-color: hsl(0, 0%, 90%);transition: background-color 300ms;"
src="https://cdn.worldvectorlogo.com/logos/world-health-organization-logo-1.svg"
alt="WHO Logo"
width="164"
height="90"
></img>,
<span style={{ color: "#505A5F" }}>{t(
`CAMPAIGN_CYCLE_INFO_${
tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.code
? tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.code?.toUpperCase()
: tempSession?.HCM_CAMPAIGN_TYPE?.projectType?.toUpperCase()
}`
)}</span>,
]}
label={"Info"}
headerClassName={"headerClassName"}
/>
<Card className="campaign-counter-container">
<CardText>
{t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Card, Header, Paragraph, CardHeader, CardSubHeader, CardText } from "@e
import AddDeliveryRuleWrapper from "./AddDeliverycontext";
import { CycleContext } from ".";
import { useTranslation } from "react-i18next";
import { InfoCard } from "@egovernments/digit-ui-components";
//just pass campaign data here
// function restructureData(data) {
// const restructuredData = [];
Expand Down Expand Up @@ -157,6 +158,28 @@ const TabContent = ({ activeSubTab, subTabCount = 3, onSubTabChange, project })
<CardText>{t(`CAMPAIGN_TAB_SUB_TEXT_${project?.code ? project?.code?.toUpperCase() : project?.toUpperCase()}`)} </CardText>
</div>
{/* Add content specific to each tab as needed */}
<InfoCard
populators={{
name: "infocard",
}}
variant="default"
style={{ marginTop: "1.5rem", marginLeft: "0rem" , marginBottom: "0rem", maxWidth: "100%" }}
className= {"infoClass"}
headerWrapperClassName = {"headerWrapperClassName"}
additionalElements={[
<img className="whoLogo"
// style="display: block;-webkit-user-select: none;margin: auto;cursor: zoom-in;background-color: hsl(0, 0%, 90%);transition: background-color 300ms;"
src="https://cdn.worldvectorlogo.com/logos/world-health-organization-logo-1.svg"
alt="WHO Logo"
width="164"
height="90"
></img>,
<span style={{ color: "#505A5F" }}>
{t(`CAMPAIGN_TAB_INFO_TEXT_${project?.code ? project?.code?.toUpperCase() : project?.toUpperCase()}`)}
</span>
]}
label={"Info"}
/>
</Card>
);
};
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@egovernments/digit-ui-module-core": "1.8.1-beta.23",
"@egovernments/digit-ui-module-hrms": "1.8.0-beta.2",
"@egovernments/digit-ui-react-components": "1.8.1-beta.25",
"@egovernments/digit-ui-components": "0.0.1-beta.25",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"@egovernments/digit-ui-module-dss": "1.8.0-beta",
"@egovernments/digit-ui-module-common": "1.8.0-beta",
"@egovernments/digit-ui-module-utilities": "1.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
rel="stylesheet" type="text/css" />
<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/digit-ui-css@1.8.2-coreui.22/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.1/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<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
2 changes: 1 addition & 1 deletion micro-ui/web/workbench/inter-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.16",
"@egovernments/digit-ui-components": "0.0.1-beta.20",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@egovernments/digit-ui-module-core": "1.8.1-beta.23",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.25",
"@egovernments/digit-ui-components": "0.0.1-beta.25",
"@egovernments/digit-ui-components": "0.0.2-beta.1",
"@egovernments/digit-ui-module-workbench": "1.0.1-beta.16",
"@egovernments/digit-ui-module-hcmworkbench":"0.0.38",
"@egovernments/digit-ui-module-campaign-manager": "0.0.1",
Expand Down

0 comments on commit 6f6f699

Please sign in to comment.