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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    market_symbol: '',
    
    
    
    
    
    
    
    
    
    calculated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    indicator_type: 'rsi',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timeframe: '1min',
    
    
    
    
    
    
    
    
    
    
    period: '',
    
    
    
    
    
    
    
    
    
    
    
    
    value: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    signal: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    histogram: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    upper_band: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    middle_band: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    lower_band: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/technical_indicators/technical_indicators-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="CalculatedAt"
  >
      <Field
          type="datetime-local"
          name="calculated_at"
          placeholder="CalculatedAt"
      />
  </FormField>































  <FormField label="IndicatorType" labelFor="indicator_type">
      <Field name="indicator_type" id="indicator_type" component="select">
      
        <option value="rsi">rsi</option>
      
        <option value="macd">macd</option>
      
        <option value="bollinger_bands">bollinger_bands</option>
      
        <option value="sma">sma</option>
      
        <option value="ema">ema</option>
      
        <option value="volume">volume</option>
      
      </Field>
  </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="Period"
    >
        <Field
            type="number"
            name="period"
            placeholder="Period"
        />
    </FormField>



























    <FormField
        label="Value"
    >
        <Field
            type="number"
            name="value"
            placeholder="Value"
        />
    </FormField>



























    <FormField
        label="Signal"
    >
        <Field
            type="number"
            name="signal"
            placeholder="Signal"
        />
    </FormField>



























    <FormField
        label="Histogram"
    >
        <Field
            type="number"
            name="histogram"
            placeholder="Histogram"
        />
    </FormField>



























    <FormField
        label="UpperBand"
    >
        <Field
            type="number"
            name="upper_band"
            placeholder="UpperBand"
        />
    </FormField>



























    <FormField
        label="MiddleBand"
    >
        <Field
            type="number"
            name="middle_band"
            placeholder="MiddleBand"
        />
    </FormField>



























    <FormField
        label="LowerBand"
    >
        <Field
            type="number"
            name="lower_band"
            placeholder="LowerBand"
        />
    </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('/technical_indicators/technical_indicators-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Technical_indicatorsNew
