product list
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { Fragment } from 'react'
|
||||
import { Switch } from '@headlessui/react'
|
||||
import MoonLoader from 'react-spinners/MoonLoader'
|
||||
|
||||
interface Props {
|
||||
active: boolean,
|
||||
onChange: (value: boolean) => void,
|
||||
isLoading?: boolean,
|
||||
label?: string,
|
||||
}
|
||||
|
||||
const SwitchComponent = (props: Props) => {
|
||||
|
||||
const handleChange = (value: boolean) => {
|
||||
props.onChange(value)
|
||||
}
|
||||
|
||||
if (props.isLoading) {
|
||||
return (
|
||||
<MoonLoader size={20} color='black' className='ml-4' />
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='dltr w-fit flex gap-2 items-center'>
|
||||
<Switch checked={props.active} onChange={handleChange} as={Fragment}>
|
||||
{({ checked }) => (
|
||||
<button
|
||||
className={`${checked ? 'bg-primary' : 'bg-gray-200'
|
||||
} relative inline-flex h-6 w-11 items-center rounded-full`}
|
||||
>
|
||||
<span className="sr-only">Enable notifications</span>
|
||||
<span
|
||||
className={`${checked ? 'translate-x-6' : 'translate-x-1'
|
||||
} inline-block h-4 w-4 transform rounded-full bg-white transition`}
|
||||
/>
|
||||
</button>
|
||||
)}
|
||||
</Switch>
|
||||
{
|
||||
props.label &&
|
||||
<div className='text-sm'>
|
||||
: {props.label}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default SwitchComponent
|
||||
@@ -2,6 +2,12 @@ export const Paths = {
|
||||
requests: {
|
||||
list: '/requests',
|
||||
},
|
||||
product: {
|
||||
list: '/product/list'
|
||||
},
|
||||
order: {
|
||||
list: '/order/list'
|
||||
},
|
||||
home: '/home',
|
||||
myOrders: '/my-orders',
|
||||
proformaInvoice: '/proforma-invoice',
|
||||
|
||||
@@ -75,3 +75,7 @@ tbody tr:nth-child(odd) {
|
||||
.rowTwoInput {
|
||||
@apply flex flex-col items-start sm:flex-row sm:gap-5 gap-5;
|
||||
}
|
||||
|
||||
.dltr {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { type FC } from 'react'
|
||||
|
||||
const OrdersList: FC = () => {
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<h1 className='text-lg font-light'>سفارش ها</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default OrdersList
|
||||
@@ -1,118 +0,0 @@
|
||||
import Tabs from '@/components/Tabs'
|
||||
import { useState, type FC } from 'react'
|
||||
import { TabMyOrdersEnum } from './enum/OrderEnum'
|
||||
import Filters from '@/components/Filters'
|
||||
import Button from '@/components/Button'
|
||||
import { AddSquare } from 'iconsax-react'
|
||||
import Table from '@/components/Table'
|
||||
|
||||
const MyOrders: FC = () => {
|
||||
|
||||
const [activeTab, setActiveTab] = useState<TabMyOrdersEnum>(TabMyOrdersEnum.ALL)
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<h1>
|
||||
سفارشات من
|
||||
</h1>
|
||||
|
||||
<div className='mt-10'>
|
||||
<Tabs
|
||||
items={[
|
||||
{ label: 'همه', value: TabMyOrdersEnum.ALL },
|
||||
{ label: 'در حال انجام', value: TabMyOrdersEnum.IN_PROGRESS },
|
||||
{ label: 'تایید شده', value: TabMyOrdersEnum.CONFIRMED },
|
||||
{ label: 'تحویل داده شده', value: TabMyOrdersEnum.DELIVERED },
|
||||
{ label: 'کنسل شده', value: TabMyOrdersEnum.CANCELLED },
|
||||
]}
|
||||
activeTab={activeTab}
|
||||
onTabChange={(tab) => setActiveTab(tab as TabMyOrdersEnum)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-16 flex justify-between items-center'>
|
||||
<Filters
|
||||
fields={[
|
||||
{ type: 'input', name: 'search', placeholder: 'جستجو' },
|
||||
{ type: 'date', name: 'date', placeholder: 'تاریخ' },
|
||||
{
|
||||
type: 'select', name: 'status', placeholder: 'وضعیت', options: [
|
||||
{ label: 'همه', value: 'all' },
|
||||
{ label: 'در حال انجام', value: 'in_progress' },
|
||||
{ label: 'تایید شده', value: 'confirmed' },
|
||||
{ label: 'تحویل داده شده', value: 'delivered' },
|
||||
{ label: 'کنسل شده', value: 'cancelled' },
|
||||
]
|
||||
},
|
||||
]}
|
||||
onChange={() => { }}
|
||||
/>
|
||||
|
||||
<Button
|
||||
className='w-fit px-5'
|
||||
>
|
||||
<div className='flex items-center gap-2'>
|
||||
<AddSquare
|
||||
size={16}
|
||||
color='#000000'
|
||||
/>
|
||||
<span>
|
||||
سفارش جدید
|
||||
</span>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className='mt-10'>
|
||||
<Table
|
||||
columns={[
|
||||
{
|
||||
key: 'id',
|
||||
title: 'شماره',
|
||||
},
|
||||
{
|
||||
key: 'title',
|
||||
title: 'عنوان',
|
||||
},
|
||||
{
|
||||
key: 'createdAt',
|
||||
title: 'زمان ثبت سفارش',
|
||||
},
|
||||
{
|
||||
key: 'designer',
|
||||
title: 'طراح',
|
||||
},
|
||||
{
|
||||
key: 'type',
|
||||
title: 'نوع سفارش',
|
||||
},
|
||||
{
|
||||
key: 'itemsCount',
|
||||
title: 'تعداد اقلام',
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: 'وضعیت سفارش',
|
||||
},
|
||||
{
|
||||
key: 'actions',
|
||||
title: '',
|
||||
}
|
||||
]}
|
||||
data={[
|
||||
{
|
||||
id: 1,
|
||||
title: 'سفارش 1',
|
||||
createdAt: '2021-01-01',
|
||||
designer: 'طراح 1',
|
||||
type: 'نوع 1',
|
||||
itemsCount: 10,
|
||||
status: 'در حال انجام',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default MyOrders
|
||||
@@ -1,73 +0,0 @@
|
||||
import Button from '@/components/Button'
|
||||
import Input from '@/components/Input'
|
||||
import Select from '@/components/Select'
|
||||
import UploadBox from '@/components/UploadBox'
|
||||
import VoiceRecorder from '@/components/VoiceRecorder'
|
||||
import { COLORS } from '@/constants/colors'
|
||||
import { AddSquare } from 'iconsax-react'
|
||||
import { type FC } from 'react'
|
||||
|
||||
const NewOrder: FC = () => {
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<h1 className='text-lg font-light'>
|
||||
سفارش جدید
|
||||
</h1>
|
||||
|
||||
<div className='bg-white rounded-3xl p-6 mt-8'>
|
||||
<div className='font-light'>اطلاعات سفارش</div>
|
||||
|
||||
<div className='mt-6'>
|
||||
<Select
|
||||
items={[]}
|
||||
label='محصول'
|
||||
placeholder='انتخاب محصول'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-6 rowTwoInput'>
|
||||
<Select
|
||||
items={[]}
|
||||
label='تعداد'
|
||||
placeholder='انتخاب'
|
||||
/>
|
||||
|
||||
<Input
|
||||
label='انتخاب دلخواه'
|
||||
placeholder='100'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-6'>
|
||||
<VoiceRecorder
|
||||
label='پیام صوتی'
|
||||
onRecordingComplete={(blob) => {
|
||||
console.log('ضبط صدا تکمیل شد:', blob)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-6'>
|
||||
<UploadBox
|
||||
label='فایل های ضبط شده'
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-6 flex justify-end'>
|
||||
<Button
|
||||
className='bg-transparent border border-primary text-primary w-fit px-6'
|
||||
>
|
||||
<div className='flex gap-1'>
|
||||
<AddSquare color={COLORS.primary} size={20} />
|
||||
<div>
|
||||
اضافه کردن
|
||||
</div>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default NewOrder
|
||||
@@ -1,154 +0,0 @@
|
||||
import { type FC, useState } from 'react'
|
||||
import { Microphone, Paperclip2, Receipt1 } from 'iconsax-react'
|
||||
import Button from '@/components/Button'
|
||||
import UploadBox from '@/components/UploadBox'
|
||||
import Input from '@/components/Input'
|
||||
|
||||
const OrderDetail: FC = () => {
|
||||
const [message, setMessage] = useState('')
|
||||
const [files, setFiles] = useState<File[]>([])
|
||||
|
||||
const orderData = {
|
||||
orderId: '۱۲۲۴۵',
|
||||
title: 'شاپینگ بک',
|
||||
designer: 'عباس حسینی',
|
||||
quantity: '۱۰۰',
|
||||
estimatedDate: '۱۴۰۵/۰۶/۰۶/۱۳',
|
||||
description: 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است، چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است، و برای شرایط فعلی تکنولوژی مورد نیاز، و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد، کتابهای زیادی در شصت و سه درصد گذشته حال و آینده، شناخت فراوان جامعه و متخصصان را می طلبد، تا با نرم افزارها شناخت بیشتری را برای طراحان رایانه ای علی الخصوص طراحان خلاق...'
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
console.log('Submit:', { message, files })
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="w-full min-h-screen bg-[#eceef6] p-6">
|
||||
{/* Header Section */}
|
||||
<div className="flex items-start justify-between mb-6">
|
||||
|
||||
|
||||
<div className="text-sm text-[#8C90A3]">
|
||||
سفارش #{orderData.orderId}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Order Information Section */}
|
||||
<div className="bg-white rounded-2xl p-6 mb-6">
|
||||
<div className='flex justify-between items-center'>
|
||||
<h2 className="text-lg font-light mb-6">اطلاعات سفارش</h2>
|
||||
|
||||
<a href="#" className="flex items-center gap-2 text-[#0037FF] text-sm">
|
||||
<Receipt1 size={20} color="#3B82F6" />
|
||||
<span>پیش فاکتور</span>
|
||||
</a>
|
||||
</div>
|
||||
<div className="flex items-center gap-6">
|
||||
{/* Product Image */}
|
||||
<div className='size-[86px] rounded-lg bg-gray-200'>
|
||||
</div>
|
||||
|
||||
{/* Order Details */}
|
||||
<div className="flex-1 flex gap-20 pr-10">
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className="text-xs text-desc">عنوان:</div>
|
||||
<div className="text-sm font-medium text-black">{orderData.title}</div>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className="text-xs text-desc">نام طرح:</div>
|
||||
<div className="text-sm font-medium text-black">{orderData.designer}</div>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className="text-xs text-desc">تعداد:</div>
|
||||
<div className="text-sm font-medium text-black">{orderData.quantity}</div>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className="text-xs text-desc">تخمین زمان:</div>
|
||||
<div className="text-sm font-medium text-black">{orderData.estimatedDate}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Order Description */}
|
||||
<div className="mt-6 pt-6 border-t border-dashed border-desc">
|
||||
<div className="text-sm font-medium mb-2 text-desc">شرح سفارش:</div>
|
||||
<p className="text-sm font-light text-black leading-6">
|
||||
{orderData.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom Section - White Card */}
|
||||
<div className="bg-white rounded-2xl p-6">
|
||||
{/* Designer Name */}
|
||||
<div className="mt-6">
|
||||
<Input
|
||||
label="نام طراح"
|
||||
placeholder="عباس حسینی"
|
||||
readOnly
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='bg-[#F5F7FC] rounded-4xl rounded-tr-none mt-6 p-6 max-w-[55%]'>
|
||||
<div className='text-sm font-light text-black leading-6'>
|
||||
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است، چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است، و برای شرایط فعلی تکنولوژی مورد نیاز، و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد، کتابهای زیادی در شصت و سه درصد گذشته حال و آینده، شناخت فراوان جامعه و متخصصان را می طلبد،
|
||||
</div>
|
||||
|
||||
<div className='flex justify-between mt-3'>
|
||||
<div className='flex items-center gap-1.5 text-[#0047FF]'>
|
||||
<Paperclip2 size={20} color="#0047FF" />
|
||||
<div className='text-xs'>loremipsum.pdf</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex justify-end'>'
|
||||
<div className='bg-[#F5F7FC] rounded-4xl rounded-tl-none mt-6 p-6 max-w-[55%]'>
|
||||
<div className='flex gap-1 text-sm mb-2'>
|
||||
<div className='font-bold'>طراح : </div>
|
||||
<div>عباس حسینی</div>
|
||||
</div>
|
||||
<div className='text-sm font-light text-black leading-6'>
|
||||
لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ، و با استفاده از طراحان گرافیک است، چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است، و برای شرایط فعلی تکنولوژی مورد نیاز، و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد، کتابهای زیادی در شصت و سه درصد گذشته حال و آینده، شناخت فراوان جامعه و متخصصان را می طلبد،
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div className="mt-6">
|
||||
<div className="text-sm mb-2 text-black">پیام شما</div>
|
||||
<div className="relative">
|
||||
<textarea
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
className="w-full h-40 bg-white border border-[#f5f7fc] rounded-xl p-4 text-sm resize-none outline-none"
|
||||
placeholder=""
|
||||
/>
|
||||
<button className="absolute left-4 bottom-4 bg-[#FFF1D7] size-8 rounded-lg flex items-center justify-center">
|
||||
<Microphone size={20} color="black" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="mt-6">
|
||||
<UploadBox
|
||||
label="فایل های ضمیمه"
|
||||
isMultiple={true}
|
||||
onChange={setFiles}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex mt-10 justify-end">
|
||||
<Button
|
||||
label="ارسال"
|
||||
onClick={handleSubmit}
|
||||
className='w-[150px]'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default OrderDetail
|
||||
@@ -1,7 +0,0 @@
|
||||
export const enum TabMyOrdersEnum {
|
||||
ALL = "all",
|
||||
IN_PROGRESS = "in_progress",
|
||||
CONFIRMED = "confirmed",
|
||||
DELIVERED = "delivered",
|
||||
CANCELLED = "cancelled",
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
import Button from '@/components/Button'
|
||||
import Filters from '@/components/Filters'
|
||||
import SwitchComponent from '@/components/Switch'
|
||||
import Table from '@/components/Table'
|
||||
import { AddSquare, Edit, More2 } from 'iconsax-react'
|
||||
import { type FC } from 'react'
|
||||
|
||||
const ProductList: FC = () => {
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<div className='flex justify-between items-center'>
|
||||
<h1 className='text-lg font-light'>محصولات</h1>
|
||||
|
||||
<Button
|
||||
className='w-fit px-6'
|
||||
>
|
||||
<div className='flex gap-1.5'>
|
||||
<AddSquare size={18} color='black' />
|
||||
<div className='text-[13px] font-light'>محصول جدید</div>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className='mt-8'>
|
||||
<Filters
|
||||
fields={[
|
||||
{
|
||||
name: 'search',
|
||||
type: 'input',
|
||||
placeholder: 'جستجوی محصول'
|
||||
}
|
||||
]}
|
||||
onChange={() => { }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className='mt-8'>
|
||||
<Table
|
||||
columns={[
|
||||
{
|
||||
key: 'id',
|
||||
title: 'شماره',
|
||||
},
|
||||
{
|
||||
key: 'title',
|
||||
title: 'عنوان محصول',
|
||||
},
|
||||
{
|
||||
key: 'attribute',
|
||||
title: 'ویژگی ها',
|
||||
render: () => {
|
||||
return (
|
||||
<div className='flex text-[#0037FF] gap-2 items-center'>
|
||||
<More2 size={18} color='#0037FF' />
|
||||
<div className='text-[13px]'>ویژگی ها</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: 'وضعیت',
|
||||
render: () => {
|
||||
return (
|
||||
<SwitchComponent
|
||||
active={true}
|
||||
onChange={() => { }}
|
||||
/>
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'actions',
|
||||
title: '',
|
||||
render: () => {
|
||||
return (
|
||||
<Edit size={20} color='#0037FF' />
|
||||
)
|
||||
}
|
||||
},
|
||||
]}
|
||||
data={[
|
||||
{
|
||||
id: 1,
|
||||
title: 'محصول 1',
|
||||
attribute: 'رنگ: قرمز، سایز: متوسط',
|
||||
status: 'فعال',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: 'محصول 2',
|
||||
attribute: 'رنگ: آبی، سایز: بزرگ',
|
||||
status: 'غیرفعال',
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ProductList
|
||||
@@ -4,11 +4,10 @@ import Home from '../pages/home/Home'
|
||||
import SideBar from '../shared/Sidebar'
|
||||
import Header from '../shared/Header'
|
||||
import { Paths } from '@/config/Paths'
|
||||
import MyOrders from '@/pages/order/MyOrders'
|
||||
import ProformaInvoice from '@/pages/invoice/ProformaInvoice'
|
||||
import NewOrder from '@/pages/order/NewOrder'
|
||||
import OrderDetail from '@/pages/order/OrderDetail'
|
||||
import RequestList from '@/pages/requests/RequestList'
|
||||
import ProductList from '@/pages/product/List'
|
||||
import OrdersList from '@/pages/order/List'
|
||||
|
||||
const MainRouter: FC = () => {
|
||||
return (
|
||||
@@ -22,12 +21,11 @@ const MainRouter: FC = () => {
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path={Paths.home} element={<Home />} />
|
||||
<Route path={Paths.myOrders} element={<MyOrders />} />
|
||||
<Route path={Paths.proformaInvoice} element={<ProformaInvoice />} />
|
||||
<Route path={Paths.newOrder} element={<NewOrder />} />
|
||||
<Route path={`${Paths.orderDetails}:id`} element={<OrderDetail />} />
|
||||
|
||||
<Route path={Paths.requests.list} element={<RequestList />} />
|
||||
<Route path={Paths.product.list} element={<ProductList />} />
|
||||
<Route path={Paths.order.list} element={<OrdersList />} />
|
||||
</Routes>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user