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

Internal demo fixes #1827

Merged
merged 8 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,7 @@ export const UICustomizations = {
label={t("START")}
variation="secondary"
icon={"ArrowForward"}
style={{minWidth:"240px"}}
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
type="button"
isDisabled={!hasRequiredRole}
// className="dm-workbench-download-template-btn dm-hover"
Expand All @@ -992,6 +993,7 @@ export const UICustomizations = {
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={"FileDownload"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("DOWNLOAD", row)}
Expand All @@ -1001,6 +1003,7 @@ export const UICustomizations = {
label={t("WBH_EDIT")}
variation="secondary"
icon={"Edit"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("EDIT", row)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const PopInboxTable = ({ ...props }) => {
},
width: "180px",
},
{
name: t("INBOX_ASSIGNEE"),
selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"),
sortable: true,
width: "180px",
},
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
...(
(props?.censusData?.[0]?.additionalFields || [])
.filter((field) => field.showOnUi)
Expand Down Expand Up @@ -101,12 +107,6 @@ const PopInboxTable = ({ ...props }) => {
sortable: false,
width: "180px",
},
{
name: t("INBOX_ASSIGNEE"),
selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"),
sortable: true,
width: "180px",
},
];
}, [props.showEditColumn, props.employeeNameData, props.censusData]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
// Initialize dropdown values with the existing accessibility details from additionalDetails if available
const [dropdown1Value, setDropdown1Value] = useState(null);
const [dropdown2Value, setDropdown2Value] = useState(null);
const [dropdown3Value, setDropdown3Value] = useState(null);
// const [dropdown3Value, setDropdown3Value] = useState(null);
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
const [initialValues, setInitialValues] = useState({});
const [showToast, setShowToast] = useState(null);

useEffect(() => {
if (census?.additionalDetails?.accessibilityDetails) {
const { roadCondition, terrain, transportationMode } = census?.additionalDetails?.accessibilityDetails || {};
const { roadCondition, terrain} = census?.additionalDetails?.accessibilityDetails || {}; /// removed transportationMode
setDropdown1Value(roadCondition);
setDropdown2Value(terrain);
setDropdown3Value(transportationMode);
// setDropdown3Value(transportationMode);

// Store initial values to compare later
setInitialValues({
roadCondition,
terrain,
transportationMode,
// transportationMode,
});
}
}, [census]);
Expand All @@ -46,9 +46,9 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
case "dropdown2":
setDropdown2Value(value);
break;
case "dropdown3":
setDropdown3Value(value);
break;
// case "dropdown3":
// setDropdown3Value(value);
// break;
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
default:
break;
}
Expand All @@ -63,7 +63,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
accessibilityDetails: {
roadCondition: dropdown1Value,
terrain: dropdown2Value,
transportationMode: dropdown3Value,
// transportationMode: dropdown3Value,
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
},
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
},
},
Expand All @@ -73,10 +73,10 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
const isChanged = React.useCallback(() => {
return (
dropdown1Value !== initialValues.roadCondition ||
dropdown2Value !== initialValues.terrain ||
dropdown3Value !== initialValues.transportationMode
dropdown2Value !== initialValues.terrain
//dropdown3Value !== initialValues.transportationMode
);
}, [dropdown1Value, dropdown2Value, dropdown3Value, initialValues]);
}, [dropdown1Value, dropdown2Value, initialValues]);

rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
// Define the mutation configuration
const mutation = Digit.Hooks.useCustomAPIMutationHook({
Expand Down Expand Up @@ -129,7 +129,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
/>
</LabelFieldPair>

<LabelFieldPair>
{/* <LabelFieldPair>
<div className="edit-label">{t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`)}</div>
<Dropdown
option={[{ name: "OTHER", code: "OTHER" }]} // Your options list
Expand All @@ -138,7 +138,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => {
select={(value) => handleDropdownChange(value, "dropdown3")}
t={t}
/>
</LabelFieldPair>
</LabelFieldPair> */}
</Card>,
]}
onOverlayClick={onClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const TimelinePopUpWrapper = ({ onClose, businessId, heading }) => {
label: t(instance?.action),
variant: 'completed',
subElements: [Digit.Utils.microplanv1.epochToDateTime(instance?.auditDetails?.lastModifiedTime),
instance?.assignes?.length > 0 &&
`${instance.assignes[0]?.name} - ${instance.assignes[0]?.roles?.[0]?.name || 'NA'}`,
instance.comment && t(`${instance.comment}`)
instance?.assigner &&
`${instance.assigner?.name} - ${instance.assigner?.roles?.[0]?.name || 'NA'}`,
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
instance.comment && `${t('COMMENT_PREFIX')} "${instance.comment}"`
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
],
showConnector: true
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export const UICustomizations = {
variation="secondary"
icon={"ArrowForward"}
type="button"
style={{minWidth:"240px"}}
isDisabled={!hasRequiredRole}
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("START", row)}
Expand All @@ -276,6 +277,7 @@ export const UICustomizations = {
label={t("WBH_DOWNLOAD")}
variation="secondary"
icon={"FileDownload"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("DOWNLOAD", row)}
Expand All @@ -285,6 +287,7 @@ export const UICustomizations = {
label={t("WBH_EDIT")}
variation="secondary"
icon={"Edit"}
style={{minWidth:"240px"}}
type="button"
// className="dm-workbench-download-template-btn dm-hover"
onClick={(e) => onActionSelect("EDIT", row)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,14 @@ const ChooseActivity = () => {
disable: isCardDisabled([], workflowData),
optionKey: "GEOSPATIAL_MAP_VIEW"
},
{
name: t("VIEW_MICROPLAN_ESTIMATIONS"),
link: `pop-inbox?campaignId=${campaignId}&microplanId=${microplanId}`,
icon: <SVG.Visibility height="36" width="36" fill={isCardDisabled(["MICROPLAN_VIEWER"], workflowData) ? "#C5C5C5" : "#C84C0E"} />,
disable: isCardDisabled(["MICROPLAN_VIEWER"], workflowData),
optionKey: "VIEW_MICROPLAN_ESTIMATIONS"
}
//commenting this as for now we are not showing viewer
// {
// name: t("VIEW_MICROPLAN_ESTIMATIONS"),
// link: `pop-inbox?campaignId=${campaignId}&microplanId=${microplanId}`,
// icon: <SVG.Visibility height="36" width="36" fill={isCardDisabled(["MICROPLAN_VIEWER"], workflowData) ? "#C5C5C5" : "#C84C0E"} />,
// disable: isCardDisabled(["MICROPLAN_VIEWER"], workflowData),
// optionKey: "VIEW_MICROPLAN_ESTIMATIONS"
// }
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
];

const updatePlan = async (req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const PlanInbox = () => {
village: filteredCensus?.boundaryCode || "NA",
villageRoadCondition: filteredCensus?.additionalDetails?.accessibilityDetails?.roadCondition?.code || "NA",
villageTerrain: filteredCensus?.additionalDetails?.accessibilityDetails?.terrain?.code || "NA",
villageTransportMode: filteredCensus?.additionalDetails?.accessibilityDetails?.transportationMode?.code || "NA",
// villageTransportMode: filteredCensus?.additionalDetails?.accessibilityDetails?.transportationMode?.code || "NA",
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
totalPop: filteredCensus?.additionalDetails?.totalPopulation || "NA",
targetPop: filteredCensus?.additionalDetails?.targetPopulation || "NA",
...dynamicSecurityData,
Expand Down Expand Up @@ -393,12 +393,12 @@ const PlanInbox = () => {
sortable: true,
width: "180px",
},
{
name: t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`),
cell: (row) => t(row?.villageTransportMode) || "NA",
sortable: true,
width: "180px",
},
// {
// name: t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`),
// cell: (row) => t(row?.villageTransportMode) || "NA",
// sortable: true,
// width: "180px",
// },
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
...getSecurityDetailsColumns(),
...getAdditionalFieldsColumns(),
...getResourceColumns(),
Expand Down Expand Up @@ -483,6 +483,7 @@ const PlanInbox = () => {
VALIDATE: { isSuffix: false, icon: "CheckCircle" },
EDIT_AND_SEND_FOR_APPROVAL: { isSuffix: false, icon: "Edit" },
APPROVE: { isSuffix: false, icon: "CheckCircle" },
ROOT_APPROVE: { isSuffix: false, icon: "CheckCircle" },
SEND_BACK_FOR_CORRECTION: { isSuffix: true, icon: "ArrowForward" },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ const PopInbox = () => {
"VALIDATE": { isSuffix: false, icon: "CheckCircle" },
"EDIT_AND_SEND_FOR_APPROVAL": { isSuffix: false, icon: "Edit" },
"APPROVE": { isSuffix: false, icon: "CheckCircle" },
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
"ROOT_APPROVE": { isSuffix: false, icon: "CheckCircle" },
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
"SEND_BACK_FOR_CORRECTION": { isSuffix: true, icon: "ArrowForward" },
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const VillageView = () => {
icon="ArrowForward"
iconFill=""
isSuffix
label={t(`HCM_MICROPLAN_VILLAGE_SECURITY_DETAIL_LINK`)}
label={data?.additionalDetails?.securityDetails ? t(`HCM_MICROPLAN_VILLAGE_SECURITY_EDIT_LINK`) : t(`HCM_MICROPLAN_VILLAGE_SECURITY_DETAIL_LINK`)}
rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
onClick={handleSecurityClick}
options={[]}
optionsKey=""
Expand All @@ -262,7 +262,7 @@ const VillageView = () => {
icon="ArrowForward"
iconFill=""
isSuffix
label={t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_LINK`)}
label={data?.additionalDetails?.accessibilityDetails ? t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_EDIT_LINK`) : t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_LINK`)}
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
onClick={handleAccibilityClick}
options={[]}
optionsKey=""
Expand Down Expand Up @@ -297,11 +297,11 @@ const VillageView = () => {
className="custom-class"
icon="Edit"
iconFill=""
label="Edit Confirmed Population"
label={t(`HCM_MICROPLAN_EDIT_CONFIRM_POPULATION_LABEL`)}
onClick={handleEditPopulationClick}
options={[]}
optionsKey=""
size="small"
size="medium"
style={{}}
title=""
variation="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,14 @@ function generateCampaignString(sessionData, t) {
const campaignTypeCode = sessionData.CAMPAIGN_DETAILS.campaignDetails.campaignType.i18nKey;
const resourceDistributionStrategy = sessionData.CAMPAIGN_DETAILS.campaignDetails.distributionStrat.resourceDistributionStrategyCode;

// Get current year and take the last two digits
const currentYear = new Date().getFullYear();
const yearLastTwoDigits = currentYear.toString().slice(-2);
const currentMonth = getCurrentMonth()
// Get current date details
const currentDate = new Date();
const day = String(currentDate.getDate()).padStart(2, '0'); // Two-digit day
const monthAbbr = currentDate.toLocaleString('en-US', { month: 'short' }); // Three-letter month abbreviation
const yearLastTwoDigits = currentDate.getFullYear().toString().slice(-2); // Last two digits of the year

rachana-egov marked this conversation as resolved.
Show resolved Hide resolved
// Construct the final string
const result = `${t(diseaseCode)}-${t(campaignTypeCode)}-${t(resourceDistributionStrategy)}-${currentMonth} ${yearLastTwoDigits}`;
const result = `${t(diseaseCode)}-${t(campaignTypeCode)}-${t(resourceDistributionStrategy)}-${day} ${monthAbbr} ${yearLastTwoDigits}`;
return result;
}

Expand Down