From ae8c26488e1170132fc9ead9c97cdcfb81ec2f71 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Wed, 23 Aug 2023 18:29:11 +0530 Subject: [PATCH 1/2] feat: rendering sections according to category structure added --- src/components/Card/Common/event.css | 17 +++ src/locales/en/translationEn.json | 10 +- .../CreateNewOrganization.jsx | 106 ++++++++++++------ 3 files changed, 93 insertions(+), 40 deletions(-) diff --git a/src/components/Card/Common/event.css b/src/components/Card/Common/event.css index 07dd6dbe5..da007946e 100644 --- a/src/components/Card/Common/event.css +++ b/src/components/Card/Common/event.css @@ -4,3 +4,20 @@ padding-left: 24px; padding-right: 24px; } + +.add-event-section-col .add-event-section-wrapper { + padding: 24px; + background-color: #ffffff; +} + +.add-event-section-col .add-event-date-wrap { + font-weight: 700; + font-size: 24px; + color: #222732; + margin-bottom: 24px; +} +.add-event-section-col .title-required:after { + margin-left: 4px; + content: '*'; + color: #f43131; +} diff --git a/src/locales/en/translationEn.json b/src/locales/en/translationEn.json index 1d67e1017..1da75a45f 100644 --- a/src/locales/en/translationEn.json +++ b/src/locales/en/translationEn.json @@ -456,11 +456,11 @@ "breadcrumb": "Back to previous screen", "linkText": "Artsdata", "createNew": "Create new organization", - "create": "Create", - "addOrganization": { - "newOrganization": "New Organization", - "editOrganization": "Edit Organization" - } + "create": "Create" + }, + "addOrganization": { + "newOrganization": "New Organization", + "editOrganization": "Edit Organization" } } }, diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx index ea1314191..a11299259 100644 --- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx +++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx @@ -2,53 +2,89 @@ import React from 'react'; import './createNewOrganization.css'; import { Form, Row, Col, Button } from 'antd'; import { useTranslation } from 'react-i18next'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useOutletContext } from 'react-router-dom'; import { LeftOutlined } from '@ant-design/icons'; import PrimaryButton from '../../../components/Button/Primary'; import { featureFlags } from '../../../utils/featureFlags'; import FeatureFlag from '../../../layout/FeatureFlag/FeatureFlag'; +import { entitiesClass } from '../../../constants/entitiesClass'; +import Card from '../../../components/Card/Common/Event'; function CreateNewOrganization() { const [form] = Form.useForm(); const { t } = useTranslation(); const navigate = useNavigate(); + const [currentCalendarData] = useOutletContext(); + let formFields = currentCalendarData?.forms?.filter((form) => form?.formName === entitiesClass.organization); + formFields = formFields?.length > 0 && formFields[0]; + console.log(formFields); + let category = formFields?.formFields?.map((field) => field?.category); + console.log(category); + let unique; + let fields; + if (category) unique = [...new Set(category)]; + console.log(unique); + if (unique) + fields = formFields?.formFields + ?.filter((field) => field.category === unique[0]) + ?.sort((a, b) => a?.order - b?.order); + + if (unique?.length > 0) { + fields = unique?.map((category) => { + return formFields?.formFields + ?.filter((field) => field.category === category) + ?.sort((a, b) => a?.order - b?.order); + }); + } + + console.log(fields); return ( - -
-
- - - - -
- -
- - -
- - - -
- -
- + fields && ( + +
+ + + + + +
+ +
+ + +
+ + + +
+ +
+ - -
-

{t('dashboard.organization.createNew.addOrganization.newOrganization')}

-
- -
- -
-
+ +
+

{t('dashboard.organization.createNew.addOrganization.newOrganization')}

+
+ +
+ {fields?.map((section, index) => { + return ( + + <> + <> + + ); + })} + +
+
+ ) ); } From 8f75fecbd4664a916956230b44d2505f64bf9c3c Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Thu, 24 Aug 2023 16:42:29 +0530 Subject: [PATCH 2/2] feat: rendering according to type added --- src/constants/formFields.js | 59 +++++++++++++++++++ .../CreateNewOrganization.jsx | 32 ++++++++-- 2 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 src/constants/formFields.js diff --git a/src/constants/formFields.js b/src/constants/formFields.js new file mode 100644 index 000000000..5a959fa74 --- /dev/null +++ b/src/constants/formFields.js @@ -0,0 +1,59 @@ +import { Form, Input } from 'antd'; +import TextEditor from '../components/TextEditor'; + +const { TextArea } = Input; + +const formTypes = { + INPUT: 'Input', + MULTISELECT: 'MultiSelect', + TEXTAREA: 'TextArea', + EDITOR: 'Editor', +}; + +export const formFieldValue = [ + { + type: formTypes.INPUT, + element: ( +