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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    market_symbol: '',
    
    
    
    
    
    
    
    
    
    quoted_at: '',
    
    
    
    
    
    
    
    
    
    
    price: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    open: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    high: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    low: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    previous_close: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    change_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    change_percent: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    volume: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timeframe: '1min',
    
    
    
    
    
    
    
    source: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



















  <FormField
      label="QuotedAt"
  >
      <Field
          type="datetime-local"
          name="quoted_at"
          placeholder="QuotedAt"
      />
  </FormField>























    <FormField
        label="Price"
    >
        <Field
            type="number"
            name="price"
            placeholder="Price"
        />
    </FormField>



























    <FormField
        label="Open"
    >
        <Field
            type="number"
            name="open"
            placeholder="Open"
        />
    </FormField>



























    <FormField
        label="High"
    >
        <Field
            type="number"
            name="high"
            placeholder="High"
        />
    </FormField>



























    <FormField
        label="Low"
    >
        <Field
            type="number"
            name="low"
            placeholder="Low"
        />
    </FormField>



























    <FormField
        label="PreviousClose"
    >
        <Field
            type="number"
            name="previous_close"
            placeholder="PreviousClose"
        />
    </FormField>



























    <FormField
        label="ChangeAmount"
    >
        <Field
            type="number"
            name="change_amount"
            placeholder="ChangeAmount"
        />
    </FormField>



























    <FormField
        label="ChangePercent"
    >
        <Field
            type="number"
            name="change_percent"
            placeholder="ChangePercent"
        />
    </FormField>



























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



































  <FormField label="Timeframe" labelFor="timeframe">
      <Field name="timeframe" id="timeframe" component="select">
      
        <option value="1min">1min</option>
      
        <option value="5min">5min</option>
      
        <option value="15min">15min</option>
      
        <option value="30min">30min</option>
      
        <option value="60min">60min</option>
      
        <option value="daily">daily</option>
      
        <option value="weekly">weekly</option>
      
        <option value="monthly">monthly</option>
      
      </Field>
  </FormField>













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

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

export default Price_quotesNew
