efril #3
@ -14,7 +14,7 @@ import ReportHeader from '@/views/dashboards/daily-report/report-header'
|
||||
import React, { useEffect, useRef, useState } from 'react'
|
||||
|
||||
const DailyPOSReport = () => {
|
||||
const reportRef = useRef<HTMLElement | null>(null)
|
||||
const reportRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
const [now, setNow] = useState(new Date())
|
||||
const [selectedDate, setSelectedDate] = useState(new Date())
|
||||
@ -22,7 +22,7 @@ const DailyPOSReport = () => {
|
||||
startDate: new Date(),
|
||||
endDate: new Date()
|
||||
})
|
||||
const [filterType, setFilterType] = useState('single') // 'single' or 'range'
|
||||
const [filterType, setFilterType] = useState<'single' | 'range'>('single') // 'single' or 'range'
|
||||
|
||||
// Use selectedDate for single date filter, or dateRange for range filter
|
||||
const getDateParams = () => {
|
||||
|
||||
@ -1,14 +1,25 @@
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
import React, { useState } from 'react'
|
||||
import { useProfitLossAnalytics } from '../../../../../../services/queries/analytics'
|
||||
import { formatShortCurrency } from '../../../../../../utils/transform'
|
||||
import { formatDateDDMMYYYY, formatShortCurrency } from '../../../../../../utils/transform'
|
||||
import MultipleSeries from '../../../../../../views/dashboards/profit-loss/EarningReportWithTabs'
|
||||
import { DailyData, ProfitLossReport } from '../../../../../../types/services/analytic'
|
||||
import { TextField, Typography, useTheme } from '@mui/material'
|
||||
|
||||
const DashboardProfitloss = () => {
|
||||
const theme = useTheme()
|
||||
|
||||
const [filter, setFilter] = useState({
|
||||
date_from: new Date().setDate(new Date().getDate() - 30).toString(),
|
||||
date_to: new Date().toString()
|
||||
})
|
||||
|
||||
// Sample data - replace with your actual data
|
||||
const { data: profitData, isLoading } = useProfitLossAnalytics()
|
||||
const { data: profitData, isLoading } = useProfitLossAnalytics({
|
||||
date_from: formatDateDDMMYYYY(filter.date_from),
|
||||
date_to: formatDateDDMMYYYY(filter.date_to)
|
||||
})
|
||||
|
||||
const formatCurrency = (amount: any) => {
|
||||
return new Intl.NumberFormat('id-ID', {
|
||||
@ -91,11 +102,45 @@ const DashboardProfitloss = () => {
|
||||
{profitData && (
|
||||
<div>
|
||||
{/* Header */}
|
||||
<div className='mb-8'>
|
||||
<h1 className='text-3xl font-bold text-gray-900 mb-2'>Profit Analysis Dashboard</h1>
|
||||
<p className='text-gray-600'>
|
||||
{formatDate(profitData.date_from)} - {formatDate(profitData.date_to)}
|
||||
</p>
|
||||
<div className='mb-8 flex gap-4 items-center justify-between'>
|
||||
<Typography variant='h1' className='text-3xl font-bold text-gray-900 mb-2'>
|
||||
Profit Analysis Dashboard
|
||||
</Typography>
|
||||
<div className='flex items-center gap-4'>
|
||||
<TextField
|
||||
type='date'
|
||||
value={new Date(profitData.date_from).toISOString().split('T')[0]}
|
||||
onChange={e => {}}
|
||||
size='small'
|
||||
sx={{
|
||||
'& .MuiOutlinedInput-root': {
|
||||
'&.Mui-focused fieldset': {
|
||||
borderColor: 'primary.main'
|
||||
},
|
||||
'& fieldset': {
|
||||
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Typography>-</Typography>
|
||||
<TextField
|
||||
type='date'
|
||||
value={new Date(profitData.date_to).toISOString().split('T')[0]}
|
||||
onChange={e => {}}
|
||||
size='small'
|
||||
sx={{
|
||||
'& .MuiOutlinedInput-root': {
|
||||
'&.Mui-focused fieldset': {
|
||||
borderColor: 'primary.main'
|
||||
},
|
||||
'& fieldset': {
|
||||
borderColor: theme.palette.mode === 'dark' ? 'rgba(231, 227, 252, 0.22)' : theme.palette.divider
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Summary Metrics */}
|
||||
|
||||
@ -92,40 +92,39 @@ const VerticalMenu = ({ dictionary, scrollMenu }: Props) => {
|
||||
</SubMenu>
|
||||
<MenuSection label={dictionary['navigation'].appsPages}>
|
||||
<SubMenu label={dictionary['navigation'].inventory} icon={<i className='tabler-salad' />}>
|
||||
{/* <MenuItem href={`/${locale}/apps/ecommerce/dashboard`}>{dictionary['navigation'].dashboard}</MenuItem> */}
|
||||
<SubMenu label={dictionary['navigation'].products}>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/products/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/products/${params.id}/detail`}>
|
||||
<MenuItem href={`/${locale}/apps/inventory/products/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/inventory/products/${params.id}/detail`}>
|
||||
{dictionary['navigation'].details}
|
||||
</MenuItem>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/products/${params.id}/edit`}>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/inventory/products/${params.id}/edit`}>
|
||||
{dictionary['navigation'].edit}
|
||||
</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/products/add`}>{dictionary['navigation'].add}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/products/category`}>
|
||||
<MenuItem href={`/${locale}/apps/inventory/products/add`}>{dictionary['navigation'].add}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/inventory/products/category`}>
|
||||
{dictionary['navigation'].category}
|
||||
</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/products/units`}>{dictionary['navigation'].units}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/products/ingredients`}>
|
||||
<MenuItem href={`/${locale}/apps/inventory/products/units`}>{dictionary['navigation'].units}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/inventory/products/ingredients`}>
|
||||
{dictionary['navigation'].ingredients}
|
||||
</MenuItem>
|
||||
</SubMenu>
|
||||
<SubMenu label={dictionary['navigation'].orders}>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/orders/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/ecommerce/orders/${params.id}/details`}>
|
||||
<MenuItem href={`/${locale}/apps/inventory/orders/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem className='hidden' href={`/${locale}/apps/inventory/orders/${params.id}/details`}>
|
||||
{dictionary['navigation'].details}
|
||||
</MenuItem>
|
||||
</SubMenu>
|
||||
<SubMenu label={dictionary['navigation'].customers}>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/customers/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/inventory/customers/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
</SubMenu>
|
||||
<SubMenu label={dictionary['navigation'].stock}>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/inventory/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/ecommerce/inventory/adjustment`}>
|
||||
{dictionary['navigation'].adjustment}
|
||||
<MenuItem href={`/${locale}/apps/inventory/stock/list`}>{dictionary['navigation'].list}</MenuItem>
|
||||
<MenuItem href={`/${locale}/apps/inventory/stock/restock`}>
|
||||
{dictionary['navigation'].restock}
|
||||
</MenuItem>
|
||||
</SubMenu>
|
||||
{/* <MenuItem href={`/${locale}/apps/ecommerce/settings`}>{dictionary['navigation'].settings}</MenuItem> */}
|
||||
{/* <MenuItem href={`/${locale}/apps/inventory/settings`}>{dictionary['navigation'].settings}</MenuItem> */}
|
||||
</SubMenu>
|
||||
<SubMenu label={dictionary['navigation'].organization} icon={<i className='tabler-sitemap' />}>
|
||||
<SubMenu label={dictionary['navigation'].outlet}>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"products": "منتجات",
|
||||
"list": "قائمة",
|
||||
"add": "يضيف",
|
||||
"adjustment": "تعديل",
|
||||
"restock": "استرجاع",
|
||||
"category": "فئة",
|
||||
"overview": "نظرة عامة",
|
||||
"profitloss": "الربح والخسارة",
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"products": "Products",
|
||||
"list": "List",
|
||||
"add": "Add",
|
||||
"adjustment": "Adjustment",
|
||||
"restock": "Re stock",
|
||||
"category": "Category",
|
||||
"overview": "Overview",
|
||||
"profitloss": "Profit Loss",
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"products": "Produits",
|
||||
"list": "Liste",
|
||||
"add": "Ajouter",
|
||||
"adjustment": "Ajustement",
|
||||
"restock": "Rapprocher",
|
||||
"category": "Catégorie",
|
||||
"overview": "Aperçu",
|
||||
"profitloss": "Profit et perte",
|
||||
|
||||
@ -96,7 +96,7 @@ const AdjustmentStockDrawer = (props: Props) => {
|
||||
sx={{ '& .MuiDrawer-paper': { width: { xs: 300, sm: 400 } } }}
|
||||
>
|
||||
<div className='flex items-center justify-between pli-6 plb-5'>
|
||||
<Typography variant='h5'>Adjust Inventory</Typography>
|
||||
<Typography variant='h5'>Re Stock</Typography>
|
||||
<IconButton size='small' onClick={handleReset}>
|
||||
<i className='tabler-x text-textSecondary text-2xl' />
|
||||
</IconButton>
|
||||
|
||||
@ -237,7 +237,7 @@ const StockListTable = () => {
|
||||
onClick={() => setAddInventoryOpen(!addInventoryOpen)}
|
||||
startIcon={<i className='tabler-plus' />}
|
||||
>
|
||||
Adjust Stock
|
||||
Re Stock
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user