import './style.css' import Box from '@mui/material/Box' import Button from '@mui/material/Button' import CircularProgress from '@mui/material/CircularProgress' import Modal from '@mui/material/Modal' import { Field, Form, Formik } from 'formik' import React from 'react' import SVG from 'react-inlinesvg' import * as yup from 'yup' import EmailSvg from '../../assets/images/email.svg' import UserSvg from '../../assets/images/user.svg' import { CheckboxField } from '../common/CheckboxField' import { CustomField } from '../common/CustomField' import { RadioField } from '../common/RadioField' import { ITicketTypes } from '../orderDetailsContainer/ticketsTable' interface Props { ticket: ITicketTypes; onClose: () => void; onSubmit: (values: InitialValuesTypes) => void; loading?: boolean; } export interface InitialValuesTypes { to: string; first_name: string; last_name: string; email: string; confirm_email: string; confirm: boolean; } const style: React.CSSProperties = { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', minWidth: 480, backgroundColor: '#e3e3e3', border: '1px solid white', outline: 'none', padding: '14px', maxHeight: '85vh', overflow: 'auto' } const schema = yup.object().shape({ to: yup.string().required(), first_name: yup.string().when('to', { is: (to: string) => to === 'friend', then: yup.string().required('First Name is required') }), last_name: yup.string().when('to', { is: (to: string) => to === 'friend', then: yup.string().required('Last Name is required') }), email: yup.string().when('to', { is: (to: string) => to === 'friend', then: yup.string().email('Invalid email').required('Email is required') }), confirm_email: yup.string().when('to', { is: (to: string) => to === 'friend', then: yup.string().email('Invalid email').oneOf([yup.ref('email'), null], 'Emails must match').required('Confirm Email is required') }), confirm: yup.boolean().oneOf([true]) }) const initialValues: InitialValuesTypes = { to: 'friend', first_name: '', last_name: '', email: '', confirm_email: '', confirm: false } export const TicketResaleModal = ({ ticket = {} as ITicketTypes, onClose = () => { }, onSubmit = () => { }, loading = false }: Props) => { const { hash, holder_name, event_name, currency, retain_amount_on_sale, ticket_type_is_active } = ticket return (

Sell Ticket

Ticket Details

Event

{event_name}

Ticket Holder

{holder_name}

Ticket ID

{hash}

Sell to Whom

{({ values, isValid, dirty }) => (
{values.to === 'friend' && (
)}
{ticket_type_is_active && (
)}

Terms of Resale

I confirm that I want to sell this ticket and that, if someone chooses to buy it, I will no longer own it or have the right to ask for it back.

I also understand that, if no one chooses to buy it, it remains my property, is valid for entry to {event_name} and I will not receive any refund.

If my ticket is sold, the original card I used to buy my ticket will be refunded with the original amount paid, minus a small handling fee of {`${currency ?? ''} ${retain_amount_on_sale ?? '0'}`}, and that any existing refunds due to me for referring sales for this event are no longer valid.

)}
) }