Skip to content

Commit

Permalink
Update date change screen date logic fix, info added, hard reload iss…
Browse files Browse the repository at this point in the history
…ue fix (#1206)

Co-authored-by: nabeelmd-eGov <[email protected]>
  • Loading branch information
nabeelmd-eGov and nabeelmd-eGov authored Aug 1, 2024
1 parent 821232c commit 39b03e6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe
}, [project]);

const handleDateChange = ({ date, endDate = false, cycleDate = false, cycleIndex }) => {
if (typeof date === "undefined") {
if (typeof date === "undefined" || date <= today) {
return null;
}
if (!endDate) {
Expand All @@ -47,7 +47,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe
};

const handleCycleDateChange = ({ date, endDate = false, cycleIndex }) => {
if (typeof date === "undefined") {
if (typeof date === "undefined" || date <= today) {
return null;
}
if (!endDate) {
Expand Down Expand Up @@ -169,7 +169,13 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe
withoutLabel={true}
type="date"
value={item?.endDate}
nonEditable={item?.endDate?.length > 0 && today >= item?.endDate && today >= cycleDates?.[index + 1]?.startDate ? true : false}
nonEditable={
item?.endDate?.length > 0 &&
today >= item?.endDate &&
(cycleDates?.[index + 1] ? today >= cycleDates?.[index + 1]?.startDate : true)
? true
: false
}
placeholder={t("HCM_END_DATE")}
populators={{
validation: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useHistory } from "react-router-dom";
import { Link } from "react-router-dom";
import _ from "lodash";
import React from "react";
import { Fragment } from "react";
Expand Down Expand Up @@ -118,8 +118,8 @@ export const UICustomizations = {
"",
`/${window.contextPath}/employee/campaign/update-dates-boundary?id=${row?.id}`
);
window.location.href = `/${window.contextPath}/employee/campaign/update-dates-boundary?id=${row?.id}`;

const navEvent = new PopStateEvent("popstate");
window.dispatchEvent(navEvent);
break;
case "ACTION_LABEL_VIEW_TIMELINE":
setTimeline(true);
Expand Down Expand Up @@ -393,8 +393,8 @@ export const UICustomizations = {
"",
`/${window.contextPath}/employee/campaign/update-dates-boundary?id=${row?.id}`
);
window.location.href = `/${window.contextPath}/employee/campaign/update-dates-boundary?id=${row?.id}`;

const navEvent = new PopStateEvent("popstate");
window.dispatchEvent(navEvent);
break;
case "ACTION_LABEL_VIEW_TIMELINE":
setTimeline(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => {
};

const handleCycleDateChange = ({ date, endDate = false, cycleIndex }) => {
if (typeof date === "undefined") {
if (typeof date === "undefined" || date <= today) {
return null;
}
if (!endDate) {
Expand Down Expand Up @@ -278,7 +278,14 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => {
withoutLabel={true}
type="date"
value={item?.endDate}
nonEditable={item?.endDate && item?.endDate?.length > 0 && today >= item?.endDate ? true : false}
nonEditable={
item?.endDate &&
item?.endDate?.length > 0 &&
today >= item?.endDate &&
(cycleDates?.[index + 1] ? today >= cycleDates?.[index + 1]?.startDate : true)
? true
: false
}
placeholder={t("HCM_END_DATE")}
populators={{
validation: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { useHistory, useLocation } from "react-router-dom";
import { dateChangeBoundaryConfig, dateChangeConfig } from "../../configs/dateChangeBoundaryConfig";
import { Button, PopUp, Toast } from "@egovernments/digit-ui-components";
import { Button, InfoCard, PopUp, Toast } from "@egovernments/digit-ui-components";

function UpdateDatesWithBoundaries() {
const { t } = useTranslation();
Expand Down Expand Up @@ -152,6 +152,17 @@ function UpdateDatesWithBoundaries() {
actionClassName={"dateUpdateAction"}
noCardStyle={true}
/>
<InfoCard
className={"infoClass"}
populators={{
name: "infocard",
}}
variant="default"
style={{ marginBottom: "1.5rem", marginTop: "1.5rem", marginLeft: "0rem", maxWidth: "100%" }}
additionalElements={[<span style={{ color: "#505A5F" }}>{t(`UPDATE_DATE_CHANGE_INFO_TEXT`)}</span>]}
label={"Info"}
headerClassName={"headerClassName"}
/>
{showPopUp && (
<PopUp
className={"boundaries-pop-module"}
Expand Down

0 comments on commit 39b03e6

Please sign in to comment.