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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    track: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    role: 'primary_artist',
    
    
    
    
    
    
    
    spotify_artist_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    apple_artist_url: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    society_identifier: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/track_contributors/track_contributors-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="Track" labelFor="track">
      <Field name="track" id="track" component={SelectField} options={[]} itemRef={'tracks'}></Field>
  </FormField>









  <FormField
      label="Contributorname"
  >
      <Field
          name="name"
          placeholder="Contributorname"
      />
  </FormField>









































  <FormField label="Role" labelFor="role">
      <Field name="role" id="role" component="select">
      
        <option value="primary_artist">primary_artist</option>
      
        <option value="featured_artist">featured_artist</option>
      
        <option value="producer">producer</option>
      
        <option value="composer">composer</option>
      
        <option value="lyricist">lyricist</option>
      
        <option value="mixer">mixer</option>
      
        <option value="mastering_engineer">mastering_engineer</option>
      
        <option value="session_musician">session_musician</option>
      
      </Field>
  </FormField>













  <FormField
      label="SpotifyartistURL"
  >
      <Field
          name="spotify_artist_url"
          placeholder="SpotifyartistURL"
      />
  </FormField>



























  <FormField
      label="AppleartistURL"
  >
      <Field
          name="apple_artist_url"
          placeholder="AppleartistURL"
      />
  </FormField>



























  <FormField
      label="Societyidentifier"
  >
      <Field
          name="society_identifier"
          placeholder="Societyidentifier"
      />
  </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('/track_contributors/track_contributors-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Track_contributorsNew
