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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    song: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    track_type: 'vocal',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    instrument: 'voice',
    
    
    
    
    
    
    
    volume_db: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pan: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mute: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    solo: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_asset: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









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









































  <FormField label="TrackType" labelFor="track_type">
      <Field name="track_type" id="track_type" component="select">
      
        <option value="vocal">vocal</option>
      
        <option value="drums">drums</option>
      
        <option value="bass">bass</option>
      
        <option value="instrument">instrument</option>
      
        <option value="fx">fx</option>
      
        <option value="bus">bus</option>
      
        <option value="master">master</option>
      
      </Field>
  </FormField>



























  <FormField label="Instrument" labelFor="instrument">
      <Field name="instrument" id="instrument" component="select">
      
        <option value="voice">voice</option>
      
        <option value="piano">piano</option>
      
        <option value="log_drum">log_drum</option>
      
        <option value="synth">synth</option>
      
        <option value="brass">brass</option>
      
        <option value="guitar">guitar</option>
      
        <option value="traditional_drums">traditional_drums</option>
      
        <option value="perc">perc</option>
      
        <option value="pads">pads</option>
      
        <option value="strings">strings</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Volume(dB)"
    >
        <Field
            type="number"
            name="volume_db"
            placeholder="Volume(dB)"
        />
    </FormField>



























    <FormField
        label="Pan"
    >
        <Field
            type="number"
            name="pan"
            placeholder="Pan"
        />
    </FormField>





































  <FormField label='Mute' labelFor='mute'>
      <Field
          name='mute'
          id='mute'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Solo' labelFor='solo'>
      <Field
          name='solo'
          id='solo'
          component={SwitchField}
      ></Field>
  </FormField>





























  <FormField label="SourceAsset" labelFor="source_asset">
      <Field name="source_asset" id="source_asset" component={SelectField} options={[]} itemRef={'assets'}></Field>
  </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('/tracks/tracks-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default TracksNew
