After adding all required Dependency . and config we will add the create code for Birth-Registration module code.
Create Form UI:-
First, we will create a form where users can enter all required information and submit the form.
for that, we need to create an index.js into web->micor-ui->internals ->packages->module->br->src->pages->citizen->create(you can give any name instead of create)->index.js
In Index.js will import the Formcomposer that is already present. inside that, we will add Heading, label, and config.
Code Block |
---|
import { FormComposer } from "@egovernments/digit-ui-react-components"; import React from "react"; import { useTranslation } from "react-i18next"; import { newConfig } from "../../../components/config/config"; const Create = () => { const { t } = useTranslation(); const configs = newConfig?newConfig:newConfig; return ( <FormComposer heading={t("Create Birth Registration")} label={t("ES_COMMON_APPLICATION_SUBMIT")} config={configs.map((config) => { return { ...config, body: config.body.filter((a) => !a.hideInEmployee), }; })} fieldStyle={{ marginRight: 0 }} /> ); }; export default Create; |
Config.js:-
Code Block |
---|
export const newConfig =[ { "head": "Birth-Details", "body": [ { type: "component", component: "BrSelectName", key: "BrSelectName", withoutLabel: true, }, { type: "component", component: "BRSelectGender", key: "BRSelectPhoneGender", withoutLabel: true, }, { type: "component", component: "BRSelectPhoneNumber", key: "BRSelectPhoneNumber", withoutLabel: true, }, { type: "component", component: "BRSelectEmailId", key: "BRSelectEmailId", withoutLabel: true, }, { type: "component", component: "BrSelectAddress", key: "BrSelectAddress", withoutLabel: true, }, { type: "component", component: "SelectCorrespondenceAddress", key: "SelectCorrespondenceAddress", withoutLabel: true, }, ] }, ]; |
...