From 16d0880182e3bc95dc2d9a6743c742af65892cd9 Mon Sep 17 00:00:00 2001 From: Aashray Katiyar Date: Mon, 6 Feb 2023 01:20:44 +0530 Subject: [PATCH 1/2] : [Add organizer form] --- app/components/conferences/eventForm.js | 70 +++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 5 deletions(-) diff --git a/app/components/conferences/eventForm.js b/app/components/conferences/eventForm.js index 4c2c000d..fc01655b 100644 --- a/app/components/conferences/eventForm.js +++ b/app/components/conferences/eventForm.js @@ -1,11 +1,11 @@ import { Form, InputGroup, - Toast, } from "react-bootstrap"; +import { useState, Fragment, useEffect } from "react"; + +export const EventForm = ({ handleChange, intialValues, ticket, handleSwitch, handlePublicSwitch, isPublic }) => { -export const EventForm = ({ handleChange, intialValues, ticket , handleSwitch, handlePublicSwitch, isPublic }) => { - return ( <> @@ -50,6 +50,9 @@ export const EventForm = ({ handleChange, intialValues, ticket , handleSwitch, h onChange={handleChange} /> + + + Start Date* { + + const [show, setShow] = useState(false); + + useEffect(() => { + console.log(intialValues); + if (intialValues["owner-name"] || intialValues["owner-description"]) { + setShow(true); + } + }, [intialValues]) + + + return ( + + {!(intialValues["owner-name"] || intialValues["owner-description"]) ? + Add Organizer Or Group Information + + setShow(!show)} + type="switch" + value={"on"} + defaultChecked={show} + /> + + : null + } + {show && ( + <> + Organizer or Group Name + + + {/* About the organization or Group */} + + About the Organizer or Group + + + + )} + + ); +} + From e9acf80d5e5871c5fe4bd9474fc0fc251173b258 Mon Sep 17 00:00:00 2001 From: Aashray Katiyar Date: Mon, 6 Feb 2023 01:21:53 +0530 Subject: [PATCH 2/2] : [Change Backend Post & Fetch Data] --- app/components/conferences/admin/EditEvent.js | 10 ++++++---- .../conferences/create/EventBasicDetails.js | 14 ++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/components/conferences/admin/EditEvent.js b/app/components/conferences/admin/EditEvent.js index 1a3b3a48..e88e0c76 100644 --- a/app/components/conferences/admin/EditEvent.js +++ b/app/components/conferences/admin/EditEvent.js @@ -21,11 +21,13 @@ export const EditEvent = ({ event, handleToast }) => { "starts-at": event.data.attributes["starts-at"].slice(0, 16), "ends-at": event.data.attributes["ends-at"].slice(0, 16), "original-image-url": event.data.attributes["original-image-url"], - "logo-url" : event.data.attributes["logo-url"], + "logo-url": event.data.attributes["logo-url"], timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, online: true, "is-sessions-speakers-enabled": true, - privacy: event.data.attributes.privacy + privacy: event.data.attributes.privacy, + "owner-name": event.data.attributes["owner-name"], + "owner-description": event.data.attributes["owner-description"], }); const [publish, setPublish] = useState("published"); @@ -86,13 +88,13 @@ export const EditEvent = ({ event, handleToast }) => { const handleFormSubmit = async (e) => { e.preventDefault(); - if(formState['logo-url'] === ""){ + if (formState['logo-url'] === "") { delete formState['logo-url']; } const data = { data: { - attributes: { ...formState, state: publish, privacy: isPublic ? "public" : "private" }, + attributes: { ...formState, state: publish, privacy: isPublic ? "public" : "private" }, id: event.data.id, type: "event", }, diff --git a/app/components/conferences/create/EventBasicDetails.js b/app/components/conferences/create/EventBasicDetails.js index c3eacf5d..8d40cfe3 100644 --- a/app/components/conferences/create/EventBasicDetails.js +++ b/app/components/conferences/create/EventBasicDetails.js @@ -29,6 +29,8 @@ export const EventBasicCreate = ({ setDraft, handleToast }) => { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, online: true, "is-sessions-speakers-enabled": true, + "owner-name": "", + "owner-description": "", }); const [publish, setPublish] = useState("draft"); @@ -138,13 +140,13 @@ export const EventBasicCreate = ({ setDraft, handleToast }) => { CustomToast({ type: "success" }); name === "switch" ? setTicket((prev) => ({ - ...prev, - state: !ticket.state, - })) + ...prev, + state: !ticket.state, + })) : setTicket((prev) => ({ - ...prev, - [name]: value, - })); + ...prev, + [name]: value, + })); }; const handlePublicSwitch = (e) => {