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