Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abishekTa-egov committed Oct 15, 2024
1 parent f365034 commit 5ed540c
Showing 1 changed file with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Link, useHistory } from "react-router-dom";
import { Link,useLocation, useHistory,Link,useParams } from "react-router-dom";
import _ from "lodash";
import React from "react";
import { Dropdown } from "@egovernments/digit-ui-components";
Expand Down Expand Up @@ -102,29 +102,27 @@ export const UICustomizations = {

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

// Allow empty mobile number
if (!phone || phone.trim() === "") {
return false; // Return true for empty input
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; // Return true if the mobile number is valid
return false;
},


preProcess: (data, additionalDetails) => {
const { phone, name } = data?.state?.searchForm || {}
const { sortOrder } = data?.state?.filterForm || {}
let { roleschosen } = data?.state?.filterForm || []
// console.log(additionalDetails["microplanData"])
// debugger;

if (!roleschosen) {
roleschosen = {}
}
Expand All @@ -140,36 +138,31 @@ export const UICustomizations = {
if (roleschosen) {
rolesString = Object.keys(roleschosen).filter(role => roleschosen[role] === true).join(',');
}
// debugger;
console.log("data", data);
console.log("additionalDetails", additionalDetails);


data.params.names = name;

data.params.phone = phone;
// debugger;

data.params.roles = rolesString;
data.params.tenantId = Digit.ULBService.getCurrentTenantId();
cleanObject(data.params);
delete data.params.roleschosen;
delete data.params.name;
// console.log(data,"dat");
// data.param.roles=roles;

return data
},

rolesForFilter: (props) => {
const userInfo = Digit.UserService.getUser();
const tenantId = Digit.ULBService.getCurrentTenantId();
// debugger
return {
params: {},
url: '/mdms-v2/v2/_search', //mdms fetch from

body: {
MdmsCriteria: {
tenantId: "mz",
tenantId: Digit.ULBService.getCurrentTenantId(),
filters: {},
schemaCode: "hcm-microplanning.rolesForMicroplan",
limit: 10,
Expand All @@ -180,7 +173,6 @@ export const UICustomizations = {
config: {
enabled: true,
select: (data) => {
console.log("dates", data)
const roles = data?.mdms.map(item => {
return (
{
Expand All @@ -193,7 +185,7 @@ export const UICustomizations = {
}
)
})
// debugger

return roles
},
},
Expand All @@ -203,7 +195,6 @@ export const UICustomizations = {

additionalCustomizations: (row, key, column, value, t, searchResult) => {
if (key === "Role") {
debugger;
return(
<div>
{value.map((item, index) => (
Expand Down

0 comments on commit 5ed540c

Please sign in to comment.