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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    artist_profile: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    platform: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    release: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    track: '',
    
    
    
    
    
    
    
    
    
    metric_date: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    streams: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    unique_listeners: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    saves: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    likes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    shares: '',
    
    
    
    
    
    
    
    
    
    
    
    
    country: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    city: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    traffic_source: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Platform" labelFor="platform">
      <Field name="platform" id="platform" component={SelectField} options={[]} itemRef={'distribution_platforms'}></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="Metricdate"
  >
      <Field
          type="datetime-local"
          name="metric_date"
          placeholder="Metricdate"
      />
  </FormField>























    <FormField
        label="Streams"
    >
        <Field
            type="number"
            name="streams"
            placeholder="Streams"
        />
    </FormField>



























    <FormField
        label="Uniquelisteners"
    >
        <Field
            type="number"
            name="unique_listeners"
            placeholder="Uniquelisteners"
        />
    </FormField>



























    <FormField
        label="Saves"
    >
        <Field
            type="number"
            name="saves"
            placeholder="Saves"
        />
    </FormField>



























    <FormField
        label="Likes"
    >
        <Field
            type="number"
            name="likes"
            placeholder="Likes"
        />
    </FormField>



























    <FormField
        label="Shares"
    >
        <Field
            type="number"
            name="shares"
            placeholder="Shares"
        />
    </FormField>





















  <FormField
      label="Country"
  >
      <Field
          name="country"
          placeholder="Country"
      />
  </FormField>



























  <FormField
      label="City"
  >
      <Field
          name="city"
          placeholder="City"
      />
  </FormField>



























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

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

export default Analytics_dailyNew
