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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    tenant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supplier_offer: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    bid_criterion: '',
    
    
    
    
    score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    comment: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    scored_by: '',
    
    
    
    
    
    
    
    
    
    scored_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Offre" labelFor="supplier_offer">
      <Field name="supplier_offer" id="supplier_offer" component={SelectField} options={[]} itemRef={'supplier_offers'}></Field>
  </FormField>



























  <FormField label="Critere" labelFor="bid_criterion">
      <Field name="bid_criterion" id="bid_criterion" component={SelectField} options={[]} itemRef={'bid_criteria'}></Field>
  </FormField>















    <FormField
        label="Score"
    >
        <Field
            type="number"
            name="score"
            placeholder="Score"
        />
    </FormField>























    <FormField label="Commentaire" hasTextareaHeight>
        <Field name="comment" as="textarea" placeholder="Commentaire" />
    </FormField>











































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



















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

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

export default Offer_scoresNew
