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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'pending',
    
    
    
    
    
    
    
    
    
    
    coins_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    cash_amount_uzs: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    payout_method: 'bank_transfer',
    
    
    
    
    
    
    
    payout_destination: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    provider_reference: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    admin_note: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    requested_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    processed_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/withdrawal_requests/withdrawal_requests-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="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="pending">pending</option>
      
        <option value="processing">processing</option>
      
        <option value="completed">completed</option>
      
        <option value="rejected">rejected</option>
      
        <option value="cancelled">cancelled</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Coinsamount"
    >
        <Field
            type="number"
            name="coins_amount"
            placeholder="Coinsamount"
        />
    </FormField>



























    <FormField
        label="Cashamount(UZS)"
    >
        <Field
            type="number"
            name="cash_amount_uzs"
            placeholder="Cashamount(UZS)"
        />
    </FormField>



































  <FormField label="Payoutmethod" labelFor="payout_method">
      <Field name="payout_method" id="payout_method" component="select">
      
        <option value="bank_transfer">bank_transfer</option>
      
        <option value="mobile_money">mobile_money</option>
      
        <option value="e_wallet">e_wallet</option>
      
      </Field>
  </FormField>













  <FormField
      label="Payoutdestination"
  >
      <Field
          name="payout_destination"
          placeholder="Payoutdestination"
      />
  </FormField>



























  <FormField
      label="Providerreference"
  >
      <Field
          name="provider_reference"
          placeholder="Providerreference"
      />
  </FormField>





























    <FormField label="Adminnote" hasTextareaHeight>
        <Field name="admin_note" as="textarea" placeholder="Adminnote" />
    </FormField>



































  <FormField
      label="Requestedat"
  >
      <Field
          type="datetime-local"
          name="requested_at"
          placeholder="Requestedat"
      />
  </FormField>



























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

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

export default Withdrawal_requestsNew
