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

const initialValues = {
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    proposal: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    impact_level: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cost_level: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    time_horizon: 'short_term',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    problem_report: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    author: '',
    
    
    
    
    
    
    
    
    
    submitted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    published_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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





























    <FormField label="Summary" hasTextareaHeight>
        <Field name="summary" as="textarea" placeholder="Summary" />
    </FormField>





























      <FormField label='Proposal' hasTextareaHeight>
          <Field
              name='proposal'
              id='proposal'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="ImpactLevel" labelFor="impact_level">
      <Field name="impact_level" id="impact_level" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
        <option value="systemic">systemic</option>
      
      </Field>
  </FormField>



























  <FormField label="CostLevel" labelFor="cost_level">
      <Field name="cost_level" id="cost_level" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
      </Field>
  </FormField>



























  <FormField label="TimeHorizon" labelFor="time_horizon">
      <Field name="time_horizon" id="time_horizon" component="select">
      
        <option value="short_term">short_term</option>
      
        <option value="mid_term">mid_term</option>
      
        <option value="long_term">long_term</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="submitted">submitted</option>
      
        <option value="under_review">under_review</option>
      
        <option value="published">published</option>
      
        <option value="rejected">rejected</option>
      
      </Field>
  </FormField>































  <FormField label="ProblemReport" labelFor="problem_report">
      <Field name="problem_report" id="problem_report" component={SelectField} options={[]} itemRef={'problem_reports'}></Field>
  </FormField>



























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



















  <FormField
      label="SubmittedAt"
  >
      <Field
          type="datetime-local"
          name="submitted_at"
          placeholder="SubmittedAt"
      />
  </FormField>



























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

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

export default Solution_proposalsNew
