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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    screener_run: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    market_symbol: '',
    
    
    
    
    last_price: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    market_cap: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pe_ratio: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    volume: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    performance_52w: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sector: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="MarketSymbol" labelFor="market_symbol">
      <Field name="market_symbol" id="market_symbol" component={SelectField} options={[]} itemRef={'market_symbols'}></Field>
  </FormField>















    <FormField
        label="LastPrice"
    >
        <Field
            type="number"
            name="last_price"
            placeholder="LastPrice"
        />
    </FormField>



























    <FormField
        label="MarketCap"
    >
        <Field
            type="number"
            name="market_cap"
            placeholder="MarketCap"
        />
    </FormField>



























    <FormField
        label="P/ERatio"
    >
        <Field
            type="number"
            name="pe_ratio"
            placeholder="P/ERatio"
        />
    </FormField>



























    <FormField
        label="Volume"
    >
        <Field
            type="number"
            name="volume"
            placeholder="Volume"
        />
    </FormField>



























    <FormField
        label="52-WeekPerformance"
    >
        <Field
            type="number"
            name="performance_52w"
            placeholder="52-WeekPerformance"
        />
    </FormField>





















  <FormField
      label="Sector"
  >
      <Field
          name="sector"
          placeholder="Sector"
      />
  </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('/screener_results/screener_results-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Screener_resultsNew
