Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Workbench screens for Product and product variants were created through JSON schema.

...

Create Screen Data’s Postman Collection
https://drive.google.com/file/d/1j-2TPsKd6TnuDogCpb1h05_vJzfSeW64/view?usp=sharing

Create Screen Schema Postman Collection
https://drive.google.com/file/d/1N7uz8TyFBt2hr3Rnp11WnD907XoA6Ik5/view?usp=sharing

Search Screen Data Postman Collection
https://drive.google.com/file/d/1d5a4TUrodZpiyHRPu5NY_il8G_VjXw_Z/view?usp=sharing

Search Screen Schema Collection
https://drive.google.com/file/d/1jFv6VPpJc-w6BodUmMLy4dcj70wnAnHw/view?usp=sharing

Search Configs in UNIFIED-DEV

https://github.com/egovernments/egov-mdms-data/pull/3472

Sidebar Role Action

Navigation URL

Path

Role

Action ID

/workbench-ui/employee/hcmworkbench/inbox

HCM.1TrackStatus

CAMPAIGN_ADMIN

1887

/workbench-ui/employee/hcmworkbench/help-screen/check-list

HCM.2Checklist

CAMPAIGN_ADMIN

1886

/workbench-ui/employee/hcmworkbench/help-screen/coded-user

HCM.3UserManagement.CodedUser

CAMPAIGN_ADMIN

1885

/workbench-ui/employee/hcmworkbench/user

HCM.3UserManagement.NamedUser

CAMPAIGN_ADMIN

1884

/health-ui/employee/hrms/search

HCM.3UserManagement.ManageUser

CAMPAIGN_ADMIN

1883

/workbench-ui/employee/workbench/localisation-search

HCM.4Localization

CAMPAIGN_ADMIN

1882

/workbench-ui/employee/hcmworkbench/campaign

HCM.5MasterData.7DetailedPlan

CAMPAIGN_ADMIN

1881

/workbench-ui/employee/hcmworkbench/facility

HCM.5MasterData.6Facility.UploadFacility

CAMPAIGN_ADMIN

1880

/workbench-ui/employee/utilities/search/commonHCMUiConfig/SearchFacilityConfig

HCM.5MasterData.6Facility.ViewFacility

CAMPAIGN_ADMIN

1879

/workbench-ui/employee/hcmworkbench/project

HCM.5MasterData.5Project.UploadProject

CAMPAIGN_ADMIN

1878

/workbench-ui/employee/utilities/search/commonHCMUiConfig/SearchProjectConfig

HCM.5MasterData.5Project.ViewProject

CAMPAIGN_ADMIN

1877

/workbench-ui/employee/hcmworkbench/boundary

HCM.5MasterData.4BoundaryData

CAMPAIGN_ADMIN

1876

/workbench-ui/employee/utilities/search/commonHCMUiConfig/SearchProductVariantConfig

HCM.5MasterData.2ProductVariant

CAMPAIGN_ADMIN

1875

/workbench-ui/employee/utilities/search/commonHCMUiConfig/SearchProductConfig

HCM.5MasterData.1Product

CAMPAIGN_ADMIN

1874

/workbench-ui/employee/hcmworkbench/help-screen/basic-setup

HCM.6BasicSetup

CAMPAIGN_ADMIN

1873

/workbench-ui/employee/workbench/mdms-search-v2?moduleName=HCM-PROJECT-TYPES&masterName=projectTypes

HCM.5MasterData.3ProjectTypes

CAMPAIGN_ADMIN

1862

...

It takes the config dynamically from the url and then does the customization on the basis of that.
Each screen has its own conditions based on the based path.

SearchDefaultConfig: {

customValidationCheck: (data) => {

//checking both to and from date are present

const { createdFrom, createdTo } = data;

if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === ""))

return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" };

return false;

},

