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

User management screen #1496

Merged
merged 24 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1e9463f
user management screen
abishekTa-egov Oct 4, 2024
ee09ead
some changes to user screen
abishekTa-egov Oct 5, 2024
6abb4fd
some name changes
abishekTa-egov Oct 7, 2024
e8553b4
user management screen
abishekTa-egov Oct 8, 2024
882cacb
table rendered
abishekTa-egov Oct 8, 2024
b1d12af
Table rendering and other changes
abishekTa-egov Oct 8, 2024
f4007d8
roles default value set to all roles
abishekTa-egov Oct 9, 2024
379a800
checkpoint
abishekTa-egov Oct 9, 2024
5892b11
EOD checkpoint
abishekTa-egov Oct 9, 2024
4d80b9a
filter deafult changes and roles as list of roles
abishekTa-egov Oct 10, 2024
2c460b3
Merge branch 'console' into user-management-screen
abishekTa-egov Oct 10, 2024
6f5dea8
index file merge changed
abishekTa-egov Oct 10, 2024
681abd5
resolved comments after pull
abishekTa-egov Oct 10, 2024
38a5930
index.html
abishekTa-egov Oct 10, 2024
641030d
index file change
abishekTa-egov Oct 10, 2024
5b8c4e6
resolved comments
abishekTa-egov Oct 10, 2024
3868ffa
Merge branch 'console' into user-management-screen
nipunarora-eGov Oct 10, 2024
696933f
changes in names
abishekTa-egov Oct 10, 2024
af84ab1
commit
abishekTa-egov Oct 10, 2024
882c082
changes
abishekTa-egov Oct 10, 2024
248ed10
Merge branch 'console' into user-management-screen
nipunarora-eGov Oct 10, 2024
00059ad
changes
abishekTa-egov Oct 10, 2024
6a004cc
Merge branch 'user-management-screen' of https://github.com/egovernme…
abishekTa-egov Oct 10, 2024
52bfc71
Merge branch 'console' into user-management-screen
nipunarora-eGov Oct 10, 2024
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 @@ -18,7 +18,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.8.0-alpha.6/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.36/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.76-campaign/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.77-campaign/dist/index.css" />

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.0.50-microplan/dist/index.css" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-css",
"version": "1.0.76-campaign",
"version": "1.0.77-campaign",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <jagan.kumar@egov.org.in>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,13 @@
color:orange;
margin-top: 0.2rem;
}

.dm-code {
max-width: var(--dm-code-max-width, 10rem);
display: inline-block; /* Keep elements inline but respect width constraints */
white-space: nowrap; /* Prevent wrapping */
overflow: hidden; /* Hide overflow text */
text-overflow: ellipsis; /* Add ellipsis to overflowing text */
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved


Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MicroplanCard = () => {
};
};

let links = [generateLink("SETUP_MICROPLAN","setup-microplan"),generateLink("SEARCH_MICROPLANS","microplan-search")];
let links = [generateLink("SETUP_MICROPLAN","setup-microplan"),generateLink("SEARCH_MICROPLANS","microplan-search"),generateLink("USER_MANAGEMENT","user-management")];

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
@@ -1,8 +1,9 @@
import { Link, useHistory } from "react-router-dom";
import { Link } from "react-router-dom";
import _ from "lodash";
import React from "react";
import { Dropdown } from "@egovernments/digit-ui-components";


//create functions here based on module name set in mdms(eg->SearchProjectConfig)
//how to call these -> Digit?.Customizations?.[masterName]?.[moduleName]
// these functions will act as middlewares
Expand All @@ -12,6 +13,8 @@ const businessServiceMap = {};

const inboxModuleNameMap = {};



