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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    workout_session: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    exercise: '',
    
    
    
    
    
    
    
    set_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reps: '',
    
    
    
    
    
    
    
    
    
    
    
    
    weight: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    weight_unit: 'kg',
    
    
    
    
    
    
    
    
    
    
    rpe: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























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















    <FormField
        label="SetNumber"
    >
        <Field
            type="number"
            name="set_number"
            placeholder="SetNumber"
        />
    </FormField>



























    <FormField
        label="Reps"
    >
        <Field
            type="number"
            name="reps"
            placeholder="Reps"
        />
    </FormField>



























    <FormField
        label="Weight"
    >
        <Field
            type="number"
            name="weight"
            placeholder="Weight"
        />
    </FormField>



































  <FormField label="WeightUnit" labelFor="weight_unit">
      <Field name="weight_unit" id="weight_unit" component="select">
      
        <option value="kg">kg</option>
      
        <option value="lb">lb</option>
      
      </Field>
  </FormField>



















    <FormField
        label="RPE(1-10)"
    >
        <Field
            type="number"
            name="rpe"
            placeholder="RPE(1-10)"
        />
    </FormField>























    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/strength_sets/strength_sets-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Strength_setsNew
