Skip to content

Commit

Permalink
Filtered road type on the basis of isActive in WS
Browse files Browse the repository at this point in the history
  • Loading branch information
deepa-s-13 committed Apr 8, 2024
1 parent 51492ac commit 21165d5
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CardLabel, Dropdown, LabelFieldPair, LinkButton, TextInput, CardLabelError, DeleteIcon } from "@upyog/digit-ui-react-components";
import _ from "lodash";
import _, { filter } from "lodash";
import React, { useState, useEffect, useMemo } from "react";
import { useForm, Controller } from "react-hook-form";
import { stringReplaceAll } from "../utils";
Expand Down Expand Up @@ -95,9 +95,10 @@ const RoadCuttForm = (_props) => {

const roadCuttingTypeMenu = useMemo(() => {
const RoadTypes = mdmsData?.["sw-services-calculation"]?.RoadType || [];
RoadTypes?.forEach(data => data.i18nKey = `WS_ROADTYPE_${stringReplaceAll(data?.code?.toUpperCase(), " ", "_")}`);
return RoadTypes;
}, [mdmsData]);
const filteredRoadTypes = RoadTypes.filter(data => data?.isActive === true); // Filter out road types with isActive: true
filteredRoadTypes.forEach(data => data.i18nKey = `WS_ROADTYPE_${stringReplaceAll(data?.code?.toUpperCase(), " ", "_")}`);
return filteredRoadTypes;
}, [mdmsData]);

useEffect(() => {
trigger();
Expand Down

0 comments on commit 21165d5

Please sign in to comment.