function cleanObject(obj) {
for (const key in obj) {
if (Object.hasOwn(obj, key)) {
Expand Down Expand Up @@ -49,7 +52,7 @@ export const UICustomizations = {
// delete data.body.PlanConfigurationSearchCriteria.pagination
data.body.PlanConfigurationSearchCriteria.status = status?.status;
cleanObject(data.body.PlanConfigurationSearchCriteria);

return data;
},
additionalCustomizations: (row, key, column, value, t, searchResult) => {
Expand Down Expand Up @@ -98,4 +101,130 @@ export const UICustomizations = {
},
},

UserManagementConfig: {

customValidationCheck: (data) => {
const { phone } = data;
const mobileRegex = /^[0-9]{10}$/;

// Allow empty mobile number
if (!phone || phone.trim() === "") {
return false;
}

// Check if phone matches the regex
if (!mobileRegex.test(phone)) {
return { error: true, label: "INVALID_MOBILE_NUMBER" }; // Return an error message if invalid
}

return false;
},
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
preProcess: (data, additionalDetails) => {

const { phone, name } = data?.state?.searchForm || {}
const { sortOrder } = data?.state?.filterForm || {}
let { roleschosen } = data?.state?.filterForm || []

if (!roleschosen) {
roleschosen = {}
}
// if(Object.keys(roleschosen).length === 0){
// for(const obj of additionalDetails["microplanData"]){

// roleschosen[obj["roleCode"]]=true;

// }
// }
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

let rolesString = '';
if (roleschosen) {
rolesString = Object.keys(roleschosen).filter(role => roleschosen[role] === true).join(',');
}



data.params.names = name;

abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
data.params.phone = phone;

data.params.roles = rolesString;
data.params.tenantId = Digit.ULBService.getCurrentTenantId();
cleanObject(data.params);
delete data.params.roleschosen;
delete data.params.name;
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved


return data
},

rolesForFilter: (props) => {
const userInfo = Digit.UserService.getUser();
const tenantId = Digit.ULBService.getCurrentTenantId();

return {
params: {},
url: '/mdms-v2/v2/_search', //mdms fetch from

body: {
MdmsCriteria: {
tenantId: "mz",
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
filters: {},
schemaCode: "hcm-microplanning.rolesForMicroplan",
limit: 10,
offset: 0
}

},
config: {
enabled: true,
select: (data) => {
const roles = data?.mdms.map(item => {
return (
{
roleCode: item.data.roleCode,
i18nKey: Digit.Utils.locale.getTransformedLocale(`MP_ROLE_${item.data.roleCode}`)

}
)
})

return roles
},
},
// changeQueryName:"setPlantUsersInboxDropdown"
}
},




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


if (key === "Role") {

if (value && value !== "NA") {

return (
<div>
{value.map((item, index) => (
<span key={index} className="dm-code">
{Digit.Utils.locale.getTransformedLocale(`MP_ROLE_${item.code}`)}
{index < value.length - 1 && ", "}
</span>
))}
</div>
);
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

}else{
return(
<div>NA</div>
)
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

},

}

};
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
export const tqmInboxConfig = {
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
"tenantId": "pb",
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
"moduleName": "UserManagementConfig",
"tqmInboxConfig": [
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
{
"label": "USER_MANAGEMENT",
"type": "inbox",
"apiDetails": {
"serviceName": "/health-hrms/employees/_search",
"requestParam": {},
"requestBody": {

},
"minParametersForSearchForm": 0,
"minParametersForFilterForm": 0,
"masterName": "commonUiConfig",
"moduleName": "UserManagementConfig",
"tableFormJsonPath": "requestParam",
"filterFormJsonPath": "requestParam",
"searchFormJsonPath": "requestParam"
},
"sections": {
"search": {
"uiConfig": {
"headerLabel": "ES_COMMON_SEARCH",
"type":"search",
"typeMobile":"filter",
"searchWrapperStyles": {
"flexDirection": "column-reverse",
"marginTop": "1.4rem",
"alignItems": "center",
"justifyContent": "end",
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
"gridColumn": "3"
},
"headerStyle": null,
"primaryLabel": "Search",
"secondaryLabel": "ES_COMMON_CLEAR_SEARCH",
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved
"minReqFields": 0,
"defaultValues": {
name:"",
phone:""
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved

},
"fields": [
{
"label": "NAME",
"type": "text",
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
"isMandatory": false,
"disable": false,
"populators": {
"name": "name",
"error": "ERR_INVALID_NAME",
"style":{
"marginBottom":"0px"
}
},

},
{
"label": "CONTACT_NUMBER",
"type": "number",
"isMandatory": false,
"disable": false,
"populators": {
"name": "phone",
"error": "ERR_INVALID_PHONE_NUMBER",
"style":{
"marginBottom":"0px"
},

},

},
]
},
"label": "",
"labelMobile": "ES_COMMON_SEARCH",
"children": {},
"show": true
},
"searchResult": {
"uiConfig": {
"columns": [
{
"label": "Name",
"jsonPath": "user.name",
},
{
"label": "Email",
"jsonPath": "user.emailId",
},
{
"label": "Contact Number",
"jsonPath": "user.mobileNumber",
},
{
"label":"Role",
"jsonPath":"user.roles",
"additionalCustomization":true
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
],
"enableGlobalSearch": false,
"enableColumnSort": true,
"resultsJsonPath": "Employees",
"tableClassName":"table pqm-table",
"rowClassName":"table-row-mdms table-row-mdms-hover",
nipunarora-eGov marked this conversation as resolved.
Show resolved Hide resolved

},
"children": {},
"show": true
},
"links": {
"uiConfig": {
"links": [
{
"text": "Bulk Upload Users",
"url": "/employee",
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
"roles": [
"MICROPLAN_ADMIN"
]
},
{
"text": "Download User Data",
"url": "/employee",
"roles": [
"MICROPLAN_ADMIN"
]
}
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
],
"label": "USER_MANAGEMENT",
"logoIcon": {
"component": "TqmInboxIcon",
"customClass": "inbox-links-icon"
}
},
"children": {},
"show": true
},
"filter": {
"uiConfig": {
"headerLabel": "TQM_INBOX_FILTER",
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
"secondaryLabel": "ES_COMMON_CLEAR_SEARCH",
"formClassName": "filter",
"type": "filter",
"typeMobile":"sort",
"headerStyle": null,
"primaryLabel": "Filter",
"minReqFields": 0,
"defaultValues": {
"roleschosen": [],
},
"fields": [

{
"label": "ROLES",
"type": "apicheckboxes",
"isMandatory": false,
"disable": false,
"populators": {
"optionsCustomStyle": {
"top": "2.3rem"
},
"name": "roleschosen",
"optionsKey": "roleCode",
"labelKey":"i18nKey",
"allowMultiSelect": false,
"masterName": "commonUiConfig",
"moduleName": "UserManagementConfig",
"customfn": "rolesForFilter"
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
},
},
abishekTa-egov marked this conversation as resolved.
Show resolved Hide resolved
]
},
"label": "Filter",
"labelMobile": "TQM_INBOX_FILTER",
"show": true
}
},
"additionalSections": {},
"persistFormData":true,
"showAsRemovableTagsInMobile":true
}
]
}
Loading