-
Notifications
You must be signed in to change notification settings - Fork 22
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
Microplan search #1356
Merged
Merged
Microplan search #1356
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
...ui/web/micro-ui-internals/packages/modules/microplan/src/configs/MicroplanSearchConfig.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
|
||
|
||
// default values of search input component | ||
const defaultSearchValues = { | ||
microplanName: "", | ||
|
||
}; | ||
|
||
|
||
//config for tab search sceeen | ||
export const TabSearchconfig = { | ||
// moduleName: "commonCampaignUiConfig", | ||
showTab: true, // setting true will enable tab screen | ||
TabSearchconfig: [ // all tab config should be added in json array | ||
{ | ||
label: "ALL", | ||
type: "search", | ||
apiDetails: { | ||
serviceName: "/plan-service/config/_search", //! Note | ||
requestParam: {}, | ||
requestBody: {}, | ||
masterName: "commonUiConfig", | ||
moduleName: "MicroplanSearchConfig", | ||
minParametersForSearchForm: 0, | ||
tableFormJsonPath: "requestBody.PlanConfigurationSearchCriteria.pagination", | ||
// filterFormJsonPath: "requestBody.MdmsCriteria.customs", | ||
searchFormJsonPath: "requestBody.PlanConfigurationSearchCriteria", | ||
}, | ||
|
||
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: "Name of the microplan", | ||
isMandatory: false, | ||
key: "microplanName", | ||
type: "text", | ||
populators: { | ||
name: "microplanName", | ||
error: "Required", | ||
validation: { pattern: /^[A-Za-z]+$/i }, | ||
}, | ||
}, | ||
// { | ||
// label: "Phone number", | ||
// isMandatory: false, | ||
// key: "Phone number", | ||
// type: "number", | ||
// disable: false, | ||
// populators: { name: "mobileNumber", error: "sample error message", validation: { min: 0, max: 999999999 } }, | ||
// }, | ||
// { | ||
// label: "Individual Id ", | ||
// isMandatory: false, | ||
// type: "text", | ||
// disable: false, | ||
// populators: { | ||
// name: "individualId", | ||
// }, | ||
// }, | ||
], | ||
}, | ||
|
||
show: true, | ||
}, | ||
searchResult: { | ||
uiConfig: { | ||
columns: [ | ||
{ | ||
label: "Name of the Microplan", | ||
jsonPath: "name", | ||
additionalCustomization:true | ||
}, | ||
|
||
{ | ||
label: "Microplan Status", | ||
jsonPath: "status", | ||
}, | ||
{ | ||
label: "Campaign Disease", | ||
jsonPath: "CampaignDetails.campaignName", | ||
}, | ||
{ | ||
label:"Camapaign Type", | ||
jsonPath:"CampaignDetails.startDate" | ||
}, | ||
{ | ||
label:"Distribution Strategy", | ||
jsonPath:" proposalDate" | ||
}, | ||
{ | ||
label:"Actions", | ||
jsonPath:"", | ||
additionalCustomization:true | ||
} | ||
], | ||
resultsJsonPath: "PlanConfiguration", | ||
|
||
enableColumnSort: true, | ||
// resultsJsonPath: "mdms", | ||
}, | ||
show: true, | ||
}, | ||
// customHookName: "microplanv1.useSavedMicroplans", //! Note | ||
|
||
}, | ||
customHookName:"microplanv1.useSavedMicroplans" | ||
}, | ||
|
||
|
||
{label: "DRAFTED_SETUP"}, | ||
{label: "EXECUTION_TO_BE_DONE",}, | ||
{label:"EXECUTION_IN_PROGRESS"}, | ||
{label:"MICROPLAN_EXECUTED"} | ||
|
||
], | ||
}; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...i/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/MicroplanSearch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Header, InboxSearchComposer } from "@egovernments/digit-ui-react-components"; | ||
import React, { useState, useEffect } from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { TabSearchconfig } from '../../configs/MicroplanSearchConfig' | ||
|
||
|
||
|
||
const defaultSearchValues = { | ||
|
||
}; | ||
|
||
const MicroplanSearch = () => { | ||
const { t } = useTranslation(); | ||
const [defaultValues, setDefaultValues] = useState(defaultSearchValues); // State to hold default values for search fields | ||
const [config, setConfig] = useState(TabSearchconfig?.TabSearchconfig?.[0]); // initially setting first index config as default from jsonarray | ||
const [tabData, setTabData] = useState( | ||
TabSearchconfig?.TabSearchconfig?.map((configItem, index) => ({ key: index, label: configItem.label, active: index === 0 ? true : false })) | ||
); // setting number of tab component and making first index enable as default | ||
useEffect(() => { | ||
// Set default values when component mounts | ||
setDefaultValues(defaultSearchValues); | ||
}, []); | ||
|
||
const onTabChange = (n) => { | ||
|
||
setTabData((prev) => prev.map((i, c) => ({ ...i, active: c === n ? true : false }))); //setting tab enable which is being clicked | ||
// setConfig(TabSearchconfig?.TabSearchconfig?.[n]);// as per tab number filtering the config | ||
const url = new URL(window.location.href); | ||
url.searchParams.set("tabId", `${n}`); | ||
window.history.replaceState({}, "", url); | ||
|
||
}; | ||
return ( | ||
<React.Fragment> | ||
|
||
<Header styles={{ fontSize: "32px" }}>{t(config?.label)}</Header> | ||
<div className="inbox-search-wrapper"> | ||
{/* Pass defaultValues as props to InboxSearchComposer */} | ||
<InboxSearchComposer | ||
configs={config} | ||
defaultValues={defaultValues} | ||
showTab={true} | ||
tabData={tabData} | ||
onTabChange={onTabChange} //!activated ion tabChange | ||
></InboxSearchComposer> | ||
</div> | ||
</React.Fragment> | ||
); | ||
}; | ||
export default MicroplanSearch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this is required?