import { mdiAccount, mdiChartTimelineVariant, mdiMail, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement } from 'react'
import CardBox from '../../components/CardBox'
import LayoutAuthenticated from '../../layouts/Authenticated'
import SectionMain from '../../components/SectionMain'
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton'
import { getPageTitle } from '../../config'

import { Field, Form, Formik } from 'formik'
import FormField from '../../components/FormField'
import BaseDivider from '../../components/BaseDivider'
import BaseButtons from '../../components/BaseButtons'
import BaseButton from '../../components/BaseButton'
import FormCheckRadio from '../../components/FormCheckRadio'
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup'
import FormFilePicker from '../../components/FormFilePicker'
import FormImagePicker from '../../components/FormImagePicker'
import { SwitchField } from '../../components/SwitchField'

import { SelectField } from '../../components/SelectField'
import { SelectFieldMany } from "../../components/SelectFieldMany";
import {RichTextField} from "../../components/RichTextField";

import { create } from '../../stores/participants/participantsSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    conference: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    display_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    participant_role: 'host',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    join_status: 'invited',
    
    
    
    
    
    
    
    
    
    
    
    
    joined_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    left_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_muted: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_video_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_screen_sharing: false,
    
    
    
    
    
    
    
    
    
    
    
    
    network_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


const ParticipantsNew = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/participants/participants-list')
  }
  return (
    <>
      <Head>
        <title>{getPageTitle('New Item')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title="New Item" main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            initialValues={
                
                initialValues
                
            }
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>





















  <FormField label="Conference" labelFor="conference">
      <Field name="conference" id="conference" component={SelectField} options={[]} itemRef={'conferences'}></Field>
  </FormField>



























  <FormField label="User" labelFor="user">
      <Field name="user" id="user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>









  <FormField
      label="DisplayName"
  >
      <Field
          name="display_name"
          placeholder="DisplayName"
      />
  </FormField>









































  <FormField label="ParticipantRole" labelFor="participant_role">
      <Field name="participant_role" id="participant_role" component="select">
      
        <option value="host">host</option>
      
        <option value="moderator">moderator</option>
      
        <option value="presenter">presenter</option>
      
        <option value="attendee">attendee</option>
      
        <option value="guest">guest</option>
      
        <option value="bot">bot</option>
      
      </Field>
  </FormField>



























  <FormField label="JoinStatus" labelFor="join_status">
      <Field name="join_status" id="join_status" component="select">
      
        <option value="invited">invited</option>
      
        <option value="lobby">lobby</option>
      
        <option value="joined">joined</option>
      
        <option value="left">left</option>
      
        <option value="kicked">kicked</option>
      
        <option value="disconnected">disconnected</option>
      
      </Field>
  </FormField>























  <FormField
      label="JoinedAt"
  >
      <Field
          type="datetime-local"
          name="joined_at"
          placeholder="JoinedAt"
      />
  </FormField>



























  <FormField
      label="LeftAt"
  >
      <Field
          type="datetime-local"
          name="left_at"
          placeholder="LeftAt"
      />
  </FormField>

































  <FormField label='IsMuted' labelFor='is_muted'>
      <Field
          name='is_muted'
          id='is_muted'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='IsVideoEnabled' labelFor='is_video_enabled'>
      <Field
          name='is_video_enabled'
          id='is_video_enabled'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='IsScreenSharing' labelFor='is_screen_sharing'>
      <Field
          name='is_screen_sharing'
          id='is_screen_sharing'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="NetworkScore"
    >
        <Field
            type="number"
            name="network_score"
            placeholder="NetworkScore"
        />
    </FormField>







































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></Field>
  </FormField>







              <BaseDivider />
              <BaseButtons>
                <BaseButton type="submit" color="info" label="Submit" />
                <BaseButton type="reset" color="info" outline label="Reset" />
                <BaseButton type='reset' color='danger' outline label='Cancel' onClick={() => router.push('/participants/participants-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

ParticipantsNew.getLayout = function getLayout(page: ReactElement) {
  return (
      <LayoutAuthenticated
        
          permission={'CREATE_PARTICIPANTS'}
        
      >
          {page}
      </LayoutAuthenticated>
  )
}

export default ParticipantsNew
