-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: test-campaign-changes
Are you sure you want to change the base?
Hlm 6407 template #1154
Changes from all commits
4001a02
e13a224
e01bec6
ef95f25
96ff68a
33d980c
0bb7cf7
617e57e
bdaa5ac
3ff3f61
9224289
232f6b2
150f0e8
54a22ff
4acfd01
8c12062
7208f33
1e39e04
ca30738
228037b
f47b952
ffd91a4
7555191
5f75bf4
6514fa2
bc55bf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" /> --> | ||
|
||
|
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]>", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||||
---|---|---|---|---|---|---|
|
@@ -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); | ||||||
} | ||||||
|
@@ -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> | ||||||
|
@@ -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} | ||||||
placeholder={t("HCM_START_DATE")} | ||||||
populators={ | ||||||
today >= startDate | ||||||
|
@@ -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} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
ToolsBiome
|
||||||
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, | ||||||
|
@@ -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} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
ToolsBiome
|
||||||
value={item?.startDate} | ||||||
placeholder={t("HCM_START_DATE")} | ||||||
populators={ | ||||||
|
@@ -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, | ||||||
|
@@ -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} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
ToolsBiome
|
||||||
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, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
|
@@ -223,50 +222,33 @@ const CampaignSummary = (props) => { | |
return { | ||
cards: [ | ||
isPreview | ||
? | ||
{ | ||
name: "timeline", | ||
sections: [ | ||
{ | ||
? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused The - const isPreview = searchParams.get("preview");
|
||
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", | ||
|
There was a problem hiding this comment.
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.
Committable suggestion
Tools
Biome