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

Hlm 6407 template #1154

Open
wants to merge 26 commits into
base: test-campaign-changes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4001a02
some changes related to generate boundary template (#1133)
nitish-egov Jul 24, 2024
e13a224
Merge branch 'campaign' into HLM-6407-template
Priyanka-eGov Jul 24, 2024
e01bec6
updated logic for target columns acc to delivery conditions only for …
nitish-egov Jul 24, 2024
ef95f25
updated version and boundary fix (#1141)
Bhavya-egov Jul 24, 2024
96ff68a
updated readmeconfig for sheet (#1142)
nitish-egov Jul 24, 2024
33d980c
HCMPRE-140: Action column fixes, date editable logic change (#1143)
nabeelmd-eGov Jul 24, 2024
0bb7cf7
Update constants.ts (#1145)
ashish-egov Jul 24, 2024
617e57e
Update Listener.ts (#1147)
ashish-egov Jul 25, 2024
bdaa5ac
HCMPRE 140 (#1149)
nabeelmd-eGov Jul 25, 2024
3ff3f61
updated core version (#1150)
Bhavya-egov Jul 25, 2024
9224289
HLM-6407 using same mdms schema for microplan
Priyanka-eGov Jul 25, 2024
232f6b2
Merge remote-tracking branch 'origin/HLM-6407-template' into HLM-6407…
Priyanka-eGov Jul 25, 2024
150f0e8
Ashish patch2 (#1152)
ashish-egov Jul 25, 2024
54a22ff
Redis cache for generating target when delivery conditions change (#1…
nitish-egov Jul 25, 2024
4acfd01
Ashish egov patch 2 (#1166)
ashish-egov Jul 29, 2024
8c12062
HCMPRE-154: Update Dates bug fixes, Toast added for error. (#1158)
nabeelmd-eGov Jul 29, 2024
7208f33
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 16, 2024
1e39e04
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 22, 2024
ca30738
HLM-6407 adding changes for facility template
Priyanka-eGov Jul 22, 2024
228037b
HLM-6407 codde review comment
Priyanka-eGov Jul 23, 2024
f47b952
HCMPRE-91 code review comments
Priyanka-eGov Jul 24, 2024
ffd91a4
HLM-6407 using same mdms schema for microplan
Priyanka-eGov Jul 25, 2024
7555191
Merge branch 'campaign' into HLM-6407-template
Priyanka-eGov Jul 29, 2024
5f75bf4
HLM-6407 code review comments
Priyanka-eGov Jul 29, 2024
6514fa2
Merge remote-tracking branch 'origin/HLM-6407-template' into HLM-6407…
Priyanka-eGov Jul 29, 2024
bc55bf3
HLM-6407 code review comments
Priyanka-eGov Jul 29, 2024
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
4 changes: 2 additions & 2 deletions micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"devDependencies": {
"@egovernments/digit-ui-libraries": "1.8.2-beta.5",
"@egovernments/digit-ui-module-workbench": "1.0.2-beta.3",
"@egovernments/digit-ui-components": "0.0.2-beta.14",
"@egovernments/digit-ui-module-core": "1.8.2-beta.6",
"@egovernments/digit-ui-components": "0.0.2-beta.15",
"@egovernments/digit-ui-module-core": "1.8.2-beta.7",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.30",
"@egovernments/digit-ui-react-components": "1.8.2-beta.11",
"@egovernments/digit-ui-module-hcmworkbench":"0.0.38",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].61-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].62-campaign/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
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.2-beta.11",
"@egovernments/digit-ui-components": "0.0.2-beta.14",
"@egovernments/digit-ui-components": "0.0.2-beta.15",
"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
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.61-campaign",
"version": "1.0.62-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 @@ -119,6 +119,5 @@
}
.timeline-user{
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.11",
"@egovernments/digit-ui-components": "0.0.2-beta.14",
"@egovernments/digit-ui-components": "0.0.2-beta.15",
"@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
Expand Up @@ -2,26 +2,26 @@ import React, { useState, useEffect, Fragment } from "react";
import { useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom";
import { LabelFieldPair, Header } from "@egovernments/digit-ui-react-components";
import { Button, Card, Dropdown, FieldV1, MultiSelectDropdown } from "@egovernments/digit-ui-components";
import { Button, Card, Dropdown, DustbinIcon, FieldV1, MultiSelectDropdown } from "@egovernments/digit-ui-components";

const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) => {
const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDelete, onDeleteCard }) => {
const { t } = useTranslation();
const tenantId = Digit.ULBService.getCurrentTenantId();
// const { t } = useTranslation();
const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000;
const today = Digit.Utils.date.getDate(Date.now());
const [startDate, setStartDate] = useState(Digit.Utils.date.getDate(project?.startDate)); // Set default start date to today
const [endDate, setEndDate] = useState(Digit.Utils.date.getDate(project?.endDate)); // Default end date
const [startDate, setStartDate] = useState(project?.startDate ? Digit.Utils.date.getDate(project?.startDate) : ""); // Set default start date to today
const [endDate, setEndDate] = useState(project?.endDate ? Digit.Utils.date.getDate(project?.endDate) : ""); // Default end date
const [cycleDates, setCycleDates] = useState(null);

useEffect(() => {
setStartDate(Digit.Utils.date.getDate(project?.startDate));
setEndDate(Digit.Utils.date.getDate(project?.endDate));
setStartDate(project?.startDate ? Digit.Utils.date.getDate(project?.startDate) : "");
setEndDate(project?.endDate ? Digit.Utils.date.getDate(project?.endDate) : "");
if (project?.additionalDetails?.projectType?.cycles?.length > 0) {
const cycleDateData = project?.additionalDetails?.projectType?.cycles?.map((cycle) => ({
cycleIndex: cycle.id,
startDate: Digit.Utils.date.getDate(cycle.startDate),
endDate: Digit.Utils.date.getDate(cycle.endDate),
startDate: cycle.startDate ? Digit.Utils.date.getDate(cycle.startDate) : "",
endDate: cycle?.endDate ? Digit.Utils.date.getDate(cycle.endDate) : "",
}));
setCycleDates(cycleDateData);
}
Expand Down Expand Up @@ -65,8 +65,15 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>

return (
<Card className={"boundary-with-container"}>
<Header className="header">{t(`${project?.address?.boundary}`)}</Header>
<LabelFieldPair style={{ display: "grid", gridTemplateColumns: "13rem 2fr", alignItems: "start" }}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
<Header className="header">{t(`${project?.address?.boundary}`)}</Header>
{canDelete && (
<div className="delete-resource-icon" onClick={onDeleteCard}>
<DustbinIcon />
</div>
)}
</div>
<LabelFieldPair style={{ display: "grid", gridTemplateColumns: "13rem 2fr", alignItems: "start", gap: "1rem" }}>
<div className="campaign-dates">
<p>{t(`HCM_CAMPAIGN_DATES`)}</p>
<span className="mandatory-date">*</span>
Expand All @@ -76,7 +83,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>
withoutLabel={true}
type="date"
value={startDate}
nonEditable={today >= startDate ? true : false}
nonEditable={startDate?.length > 0 && today > startDate ? true : false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify boolean literals in conditional expression.

Unnecessary use of boolean literals in the conditional expression.

- nonEditable={startDate?.length > 0 && today > startDate ? true : false}
+ nonEditable={startDate?.length > 0 && today > startDate}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nonEditable={startDate?.length > 0 && today > startDate ? true : false}
nonEditable={startDate?.length > 0 && today > startDate}
Tools
Biome

[error] 86-86: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

placeholder={t("HCM_START_DATE")}
populators={
today >= startDate
Expand All @@ -97,19 +104,16 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>
withoutLabel={true}
type="date"
value={endDate}
nonEditable={today >= endDate ? true : false}
nonEditable={endDate?.length > 0 && today > endDate ? true : false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify boolean literals in conditional expression.

Unnecessary use of boolean literals in the conditional expression.

- nonEditable={endDate?.length > 0 && today > endDate ? true : false}
+ nonEditable={endDate?.length > 0 && today > endDate}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nonEditable={endDate?.length > 0 && today > endDate ? true : false}
nonEditable={endDate?.length > 0 && today > endDate}
Tools
Biome

[error] 107-107: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

placeholder={t("HCM_END_DATE")}
populators={
today >= endDate
? {}
: {
validation: {
min: startDate
? Digit.Utils.date.getDate(new Date(startDate).getTime() + 2 * ONE_DAY_IN_MS)
: Digit.Utils.date.getDate(Date.now() + 2 * ONE_DAY_IN_MS),
},
}
}
populators={{
validation: {
min:
startDate >= today
? Digit.Utils.date.getDate(new Date(startDate).getTime() + 2 * ONE_DAY_IN_MS)
: Digit.Utils.date.getDate(Date.now() + 2 * ONE_DAY_IN_MS),
},
}}
onChange={(d) => {
handleDateChange({
date: d,
Expand All @@ -131,7 +135,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>
<FieldV1
withoutLabel={true}
type="date"
nonEditable={today >= item?.startDate ? true : false}
nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify boolean literals in conditional expression.

Unnecessary use of boolean literals in the conditional expression.

- nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false}
+ nonEditable={item?.startDate?.length > 0 && today > item?.startDate}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false}
nonEditable={item?.startDate?.length > 0 && today > item?.startDate}
Tools
Biome

[error] 138-138: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

value={item?.startDate}
placeholder={t("HCM_START_DATE")}
populators={
Expand All @@ -141,7 +145,8 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>
validation: {
min:
index > 0
? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime() + 86400000)
? cycleDates?.find((j) => j.cycleIndex == index)?.endDate &&
new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime() + 86400000)
?.toISOString()
?.split("T")?.[0]
: startDate,
Expand All @@ -161,22 +166,18 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch }) =>
withoutLabel={true}
type="date"
value={item?.endDate}
nonEditable={today >= item?.endDate ? true : false}
nonEditable={item?.endDate?.length > 0 && today > item?.endDate && today > cycleDates?.[index + 1]?.startDate ? true : false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify boolean literals in conditional expression.

Unnecessary use of boolean literals in the conditional expression.

- nonEditable={item?.endDate?.length > 0 && today > item?.endDate && today > cycleDates?.[index + 1]?.startDate ? true : false}
+ nonEditable={item?.endDate?.length > 0 && today > item?.endDate && today > cycleDates?.[index + 1]?.startDate}
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nonEditable={item?.endDate?.length > 0 && today > item?.endDate && today > cycleDates?.[index + 1]?.startDate ? true : false}
nonEditable={item?.endDate?.length > 0 && today > item?.endDate && today > cycleDates?.[index + 1]?.startDate}
Tools
Biome

[error] 169-169: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

placeholder={t("HCM_END_DATE")}
populators={
today >= item?.endDate
? {}
: {
validation: {
min: cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate
? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + 86400000)
?.toISOString()
?.split("T")?.[0]
: null,
max: endDate,
},
}
}
populators={{
validation: {
min: cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate
? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + 86400000)
?.toISOString()
?.split("T")?.[0]
: null,
max: endDate,
},
}}
onChange={(d) => {
handleCycleDateChange({
date: d,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ const CampaignSummary = (props) => {
const searchParams = new URLSearchParams(location.search);
const id = searchParams.get("id");
const noAction = searchParams.get("action");
const isChangeDates = searchParams.get("changeDates");
const [showToast, setShowToast] = useState(null);
const [userCredential, setUserCredential] = useState(null);
const [deliveryErrors, setDeliveryErrors] = useState(null);
Expand Down Expand Up @@ -223,50 +222,33 @@ const CampaignSummary = (props) => {
return {
cards: [
isPreview
?
{
name: "timeline",
sections: [
{
? {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused isPreview variable.

The isPreview variable is defined but not used in the component.

- const isPreview = searchParams.get("preview");

Committable suggestion was skipped due to low confidence.

name: "timeline",
type: "COMPONENT",
component: "TimelineComponent",
props: {
campaignId: data?.[0]?.id,
resourceId: resourceIdArr
},
cardHeader: { value: t("HCM_TIMELINE"), inlineStyles: { marginTop: 0, fontSize: "1.5rem" } },
},
],
}: {},
sections: [
{
name: "timeline",
type: "COMPONENT",
component: "TimelineComponent",
props: {
campaignId: data?.[0]?.id,
resourceId: resourceIdArr,
},
cardHeader: { value: t("HCM_TIMELINE"), inlineStyles: { marginTop: 0, fontSize: "1.5rem" } },
},
],
}
: {},
{
sections: [
{
type: "DATA",
cardHeader: { value: t("CAMPAIGN_DETAILS"), inlineStyles: { marginTop: 0, fontSize: "1.5rem" } },
cardSecondaryAction:
isChangeDates === "true" ? (
<div
className="campaign-preview-edit-container"
onClick={() =>
history.push(`/${window.contextPath}/employee/campaign/update-dates-boundary?id=${id}`, {
name: data?.[0]?.campaignName,
projectId: data?.[0]?.projectId,
data: data?.[0],
})
}
>
<span>{t(`CAMPAIGN_UPDATE_DATES`)}</span>
<EditIcon />
</div>
) : (
noAction !== "false" && (
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(1)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
)
),
cardSecondaryAction: noAction !== "false" && (
<div className="campaign-preview-edit-container" onClick={() => handleRedirect(1)}>
<span>{t(`CAMPAIGN_EDIT`)}</span>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ const NDSSCard = () => {

const DSSCard = () => {
const STADMIN = Digit.UserService.hasAccess("STADMIN");
const isNationalSupervisor = Digit.UserService.hasAccess(["NATIONAL_SUPERVISOR"]);
const isProvincialSupervisor = Digit.UserService.hasAccess(["PROVINCIAL_SUPERVISOR"]);
const isDistrictSupervisor = Digit.UserService.hasAccess(["DISTRICT_SUPERVISOR"]);
const isHealthFacilitySupervisor = Digit.UserService.hasAccess(["HEALTH_FACILITY_SUPERVISOR"]);
const isCommunitySupervisor = Digit.UserService.hasAccess(["COMMUNITY_SUPERVISOR"]);
const { t } = useTranslation();

const { data: tenantData } = Digit.Hooks.dss.useMDMS(Digit.ULBService.getStateId(), "tenant", ["tenants"], {
Expand All @@ -69,15 +74,22 @@ const DSSCard = () => {
enabled: true,
});

if (
!STADMIN ||
!isNationalSupervisor ||
!isProvincialSupervisor ||
!isDistrictSupervisor ||
!isHealthFacilitySupervisor ||
!isCommunitySupervisor
) {
return null;
}

const shouldInvokeProjectService = tenantData?.integrateProjectService || false;
if (shouldInvokeProjectService) {
return <DynamicDSSCard />;
}

if (!STADMIN) {
return null;
}

let links = Object.values(nationalScreenURLs)
.filter((ele) => ele["active"] === true)
.map((obj) => ({
Expand Down Expand Up @@ -206,4 +218,4 @@ const DynamicDSSCard = () => {
return <EmployeeModuleCard {...propsForModuleCard} />;
};

export { DSSCard, NDSSCard };
export { DSSCard, NDSSCard };
Loading
Loading