date picker
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import Button from '@/components/Button'
|
||||
import Table from '@/components/Table'
|
||||
import Filters, { type FilterValues, type FieldType } from '@/components/Filters'
|
||||
import { Add, Eye } from 'iconsax-react'
|
||||
import { Add } from 'iconsax-react'
|
||||
import { type FC, useState, useMemo, useCallback } from 'react'
|
||||
import { Pages } from '@/config/Pages'
|
||||
import { Link } from 'react-router-dom'
|
||||
@@ -118,11 +118,6 @@ const CustomersList: FC = () => {
|
||||
{
|
||||
key: 'details',
|
||||
title: 'جزئیات',
|
||||
render: (item: CustomerListRow) => (
|
||||
<Link to={`${Pages.customers.detail}${item.id}`} className='inline-flex items-center justify-center'>
|
||||
<Eye size={20} color="#8C90A3" />
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
], [])
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { type FC } from 'react'
|
||||
import { TicketDiscount } from 'iconsax-react'
|
||||
|
||||
interface DiscountCode {
|
||||
id: string
|
||||
@@ -81,10 +80,10 @@ const DiscountCodesTable: FC = () => {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button className='w-full mt-4 bg-black text-white rounded-xl py-3 flex items-center justify-center gap-2 text-xs font-light hover:bg-gray-800 transition-colors'>
|
||||
{/* <button className='w-full mt-4 bg-black text-white rounded-xl py-3 flex items-center justify-center gap-2 text-xs font-light hover:bg-gray-800 transition-colors'>
|
||||
<TicketDiscount size={16} />
|
||||
<span>اضافه کردن کد تخفیف</span>
|
||||
</button>
|
||||
</button> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Tabs from '@/components/Tabs'
|
||||
import { KeySquare, Money2, Setting4, TruckFast } from 'iconsax-react'
|
||||
import { Money2, Setting4 } from 'iconsax-react'
|
||||
import { useState, type FC } from 'react'
|
||||
import { SettingTabEnum } from './enum/Enum'
|
||||
import GeneralSettings from './GeneralSettings'
|
||||
@@ -21,21 +21,11 @@ const Setting: FC = () => {
|
||||
label: 'عمومی',
|
||||
value: SettingTabEnum.GENERAL,
|
||||
},
|
||||
{
|
||||
icon: <KeySquare color={activeTab === SettingTabEnum.PASSWORD ? 'black' : '#8C90A3'} size={24} />,
|
||||
label: 'رمز عبور',
|
||||
value: SettingTabEnum.PASSWORD,
|
||||
},
|
||||
{
|
||||
icon: <Money2 color={activeTab === SettingTabEnum.FINANCIAL ? 'black' : '#8C90A3'} size={24} />,
|
||||
label: 'تنظیمات امتیاز',
|
||||
value: SettingTabEnum.FINANCIAL,
|
||||
},
|
||||
{
|
||||
icon: <TruckFast color={activeTab === SettingTabEnum.DELIVERY ? 'black' : '#8C90A3'} size={24} />,
|
||||
label: 'روش های ارسال',
|
||||
value: SettingTabEnum.DELIVERY,
|
||||
},
|
||||
]}
|
||||
onChange={(value: string) => setActiveTab(value as SettingTabEnum)}
|
||||
active={activeTab}
|
||||
|
||||
@@ -14,6 +14,7 @@ import Button from '@/components/Button'
|
||||
import { useGetPaymentsChart } from '../hooks/useStatsData'
|
||||
import { formatPrice } from '@/helpers/func'
|
||||
import PageLoading from '@/components/PageLoading'
|
||||
import moment from 'moment-jalaali'
|
||||
|
||||
const RevenueChart: FC = () => {
|
||||
const [selectedTab] = useState<
|
||||
@@ -22,6 +23,12 @@ const RevenueChart: FC = () => {
|
||||
const [startDate, setStartDate] = useState<string>('')
|
||||
const [endDate, setEndDate] = useState<string>('')
|
||||
|
||||
const convertToPersian = (gregorianDate: string | null | undefined): string | undefined => {
|
||||
if (!gregorianDate) return undefined
|
||||
const persianDate = moment(gregorianDate, 'YYYY-MM-DD').format('jYYYY-jMM-jDD')
|
||||
return persianDate
|
||||
}
|
||||
|
||||
const apiParams = useMemo(() => {
|
||||
const params: {
|
||||
period?: 'daily' | 'monthly' | 'yearly';
|
||||
@@ -177,14 +184,6 @@ const RevenueChart: FC = () => {
|
||||
)
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className='bg-white rounded-3xl p-6 shadow-sm h-full overflow-visible flex items-center justify-center min-h-[600px]'>
|
||||
<PageLoading />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='bg-white rounded-3xl p-6 shadow-sm h-full overflow-visible'>
|
||||
{/* Header */}
|
||||
@@ -198,11 +197,13 @@ const RevenueChart: FC = () => {
|
||||
<DatePicker
|
||||
label='تاریخ شروع'
|
||||
placeholder='انتخاب تاریخ شروع'
|
||||
defaulValue={convertToPersian(startDate)}
|
||||
onChange={setStartDate}
|
||||
/>
|
||||
<DatePicker
|
||||
label='تاریخ پایان'
|
||||
placeholder='انتخاب تاریخ پایان'
|
||||
defaulValue={convertToPersian(endDate)}
|
||||
onChange={setEndDate}
|
||||
/>
|
||||
<Button className=''>
|
||||
@@ -304,7 +305,11 @@ const RevenueChart: FC = () => {
|
||||
</div>
|
||||
|
||||
{/* نمودار */}
|
||||
{chartData.length === 0 ? (
|
||||
{isLoading ? (
|
||||
<div className='w-full h-[400px] min-h-[400px] flex items-center justify-center'>
|
||||
<PageLoading />
|
||||
</div>
|
||||
) : chartData.length === 0 ? (
|
||||
<div className='w-full h-[400px] min-h-[400px] flex items-center justify-center text-gray-500'>
|
||||
دادهای برای نمایش وجود ندارد
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user