preProcess: (data) => {

const location = useLocation();

data.params = { ...data.params };

const { masterName } = useParams();

const searchParams = new URLSearchParams(location.search);

const paths = {

SearchProjectConfig: {

basePath: "Projects",

pathConfig: {

// id: "id[0]",

tenantId: "tenantId",

},

dateConfig: {

endDate: "dayend",

startDate: "daystart",

},

selectConfig: {},

textConfig: ["id", "tenantId", "name", "projectNumber", "projectSubType", "projectType"],

},

SearchProductConfig: {

basePath: "Product",

pathConfig: {

id: "id[0]",

},

dateConfig: {},

selectConfig: {},

textConfig: ["id", "manufacturer", "name", "type"],

},

SearchHouseholdConfig: {

basePath: "Household",

pathConfig: {

id: "id[0]",

clientReferenceId: "clientReferenceId[0]",

},

dateConfig: {},

selectConfig: {},

textConfig: ["boundaryCode", "clientReferenceId", "id"],

},

SearchProductVariantConfig: {

basePath: "ProductVariant",

pathConfig: {

id: "id[0]",

},

dateConfig: {},

selectConfig: {},

textConfig: ["productId", "sku", "variation" , "id"],

},

SearchProjectBeneficiaryConfig: {

basePath: "ProjectBeneficiary",

pathConfig: {

id: "id[0]",

clientReferenceId: "clientReferenceId[0]",

},

dateConfig: {

dateOfRegistration: "daystart",

},

selectConfig: {},

textConfig: ["beneficiaryId", "projectId" , "id" , "clientReferenceId"],

},

SearchProjectStaffConfig: {

basePath: "ProjectStaff",

pathConfig: {

id: "id[0]",

},

dateConfig: {

startDate: "daystart",

endDate: "dayend",

},

selectConfig: {},

textConfig: ["projectId", "userId" , "id"],

},

SearchProjectResourceConfig: {

basePath: "ProjectResource",

pathConfig: {

id: "id[0]",

},

dateConfig: {},

selectConfig: {},

textConfig: ["id"],

},

SearchProjectTaskConfig: {

basePath: "Task",

pathConfig: {

id: "id[0]",

clientReferenceId: "clientReferenceId[0]",

},

dateConfig: {

plannedEndDate: "dayend",

plannedStartDate: "daystart",

actualEndDate: "dayend",

actualStartDate: "daystart",

},

selectConfig: {},

textConfig: ["projectId", "localityCode", "projectBeneficiaryId", "status" , "id" ,"clientReferenceId"],

},

SearchFacilityConfig: {

basePath: "Facility",

pathConfig: {

id: "id[0]",

},

dateConfig: {},

selectConfig: {},

textConfig: ["faciltyUsage", "localityCode", "storageCapacity", "id"],

},

SearchProjectFacilityConfig: {

basePath: "ProjectFacility",

pathConfig: {

id: "id[0]",

projectId: "projectId[0]",

facilityId: "facilityId[0]"

},

dateConfig: {

},

selectConfig: {

},

textConfig :["id","projectId","facilityId"]

}

};

const id = searchParams.get("config") || masterName;

if (!paths || !paths?.[id]) {

return data;

}

let requestBody = { ...data.body[paths[id]?.basePath] };

const pathConfig = paths[id]?.pathConfig;

const dateConfig = paths[id]?.dateConfig;

const selectConfig = paths[id]?.selectConfig;

const textConfig = paths[id]?.textConfig;

if (paths[id].basePath == "Projects") {

data.state.searchForm = { ...data.state.searchForm, tenantId: "mz" };

}

let Product = Object.keys(requestBody)

.map((key) => {

if (selectConfig[key]) {

requestBody[key] = _.get(requestBody, selectConfig[key], null);

} else if (typeof requestBody[key] == "object") {

requestBody[key] = requestBody[key]?.code;

} else if (textConfig?.includes(key)) {

requestBody[key] = requestBody[key]?.trim();

}

return key;

})

.filter((key) => requestBody[key])

.reduce((acc, curr) => {

if (pathConfig[curr]) {

_.set(acc, pathConfig[curr], requestBody[curr]);

} else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) {

_.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr]));

} else {

_.set(acc, curr, requestBody[curr]);

}

return acc;

}, {});

if (paths[id].basePath == "Projects") {

data.body[paths[id].basePath] = [{ ...Product }];

} else data.body[paths[id].basePath] = { ...Product };

return data;

},

additionalCustomizations: (row, key, column, value, t, searchResult) => {

//here we can add multiple conditions

//like if a cell is link then we return link

//first we can identify which column it belongs to then we can return relevant result

switch (key) {

case "PROJECT_NUMBER":

return (

<span <span className="link"><Link

<Link

to={`/${window.contextPath}/employee/hcmworkbench/campaign-view?tenantId=${row?.tenantId}&projectNumber=${row?.projectNumber}`}

>{row?.projectNumber}

</Link>Link>

</span>span>

);

case "PROJECT_ID":

return (

<span <span className="link"><Link

<Link

to={`/${window.contextPath}/employee/hcmworkbench/campaign-view?tenantId=${row?.tenantId}&projectId=${row?.projectId}`}

>{row?.projectId}

</Link>Link>

</span>span>

);

case "MASTERS_SOCIAL_CATEGORY":

return value ? <span<span style={{ whiteSpace: "nowrap" }}>{String(t(`MASTERS_${value}`))}</span>span> : t("ES_COMMON_NA");

case "CORE_COMMON_PROFILE_CITY":

return value ? <span<span style={{ whiteSpace: "nowrap" }}>{String(t(Digit.Utils.locale.getCityLocale(value)))}</span>span> : t("ES_COMMON_NA");

case "MASTERS_WARD":

return value ? (

<span <span style={{ whiteSpace: "nowrap" }}>{String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))}</span>span>

) : (

t("ES_COMMON_NA")

);

case "MASTERS_LOCALITY":

return value ? (

<span <span style={{ whiteSpace: "break-spaces" }}>{String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))}</span>span>

) : (

t("ES_COMMON_NA")

);

default:

return t("ES_COMMON_NA");

}

},

MobileDetailsOnClick: (row, tenantId) => {

let link;

Object.keys(row).map((key) => {

if (key === "MASTERS_WAGESEEKER_ID")

link = `/${window.contextPath}/employee/masters/view-wageseeker?tenantId=${tenantId}&wageseekerId=${row[key]}`;

});

return link;

},

additionalValidations: (type, data, keys) => {

if (type === "date") {

return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true;

}

},

}