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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    royalty_report: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    release: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    track: '',
    
    
    
    
    territory: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    store_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    quantity: '',
    
    
    
    
    
    
    
    
    
    
    
    
    unit_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    gross_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    net_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    currency: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    usage_type: 'stream',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Release" labelFor="release">
      <Field name="release" id="release" component={SelectField} options={[]} itemRef={'releases'}></Field>
  </FormField>



























  <FormField label="Track" labelFor="track">
      <Field name="track" id="track" component={SelectField} options={[]} itemRef={'tracks'}></Field>
  </FormField>









  <FormField
      label="Territory"
  >
      <Field
          name="territory"
          placeholder="Territory"
      />
  </FormField>



























  <FormField
      label="Storename"
  >
      <Field
          name="store_name"
          placeholder="Storename"
      />
  </FormField>

































    <FormField
        label="Quantity"
    >
        <Field
            type="number"
            name="quantity"
            placeholder="Quantity"
        />
    </FormField>



























    <FormField
        label="Unitrate"
    >
        <Field
            type="number"
            name="unit_rate"
            placeholder="Unitrate"
        />
    </FormField>



























    <FormField
        label="Grossamount"
    >
        <Field
            type="number"
            name="gross_amount"
            placeholder="Grossamount"
        />
    </FormField>



























    <FormField
        label="Netamount"
    >
        <Field
            type="number"
            name="net_amount"
            placeholder="Netamount"
        />
    </FormField>





















  <FormField
      label="Currency"
  >
      <Field
          name="currency"
          placeholder="Currency"
      />
  </FormField>





































  <FormField
      label="Eventat"
  >
      <Field
          type="datetime-local"
          name="event_at"
          placeholder="Eventat"
      />
  </FormField>































  <FormField label="Usagetype" labelFor="usage_type">
      <Field name="usage_type" id="usage_type" component="select">
      
        <option value="stream">stream</option>
      
        <option value="download">download</option>
      
        <option value="video">video</option>
      
        <option value="ugc">ugc</option>
      
        <option value="content_id">content_id</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></Field>
  </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('/royalty_lines/royalty_lines-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Royalty_linesNew
