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

HLM-5333: Form composer api integration for draft #233

Merged
merged 5 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@egovernments/digit-ui-libraries": "1.8.1-beta.1",
"@egovernments/digit-ui-module-core": "1.8.1-beta.6",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.1",
"@egovernments/digit-ui-react-components": "1.8.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.6",
"@egovernments/digit-ui-module-workbench": "1.0.1-beta.2",
"@egovernments/digit-ui-module-hcmworkbench":"0.0.38",
"@egovernments/digit-ui-module-campaign-manager": "0.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
rel="stylesheet"
href="https://unpkg.com/@egovernments/[email protected]/dist/index.css"
/> -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].3/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].5/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module.exports = function (app) {
"/hcm-bff/bulk/_transform",
"/hcm-bff/hcm/_processmicroplan",
"/health-hrms",
"/project-factory/v1/project-type",
].forEach((location) => app.use(location, createProxy));
["/pb-egov-assets"].forEach((location) => app.use(location, assetsProxy));
["/mdms-v2/v2/_create"].forEach((location) => app.use(location, mdmsProxy));
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"dependencies": {
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-react-components": "1.8.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.6",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.1-beta.5",
"@egovernments/digit-ui-react-components": "1.8.1-beta.6",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import TimelineCampaign from "./components/TimelineCampaign";
import CampaignDates from "./components/CampaignDates";
import CampaignType from "./components/CampaignType";
import CampaignName from "./components/CampaignName";
import MyCampaign from "./pages/employee/MyCampaign";

const CampaignModule = ({ stateCode, userType, tenants }) => {
const moduleCode = ["campaignmanager", "workbench", "mdms", "schema"];
Expand Down Expand Up @@ -45,7 +46,8 @@ const componentsToRegister = {
TimelineCampaign,
CampaignDates,
CampaignType,
CampaignName
CampaignName,
MyCampaign
};

const overrideHooks = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import React from "react";
import { useTranslation } from "react-i18next";

const ROLES = {
LOCALISATION: ["EMPLOYEE", "SUPERUSER","EMPLOYEE_COMMON","LOC_ADMIN"],
LOCALISATION: ["EMPLOYEE", "SUPERUSER", "EMPLOYEE_COMMON", "LOC_ADMIN"],
MDMS: ["MDMS_ADMIN", "EMPLOYEE", "SUPERUSER"],
DSS: ["STADMIN"],
};

const CampaignCard = () => {
// if (!Digit.Utils.didEmployeeHasAtleastOneRole(Object.values(ROLES).flatMap((e) => e))) {
// return null;
// return null;
// }

const { t } = useTranslation();
Expand All @@ -37,6 +37,11 @@ const CampaignCard = () => {
link: `/${window?.contextPath}/employee/campaign/setup-campaign`,
roles: [], // @nabeel roles to be added later
},
{
label: t("ACTION_TEST_MY_CAMPAIGN"),
link: `/${window?.contextPath}/employee/campaign/my-campaign`,
roles: [], // @nabeel roles to be added later
},
];

links = links.filter((link) => (link?.roles && link?.roles?.length > 0 ? Digit.Utils.didEmployeeHasAtleastOneRole(link?.roles) : true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const CampaignConfig = (totalFormData) => {
{
stepCount: "2",
key: "4",
name: "HCM_CAMPAIGN_CYCLE_CONFIGURE",
body: [
{
isMandatory: false,
Expand All @@ -93,6 +94,7 @@ export const CampaignConfig = (totalFormData) => {
},
populators: {
name: "cycleConfiguration",
sessionData: totalFormData,
// optionsKey: "code",
error: "ES__REQUIRED",
required: true,
Expand All @@ -103,6 +105,7 @@ export const CampaignConfig = (totalFormData) => {
{
stepCount: "2",
key: "5",
name: "HCM_CAMPAIGN_DELIVERY_DATA",
body: [
{
isMandatory: false,
Expand All @@ -114,6 +117,7 @@ export const CampaignConfig = (totalFormData) => {
disable: false,
customProps: {
module: "HCM",
sessionData: totalFormData,
},
populators: {
name: "deliveryRule",
Expand Down Expand Up @@ -173,6 +177,7 @@ export const CampaignConfig = (totalFormData) => {
{
stepCount: "5",
key: "8",
isLast: true,
body: [
{
isMandatory: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,260 @@ const businessServiceMap = {};

const inboxModuleNameMap = {};

export const UICustomizations = {};
export const UICustomizations = {
MyCampaignConfigAdmin: {
preProcess: (data, additionalDetails) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
data.body = { RequestInfo: data.body.RequestInfo };
data.params.tenantId = tenantId;
const { limit, offset } = data?.state?.tableForm || {};
delete data.body.custom;
delete data.body.inbox;
return data;
},
populateStatusReqCriteria: () => {
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
url: "/egov-workflow-v2/egov-wf/businessservice/_search",
params: { tenantId, businessServices: businessServiceMap?.tqm },
body: {},
changeQueryName: "setWorkflowStatus",
config: {
enabled: true,
select: (data) => {
const wfStates = data?.BusinessServices?.[0]?.states
?.filter((state) => state.applicationStatus)
?.map((state) => {
return {
i18nKey: `WF_STATUS_${businessServiceMap?.tqm}_${state?.applicationStatus}`,
...state,
};
});
return wfStates;
},
},
};
},
getCustomActionLabel: (obj, row) => {
return "";
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
switch (key) {
case "TQM_INBOX_SLA":
let sla = 0;
const currentDate = new Date();
const targetTimestamp = row?.businessObject?.scheduledDate;
const targetDate = new Date(targetTimestamp);
const remainingSLA = targetDate - currentDate;
sla = Math.ceil(remainingSLA / (24 * 60 * 60 * 1000));
if (!row?.businessObject?.scheduledDate) return t("ES_COMMON_NA");
return Math.sign(sla) === -1 ? (
<span className="sla-cell-error">
{Math.ceil(sla)} {t("COMMON_DAYS_OVERDUE")}
</span>
) : (
<span className="sla-cell-success">
{sla} {t("COMMON_DAYS")}
</span>
);

case "TQM_PENDING_DATE":
return Digit.DateUtils.ConvertEpochToDate(value);

case "TQM_TEST_ID":
return (
<span className="link">
<Link
to={`/${
window.contextPath
}/employee/tqm/view-test-results?tenantId=${Digit.ULBService.getCurrentTenantId()}&id=${value}&from=TQM_BREAD_INBOX`}
>
{String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))}
</Link>
</span>
);

default:
return "case_not_found";
}
},
populatePlantUsersReqCriteria: (props) => {
const userInfo = Digit.UserService.getUser();
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
params: {},
url: "/pqm-service/plant/user/v1/_search",
body: {
plantUserSearchCriteria: {
tenantId,
// "plantCodes": [],
plantUserUuids: userInfo?.info?.uuid ? [userInfo?.info?.uuid] : [],
additionalDetails: {},
},
pagination: {},
},
config: {
select: (data) => {
return Digit.SessionStorage.get("user_plants");
},
},
changeQueryName: "setPlantUsersInboxDropdown",
};
},
onCardClick: (obj) => {
return `view-test-results?tenantId=${obj?.apiResponse?.businessObject?.tenantId}&id=${obj?.apiResponse?.businessObject?.testId}&from=TQM_BREAD_INBOX`;
},
onCardActionClick: (obj) => {
return `view-test-results?tenantId=${obj?.apiResponse?.businessObject?.tenantId}&id=${obj?.apiResponse?.businessObject?.testId}&from=TQM_BREAD_INBOX`;
},
getCustomActionLabel: (obj, row) => {
return "TQM_VIEW_TEST_DETAILS";
},
},
TabVehicleConfigAdmin: {
populateMdmsv2SearchReqCriteria: ({ schemaCode }) => {
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
url: "/mdms-v2/v2/_search",
params: {},
body: {
tenantId,
MdmsCriteria: {
tenantId: tenantId,
schemaCode: schemaCode,
isActive: true,
},
},
changeQueryName: `mdms-v2-${schemaCode}`,
config: {
enabled: schemaCode ? true : true,
select: (response) => {
const { mdms } = response;
//first filter with isActive
//then make a data array with actual data
//refer the "code" key in data(for now) and set options array , also set i18nKey in each object to show in UI
const options = mdms?.map((row) => {
return {
i18nKey: Digit.Utils.locale.getTransformedLocale(`${row?.schemaCode}_${row?.data?.code}`),
...row.data,
};
});
return options;
},
},
};
},
preProcess: (data, additionalDetails) => {
const tenantId = Digit.ULBService.getCurrentTenantId();
delete data.body.custom;
delete data.body.inbox;
data.body = { RequestInfo: data.body.RequestInfo };
data.params.tenantId = tenantId;
return data;
},
populateStatusReqCriteria: () => {
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
url: "/egov-workflow-v2/egov-wf/businessservice/_search",
params: { tenantId, businessServices: businessServiceMap?.tqm },
body: {},
changeQueryName: "setWorkflowStatus",
config: {
enabled: true,
select: (data) => {
const wfStates = data?.BusinessServices?.[0]?.states
?.filter((state) => state.applicationStatus)
?.map((state) => {
return {
i18nKey: `WF_STATUS_${businessServiceMap?.tqm}_${state?.applicationStatus}`,
...state,
};
});
return wfStates;
},
},
};
},
getCustomActionLabel: (obj, row) => {
return "";
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
console.log("MADARCHOD", row, key, column, value, searchResult);
switch (key) {
case "TQM_INBOX_SLA":
let sla = 0;
const currentDate = new Date();
const targetTimestamp = row?.businessObject?.scheduledDate;
const targetDate = new Date(targetTimestamp);
const remainingSLA = targetDate - currentDate;
sla = Math.ceil(remainingSLA / (24 * 60 * 60 * 1000));
if (!row?.businessObject?.scheduledDate) return t("ES_COMMON_NA");
return Math.sign(sla) === -1 ? (
<span className="sla-cell-error">
{Math.ceil(sla)} {t("COMMON_DAYS_OVERDUE")}
</span>
) : (
<span className="sla-cell-success">
{sla} {t("COMMON_DAYS")}
</span>
);

case "TQM_PENDING_DATE":
return Digit.DateUtils.ConvertEpochToDate(value);

case "TQM_TEST_ID":
return (
<span className="link">
<Link
to={`/${
window.contextPath
}/employee/tqm/view-test-results?tenantId=${Digit.ULBService.getCurrentTenantId()}&id=${value}&from=TQM_BREAD_INBOX`}
>
{String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))}
</Link>
</span>
);

default:
return "case_not_found";
}
},
populatePlantUsersReqCriteria: (props) => {
const userInfo = Digit.UserService.getUser();
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
params: {},
url: "/pqm-service/plant/user/v1/_search",
body: {
plantUserSearchCriteria: {
tenantId,
// "plantCodes": [],
plantUserUuids: userInfo?.info?.uuid ? [userInfo?.info?.uuid] : [],
additionalDetails: {},
},
pagination: {},
},
config: {
select: (data) => {
return Digit.SessionStorage.get("user_plants");
},
},
changeQueryName: "setPlantUsersInboxDropdown",
};
},
onCardClick: (obj) => {
return `view-test-results?tenantId=${obj?.apiResponse?.businessObject?.tenantId}&id=${obj?.apiResponse?.businessObject?.testId}&from=TQM_BREAD_INBOX`;
},
onCardActionClick: (obj) => {
return `view-test-results?tenantId=${obj?.apiResponse?.businessObject?.tenantId}&id=${obj?.apiResponse?.businessObject?.testId}&from=TQM_BREAD_INBOX`;
},
getCustomActionLabel: (obj, row) => {
return "TQM_VIEW_TEST_DETAILS";
},
},
};
Loading