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

const initialValues = {
    
    
    module_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    module_type: 'thinking_method',
    
    
    
    
    
    
    
    
    
    module_description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evidence_level: 'high',
    
    
    
    
    
    
    
    
    method_steps: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    requires_citations: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_active: false,
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/skill_modules/skill_modules-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="ModuleName"
  >
      <Field
          name="module_name"
          placeholder="ModuleName"
      />
  </FormField>









































  <FormField label="ModuleType" labelFor="module_type">
      <Field name="module_type" id="module_type" component="select">
      
        <option value="thinking_method">thinking_method</option>
      
        <option value="compliance">compliance</option>
      
        <option value="analysis">analysis</option>
      
        <option value="generation">generation</option>
      
        <option value="research">research</option>
      
        <option value="optimization">optimization</option>
      
        <option value="simulation">simulation</option>
      
        <option value="creative">creative</option>
      
      </Field>
  </FormField>

















      <FormField label='ModuleDescription' hasTextareaHeight>
          <Field
              name='module_description'
              id='module_description'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="EvidenceLevel" labelFor="evidence_level">
      <Field name="evidence_level" id="evidence_level" component="select">
      
        <option value="high">high</option>
      
        <option value="medium">medium</option>
      
        <option value="low">low</option>
      
        <option value="unknown">unknown</option>
      
      </Field>
  </FormField>















    <FormField label="MethodSteps" hasTextareaHeight>
        <Field name="method_steps" as="textarea" placeholder="MethodSteps" />
    </FormField>









































  <FormField label='RequiresCitations' labelFor='requires_citations'>
      <Field
          name='requires_citations'
          id='requires_citations'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='IsActive' labelFor='is_active'>
      <Field
          name='is_active'
          id='is_active'
          component={SwitchField}
      ></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('/skill_modules/skill_modules-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Skill_modulesNew
