Skip to content

Commit

Permalink
feat: admin can create free and private events
Browse files Browse the repository at this point in the history
  • Loading branch information
mbappai committed Sep 17, 2023
1 parent 5a15b4a commit b8c58af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
16 changes: 12 additions & 4 deletions pages/organizations/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,23 @@ function gotoEventPage(event:Event){
key: 'locationName',
width:'200px',
},
{
title: 'Type',
dataIndex: 'eventType',
key: 'eventType',
width:'100px',
render: (type)=>(
<Tag style={{textTransform:'capitalize'}}>{type}</Tag>
)
},
{
title: 'Price',
dataIndex: 'price',
key: 'price',
width:'100px',
render: (price)=>(
<div>
<Text>$</Text>
<Text>{price/100}</Text>
{price===0?<Text>Free</Text>:<Text>${price/100}</Text>}
</div>
)
},
Expand All @@ -207,8 +215,8 @@ function gotoEventPage(event:Event){
key: 'totalTickets',
width:'100px',
render: (totalTickets)=>(
<div>
<Text>{totalTickets}</Text>
<div>
<Text>{totalTickets.toLocaleString()}</Text>
</div>
)
},
Expand Down
12 changes: 5 additions & 7 deletions pages/organizations/events/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ export default function NewEvent(){

function makeEventFree(){
form.setFieldValue('price',0)
form.resetFields(['price'])
setIsEventFree(!isEventFree)
}

Expand Down Expand Up @@ -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,
Expand All @@ -181,7 +180,7 @@ export default function NewEvent(){
// @ts-ignore
delete formObject.contact

// console.log(formObject)
console.log(formObject)

createData.mutate(formObject)
}
Expand Down Expand Up @@ -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' }]}
>
<Input disabled={isEventFree} size='large' style={{width:'100%', marginRight:'1rem'}} prefix="$" suffix='Per DAT' placeholder="0" />
<Input disabled={isEventFree} size='large' style={{width:'100%', marginRight:'1rem'}} prefix="$" suffix='Per DAT' placeholder="0" />
</Form.Item>
<Checkbox style={{ height:'100%', marginTop:'.2rem', marginLeft:'1rem', alignItems:'center'}} onChange={makeEventFree} value={isEventFree}>Free</Checkbox>
</div>
Expand Down Expand Up @@ -550,7 +549,6 @@ const SubmitButton = ({ form, isCreatingData, isHashingAssets }:SubmitButtonProp

// Watch all values
const values = Form.useWatch([], form);


useEffect(() => {

Expand Down

0 comments on commit b8c58af

Please sign in to comment.