Skip to content

Commit

Permalink
fixed css and summary rerendering issue (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhavya-egov authored Oct 22, 2024
1 parent 96ccb9f commit 7f0c3bd
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,49 +138,49 @@ const Wrapper = ({ boundaryOptions, setShowPopUp, alreadyQueuedSelectedState, on
{t((hierarchyType + "_" + boundaryType).toUpperCase())}
<span className="mandatory-span">*</span>
</CardLabel>
<MultiSelectDropdown
t={t}
props={{ className: "selecting-boundaries-dropdown" }}
options={Object.entries(popUpOption)
.filter(([key]) => key.startsWith(boundaryType))
.flatMap(([key, value]) =>
Object.entries(value || {})
.filter(([subkey, item]) => {
const itemCode = item?.split(".")?.[0];
if (frozenData?.length > 0) {
const isFrozen = frozenData.some((frozenOption) => {
return (
frozenOption.code === subkey && frozenOption.type === boundaryType
);
});
return frozenType === "filter" ? !isFrozen : true; // Filter or include based on frozenType
}
return true;
})
.map(([subkey, item]) => ({
code: item?.split(".")?.[0],
name: item?.split(".")?.[0],
options: [
{
code: subkey,
name: subkey,
type: boundaryType,
parent: `${item?.split(".")?.[0]}`,
},
],
}))
)}
onSelect={(value) => {
handleSelected(value);
}}
selected={dummySelected}
optionsKey={"code"}
addCategorySelectAllCheck={true}
addSelectAllCheck={true}
selectedNumber={dummySelected?.length}
variant="nestedmultiselect"
frozenData={frozenData}
/>
<div style={{ width: "100%" }}>
<MultiSelectDropdown
t={t}
props={{ className: "selecting-boundaries-dropdown" }}
options={Object.entries(popUpOption)
.filter(([key]) => key.startsWith(boundaryType))
.flatMap(([key, value]) =>
Object.entries(value || {})
.filter(([subkey, item]) => {
const itemCode = item?.split(".")?.[0];
if (frozenData?.length > 0) {
const isFrozen = frozenData.some((frozenOption) => {
return frozenOption.code === subkey && frozenOption.type === boundaryType;
});
return frozenType === "filter" ? !isFrozen : true; // Filter or include based on frozenType
}
return true;
})
.map(([subkey, item]) => ({
code: item?.split(".")?.[0],
name: item?.split(".")?.[0],
options: [
{
code: subkey,
name: subkey,
type: boundaryType,
parent: `${item?.split(".")?.[0]}`,
},
],
}))
)}
onSelect={(value) => {
handleSelected(value);
}}
selected={dummySelected}
optionsKey={"code"}
addCategorySelectAllCheck={true}
addSelectAllCheck={true}
selectedNumber={dummySelected?.length}
variant="nestedmultiselect"
frozenData={frozenData}
/>
</div>
</LabelFieldPair>

{Object.entries(
Expand Down Expand Up @@ -209,36 +209,36 @@ const Wrapper = ({ boundaryOptions, setShowPopUp, alreadyQueuedSelectedState, on
})}
</div>
{frozenData.length === 0 && (
<Button
label={t("Clear All")}
onClick={() => {
const updatedDummySelected = dummySelected.filter((item) => item?.propsData?.[1]?.parent !== parent);
setDummySelected(updatedDummySelected);
}}
// onClick={handleClearAll}
variation=""
style={{
height: "2rem",
minWidth: "4.188rem",
minHeight: "2rem",
padding: "0.5rem",
justifyContent: "center",
alignItems: "center",
borderRadius: "0.25rem",
border: "1px solid #C84C0E",
background: background,
marginTop: "1rem",
}}
textStyles={{
height: "auto",
fontSize: "0.875rem",
fontWeight: "400",
width: "100%",
lineHeight: "16px",
color: primaryIconColor,
}}
/>
)}
<Button
label={t("HCM_CLEAR_ALL")}
onClick={() => {
const updatedDummySelected = dummySelected.filter((item) => item?.propsData?.[1]?.parent !== parent);
setDummySelected(updatedDummySelected);
}}
// onClick={handleClearAll}
variation=""
style={{
height: "2rem",
minWidth: "4.188rem",
minHeight: "2rem",
padding: "0.5rem",
justifyContent: "center",
alignItems: "center",
borderRadius: "0.25rem",
border: "1px solid #C84C0E",
background: background,
marginTop: "1rem",
}}
textStyles={{
height: "auto",
fontSize: "0.875rem",
fontWeight: "400",
width: "100%",
lineHeight: "16px",
color: primaryIconColor,
}}
/>
)}
</div>
))}
</PopUp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1497,13 +1497,27 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
function onActionSelect(action) {
setDisplayMenu(false);
switch (action) {
case "UPDATE_DATES":
case "HCM_UPDATE_DATES":
history.push(`/${window.contextPath}/employee/campaign/update-dates-boundary?id=${id}`, {
name: draftData?.campaignName,
projectId: draftData?.projectId,
data: draftData,
});
break;
case "HCM_CONFIGURE_APP":
history.push(`/${window.contextPath}/employee/campaign/checklist/search?name=${draftData?.campaignName}&campaignId=${draftData?.id}`, {
name: draftData?.campaignName,
projectId: draftData?.projectId,
data: draftData,
});
break;
case "HCM_UPDATE_CAMPAIGN":
history.push( `/${window.contextPath}/employee/campaign/update-campaign?key=1&parentId=${draftData?.id}`, {
name: draftData?.campaignName,
projectId: draftData?.projectId,
data: draftData,
});
break;
default:
break;
}
Expand Down Expand Up @@ -1552,8 +1566,9 @@ const SetupCampaign = ({ hierarchyType, hierarchyData }) => {
{displayMenu ? (
<Menu
options={[
"UPDATE_DATES",
// "CONFIGURE_APP"
"HCM_UPDATE_DATES",
"HCM_CONFIGURE_APP",
"HCM_UPDATE_CAMPAIGN",
]}
t={t}
onSelect={onActionSelect}
Expand Down

0 comments on commit 7f0c3bd

Please sign in to comment.