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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    workspace: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    primary_genre: '',
    
    
    
    
    
    
    
    target_bpm: '',
    
    
    
    
    
    
    
    
    
    
    
    
    target_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mood: 'happy',
    
    
    
    
    
    
    
    
    
    
    target_duration_seconds: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    collaboration_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    last_opened_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









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































      <FormField label='Description' hasTextareaHeight>
          <Field
              name='description'
              id='description'
              component={RichTextField}
          ></Field>
      </FormField>









































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























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="in_progress">in_progress</option>
      
        <option value="ready_for_mix">ready_for_mix</option>
      
        <option value="ready_for_master">ready_for_master</option>
      
        <option value="exported">exported</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </FormField>































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















    <FormField
        label="TargetBPM"
    >
        <Field
            type="number"
            name="target_bpm"
            placeholder="TargetBPM"
        />
    </FormField>





















  <FormField
      label="TargetKey"
  >
      <Field
          name="target_key"
          placeholder="TargetKey"
      />
  </FormField>









































  <FormField label="Mood" labelFor="mood">
      <Field name="mood" id="mood" component="select">
      
        <option value="happy">happy</option>
      
        <option value="sad">sad</option>
      
        <option value="spiritual">spiritual</option>
      
        <option value="energetic">energetic</option>
      
        <option value="romantic">romantic</option>
      
        <option value="chill">chill</option>
      
        <option value="aggressive">aggressive</option>
      
      </Field>
  </FormField>



















    <FormField
        label="TargetDurationSeconds"
    >
        <Field
            type="number"
            name="target_duration_seconds"
            placeholder="TargetDurationSeconds"
        />
    </FormField>





































  <FormField label='CollaborationEnabled' labelFor='collaboration_enabled'>
      <Field
          name='collaboration_enabled'
          id='collaboration_enabled'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="LastOpenedAt"
  >
      <Field
          type="datetime-local"
          name="last_opened_at"
          placeholder="LastOpenedAt"
      />
  </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('/projects/projects-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default ProjectsNew
