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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    currency: 'DOODLECOIN',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    direction: 'CREDIT',
    
    
    
    
    
    
    
    
    
    
    amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    balance_after: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reason: 'CODE_REDEMPTION',
    
    
    
    
    
    
    
    reference: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    occurred_at: '',
    
    
    
    
    
    
    
    
    
    
    
    note: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="Currency" labelFor="currency">
      <Field name="currency" id="currency" component="select">
      
        <option value="DOODLECOIN">DOODLECOIN</option>
      
        <option value="SUPERCHARGED">SUPERCHARGED</option>
      
      </Field>
  </FormField>



























  <FormField label="Direction" labelFor="direction">
      <Field name="direction" id="direction" component="select">
      
        <option value="CREDIT">CREDIT</option>
      
        <option value="DEBIT">DEBIT</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Amount"
    >
        <Field
            type="number"
            name="amount"
            placeholder="Amount"
        />
    </FormField>



























    <FormField
        label="BalanceAfter"
    >
        <Field
            type="number"
            name="balance_after"
            placeholder="BalanceAfter"
        />
    </FormField>



































  <FormField label="Reason" labelFor="reason">
      <Field name="reason" id="reason" component="select">
      
        <option value="CODE_REDEMPTION">CODE_REDEMPTION</option>
      
        <option value="REFERRAL_REWARD">REFERRAL_REWARD</option>
      
        <option value="STREAK_REWARD">STREAK_REWARD</option>
      
        <option value="CONVERSION">CONVERSION</option>
      
        <option value="MEMBERSHIP_PURCHASE">MEMBERSHIP_PURCHASE</option>
      
        <option value="PRODUCT_PURCHASE">PRODUCT_PURCHASE</option>
      
        <option value="ITEM_REDEMPTION">ITEM_REDEMPTION</option>
      
        <option value="ADMIN_ADJUSTMENT">ADMIN_ADJUSTMENT</option>
      
        <option value="OTHER">OTHER</option>
      
      </Field>
  </FormField>













  <FormField
      label="Reference"
  >
      <Field
          name="reference"
          placeholder="Reference"
      />
  </FormField>





































  <FormField
      label="OccurredAt"
  >
      <Field
          type="datetime-local"
          name="occurred_at"
          placeholder="OccurredAt"
      />
  </FormField>



















    <FormField label="Note" hasTextareaHeight>
        <Field name="note" as="textarea" placeholder="Note" />
    </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('/wallet_transactions/wallet_transactions-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Wallet_transactionsNew
