From 48ee063d18a2b66d5f85c6988b643e31377953ae Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Tue, 30 Jul 2024 14:22:27 +0530 Subject: [PATCH 1/9] date validation fix --- .../micro-ui-internals/example/package.json | 2 +- .../example/public/index.html | 2 +- .../css/src/pages/employee/index.scss | 3 + .../src/components/BoundaryWithDate.js | 53 ++++---- .../src/components/DateWithBoundary.js | 2 +- .../src/pages/employee/DateAndCycleUpdate.js | 122 +++++++++--------- .../employee/UpdateDatesWithBoundaries.js | 36 +++++- micro-ui/web/package.json | 2 +- micro-ui/web/public/index.html | 2 +- micro-ui/web/workbench/package.json | 2 +- 10 files changed, 132 insertions(+), 94 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/example/package.json b/micro-ui/web/micro-ui-internals/example/package.json index 1f903f2bde4..a5032498240 100644 --- a/micro-ui/web/micro-ui-internals/example/package.json +++ b/micro-ui/web/micro-ui-internals/example/package.json @@ -12,7 +12,7 @@ "@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.18", - "@egovernments/digit-ui-module-core": "1.8.2-beta.8", + "@egovernments/digit-ui-module-core": "1.8.2-beta.9", "@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", diff --git a/micro-ui/web/micro-ui-internals/example/public/index.html b/micro-ui/web/micro-ui-internals/example/public/index.html index 5ace6d5947a..27b1397a3f9 100644 --- a/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/micro-ui/web/micro-ui-internals/example/public/index.html @@ -14,7 +14,7 @@ rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.8.0-alpha.6/dist/index.css" /> --> - + diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index db6f6a1d271..9e9cf52f732 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -550,3 +550,6 @@ tbody { min-width: 8.6rem; } } +.digit-card-component.bannerCard.removeBottomMargin.languageSelection{ + width: unset; +} \ No newline at end of file diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js index ed0dc797b8f..9191c5c352b 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js @@ -28,6 +28,9 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe }, [project]); const handleDateChange = ({ date, endDate = false, cycleDate = false, cycleIndex }) => { + if (typeof date === "undefined") { + return null; + } if (!endDate) { dateReducerDispatch({ type: "START_DATE", @@ -44,6 +47,9 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe }; const handleCycleDateChange = ({ date, endDate = false, cycleIndex }) => { + if (typeof date === "undefined") { + return null; + } if (!endDate) { dateReducerDispatch({ type: "CYCLE_START_DATE", @@ -54,7 +60,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe }); } else { dateReducerDispatch({ - type: "CYCYLE_END_DATE", + type: "CYCLE_END_DATE", date: date, item: project, cycleIndex: cycleIndex, @@ -96,7 +102,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe } onChange={(d) => { handleDateChange({ - date: d, + date: d?.target?.value, }); }} /> @@ -116,7 +122,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe }} onChange={(d) => { handleDateChange({ - date: d, + date: d?.target?.value, endDate: true, }); }} @@ -138,26 +144,23 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe nonEditable={item?.startDate?.length > 0 && today > item?.startDate ? true : false} value={item?.startDate} placeholder={t("HCM_START_DATE")} - populators={ - today >= item?.startDate - ? {} - : { - validation: { - min: - index > 0 - ? 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, - max: endDate, - }, - } - } + populators={{ + validation: { + min: + index > 0 && !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime()) + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime() + ONE_DAY_IN_MS) + ?.toISOString() + ?.split("T")?.[0] + : today >= startDate + ? today + : startDate, + max: endDate, + }, + }} onChange={(d) => { // setStartValidation(true); handleCycleDateChange({ - date: d, + date: d?.target?.value, cycleIndex: item?.cycleIndex, }); }} @@ -170,17 +173,19 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe placeholder={t("HCM_END_DATE")} 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) + min: !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) ?.toISOString() ?.split("T")?.[0] - : null, + : today >= startDate + ? today + : startDate, max: endDate, }, }} onChange={(d) => { handleCycleDateChange({ - date: d, + date: d?.target?.value, endDate: true, cycleIndex: item?.cycleIndex, }); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js index 5c2ba3d6379..49bd71a2e76 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DateWithBoundary.js @@ -62,7 +62,7 @@ const reducer = (state, action) => { return item; }); break; - case "CYCYLE_END_DATE": + case "CYCLE_END_DATE": const cycleEndRemap = action?.cycles?.map((item, index) => { if (item?.id === action?.cycleIndex) { return { diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js index 61245b4f406..093e201d774 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js @@ -30,7 +30,7 @@ const reducer = (state, action) => { if (item?.id === action?.cycleIndex) { return { ...item, - startDate: Digit.Utils.pt.convertDateToEpoch(action?.date, "dayStart"), + startDate: Digit.Utils.pt.convertDateToEpoch(typeof action?.date === "string" ? action?.date : null, "dayStart"), }; } return item; @@ -46,7 +46,7 @@ const reducer = (state, action) => { }, }; break; - case "CYCYLE_END_DATE": + case "CYCLE_END_DATE": const cycleEndRemap = action?.cycles?.map((item, index) => { if (item?.id === action?.cycleIndex) { return { @@ -116,14 +116,16 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { useEffect(() => { if (dateReducer) { - setStartDate(Digit.Utils.date.getDate(dateReducer?.startDate)); - setEndDate(Digit.Utils.date.getDate(dateReducer?.endDate)); + setStartDate(dateReducer?.startDate ? Digit.Utils.date.getDate(dateReducer?.startDate) : ""); + setEndDate(dateReducer?.endDate ? Digit.Utils.date.getDate(dateReducer?.endDate) : ""); if (dateReducer?.additionalDetails?.projectType?.cycles?.length > 0) { - const cycleDateData = dateReducer?.additionalDetails?.projectType?.cycles?.map((cycle) => ({ - cycleIndex: cycle.id, - startDate: Digit.Utils.date.getDate(cycle.startDate), - endDate: Digit.Utils.date.getDate(cycle.endDate), - })); + const cycleDateData = dateReducer?.additionalDetails?.projectType?.cycles?.map((cycle) => { + return { + cycleIndex: cycle.id, + startDate: cycle.startDate ? Digit.Utils.date.getDate(cycle.startDate) : "", + endDate: cycle.endDate ? Digit.Utils.date.getDate(cycle.endDate) : "", + }; + }); setCycleDates(cycleDateData); } } @@ -139,7 +141,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { }, [isLoading, projectData]); const handleDateChange = ({ date, endDate = false, cycleDate = false, cycleIndex }) => { - if (!date || date <= today) { + if (typeof date === "undefined") { return null; } if (!endDate) { @@ -158,7 +160,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { }; const handleCycleDateChange = ({ date, endDate = false, cycleIndex }) => { - if (!date || date <= today) { + if (typeof date === "undefined") { return null; } if (!endDate) { @@ -171,7 +173,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { }); } else { dateReducerDispatch({ - type: "CYCYLE_END_DATE", + type: "CYCLE_END_DATE", date: date, item: dateReducer, cycleIndex: cycleIndex, @@ -182,17 +184,18 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { return (
{t(`UPDATE_DATE_AND_CYCLE_HEADER`)}
- +

