diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js
index 76eef2b1fc1..3d0186efdfe 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/Module.js
@@ -7,6 +7,8 @@ import ViewEstimateComponent from "./components/ViewEstimateComponent";
import { overrideHooks, updateCustomConfigs } from "./utils";
import AdditionalComponentWrapper from "./components/AdditionalComponent";
import SampleMultiComponent from "./components/SampleMultiComponent";
+import EstimateDetailsComponent from "./components/EstimateDetailsComponent";
+import AddressDetailsComponent from "./components/AddressDetailsComponent";
export const SampleModule = ({ stateCode, userType, tenants }) => {
const { path, url } = useRouteMatch();
@@ -31,6 +33,8 @@ const componentsToRegister = {
ViewEstimatePage: ViewEstimateComponent,
SampleAdditionalComponent: AdditionalComponentWrapper,
SampleMultiComponent: SampleMultiComponent,
+ EstimateDetailsComponent: EstimateDetailsComponent,
+ AddressDetailsComponent: AddressDetailsComponent,
};
export const initSampleComponents = () => {
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AddressDetailsComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AddressDetailsComponent.js
new file mode 100644
index 00000000000..2f591a15e8c
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/AddressDetailsComponent.js
@@ -0,0 +1,116 @@
+import { AddNewIcon } from "@egovernments/digit-ui-components";
+import { AddIcon, Button, Dropdown, DustbinIcon, LabelFieldPair, TextInput } from "@egovernments/digit-ui-react-components";
+import React, { Fragment, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+// import {} from "./";
+
+const AddressDetailsComponent = ({ onSelect, ...props }) => {
+ const { t } = useTranslation();
+
+ // const [documentData, setDocumentData] = useState({});
+
+ const [options, setOptions] = useState([true, false]);
+
+ const [addressData, setAddressData] = useState([
+ {
+ tenantid: "12",
+ longitude: 21,
+ latitude: 21,
+ city: "city",
+ },
+ ]);
+
+ // when doc update calling onselect for update the value in formdata
+ useEffect(() => {
+ onSelect("address", addressData);
+ }, [addressData]);
+
+ // fn to update the value based on key.
+ const handleUpdateField = ({ key, value, item, index }) => {
+ setAddressData((prev) => {
+ return prev.map((i, n) => {
+ if (n === index) {
+ return {
+ ...i,
+ [key]: value,
+ };
+ }
+ return i;
+ });
+ });
+ };
+
+ return (
+ <>
+ {addressData?.map((item, index) => (
+
+ {/* // tenantId*/}
+
+
+ {`${t("Tenant Id")}`}
+
+ {
+ handleUpdateField({ key: "tenantid", value: event.target.value, item: item, index: index });
+ console.log(event);
+ console.log(item);
+ console.log(index);
+ }}
+ />
+
+
+ {/* Longitude */}
+
+
+ {`${t("Longitude")}`}
+
+ handleUpdateField({ key: "longitude", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Latitude */}
+
+
+ {`${t("Latitude")}`}
+
+ handleUpdateField({ key: "latitude", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* City */}
+
+
+ {`${t("City ")}`}
+
+ handleUpdateField({ key: "city", value: event.target.value, item: item, index: index })}
+ />
+
+
+ ))}
+ >
+ );
+};
+
+export default AddressDetailsComponent;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/EstimateDetailsComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/EstimateDetailsComponent.js
new file mode 100644
index 00000000000..fc33ecb8227
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/EstimateDetailsComponent.js
@@ -0,0 +1,223 @@
+import { AddNewIcon } from "@egovernments/digit-ui-components";
+import { AddIcon, Button, Dropdown, DustbinIcon, LabelFieldPair, TextInput } from "@egovernments/digit-ui-react-components";
+import React, { Fragment, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+// import {} from "./";
+
+const EstimateDetailsComponent = ({ onSelect, ...props }) => {
+ const { t } = useTranslation();
+
+ // const [documentData, setDocumentData] = useState({});
+
+ const [options, setOptions] = useState([true, false]);
+
+ const [documentData, setDocumentData] = useState([
+ {
+ sorId: "21",
+ category: "category",
+ name: "name",
+ description: "desc",
+ unitRate: 12,
+ noOfunit: 21,
+ uom: "uom",
+ length: 2,
+ width: 3,
+ amountDetail: [
+ {
+ type: "EstimatedAmount",
+ amount: 111386,
+ isActive: true,
+ },
+ ],
+ isActive: true,
+ },
+ ]);
+
+ // when doc update calling onselect for update the value in formdata
+ useEffect(() => {
+ onSelect("estimateDetails", documentData);
+ }, [documentData]);
+
+ // fn to update the value based on type.
+ const handleUpdateField = ({ key, value, item, index }) => {
+ setDocumentData((prev) => {
+ return prev.map((i, n) => {
+ if (n === index) {
+ return {
+ ...i,
+ [key]: value,
+ };
+ }
+ return i;
+ });
+ });
+ };
+
+ return (
+ <>
+ {documentData?.map((item, index) => (
+
+ {/* // Sor Id */}
+
+
+ {`${t("SOR Id")}`}
+
+ {
+ handleUpdateField({ key: "sorId", value: event.target.value, item: item, index: index });
+ console.log(event);
+ console.log(item);
+ console.log(index);
+ }}
+ />
+
+
+ {/* category */}
+
+
+ {`${t("Category")}`}
+
+ handleUpdateField({ key: "category", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Name */}
+
+
+ {`${t("Name")}`}
+
+ handleUpdateField({ key: "name", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Description */}
+
+
+ {`${t("Description ")}`}
+
+ handleUpdateField({ key: "description", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Unit Rate */}
+
+
+ {`${t("Unit Rate")}`}
+
+ handleUpdateField({ key: "unitRate", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* No of Unit */}
+
+
+ {`${t("No of Unit")}`}
+
+ handleUpdateField({ key: "noOfunit", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* UOM */}
+
+
+ {`${t("UOM")}`}
+
+ handleUpdateField({ key: "uom", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Length */}
+
+
+ {`${t("Length")}`}
+
+ handleUpdateField({ key: "length", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* Width */}
+
+
+ {`${t("Width")}`}
+
+ handleUpdateField({ key: "width", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/* isActive */}
+
+
+ {`${t("isActive")}`}
+
+ handleUpdateField({ key: "isActive", value: event.target.value, item: item, index: index })}
+ />
+
+
+ {/*
+
+ {`${t("isActive")}`}
+
+ i.code === item?.type)}
+ select={(value) => {
+ handleUpdateField({ value: value, item: item, index: index });
+ }}
+ />
+ */}
+
+ ))}
+ >
+ );
+};
+
+export default EstimateDetailsComponent;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/SampleCard.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/SampleCard.js
index 6ccf6fe0a98..40cbf1a4d75 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/SampleCard.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/SampleCard.js
@@ -3,42 +3,32 @@ import React from "react";
import { useTranslation } from "react-i18next";
const SampleCard = () => {
-
const { t } = useTranslation();
const propsForModuleCard = {
Icon: ,
moduleName: t("Sample"),
- kpis: [
-
- ],
+ kpis: [],
links: [
-
-
{
label: t("Individual Search"),
link: `/${window?.contextPath}/employee/sample/search-individual`,
-
},
{
label: t("Individual Create"),
link: `/${window?.contextPath}/employee/sample/create-individual`,
-
},
{
label: t("Sample Create"),
link: `/${window?.contextPath}/employee/sample/sample-create`,
-
},
{
label: t("Sample Search"),
link: `/${window?.contextPath}/employee/sample/sample-search`,
-
},
{
label: t("Sample View"),
link: `/${window?.contextPath}/employee/sample/sample-view??tenantId=pg.citya&estimateNumber=ES/2023-24/002390&projectNumber=PJ/2023-24/02/002830`,
-
},
{
label: t("Sample Components"),
@@ -52,11 +42,18 @@ const SampleCard = () => {
label: t("Individual View Details"),
link: `/${window?.contextPath}/employee/sample/individual-details-view`,
},
-
+ {
+ label: t("Create Estimate"),
+ link: `/${window?.contextPath}/employee/sample/estimate/create`,
+ },
+ {
+ label: t("Search Estimate"),
+ link: `/${window?.contextPath}/employee/sample/estimate/search`,
+ },
],
};
return ;
};
-export default SampleCard;
\ No newline at end of file
+export default SampleCard;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/ViewEstimateComponent.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/ViewEstimateComponent.js
index 11be9221b13..9f4251b85c7 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/ViewEstimateComponent.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/components/ViewEstimateComponent.js
@@ -1,69 +1,71 @@
-import React, { Fragment, useState, useEffect, useRef, } from 'react'
-import { Loader, WorkflowActions, WorkflowTimeline, Toast } from '@egovernments/digit-ui-react-components';
+import React, { Fragment, useState, useEffect, useRef } from "react";
+import { Loader, WorkflowActions, WorkflowTimeline, Toast } from "@egovernments/digit-ui-react-components";
import { useTranslation } from "react-i18next";
-import ApplicationDetails from '../../../templates/ApplicationDetails';
+import ApplicationDetails from "../../../templates/ApplicationDetails";
-const ViewEstimateComponent = ({editApplicationNumber,...props}) => {
- const [toast, setToast] = useState({show : false, label : "", error : false});
- const menuRef = useRef();
- const [isStateChanged, setStateChanged] = useState(``)
-
- const { t } = useTranslation()
+const ViewEstimateComponent = ({ editApplicationNumber, ...props }) => {
+ const [toast, setToast] = useState({ show: false, label: "", error: false });
+ const menuRef = useRef();
+ const [isStateChanged, setStateChanged] = useState(``);
- const { tenantId, estimateNumber } = Digit.Hooks.useQueryParams();
- console.log("tenantId",tenantId);
- console.log("estimateNumber",estimateNumber);
- const businessService = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate");
+ const { t } = useTranslation();
- const { isLoading, data: applicationDetails, isError } = Digit.Hooks.estimates.useEstimateDetailsScreen(t, tenantId, estimateNumber,{}, isStateChanged)
-
- useEffect(()=>{
- if(isError || (!isLoading && applicationDetails?.isNoDataFound)) {
- setToast({show : true, label : t("COMMON_ESTIMATE_NOT_FOUND"), error : true});
- }
- },[isLoading, isError, applicationDetails]);
+ const { tenantId, estimateNumber } = Digit.Hooks.useQueryParams();
+ console.log("tenantId", tenantId);
+ console.log("estimateNumber", estimateNumber);
+ const businessService = Digit?.Customizations?.["commonUiConfig"]?.getBusinessService("estimate");
-
+ const { isLoading, data: applicationDetails, isError } = Digit.Hooks.estimates.useEstimateDetailsScreen(
+ t,
+ tenantId,
+ estimateNumber,
+ {},
+ isStateChanged
+ );
- const handleToastClose = () => {
- setToast({show : false, label : "", error : false});
+ useEffect(() => {
+ if (isError || (!isLoading && applicationDetails?.isNoDataFound)) {
+ setToast({ show: true, label: t("COMMON_ESTIMATE_NOT_FOUND"), error: true });
}
- if (isLoading) return
- return (
+ }, [isLoading, isError, applicationDetails]);
+
+ const handleToastClose = () => {
+ setToast({ show: false, label: "", error: false });
+ };
+ if (isLoading) return ;
+ return (
+ <>
+ {!applicationDetails?.isNoDataFound && !isError && (
<>
- {
- (!applicationDetails?.isNoDataFound) && !isError &&
- <>
-
-
- >
-
- }
- {toast?.show && }
+
+
>
- )
-}
+ )}
+ {toast?.show && }
+ >
+ );
+};
-export default ViewEstimateComponent;
\ No newline at end of file
+export default ViewEstimateComponent;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/EstimateConfig.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/EstimateConfig.js
new file mode 100644
index 00000000000..c55830f72e7
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/EstimateConfig.js
@@ -0,0 +1,198 @@
+import { EstimateDetailsComponent } from "../components/EstimateDetailsComponent";
+
+export const estimateConfig = [
+ {
+ head: "Create Estimate",
+ body: [
+ {
+ inline: true,
+ label: "Proposal date",
+ isMandatory: false,
+ key: "proposalDate",
+ // type: "date",
+ type: "number",
+ disable: false,
+ populators: { name: "proposalDate", error: "Required" },
+ },
+ {
+ inline: true,
+ label: "Status",
+ isMandatory: false,
+ key: "status",
+ type: "dropdown",
+ disable: false,
+ populators: {
+ name: "status",
+ error: "Required",
+ optionsKey: "name", // without this it was not populating options
+ required: "true",
+ options: [
+ {
+ name: "In status",
+ label: "Status",
+ },
+ {
+ name: "Completed",
+ label: "Status", //Doubt
+ },
+ ],
+ },
+ },
+ {
+ isMandatory: true,
+ key: "wfStatus",
+ type: "dropdown",
+ label: "Enter Workflow Status",
+ disable: false,
+ populators: {
+ name: "wfStatus",
+ error: "Required",
+ optionsKey: "name", // without this it was not populating options
+ required: "true",
+ options: [
+ {
+ name: "APPLIED",
+ // label: "Wf-Status",
+ },
+ {
+ name: "PENDING",
+ // label: "Wf-Status", //Doubt
+ },
+ {
+ name: "APPROVED",
+ // label: "Wf-Status", //Doubt
+ },
+ ],
+ },
+ },
+
+ {
+ inline: true,
+ label: "Name",
+ isMandatory: false,
+ key: "name",
+ type: "text",
+ disable: false,
+ populators: { name: "name", error: "Required" },
+ },
+
+ {
+ inline: true,
+ label: "Description",
+ isMandatory: false,
+ key: "description",
+ type: "text",
+ disable: false,
+ populators: { name: "description", error: "Required" },
+ },
+
+ {
+ inline: true,
+ label: "Executing Department",
+ isMandatory: false,
+ key: "executingDepartment",
+ type: "dropdown",
+ disable: false,
+ populators: {
+ name: "executingDepartment",
+ error: "Required",
+ optionsKey: "name", // without this it was not populating options
+ required: "true",
+ options: [
+ {
+ name: "Department1",
+ // label: "Executing Department",
+ },
+ {
+ name: "Department2",
+ // label: "Executing Department", //Doubt
+ },
+ ],
+ },
+ },
+ ],
+ },
+ // {
+ // head: "Address",
+ // key: "address",
+ // body: [
+ // {
+ // inline: true,
+ // label: "Tenant Id",
+ // isMandatory: true,
+ // key: "tenantid",
+ // type: "number",
+ // disable: false,
+ // populators: { name: "tenantid", error: "Required " },
+ // },
+ // {
+ // inline: true,
+ // label: "Longitude",
+ // isMandatory: true,
+ // key: "longitude",
+ // type: "number",
+ // disable: false,
+ // populators: { name: "longitude", error: "Required ", validation: { min: -180, max: 180 } },
+ // },
+ // {
+ // inline: true,
+ // label: "Latitude",
+ // isMandatory: true,
+ // key: "latitude",
+ // type: "number",
+ // disable: false,
+ // populators: { name: "latitude", error: "Required ", validation: { min: -90, max: 90 } },
+ // },
+
+ // {
+ // inline: true,
+ // label: "City",
+ // isMandatory: true,
+ // key: "city",
+ // type: "text",
+ // disable: false,
+ // populators: { name: "city", error: " Required ", validation: { pattern: /^[A-Za-z]+$/i } },
+ // },
+ // ],
+ // },
+
+ {
+ head: "Address Details",
+ key: "address",
+ body: [
+ {
+ isMandatory: false,
+ key: "address",
+ type: "component", // for custom component
+ component: "AddressDetailsComponent", // name of the component as per component registry
+ withoutLabel: true,
+ disable: false,
+ customProps: {},
+ populators: {
+ name: "addressDetails",
+ required: true,
+ },
+ },
+ ],
+ },
+
+ {
+ head: "Estimate Details",
+ key: "estimateDetails",
+ body: [
+ {
+ isMandatory: false,
+ key: "estimateDetails",
+ type: "component", // for custom component
+ component: "EstimateDetailsComponent", // name of the component as per component registry
+ withoutLabel: true,
+ disable: false,
+ customProps: {},
+ populators: {
+ name: "estimateDetails",
+ required: true,
+ },
+ },
+ ],
+ },
+];
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/IndividualSearchCOnfig.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/IndividualSearchCOnfig.js
index 536cd48b1b6..63e9cbd38d6 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/IndividualSearchCOnfig.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/IndividualSearchCOnfig.js
@@ -1,25 +1,24 @@
const defaultSearchValues = {
- individualName: "",
- mobileNumber: "",
- IndividualID: ""
- };
-export const searchconfig = () =>
-{
+ individualName: "",
+ mobileNumber: "",
+ IndividualID: "",
+};
+export const searchconfig = () => {
return {
label: "Individual Search",
type: "search",
apiDetails: {
serviceName: "/individual/v1/_search",
requestParam: {
- "tenantId":Digit.ULBService.getCurrentTenantId()
+ tenantId: Digit.ULBService.getCurrentTenantId(),
},
requestBody: {
apiOperation: "SEARCH",
Individual: {
- "tenantId": Digit.ULBService.getCurrentTenantId(),
+ tenantId: Digit.ULBService.getCurrentTenantId(),
},
},
- masterName: "commonUiConfig",
+ masterName: "commonUiConfig",
moduleName: "SearchIndividualConfig",
minParametersForSearchForm: 0,
tableFormJsonPath: "requestParam",
@@ -40,10 +39,10 @@ export const searchconfig = () =>
isMandatory: false,
key: "individualName",
type: "text",
- populators: {
- name: "individualName",
- error: "Required",
- validation: { pattern: /^[A-Za-z]+$/i }
+ populators: {
+ name: "individualName",
+ error: "Required",
+ validation: { pattern: /^[A-Za-z]+$/i },
},
},
{
@@ -52,21 +51,21 @@ export const searchconfig = () =>
key: "Phone number",
type: "number",
disable: false,
- populators: { name: "mobileNumber", error: "sample error message", validation: { min: 0, max: 999999999} },
+ populators: { name: "mobileNumber", error: "sample error message", validation: { min: 0, max: 999999999 } },
},
{
label: "Individual Id ",
isMandatory: false,
type: "text",
disable: false,
- populators: {
+ populators: {
name: "individualId",
},
},
],
},
- show: true
+ show: true,
},
searchResult: {
tenantId: Digit.ULBService.getCurrentTenantId(),
@@ -76,11 +75,10 @@ export const searchconfig = () =>
label: "IndividualID",
jsonPath: "individualId",
},
-
+
{
label: "Name",
jsonPath: "name.givenName",
-
},
{
label: "Address",
@@ -89,10 +87,10 @@ export const searchconfig = () =>
],
enableColumnSort: true,
- resultsJsonPath: "Individual"
+ resultsJsonPath: "Individual",
},
show: true,
},
},
};
-};
\ No newline at end of file
+};
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/SearchEstimateConfig.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/SearchEstimateConfig.js
new file mode 100644
index 00000000000..9268ba31f68
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/SearchEstimateConfig.js
@@ -0,0 +1,107 @@
+const defaultSearchValues = {
+ options: [],
+ value: "",
+};
+
+const SearchEstimateConfig = () => {
+ return {
+ label: "Estimate Search",
+ type: "search",
+ apiDetails: {
+ serviceName: "/mdms-v2/v2/_search",
+ requestBody: {
+ apiOperation: "SEARCH",
+ MdmsCriteria: {
+ tenantId: Digit.ULBService.getCurrentTenantId(),
+ customs: {},
+ // tenantId: "pg",
+ },
+ },
+ masterName: "commonUiConfig",
+ moduleName: "SearchEstimateConfig",
+ minParametersForSearchForm: 0,
+ tableFormJsonPath: "requestParam",
+ searchFormJsonPath: "requestBody.MdmsCriteria.customs",
+ filterFormJsonPath: "requestBody.MdmsCriteria.customs",
+ },
+ sections: {
+ search: {
+ uiConfig: {
+ formClassName: "custom-both-clear-search",
+ primaryLabel: "ES_COMMON_SEARCH",
+ secondaryLabel: "ES_COMMON_CLEAR_SEARCH",
+ minReqFields: 0,
+ defaultValues: defaultSearchValues, // Set default values for search fields
+ fields: [
+ {
+ label: "Options",
+ isMandatory: false,
+ key: "options",
+ type: "dropdown",
+ populators: {
+ name: "options",
+ error: "Required",
+ optionsKey: "label",
+ // options: requestBody.MdmsCriteria,
+ options: [
+ {
+ label: "Name",
+ // type: "text",
+ name: "name",
+ },
+ {
+ label: "Description",
+ name: "description",
+ },
+
+ {
+ label: "Executing Department",
+ name: "executingDepartment",
+ },
+ ],
+ validation: { pattern: /^[A-Za-z]+$/i },
+ },
+ },
+ {
+ label: "Value",
+ isMandatory: false,
+ key: "value",
+ type: "text",
+ disable: false,
+ populators: { name: "value", error: "sample error message" },
+ },
+ ],
+ },
+
+ show: true,
+ },
+ searchResult: {
+ tenantId: Digit.ULBService.getCurrentTenantId(),
+ // tenantId: "pb",
+ uiConfig: {
+ columns: [
+ {
+ label: "Name",
+ jsonPath: "data.name",
+ },
+
+ {
+ label: "Description",
+ jsonPath: "data.description",
+ },
+ {
+ label: "Executing Department",
+ jsonPath: "data.executingDepartment",
+ },
+ ],
+
+ enableColumnSort: true,
+ resultsJsonPath: "mdms",
+ },
+ show: true,
+ },
+ },
+ };
+};
+
+export default SearchEstimateConfig;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/UICustomizations.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/UICustomizations.js
index 6244ac3a1d5..1c1bc4e5909 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/UICustomizations.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/UICustomizations.js
@@ -11,4 +11,35 @@ const businessServiceMap = {};
const inboxModuleNameMap = {};
-export const UICustomizations = {};
\ No newline at end of file
+export const UICustomizations = {
+ SearchEstimateConfig: {
+ preProcess: (data, additionalDetails) => {
+ // debugger;
+ console.log("preProcessing Data", data);
+ // console.log(data);
+ const filters = {};
+
+ // debugger;
+
+ if (data.body.MdmsCriteria && data.body.MdmsCriteria.customs != null && data.body.MdmsCriteria.customs.options != null) {
+ const key = data.body.MdmsCriteria.customs.options.name;
+ // console.log(key);
+ if (data.body.MdmsCriteria.customs.options.type == "number") {
+ filters[key] = parseInt(data.body.MdmsCriteria.customs.value);
+ } else filters[key] = data.body.MdmsCriteria.customs.value;
+
+ data.body.MdmsCriteria.filters = filters;
+ // debugger;
+ delete data.body.MdmsCriteria.customs;
+ console.log(data);
+ }
+ return data;
+ },
+ additionalCustomizations: (row, key) => {
+ // debugger;
+ if (key === "id") {
+ return IDDD
;
+ }
+ },
+ },
+};
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/ViewEstimate.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/ViewEstimate.js
new file mode 100644
index 00000000000..97682b3c174
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/configs/ViewEstimate.js
@@ -0,0 +1,53 @@
+import React, { Fragment, useState, useEffect } from "react";
+import { ViewComposer, Header, Loader } from "@egovernments/digit-ui-react-components";
+import { useTranslation } from "react-i18next";
+import { useLocation } from "react-router-dom";
+import { useEstimateView } from "../hooks/useEstimateView";
+
+function ViewEstimate() {
+ const { t } = useTranslation();
+ const location = useLocation();
+ const tenantId = Digit.ULBService.getCurrentTenantId();
+ const searchParams = new URLSearchParams(location.search);
+ const [estimateIdentifier, setEstimateIdentifier] = useState(null); // Define individualId state
+
+ useEffect(() => {
+ const name = searchParams.get("name");
+ console.log("name", name);
+ setEstimateIdentifier(name); // Set estimateId state with the value from URL
+ }, [searchParams]);
+
+ const { isLoading, data, revalidate, isFetching } = useEstimateView({
+ t,
+ tenantId: tenantId,
+ estimateIdentifier: searchParams.get("name"), // Use estimateId here
+ config: {
+ select: (data) => ({
+ cards: [
+ {
+ sections: [
+ {
+ type: "DATA",
+ values: data?.details,
+ },
+ ],
+ },
+ ],
+ }),
+ },
+ });
+ console.log("testData", data);
+
+ // if (isLoading) {
+ // return ;
+ // }
+
+ return (
+ <>
+
+ {!isLoading && estimateIdentifier && }
+ >
+ );
+}
+
+export default ViewEstimate;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchEstimateResultData.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchEstimateResultData.js
new file mode 100644
index 00000000000..c07733cabf1
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchEstimateResultData.js
@@ -0,0 +1,64 @@
+export const searchEstimateResultData = async ({ t, estimateIdentifier, tenantId }) => {
+ const response = await Digit.CustomService.getResponse({
+ url: "/mdms-v2/v2/_search",
+ body: {
+ MdmsCriteria: {
+ tenantId: "mz",
+ filters: {
+ name: estimateIdentifier,
+ },
+ },
+ // apiOperation: "SEARCH",
+ // auth: "dfcca143-b5a6-4726-b5cd-c2c949cb0f2b",
+ },
+ method: "SEARCH",
+ });
+
+ // debugger;
+ console.log("response", response);
+ return {
+ details: [
+ // {
+ // sections: [
+ // {
+ // type: "DATA",
+ // values: [
+ {
+ key: "Name",
+ value: response?.mdms[0]?.data?.name || "NA",
+ },
+ {
+ key: "Status",
+ value: response?.mdms[0]?.data?.status || "NA",
+ },
+ {
+ key: "Workflow Status",
+ value: response?.mdms[0]?.data?.wfStatus || "NA",
+ },
+ {
+ key: "City",
+ value: response?.mdms[0]?.data?.address?.city || "NA",
+ },
+ {
+ key: "Description",
+ value: response?.mdms[0]?.data?.description || "NA",
+ },
+ {
+ key: "Estimate Name",
+ value: response?.mdms[0]?.data?.estimateDetails[0]?.name || "NA",
+ },
+ {
+ key: "Number of Unit",
+ value: response?.mdms[0]?.data?.estimateDetails[0]?.noOfunit || "NA",
+ },
+ {
+ key: "Unit rate",
+ value: response?.mdms[0]?.data?.estimateDetails[0]?.unitRate || "NA",
+ },
+ ],
+ };
+ // ],
+ // },
+ // ],
+ // };
+};
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchTestResultData.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchTestResultData.js
index 7e557d4f1ca..3453d5c44c9 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchTestResultData.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/services/searchTestResultData.js
@@ -1,48 +1,43 @@
export const searchTestResultData = async ({ t, individualId, tenantId }) => {
-
const response = await Digit.CustomService.getResponse({
url: "/individual/v1/_search",
-
+
params: {
tenantId: "pg.citya",
offset: 0,
limit: 10,
-
},
body: {
- Individual: {
- "tenantId": "pg.citya",
- "individualId": individualId,
- },
+ Individual: {
+ tenantId: "pg.citya",
+ individualId: individualId,
},
-
+ },
});
console.log("response", response);
-
-
return {
details: [
- // {
- // sections: [
- // {
- // type: "DATA",
- // values: [
- {
- key: "Applicant name",
- value: response?.Individual?.[0]?.name?.givenName || "NA",
- },
- {
- key: "Applicant Id",
- value: response?.Individual?.[0]?.identifiers?.[0].individualId || "NA",
- },
- // {
- // key : "Adress",
- // value : response?.Individual?.[0]
- // }
- ],
- }
-// ],
-// },
-// ],
-// };
- }
+ // {
+ // sections: [
+ // {
+ // type: "DATA",
+ // values: [
+ {
+ key: "Applicant name",
+ value: response?.Individual?.[0]?.name?.givenName || "NA",
+ },
+ {
+ key: "Applicant Id",
+ value: response?.Individual?.[0]?.identifiers?.[0].individualId || "NA",
+ },
+ // {
+ // key : "Adress",
+ // value : response?.Individual?.[0]
+ // }
+ ],
+ };
+ // ],
+ // },
+ // ],
+ // };
+};
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/useEstimateView.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/useEstimateView.js
new file mode 100644
index 00000000000..9997b7ae16b
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/hooks/useEstimateView.js
@@ -0,0 +1,10 @@
+import { useQuery } from "react-query";
+import { sampleService } from "./services/sampleService";
+import { searchEstimateResultData } from "./services/searchEstimateResultData";
+
+export const useEstimateView = ({ t, estimateIdentifier, tenantId, config }) => {
+ //console.log(props);
+ console.log(estimateIdentifier, "estimateIdentifier");
+ // debugger;
+ return useQuery(["Estimate Details", estimateIdentifier], () => searchEstimateResultData({ t, estimateIdentifier, tenantId }), config);
+};
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/CreateEstimate.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/CreateEstimate.js
new file mode 100644
index 00000000000..4d553787369
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/CreateEstimate.js
@@ -0,0 +1,56 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { useHistory } from "react-router-dom";
+import { FormComposerV2, Header } from "@egovernments/digit-ui-react-components";
+import { estimateConfig } from "../../configs/EstimateConfig";
+import { transformCreateData } from "../../utils/createUtils";
+import { transformEstimateData } from "../../utils/transformEstimateData";
+
+const CreateEstimate = () => {
+ const tenantId = Digit.ULBService.getCurrentTenantId();
+ const { t } = useTranslation();
+ const history = useHistory();
+ const reqCreate = {
+ url: `/mdms-v2/v2/_create/digitAssignment.estimate`,
+ params: {},
+ body: {},
+ config: {
+ enable: false,
+ },
+ };
+
+ const mutation = Digit.Hooks.useCustomAPIMutationHook(reqCreate);
+
+ const onSubmit = async (data) => {
+ console.log(data, "data");
+ console.log("transformed", transformEstimateData(data));
+ await mutation.mutate({
+ url: `/mdms-v2/v2/_create/digitAssignment.estimate`,
+ body: transformEstimateData(data),
+ config: {
+ enable: true,
+ },
+ });
+ };
+ return (
+
+
+ {
+ return {
+ ...config,
+ };
+ })}
+ defaultValues={{}}
+ onFormValueChange={(setValue, formData, formState, reset, setError, clearErrors, trigger, getValues) => {
+ console.log(formData, "formData");
+ }}
+ onSubmit={(data) => onSubmit(data)}
+ fieldStyle={{ marginRight: 0 }}
+ />
+
+ );
+};
+
+export default CreateEstimate;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/SearchEstimate.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/SearchEstimate.js
new file mode 100644
index 00000000000..50b763b9185
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/SearchEstimate.js
@@ -0,0 +1,52 @@
+import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components";
+import React, { useState, useEffect } from "react";
+import { useTranslation } from "react-i18next";
+import SearchEstimateConfig from "../../configs/SearchEstimateConfig";
+
+import { useHistory } from "react-router-dom/cjs/react-router-dom.min";
+import reactRouterDom from "react-router-dom";
+
+const defaultSearchValues = {
+ id: "",
+ tenantId: "",
+ schemaCode: "",
+};
+
+const SearchEstimate = () => {
+ const history = useHistory();
+
+ const onClickRow = (row) => {
+ console.log(row);
+ const data = row.original.data;
+ console.log(data, "data");
+ history.push(`view?name=${data.name}`);
+ };
+
+ const { t } = useTranslation();
+ const [defaultValues, setDefaultValues] = useState(defaultSearchValues); // State to hold default values for search fields
+ const indConfigs = SearchEstimateConfig();
+
+ useEffect(() => {
+ // Set default values when component mounts
+ setDefaultValues(defaultSearchValues);
+ }, []);
+
+ return (
+
+
+
+ {/* Pass defaultValues as props to InboxSearchComposer */}
+
+
+
+ );
+};
+export default SearchEstimate;
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/index.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/index.js
index e5b582ae642..69acd4e19af 100644
--- a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/index.js
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/pages/employee/index.js
@@ -15,6 +15,9 @@ import SampleComponents from "./SampleComponents";
import PanelCardResponse from "./PanelCardResponse";
import TabIndividualSearch from "./TabIndividualSearch";
import IndividualViewDetails from "./IndividualViewDetails";
+import CreateEstimate from "./CreateEstimate";
+import SearchEstimate from "./SearchEstimate";
+import ViewEstimate from "../../configs/ViewEstimate";
const ProjectBreadCrumb = ({ location }) => {
const { t } = useTranslation();
@@ -53,6 +56,9 @@ const App = ({ path, stateCode, userType, tenants }) => {
} />
} />
} />
+ } />
+ } />
+ } />
);
diff --git a/micro-ui/web/micro-ui-internals/packages/modules/sample/src/utils/transformEstimateData.js b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/utils/transformEstimateData.js
new file mode 100644
index 00000000000..dc3dcedac4a
--- /dev/null
+++ b/micro-ui/web/micro-ui-internals/packages/modules/sample/src/utils/transformEstimateData.js
@@ -0,0 +1,115 @@
+// /* Inbox Search Composer*/
+
+// export const transformEstimateData = (data) => {
+// return {
+// Mdms: {
+// tenantId: "mz",
+// schemaCode: "digitAssignment.estimate",
+// uniqueIdentifier: null,
+// data: {
+// proposalDate: 21,
+// status: data.status.name,
+// wfStatus: data.wfStatus.name,
+// name: data.name,
+// description: data.description,
+// executingDepartment: data.executingDepartment.name,
+// address: data.address[0],
+// estimateDetails: data.estimateDetails,
+// // estimateDetails: null,
+// },
+// isActive: true,
+// },
+// RequestInfo: {
+// apiId: "asset-services",
+// ver: null,
+// ts: null,
+// action: null,
+// did: null,
+// key: null,
+// msgId: "search with from and to values",
+// authToken: "68d5e60e-abad-4d7e-aacb-f6d8f9237a20",
+// correlationId: null,
+// userInfo: {
+// id: "1",
+// userName: null,
+// name: null,
+// type: null,
+// mobileNumber: null,
+// emailId: null,
+// roles: null,
+// uuid: "db842ca9-25c5-4419-a72f-459443d38feb",
+// },
+// },
+// };
+// };
+
+/* Inbox Search Composer*/
+
+export const transformEstimateData = (data) => {
+ return {
+ Mdms: {
+ tenantId: "mz",
+ schemaCode: "digitAssignment.estimate",
+ uniqueIdentifier: null,
+ data: {
+ proposalDate: 1721215066793,
+ status: "INWORKFLOW",
+ wfStatus: "PENDINGFORVERIFICATION",
+ name: "tsk3",
+ description: "testing",
+ executingDepartment: "WRK",
+ address: {
+ tenantId: "od.testing",
+ latitude: 20.5,
+ longitude: 35.2,
+ city: "od.testing",
+ },
+ estimateDetails: [
+ {
+ sorId: "SOR_000364",
+ category: "SOR",
+ name:
+ "Honey Comb brick masonry using 25cm x 12cm x 8cm KB brick having crushing strength not less than 75 Kg / cm2 in cement mortar (1:4) and plastered with 16mm thick CM(1:6) including white washing two coats etc. complete.",
+ description: "asd",
+ unitRate: 1113.86,
+ noOfunit: 100,
+ uom: "SQM",
+ length: 10,
+ width: 10,
+ amountDetail: [
+ {
+ type: "EstimatedAmount",
+ amount: 111386,
+ isActive: true,
+ },
+ ],
+ isActive: true,
+ },
+ ],
+ // estimateDetails: null,
+ },
+ isActive: true,
+ },
+ RequestInfo: {
+ apiId: "asset-services",
+ ver: null,
+ ts: null,
+ action: null,
+ did: null,
+ key: null,
+ msgId: "search with from and to values",
+ authToken: "68d5e60e-abad-4d7e-aacb-f6d8f9237a20",
+ correlationId: null,
+ userInfo: {
+ id: "1",
+ userName: null,
+ name: null,
+ type: null,
+ mobileNumber: null,
+ emailId: null,
+ roles: null,
+ uuid: "db842ca9-25c5-4419-a72f-459443d38feb",
+ },
+ },
+ };
+};