From b8c58afc47c77faa1de4621c3b6cacb5dd793001 Mon Sep 17 00:00:00 2001 From: mbappai Date: Sun, 17 Sep 2023 16:17:16 +0100 Subject: [PATCH] feat: admin can create free and private events --- pages/organizations/events/index.tsx | 16 ++++++++++++---- pages/organizations/events/new.tsx | 12 +++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pages/organizations/events/index.tsx b/pages/organizations/events/index.tsx index 6b07ec8e..7049bdca 100644 --- a/pages/organizations/events/index.tsx +++ b/pages/organizations/events/index.tsx @@ -189,6 +189,15 @@ function gotoEventPage(event:Event){ key: 'locationName', width:'200px', }, + { + title: 'Type', + dataIndex: 'eventType', + key: 'eventType', + width:'100px', + render: (type)=>( + {type} + ) + }, { title: 'Price', dataIndex: 'price', @@ -196,8 +205,7 @@ function gotoEventPage(event:Event){ width:'100px', render: (price)=>(
- $ - {price/100} + {price===0?Free:${price/100}}
) }, @@ -207,8 +215,8 @@ function gotoEventPage(event:Event){ key: 'totalTickets', width:'100px', render: (totalTickets)=>( -
- {totalTickets} +
+ {totalTickets.toLocaleString()}
) }, diff --git a/pages/organizations/events/new.tsx b/pages/organizations/events/new.tsx index 247a94ac..b5e711d5 100644 --- a/pages/organizations/events/new.tsx +++ b/pages/organizations/events/new.tsx @@ -125,7 +125,6 @@ export default function NewEvent(){ function makeEventFree(){ form.setFieldValue('price',0) - form.resetFields(['price']) setIsEventFree(!isEventFree) } @@ -156,8 +155,8 @@ export default function NewEvent(){ startTime: dayjs(validity.startTime).format(), name: formData.name, description: formData.description, - type: formData.privacy, - price: Number(formData.price)*100, + type: formData.type, + price: Number(formData.price)*100 || 0, locationName: formData.locationName, totalTickets: Number(formData.totalTickets), duration: Number(formData.duration)*60, @@ -181,7 +180,7 @@ export default function NewEvent(){ // @ts-ignore delete formObject.contact - // console.log(formObject) + console.log(formObject) createData.mutate(formObject) } @@ -301,9 +300,9 @@ export default function NewEvent(){ // extra="Market Value of the promotion is required so that the Community DAT can be properly priced on the Marketplace" label='Price' style={{width:'50%'}} - rules={[{ required: true, message: 'Please input a valid price!' },{ pattern: /^\d+$/, message: 'Area code must be a number' },{min:1, message: 'Price cannot be any lower than $1'}]} + rules={[{ pattern: /^\d+$/, message: 'Price must be a number' }]} > - + Free
@@ -550,7 +549,6 @@ const SubmitButton = ({ form, isCreatingData, isHashingAssets }:SubmitButtonProp // Watch all values const values = Form.useWatch([], form); - useEffect(() => {