{t(`HCM_CAMPAIGN_DATES`)}

*
= startDate ? true : false} + nonEditable={startDate && startDate?.length > 0 && today >= startDate ? true : false} placeholder={t("HCM_START_DATE")} populators={ today >= startDate @@ -205,31 +208,28 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { } onChange={(d) => { handleDateChange({ - date: d, + date: d?.target?.value, }); }} /> = endDate ? true : false} + nonEditable={endDate && endDate?.length > 0 && today >= endDate ? true : false} placeholder={t("HCM_END_DATE")} - populators={ - today >= endDate - ? {} - : { - validation: { - min: - startDate && 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), - }, - } - } + populators={{ + validation: { + min: + startDate && 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, + date: d?.target?.value, endDate: true, }); }} @@ -246,57 +246,55 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => {
= item?.startDate ? true : false} + nonEditable={item?.startDate && item?.startDate?.length > 0 && today >= item?.startDate ? true : false} placeholder={t("HCM_START_DATE")} - populators={ - today >= item?.startDate - ? {} - : { - validation: { - min: - index > 0 - ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime() + 86400000) - ?.toISOString() - ?.split("T")?.[0] - : startDate, - max: endDate, - }, - } - } + populators={{ + validation: { + min: + index > 0 && !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime()) + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index)?.endDate)?.getTime() + ONE_DAY_IN_MS) + ?.toISOString() + ?.split("T")?.[0] + : today >= startDate + ? today + : startDate, + max: endDate, + }, + }} onChange={(d) => { // setStartValidation(true); handleCycleDateChange({ - date: d, + date: d?.target?.value, cycleIndex: item?.cycleIndex, }); }} /> = item?.endDate ? true : false} + nonEditable={item?.endDate && item?.endDate?.length > 0 && today >= item?.endDate ? true : false} 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: !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) + ?.toISOString() + ?.split("T")?.[0] + : today >= startDate + ? today + : startDate, + max: endDate, + }, + }} onChange={(d) => { handleCycleDateChange({ - date: d, + date: d?.target?.value, endDate: true, cycleIndex: item?.cycleIndex, }); diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js index 07ae457fe7f..adcbbb8fe18 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js @@ -32,9 +32,41 @@ function UpdateDatesWithBoundaries() { } }, [showToast]); + const checkValid = (data) => { + if (DateWithBoundary) { + const temp = data?.dateWithBoundary; + const allCycleDateValid = temp + .map((i) => i.additionalDetails.projectType.cycles.every((j) => j.startDate && j.endDate)) + .every((k) => k === true); + const allDateValid = temp.every((i) => i.startDate && i.endDate); + + if (allCycleDateValid && allDateValid) { + return true; + } + return false; + } else if (!DateWithBoundary) { + const cycleDateValid = data?.dateAndCycle?.additionalDetails?.projectType?.cycles?.every((item) => item?.startDate && item?.endDate); + if (data?.dateAndCycle?.startDate && data?.dateAndCycle?.endDate && cycleDateValid) { + return true; + } + return false; + } + }; const onSubmit = async (formData) => { - if (!formData?.dateWithBoundary || formData?.dateWithBoundary?.length === 0) { - setShowToast({ isError: true, label: "SELECT_BOUNDARY_LEVEL_ERROR" }); + if (DateWithBoundary) { + if (!formData?.dateWithBoundary || !Array.isArray(formData?.dateWithBoundary) || formData?.dateWithBoundary?.length === 0) { + setShowToast({ isError: true, label: "SELECT_BOUNDARY_LEVEL_ERROR" }); + return; + } + } else if (!DateWithBoundary) { + if (!formData?.dateAndCycle) { + setShowToast({ isError: true, label: "SELECT_DATE_CHANGE_MANDATORY_ERROR" }); + return; + } + } + let isValid = checkValid(formData); + if (!isValid) { + setShowToast({ isError: true, label: "MANDATORY_FIELDS_MISSING" }); return; } setShowPopUp(formData); diff --git a/micro-ui/web/package.json b/micro-ui/web/package.json index 870a830d91b..5592c413087 100644 --- a/micro-ui/web/package.json +++ b/micro-ui/web/package.json @@ -16,7 +16,7 @@ "dependencies": { "@egovernments/digit-ui-libraries": "1.8.2-beta.5", "@egovernments/digit-ui-module-workbench": "1.0.1-beta.16", - "@egovernments/digit-ui-module-core": "1.8.2-beta.8", + "@egovernments/digit-ui-module-core": "1.8.2-beta.9", "@egovernments/digit-ui-module-hrms": "1.8.0-beta.2", "@egovernments/digit-ui-react-components": "1.8.2-beta.11", "@egovernments/digit-ui-components": "0.0.2-beta.18", diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index 24a43e2bba3..32b547b95e9 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -8,7 +8,7 @@ href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" type="text/css" /> - + diff --git a/micro-ui/web/workbench/package.json b/micro-ui/web/workbench/package.json index ff581e92e58..159fa4732e4 100644 --- a/micro-ui/web/workbench/package.json +++ b/micro-ui/web/workbench/package.json @@ -15,7 +15,7 @@ "@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.18", - "@egovernments/digit-ui-module-core": "1.8.2-beta.8", + "@egovernments/digit-ui-module-core": "1.8.2-beta.9", "@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", From 2d94404578af48f1601031f9e43061e4edaef7b3 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Tue, 30 Jul 2024 15:04:51 +0530 Subject: [PATCH 2/9] Update date logic --- .../employee/UpdateDatesWithBoundaries.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js index adcbbb8fe18..461bffb3660 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js @@ -76,7 +76,24 @@ function UpdateDatesWithBoundaries() { setShowPopUp(null); try { if (DateWithBoundary) { - const temp = await Digit.Hooks.campaign.useProjectUpdateWithBoundary({ formData: formData?.dateWithBoundary }); + // updating the endDate by +1 sec and -1 sec so that backend logic for ancestor update work + const payload = formData?.dateWithBoundary?.map((item) => { + let itemEndDate = item?.endDate; + let endDate = new Date(item?.endDate); + let endSecond = endDate?.getSeconds(); + if (endSecond < 59) { + return { + ...item, + endDate: itemEndDate + 1000, + }; + } else { + return { + ...item, + endDate: itemEndDate - 1000, + }; + } + }); + const temp = await Digit.Hooks.campaign.useProjectUpdateWithBoundary({ formData: payload }); // setShowToast({ isError: false, label: "DATE_UPDATED_SUCCESSFULLY" }); history.push(`/${window.contextPath}/employee/campaign/response?isSuccess=${true}`, { message: t("ES_CAMPAIGN_DATE_CHANGE_WITH_BOUNDARY_SUCCESS"), From 571b8e7584f6b4c5ed7695563e250b33f34f82cb Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Tue, 30 Jul 2024 15:08:07 +0530 Subject: [PATCH 3/9] FIX --- .../src/pages/employee/UpdateDatesWithBoundaries.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js index 461bffb3660..07a67e84f4d 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/UpdateDatesWithBoundaries.js @@ -66,7 +66,7 @@ function UpdateDatesWithBoundaries() { } let isValid = checkValid(formData); if (!isValid) { - setShowToast({ isError: true, label: "MANDATORY_FIELDS_MISSING" }); + setShowToast({ isError: true, label: "UPDATE_DATE_MANDATORY_FIELDS_MISSING" }); return; } setShowPopUp(formData); From 3681cf83437ec239e2ac5258f453e4b4f36aa289 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Tue, 30 Jul 2024 15:34:34 +0530 Subject: [PATCH 4/9] css add --- micro-ui/web/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index d7ae529c30f..07bf896b658 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -8,7 +8,7 @@ href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" type="text/css" /> - + From 0270b0fc76e9056149be0a906b429607123273cd Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Tue, 30 Jul 2024 16:20:17 +0530 Subject: [PATCH 5/9] non editable fix --- .../campaign-manager/src/components/BoundaryWithDate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js index 9191c5c352b..83a84c4a3ef 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js @@ -89,7 +89,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe withoutLabel={true} type="date" value={startDate} - nonEditable={startDate?.length > 0 && today > startDate ? true : false} + nonEditable={startDate?.length > 0 && today >= startDate ? true : false} placeholder={t("HCM_START_DATE")} populators={ today >= startDate @@ -110,7 +110,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe withoutLabel={true} type="date" value={endDate} - nonEditable={endDate?.length > 0 && today > endDate ? true : false} + nonEditable={endDate?.length > 0 && today >= endDate ? true : false} placeholder={t("HCM_END_DATE")} populators={{ validation: { @@ -141,7 +141,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe 0 && today > item?.startDate ? true : false} + nonEditable={item?.startDate?.length > 0 && today >= item?.startDate ? true : false} value={item?.startDate} placeholder={t("HCM_START_DATE")} populators={{ @@ -169,7 +169,7 @@ 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 && today >= cycleDates?.[index + 1]?.startDate ? true : false} placeholder={t("HCM_END_DATE")} populators={{ validation: { From 6e535e4ebc915f04ba69ed01ebc7f3fe31989fb6 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Wed, 31 Jul 2024 12:36:11 +0530 Subject: [PATCH 6/9] date start from tomorrow --- .../src/components/BoundaryWithDate.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js index 83a84c4a3ef..e7488096717 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js @@ -10,6 +10,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe // const { t } = useTranslation(); const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000; const today = Digit.Utils.date.getDate(Date.now()); + const tomorrow = Digit.Utils.date.getDate(new Date(today).getTime() + ONE_DAY_IN_MS); 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); @@ -152,7 +153,7 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe ?.toISOString() ?.split("T")?.[0] : today >= startDate - ? today + ? tomorrow : startDate, max: endDate, }, @@ -173,13 +174,16 @@ const BoundaryWithDate = ({ project, props, onSelect, dateReducerDispatch, canDe placeholder={t("HCM_END_DATE")} populators={{ validation: { - min: !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) - ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) - ?.toISOString() - ?.split("T")?.[0] - : today >= startDate - ? today - : startDate, + min: + !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) && + Digit.Utils.date.getDate(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) > + today + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) + ?.toISOString() + ?.split("T")?.[0] + : today >= startDate + ? tomorrow + : startDate, max: endDate, }, }} From 4f0fa26904c618126acac102ada48b55e147f836 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Wed, 31 Jul 2024 13:22:28 +0530 Subject: [PATCH 7/9] css fix for language screen --- micro-ui/web/micro-ui-internals/example/public/index.html | 2 +- micro-ui/web/micro-ui-internals/packages/css/package.json | 2 +- .../packages/css/src/pages/employee/index.scss | 2 +- micro-ui/web/public/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/example/public/index.html b/micro-ui/web/micro-ui-internals/example/public/index.html index 49e6287a4ab..684f5350549 100644 --- a/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/micro-ui/web/micro-ui-internals/example/public/index.html @@ -17,7 +17,7 @@ - + diff --git a/micro-ui/web/micro-ui-internals/packages/css/package.json b/micro-ui/web/micro-ui-internals/packages/css/package.json index 43066db29bc..899c07d1aa7 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-css", - "version": "1.0.64-campaign", + "version": "1.0.65-campaign", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss index 9e9cf52f732..3959f5eb0b6 100644 --- a/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss +++ b/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss @@ -551,5 +551,5 @@ tbody { } } .digit-card-component.bannerCard.removeBottomMargin.languageSelection{ - width: unset; + width: unset !important; } \ No newline at end of file diff --git a/micro-ui/web/public/index.html b/micro-ui/web/public/index.html index 07bf896b658..a99ea661706 100644 --- a/micro-ui/web/public/index.html +++ b/micro-ui/web/public/index.html @@ -11,7 +11,7 @@ - + DIGIT From b6c90996b4306e8c3ea8341742c718998aee35e1 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Wed, 31 Jul 2024 15:20:47 +0530 Subject: [PATCH 8/9] disable today date --- .../campaign-manager/src/components/BoundaryWithDate.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js index e7488096717..2df60822efa 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/BoundaryWithDate.js @@ -170,7 +170,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: { From e16cf3365ce7389e92648611f877873a3239c1a5 Mon Sep 17 00:00:00 2001 From: nabeelmd-eGov Date: Wed, 31 Jul 2024 17:56:07 +0530 Subject: [PATCH 9/9] date and cycle fix --- .../src/pages/employee/DateAndCycleUpdate.js | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js index 093e201d774..02d53ba56a2 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/DateAndCycleUpdate.js @@ -77,6 +77,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { const { t } = useTranslation(); const ONE_DAY_IN_MS = 24 * 60 * 60 * 1000; const today = Digit.Utils.date.getDate(Date.now()); + const tomorrow = Digit.Utils.date.getDate(new Date(today).getTime() + ONE_DAY_IN_MS); const tenantId = Digit.ULBService.getCurrentTenantId(); const { state } = useLocation(); const historyState = window.history.state; @@ -260,7 +261,7 @@ const DateAndCycleUpdate = ({ onSelect, formData, ...props }) => { ?.toISOString() ?.split("T")?.[0] : today >= startDate - ? today + ? tomorrow : startDate, max: endDate, }, @@ -278,17 +279,27 @@ 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: { - min: !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) - ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) - ?.toISOString() - ?.split("T")?.[0] - : today >= startDate - ? today - : startDate, + min: + !isNaN(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime()) && + Digit.Utils.date.getDate(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) > + today + ? new Date(new Date(cycleDates?.find((j) => j.cycleIndex == index + 1)?.startDate)?.getTime() + ONE_DAY_IN_MS) + ?.toISOString() + ?.split("T")?.[0] + : today >= startDate + ? tomorrow + : startDate, max: endDate, }, }}