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/match_players/match_playersSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    match: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    display_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    avatar_customization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    player_status: 'joined',
    
    
    
    
    
    
    
    
    
    
    score_points: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    correct_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    incorrect_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    yux_earned: '',
    
    
    
    
    
    
    
    
    
    
    
    
    race_distance_km: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    joined_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    left_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/match_players/match_players-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="Match" labelFor="match">
      <Field name="match" id="match" component={SelectField} options={[]} itemRef={'matches'}></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="AvatarCustomization" labelFor="avatar_customization">
      <Field name="avatar_customization" id="avatar_customization" component={SelectField} options={[]} itemRef={'avatar_customizations'}></Field>
  </FormField>























  <FormField label="PlayerStatus" labelFor="player_status">
      <Field name="player_status" id="player_status" component="select">
      
        <option value="joined">joined</option>
      
        <option value="ready">ready</option>
      
        <option value="playing">playing</option>
      
        <option value="disconnected">disconnected</option>
      
        <option value="finished">finished</option>
      
      </Field>
  </FormField>



















    <FormField
        label="ScorePoints"
    >
        <Field
            type="number"
            name="score_points"
            placeholder="ScorePoints"
        />
    </FormField>



























    <FormField
        label="CorrectCount"
    >
        <Field
            type="number"
            name="correct_count"
            placeholder="CorrectCount"
        />
    </FormField>



























    <FormField
        label="IncorrectCount"
    >
        <Field
            type="number"
            name="incorrect_count"
            placeholder="IncorrectCount"
        />
    </FormField>



























    <FormField
        label="YUXEarned"
    >
        <Field
            type="number"
            name="yux_earned"
            placeholder="YUXEarned"
        />
    </FormField>



























    <FormField
        label="RaceDistance(km)"
    >
        <Field
            type="number"
            name="race_distance_km"
            placeholder="RaceDistance(km)"
        />
    </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>















              <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('/match_players/match_players-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Match_playersNew
