'use client'

import DateRangePicker from '@/components/RangeDatePicker'
import { ReportItem, ReportItemFooter, ReportItemHeader, ReportItemSubheader } from '@/components/report/ReportItem'
import { Button, Card, CardContent, Paper } from '@mui/material'
import { useState } from 'react'

const ReportNeracaContent = () => {
  const [startDate, setStartDate] = useState<Date | null>(new Date())
  const [endDate, setEndDate] = useState<Date | null>(new Date())

  return (
    <Card>
      <div className='p-6 border-be'>
        <div className='flex items-center justify-end gap-2'>
          <Button
            color='secondary'
            variant='tonal'
            startIcon={<i className='tabler-upload' />}
            className='max-sm:is-full'
          >
            Ekspor
          </Button>
          <DateRangePicker
            startDate={startDate}
            endDate={endDate}
            onStartDateChange={setStartDate}
            onEndDateChange={setEndDate}
          />
        </div>
      </div>
      <CardContent>
        <ReportItemHeader title='Aset' date='11/09/2025' />
        <ReportItemSubheader title='Kas & Bank' />
        <ReportItem accountCode='1-10001' accountName='Kas' amount={39705850} onClick={() => {}} />
        <ReportItem accountCode='1-10002' accountName='Rekening Bank' amount={33335787} onClick={() => {}} />
        <ReportItem accountCode='1-10003' accountName='Giro' amount={30631261} onClick={() => {}} />
        <ReportItem accountCode='1-10003' accountName='Giro' amount={30631261} onClick={() => {}} />
        <ReportItemFooter title='Total Kas & Bank' amount={103672897} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Aset Lancar' />
        <ReportItem accountCode='1-10100' accountName='Piutang Usaha' amount={49601559} onClick={() => {}} />
        <ReportItem accountCode='1-10102' accountName='Cadangan Kerugian Piutang' amount={5930450} onClick={() => {}} />
        <ReportItem accountCode='1-10200' accountName='Persediaan Barang' amount={14536046} onClick={() => {}} />
        <ReportItem accountCode='1-10402' accountName='Biaya Dibayar Di Muka' amount={-77477} onClick={() => {}} />
        <ReportItem accountCode='1-10500' accountName='PPN Masukan' amount={4559934} onClick={() => {}} />
        <ReportItem
          accountCode='1-10501'
          accountName='Pajak Dibayar Di Muka - PPh 22'
          amount={-21622}
          onClick={() => {}}
        />
        <ReportItemFooter title='Total Aset Lancar' amount={74528890} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Aset Tetap' />
        <ReportItem accountCode='1-10700' accountName='Aset Tetap - Tanah' amount={17900000} onClick={() => {}} />
        <ReportItem accountCode='1-10701' accountName='Aset Tetap - Bangunan' amount={-21622} onClick={() => {}} />
        <ReportItemFooter title='Total Aset Tetap' amount={17878378} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Depresiasi & Amortisasi' />
        <ReportItem
          accountCode='1-10753'
          accountName='Akumulasi penyusutan - Kendaraan'
          amount={-45946}
          onClick={() => {}}
        />
        <ReportItem accountCode='1-10757' accountName='Akumulasi Amortisasi' amount={19820} onClick={() => {}} />
        <ReportItemFooter title='Total Depresiasi & Amortisasi' amount={-26126} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Lainnya' />
        <ReportItemFooter title='Total Lainnya' amount={0} />
        <ReportItemSubheader title='' />

        <ReportItemFooter title='Total Aset' amount={196054040} />
        <ReportItemSubheader title='' />

        <ReportItemHeader title='Liabilities and Modal' date='11/09/2025' />
        <ReportItemSubheader title='Liabilitas Jangka Pendek' />
        <ReportItem accountCode='2-20100' accountName='Hutang Usaha' amount={43333108} onClick={() => {}} />
        <ReportItem accountCode='2-20101' accountName='Hutang Belum Ditagih' amount={10367721} onClick={() => {}} />
        <ReportItem accountCode='2-20500' accountName='PPN Keluaran' amount={14933183} onClick={() => {}} />
        <ReportItemFooter title='Total Liabilitas Jangka Pendek' amount={68634012} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Liabilitas Jangka Panjang' />
        <ReportItemFooter title='Total Liabilitas Jangka Panjang' amount={0} />
        <ReportItemSubheader title='' />

        <ReportItemSubheader title='Perubahan Modal' />
        <ReportItem accountCode='3-30000' accountName='Modal Saham' amount={83665766} onClick={() => {}} />
        <ReportItem
          accountCode='3-30300'
          accountName='Pendapatan Komprehensif Lainnya'
          amount={-78378}
          onClick={() => {}}
        />
        <ReportItem accountCode='' accountName='Pendapatan sampai periode terakhir' amount={0} onClick={() => {}} />
        <ReportItem accountCode='' accountName='Pendapatan periode ini' amount={43832641} onClick={() => {}} />
        <ReportItemFooter title='Total Perubahan Modal' amount={127420028} />
        <ReportItemSubheader title='' />

        <ReportItemFooter title='Total Liabilitas and Modal' amount={196054040} />
        <ReportItemSubheader title='' />
      </CardContent>
    </Card>
  )
}

export default ReportNeracaContent
