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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    payroll_period: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    employee: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    outlet: '',
    
    
    
    
    
    
    
    workdays: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sick_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    leave_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    absent_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    late_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    late_minutes_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    base_salary_monthly: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    daily_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    base_salary_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    meal_transport_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    position_allowance_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    kpi_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    kpi_allowance_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    overtime_hours_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    overtime_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    overtime_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    revenue_bonus_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    service_charge_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    deduction_total: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    take_home_pay: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    adjustment_notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Employee" labelFor="employee">
      <Field name="employee" id="employee" component={SelectField} options={[]} itemRef={'employees'}></Field>
  </FormField>



























  <FormField label="Outlet" labelFor="outlet">
      <Field name="outlet" id="outlet" component={SelectField} options={[]} itemRef={'outlets'}></Field>
  </FormField>















    <FormField
        label="Workdays"
    >
        <Field
            type="number"
            name="workdays"
            placeholder="Workdays"
        />
    </FormField>



























    <FormField
        label="SickDays"
    >
        <Field
            type="number"
            name="sick_days"
            placeholder="SickDays"
        />
    </FormField>



























    <FormField
        label="LeaveDays"
    >
        <Field
            type="number"
            name="leave_days"
            placeholder="LeaveDays"
        />
    </FormField>



























    <FormField
        label="AbsentDays"
    >
        <Field
            type="number"
            name="absent_days"
            placeholder="AbsentDays"
        />
    </FormField>



























    <FormField
        label="LateCount"
    >
        <Field
            type="number"
            name="late_count"
            placeholder="LateCount"
        />
    </FormField>



























    <FormField
        label="LateMinutesTotal"
    >
        <Field
            type="number"
            name="late_minutes_total"
            placeholder="LateMinutesTotal"
        />
    </FormField>



























    <FormField
        label="BaseSalary(Monthly)"
    >
        <Field
            type="number"
            name="base_salary_monthly"
            placeholder="BaseSalary(Monthly)"
        />
    </FormField>



























    <FormField
        label="DailyRate"
    >
        <Field
            type="number"
            name="daily_rate"
            placeholder="DailyRate"
        />
    </FormField>



























    <FormField
        label="BaseSalaryTotal"
    >
        <Field
            type="number"
            name="base_salary_total"
            placeholder="BaseSalaryTotal"
        />
    </FormField>



























    <FormField
        label="Meal+TransportTotal"
    >
        <Field
            type="number"
            name="meal_transport_total"
            placeholder="Meal+TransportTotal"
        />
    </FormField>



























    <FormField
        label="PositionAllowanceTotal"
    >
        <Field
            type="number"
            name="position_allowance_total"
            placeholder="PositionAllowanceTotal"
        />
    </FormField>



























    <FormField
        label="KPIScore"
    >
        <Field
            type="number"
            name="kpi_score"
            placeholder="KPIScore"
        />
    </FormField>



























    <FormField
        label="KPIAllowanceTotal"
    >
        <Field
            type="number"
            name="kpi_allowance_total"
            placeholder="KPIAllowanceTotal"
        />
    </FormField>



























    <FormField
        label="OvertimeHoursTotal"
    >
        <Field
            type="number"
            name="overtime_hours_total"
            placeholder="OvertimeHoursTotal"
        />
    </FormField>



























    <FormField
        label="OvertimeRate"
    >
        <Field
            type="number"
            name="overtime_rate"
            placeholder="OvertimeRate"
        />
    </FormField>



























    <FormField
        label="OvertimeTotal"
    >
        <Field
            type="number"
            name="overtime_total"
            placeholder="OvertimeTotal"
        />
    </FormField>



























    <FormField
        label="RevenueBonusTotal"
    >
        <Field
            type="number"
            name="revenue_bonus_total"
            placeholder="RevenueBonusTotal"
        />
    </FormField>



























    <FormField
        label="ServiceChargeTotal"
    >
        <Field
            type="number"
            name="service_charge_total"
            placeholder="ServiceChargeTotal"
        />
    </FormField>



























    <FormField
        label="DeductionTotal"
    >
        <Field
            type="number"
            name="deduction_total"
            placeholder="DeductionTotal"
        />
    </FormField>



























    <FormField
        label="TakeHomePay"
    >
        <Field
            type="number"
            name="take_home_pay"
            placeholder="TakeHomePay"
        />
    </FormField>



































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="hr_reviewed">hr_reviewed</option>
      
        <option value="approved">approved</option>
      
        <option value="paid">paid</option>
      
      </Field>
  </FormField>















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

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

export default Payroll_itemsNew
