Done
This commit is contained in:
parent
4edad39749
commit
77b8f31fc2
|
|
@ -8,14 +8,14 @@ const SearchField = ({ name, label, placeholder, isDisabled, searchBy, option, i
|
||||||
const [searchQuery, setSearchQuery] = useState<string>('');
|
const [searchQuery, setSearchQuery] = useState<string>('');
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(window?.location?.search);
|
||||||
setSearchQuery(searchParams?.get('search') || '');
|
setSearchQuery(searchParams?.get('search') || '');
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const SelecthandleChange = (value: { value: string; label: React.ReactNode }) => {
|
const SelecthandleChange = (value: { value: string; label: React.ReactNode }) => {
|
||||||
formik.setFieldValue(name, value);
|
formik?.setFieldValue(name, value);
|
||||||
|
|
||||||
};
|
};
|
||||||
const SearchHandleChange = (value:any) => {
|
const SearchHandleChange = (value:any) => {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
border: 2px solid var(--primary);
|
border: 2px solid var(--primary);
|
||||||
background-color: var(--primary);
|
background-color: var(--primary);
|
||||||
border-radius: 0.5vw;
|
border-radius: 0.5vw;
|
||||||
padding:.5vw 1vw;
|
height: 40px;
|
||||||
|
width: 70px;
|
||||||
font-size: 1vw ;
|
font-size: 1vw ;
|
||||||
display: flex; justify-content: center; align-items: center;
|
display: flex; justify-content: center; align-items: center;
|
||||||
box-shadow: 2px 2px 7px 0 var(--primary);
|
box-shadow: 2px 2px 7px 0 var(--primary);
|
||||||
|
|
|
||||||
28
src/Layout/Dashboard/AddButton/dist/AddButton.js
vendored
Normal file
28
src/Layout/Dashboard/AddButton/dist/AddButton.js
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
"use strict";
|
||||||
|
var __assign = (this && this.__assign) || function () {
|
||||||
|
__assign = Object.assign || function(t) {
|
||||||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||||
|
s = arguments[i];
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||||
|
t[p] = s[p];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
return __assign.apply(this, arguments);
|
||||||
|
};
|
||||||
|
exports.__esModule = true;
|
||||||
|
var react_1 = require("react");
|
||||||
|
require("./Add_Button.scss");
|
||||||
|
var react_i18next_1 = require("react-i18next");
|
||||||
|
var AddButton = function (props) {
|
||||||
|
var t = react_i18next_1.useTranslation()[0];
|
||||||
|
return (react_1["default"].createElement("div", __assign({ className: 'Add_Button' }, props),
|
||||||
|
react_1["default"].createElement("button", null,
|
||||||
|
react_1["default"].createElement("span", null,
|
||||||
|
react_1["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 24, height: 24 },
|
||||||
|
react_1["default"].createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
||||||
|
react_1["default"].createElement("path", { fill: "currentColor", d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z" })),
|
||||||
|
" ",
|
||||||
|
t("Add")))));
|
||||||
|
};
|
||||||
|
exports["default"] = AddButton;
|
||||||
25
src/Layout/Dashboard/AddButton/dist/AddButtonLayout.js
vendored
Normal file
25
src/Layout/Dashboard/AddButton/dist/AddButtonLayout.js
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
"use strict";
|
||||||
|
exports.__esModule = true;
|
||||||
|
var react_1 = require("react");
|
||||||
|
require("./Add_Button.scss");
|
||||||
|
var react_i18next_1 = require("react-i18next");
|
||||||
|
var LayoutPagestate_1 = require("../../../lib/state mangment/LayoutPagestate");
|
||||||
|
var AddButtonLayout = function (_a) {
|
||||||
|
var haveAddModal = _a.haveAddModal;
|
||||||
|
var _b = LayoutPagestate_1.usePageState(), setIsOpenAddModel = _b.setIsOpenAddModel, setObjectToEdit = _b.setObjectToEdit;
|
||||||
|
var t = react_i18next_1.useTranslation()[0];
|
||||||
|
return (react_1["default"].createElement("div", { className: 'Add_Button', onClick: function () {
|
||||||
|
if (haveAddModal) {
|
||||||
|
setIsOpenAddModel();
|
||||||
|
}
|
||||||
|
setObjectToEdit(null);
|
||||||
|
} },
|
||||||
|
react_1["default"].createElement("button", null,
|
||||||
|
react_1["default"].createElement("span", null,
|
||||||
|
react_1["default"].createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: 24, height: 24 },
|
||||||
|
react_1["default"].createElement("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
||||||
|
react_1["default"].createElement("path", { fill: "currentColor", d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z" })),
|
||||||
|
" ",
|
||||||
|
t("Add")))));
|
||||||
|
};
|
||||||
|
exports["default"] = AddButtonLayout;
|
||||||
33
src/Layout/Dashboard/AddButton/dist/Add_Button.css
vendored
Normal file
33
src/Layout/Dashboard/AddButton/dist/Add_Button.css
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
.Add_Button button {
|
||||||
|
border: 2px solid var(--primary);
|
||||||
|
background-color: var(--primary);
|
||||||
|
border-radius: 0.5vw;
|
||||||
|
font-size: 1vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
box-shadow: 2px 2px 7px 0 var(--primary);
|
||||||
|
height: 40px;
|
||||||
|
width:70px
|
||||||
|
|
||||||
|
}
|
||||||
|
.Add_Button button span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--bg);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.Add_Button button:hover {
|
||||||
|
background-color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 700px) {
|
||||||
|
.Add_Button button {
|
||||||
|
font-size: 2vw !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media screen and (max-width: 470px) {
|
||||||
|
.Add_Button button {
|
||||||
|
font-size: 3vw !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
45
src/Layout/Dashboard/AddButton/dist/dist/AddButton.dev.js
vendored
Normal file
45
src/Layout/Dashboard/AddButton/dist/dist/AddButton.dev.js
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __assign = void 0 && (void 0).__assign || function () {
|
||||||
|
__assign = Object.assign || function (t) {
|
||||||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||||
|
s = arguments[i];
|
||||||
|
|
||||||
|
for (var p in s) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
|
||||||
|
return __assign.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.__esModule = true;
|
||||||
|
|
||||||
|
var react_1 = require("react");
|
||||||
|
|
||||||
|
require("./Add_Button.scss");
|
||||||
|
|
||||||
|
var react_i18next_1 = require("react-i18next");
|
||||||
|
|
||||||
|
var AddButton = function AddButton(props) {
|
||||||
|
var t = react_i18next_1.useTranslation()[0];
|
||||||
|
return react_1["default"].createElement("div", __assign({
|
||||||
|
className: 'Add_Button'
|
||||||
|
}, props), react_1["default"].createElement("button", null, react_1["default"].createElement("span", null, react_1["default"].createElement("svg", {
|
||||||
|
xmlns: "http://www.w3.org/2000/svg",
|
||||||
|
viewBox: "0 0 24 24",
|
||||||
|
width: 24,
|
||||||
|
height: 24
|
||||||
|
}, react_1["default"].createElement("path", {
|
||||||
|
fill: "none",
|
||||||
|
d: "M0 0h24v24H0z"
|
||||||
|
}), react_1["default"].createElement("path", {
|
||||||
|
fill: "currentColor",
|
||||||
|
d: "M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"
|
||||||
|
})), " ", t("Add"))));
|
||||||
|
};
|
||||||
|
|
||||||
|
exports["default"] = AddButton;
|
||||||
47
src/Layout/Dashboard/SearchField.tsx
Normal file
47
src/Layout/Dashboard/SearchField.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
import { Input } from 'antd';
|
||||||
|
import { SearchProps } from 'antd/es/input'
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom';
|
||||||
|
const { Search } = Input;
|
||||||
|
|
||||||
|
const SearchField = ({searchBy } : any) => {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
const [searchParams,] = useSearchParams();
|
||||||
|
const location =useLocation()
|
||||||
|
const {t} = useTranslation();
|
||||||
|
console.log(searchBy,"searchBy");
|
||||||
|
|
||||||
|
|
||||||
|
const [searchValue, setSearchValue] = useState(searchParams.get('search')|| "");
|
||||||
|
|
||||||
|
const onSearch: SearchProps['onSearch'] = (value, _e, info) => {
|
||||||
|
// console.log(value);
|
||||||
|
|
||||||
|
navigate(`${location?.pathname}?${searchBy ?? "search"}=${value}`, { replace: true });
|
||||||
|
}
|
||||||
|
const onChange = (e :any) => {
|
||||||
|
setSearchValue(e.target.value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='SearchField'
|
||||||
|
>
|
||||||
|
<Search
|
||||||
|
allowClear
|
||||||
|
enterButton={t("search")}
|
||||||
|
size="middle"
|
||||||
|
placeholder={t("search")}
|
||||||
|
onSearch={onSearch}
|
||||||
|
style={{ width: 250 }}
|
||||||
|
value={searchValue}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SearchField
|
||||||
|
|
@ -5,12 +5,11 @@ import DashHeader from '../../Layout/Dashboard/DashHeader'
|
||||||
import LyTable from '../../Layout/Dashboard/LyTable'
|
import LyTable from '../../Layout/Dashboard/LyTable'
|
||||||
import useTableColumns from './useTableColumns'
|
import useTableColumns from './useTableColumns'
|
||||||
import { QueryStatusEnum } from '../../config/QueryStatus'
|
import { QueryStatusEnum } from '../../config/QueryStatus'
|
||||||
import { useGetProduct } from '../../api/product'
|
|
||||||
import { Button } from 'antd'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||||
import { useGetCategories } from '../../api/Categories'
|
import { useGetCategories } from '../../api/Categories'
|
||||||
|
import SearchField from '../../Layout/Dashboard/SearchField'
|
||||||
|
|
||||||
function Page() {
|
function Page() {
|
||||||
|
|
||||||
|
|
@ -24,7 +23,11 @@ function Page() {
|
||||||
// Pass Status to Layout
|
// Pass Status to Layout
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
<DashHeader showAddButton={false} title={'categories'}>
|
<DashHeader showAddButton={false} title={'categories'}>
|
||||||
<AddButton onClick={()=>navigate('/categories/add')}></AddButton>
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SearchField searchBy={"name"} />
|
||||||
|
|
||||||
|
<AddButton onClick={()=>navigate('/categories/add')}></AddButton>
|
||||||
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
|
|
||||||
<LyTable
|
<LyTable
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import { useTranslation } from 'react-i18next'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||||
import { useGetCoupon } from '../../api/Coupon'
|
import { useGetCoupon } from '../../api/Coupon'
|
||||||
|
import SearchField from '../../Layout/Dashboard/SearchField'
|
||||||
|
|
||||||
function Page() {
|
function Page() {
|
||||||
|
|
||||||
|
|
@ -23,10 +24,16 @@ function Page() {
|
||||||
return (
|
return (
|
||||||
// Pass Status to Layout
|
// Pass Status to Layout
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
|
|
||||||
<DashHeader showAddButton={false} title={'coupon'}>
|
<DashHeader showAddButton={false} title={'coupon'}>
|
||||||
<AddButton onClick={()=>navigate('/coupon/add')}></AddButton>
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SearchField />
|
||||||
|
|
||||||
|
<AddButton onClick={()=>navigate('/coupon/add')}></AddButton>
|
||||||
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
|
|
||||||
|
|
||||||
<LyTable
|
<LyTable
|
||||||
data={data?.coupons}
|
data={data?.coupons}
|
||||||
isLoading={false}
|
isLoading={false}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function Form() {
|
||||||
<ValidationField name="coupon_type" type="Select" option={values?.discount_type !== 'flat' ? coupon_type :coupon_type_discount_flat } />
|
<ValidationField name="coupon_type" type="Select" option={values?.discount_type !== 'flat' ? coupon_type :coupon_type_discount_flat } />
|
||||||
{/* <ValidationField name="itemable_type" label='coupon_item_type' type="Select" option={itemable_type} isDisabled={values?.coupon_type !== "specified"} isMulti/> */}
|
{/* <ValidationField name="itemable_type" label='coupon_item_type' type="Select" option={itemable_type} isDisabled={values?.coupon_type !== "specified"} isMulti/> */}
|
||||||
<ValidationField name="product_attr" label='product_item' type="Search" option={SelectProductData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
<ValidationField name="product_attr" label='product_item' type="Search" option={SelectProductData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
||||||
<ValidationField name="category_attr" label='categories_item_name' type="Search" option={SelectCategoriesData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
<ValidationField name="category_attr" label='categories_item_name' type="Search" option={SelectCategoriesData} searchBy={"name"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
||||||
<ValidationField name="status" type='Checkbox' label='status' />
|
<ValidationField name="status" type='Checkbox' label='status' />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ function Form() {
|
||||||
<ValidationField name="coupon_type" type="Select" option={values?.discount_type !== 'flat' ? coupon_type :coupon_type_discount_flat } />
|
<ValidationField name="coupon_type" type="Select" option={values?.discount_type !== 'flat' ? coupon_type :coupon_type_discount_flat } />
|
||||||
{/* <ValidationField name="itemable_type" label='coupon_item_type' type="Select" option={itemable_type} isDisabled={values?.coupon_type !== "specified"} isMulti/> */}
|
{/* <ValidationField name="itemable_type" label='coupon_item_type' type="Select" option={itemable_type} isDisabled={values?.coupon_type !== "specified"} isMulti/> */}
|
||||||
<ValidationField name="product_attr" label='product_item' type="Search" option={SelectProductData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
<ValidationField name="product_attr" label='product_item' type="Search" option={SelectProductData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
||||||
<ValidationField name="category_attr" label='categories_item_name' type="Search" option={SelectCategoriesData} searchBy={"search"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
<ValidationField name="category_attr" label='categories_item_name' type="Search" option={SelectCategoriesData} searchBy={"name"} isDisabled={values?.coupon_type !== "specified"}isMulti />
|
||||||
<ValidationField name="status" type='Checkbox' label='status' />
|
<ValidationField name="status" type='Checkbox' label='status' />
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { useGetProduct } from '../../api/product'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||||
|
import SearchField from '../../Layout/Dashboard/SearchField'
|
||||||
|
|
||||||
function ProductsPage() {
|
function ProductsPage() {
|
||||||
|
|
||||||
|
|
@ -21,7 +22,11 @@ function ProductsPage() {
|
||||||
return (
|
return (
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
<DashHeader showAddButton={false} title={'products'}>
|
<DashHeader showAddButton={false} title={'products'}>
|
||||||
<AddButton onClick={()=>navigate('/products/add')}></AddButton>
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SearchField/>
|
||||||
|
|
||||||
|
<AddButton onClick={()=>navigate('/products/add')}></AddButton>
|
||||||
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
|
|
||||||
<LyTable
|
<LyTable
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ import { Tabs, Space } from 'antd';
|
||||||
import { CopyOutlined } from '@ant-design/icons';
|
import { CopyOutlined } from '@ant-design/icons';
|
||||||
import { TabItem } from './TabItem';
|
import { TabItem } from './TabItem';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { FormikContext, FormikValues, useFormikContext } from 'formik';
|
import { FormikValues, useFormikContext } from 'formik';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useProductVarianState } from '../../../../lib/state mangment/Pages/Products';
|
||||||
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
|
|
@ -22,6 +23,16 @@ export const TabsContainer: React.FC = () => {
|
||||||
const formikContext = useFormikContext<FormikValues>();
|
const formikContext = useFormikContext<FormikValues>();
|
||||||
const { values, handleChange } = formikContext;
|
const { values, handleChange } = formikContext;
|
||||||
const [width, setWidth] = useState(window.innerWidth);
|
const [width, setWidth] = useState(window.innerWidth);
|
||||||
|
// const {setTapItems,TapItems,TapItemValues,setTapItemValues} = useProductVarianState(state => state)
|
||||||
|
// useEffect(() => {
|
||||||
|
// setTapItems(items)
|
||||||
|
// }, [items])
|
||||||
|
// useEffect(() => {
|
||||||
|
// setTapItemValues(values?.variable)
|
||||||
|
// }, [values?.variable])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const [t] = useTranslation()
|
const [t] = useTranslation()
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
const newKey = `${items.length + 1}`;
|
const newKey = `${items.length + 1}`;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { FormItem } from './FormItem';
|
||||||
import { useFormikContext, FormikValues } from 'formik';
|
import { useFormikContext, FormikValues } from 'formik';
|
||||||
import File from './Field/File';
|
import File from './Field/File';
|
||||||
import MaltyFile from './Field/FileImage';
|
import MaltyFile from './Field/FileImage';
|
||||||
import Select from './Field/Select';
|
|
||||||
import ObjectField from './Field/Object';
|
import ObjectField from './Field/Object';
|
||||||
import Atteibute from './Field/Atteibute';
|
import Atteibute from './Field/Atteibute';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
@ -25,44 +24,7 @@ export const VariableTabs: React.FC<VariableTabsProps> = ({ tabKey }) => {
|
||||||
handleChange(`variable.${tabKey}.${fieldName}`)(e); // Prepend "variable"
|
handleChange(`variable.${tabKey}.${fieldName}`)(e); // Prepend "variable"
|
||||||
};
|
};
|
||||||
const FormikName = (FormikFieldname: any) => values?.variable?.[tabKey]?.[FormikFieldname];
|
const FormikName = (FormikFieldname: any) => values?.variable?.[tabKey]?.[FormikFieldname];
|
||||||
const SelectedCategoriesAttribute = [
|
|
||||||
{
|
|
||||||
name: "color",
|
|
||||||
id: 1,
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
label: "red"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 2,
|
|
||||||
label: "green"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 3,
|
|
||||||
label: "blue"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "size",
|
|
||||||
id: 1,
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
value: 1,
|
|
||||||
label: "xs"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 2,
|
|
||||||
label: "sm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 3,
|
|
||||||
label: "lg"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@ import DashHeader from '../../Layout/Dashboard/DashHeader'
|
||||||
import LyTable from '../../Layout/Dashboard/LyTable'
|
import LyTable from '../../Layout/Dashboard/LyTable'
|
||||||
import useTableColumns from './useTableColumns'
|
import useTableColumns from './useTableColumns'
|
||||||
import { QueryStatusEnum } from '../../config/QueryStatus'
|
import { QueryStatusEnum } from '../../config/QueryStatus'
|
||||||
import { useGetProduct } from '../../api/product'
|
|
||||||
import { Button } from 'antd'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||||
import { useGetSlider } from '../../api/Slider'
|
import { useGetSlider } from '../../api/Slider'
|
||||||
|
import SearchField from '../../Layout/Dashboard/SearchField'
|
||||||
|
|
||||||
function Page() {
|
function Page() {
|
||||||
|
|
||||||
|
|
@ -25,7 +24,11 @@ function Page() {
|
||||||
// Pass Status to Layout
|
// Pass Status to Layout
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
<DashHeader showAddButton={false} title={'slider'}>
|
<DashHeader showAddButton={false} title={'slider'}>
|
||||||
<AddButton onClick={()=>navigate('/slider/add')}></AddButton>
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SearchField />
|
||||||
|
|
||||||
|
<AddButton onClick={()=>navigate('/slider/add')}></AddButton>
|
||||||
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
|
|
||||||
<LyTable
|
<LyTable
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { QueryStatusEnum } from "../../config/QueryStatus";
|
||||||
import LyTable from "../../Layout/Dashboard/LyTable";
|
import LyTable from "../../Layout/Dashboard/LyTable";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useGetOrder } from "../../api/order";
|
import { useGetOrder } from "../../api/order";
|
||||||
|
import SearchField from "../../Layout/Dashboard/SearchField";
|
||||||
// import SearchField from "../../Components/ValidationField/View/SearchField";
|
// import SearchField from "../../Components/ValidationField/View/SearchField";
|
||||||
const OrderPage = () => {
|
const OrderPage = () => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
|
@ -18,7 +19,7 @@ const OrderPage = () => {
|
||||||
|
|
||||||
const filterIsApplied = search !== "";
|
const filterIsApplied = search !== "";
|
||||||
//Table Content -- Data + Columns
|
//Table Content -- Data + Columns
|
||||||
const { data, isLoading , status } = useGetOrder({search});
|
const { data, isLoading, status } = useGetOrder({ search });
|
||||||
|
|
||||||
const totalRows = data?.pagination?.total || 0;
|
const totalRows = data?.pagination?.total || 0;
|
||||||
|
|
||||||
|
|
@ -26,19 +27,21 @@ const OrderPage = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DashBody status={status as QueryStatusEnum} >
|
<DashBody status={status as QueryStatusEnum} >
|
||||||
<DashHeader title="orders" showAddButton={false}>
|
<DashHeader title="orders" showAddButton={false}>
|
||||||
{/* <SearchField/> */}
|
<div className='RightSide d-flex gap-2 align-center '>
|
||||||
|
<SearchField />
|
||||||
|
</div>
|
||||||
</DashHeader>
|
</DashHeader>
|
||||||
<LyTable
|
<LyTable
|
||||||
data={data?.Orders}
|
data={data?.Orders}
|
||||||
total={totalRows}
|
total={totalRows}
|
||||||
column={columns}
|
column={columns}
|
||||||
is_pagination={true}
|
is_pagination={true}
|
||||||
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</DashBody>
|
</DashBody>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -487,6 +487,22 @@ padding: 10px 40px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ant input affix wrapper */
|
||||||
|
.ant-input-group-wrapper .ant-input-wrapper .ant-input-affix-wrapper{
|
||||||
|
height:40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ant input search button */
|
||||||
|
.ant-input-wrapper .ant-input-group-addon .ant-input-search-button{
|
||||||
|
height:40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@media screen and (max-width: 500px) {
|
||||||
|
.SearchField{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/lib/state mangment/Pages/Products.ts
Normal file
15
src/lib/state mangment/Pages/Products.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import {create} from 'zustand'
|
||||||
|
|
||||||
|
interface ProductState {
|
||||||
|
TapItems:any;
|
||||||
|
setTapItems :any ;
|
||||||
|
TapItemValues:any;
|
||||||
|
setTapItemValues :any ;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useProductVarianState = create<ProductState>((set) => ({
|
||||||
|
TapItems:[],
|
||||||
|
setTapItems: (data : any) => set(() => ({ TapItems: data })),
|
||||||
|
TapItemValues:[],
|
||||||
|
setTapItemValues: (data : any) => set(() => ({ TapItemValues: data })),
|
||||||
|
}));
|
||||||
69
src/lib/state mangment/dist/AuthState.js
vendored
Normal file
69
src/lib/state mangment/dist/AuthState.js
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (_) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.__esModule = true;
|
||||||
|
var zustand_1 = require("zustand");
|
||||||
|
var AppKey_1 = require("../../config/AppKey");
|
||||||
|
var useAuthState = zustand_1.create(function (set) {
|
||||||
|
var storedUser = localStorage.getItem(AppKey_1.USER_KEY);
|
||||||
|
var storedToken = localStorage.getItem(AppKey_1.TOKEN_KEY);
|
||||||
|
var initialUser = (storedUser && storedUser !== 'undefined') ? JSON.parse(storedUser) : null;
|
||||||
|
return {
|
||||||
|
user: initialUser,
|
||||||
|
isAuthenticated: !!storedToken,
|
||||||
|
token: storedToken,
|
||||||
|
login: function (userData) { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
console.log(userData);
|
||||||
|
localStorage.setItem(AppKey_1.TOKEN_KEY, userData.token);
|
||||||
|
localStorage.setItem(AppKey_1.USER_KEY, JSON.stringify(userData.admin));
|
||||||
|
set(function (state) { return ({ user: userData.admin, isAuthenticated: true, token: userData.token }); });
|
||||||
|
return [2 /*return*/];
|
||||||
|
});
|
||||||
|
}); },
|
||||||
|
logout: function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
localStorage.removeItem(AppKey_1.TOKEN_KEY);
|
||||||
|
localStorage.removeItem(AppKey_1.TOKEN_KEY_SOCKET);
|
||||||
|
localStorage.removeItem(AppKey_1.USER_KEY);
|
||||||
|
set(function (state) { return ({ user: null, isAuthenticated: false, token: null }); });
|
||||||
|
return [2 /*return*/];
|
||||||
|
});
|
||||||
|
}); }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
exports["default"] = useAuthState;
|
||||||
23
src/lib/state mangment/dist/LayoutPagestate.js
vendored
Normal file
23
src/lib/state mangment/dist/LayoutPagestate.js
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
"use strict";
|
||||||
|
exports.__esModule = true;
|
||||||
|
exports.usePageState = void 0;
|
||||||
|
var zustand_1 = require("zustand");
|
||||||
|
exports.usePageState = zustand_1.create(function (set) { return ({
|
||||||
|
isOpenAddModel: false,
|
||||||
|
isOpenEditModel: false,
|
||||||
|
objectToEdit: null,
|
||||||
|
isThemChanged: false,
|
||||||
|
setThemChange: function () {
|
||||||
|
return set(function (state) { return ({ isThemChanged: !state.isThemChanged }); });
|
||||||
|
},
|
||||||
|
setIsOpenAddModel: function () {
|
||||||
|
return set(function (state) { return ({ isOpenAddModel: !state.isOpenAddModel }); });
|
||||||
|
},
|
||||||
|
setIsOpenEditModel: function () {
|
||||||
|
return set(function (state) { return ({ isOpenEditModel: !state.isOpenEditModel }); });
|
||||||
|
},
|
||||||
|
CloseAllModal: function () {
|
||||||
|
return set(function (state) { return ({ isOpenAddModel: false, isOpenEditModel: false }); });
|
||||||
|
},
|
||||||
|
setObjectToEdit: function (data) { return set(function () { return ({ objectToEdit: data }); }); }
|
||||||
|
}); });
|
||||||
22
src/lib/state mangment/driver&customer/dist/ModelState.js
vendored
Normal file
22
src/lib/state mangment/driver&customer/dist/ModelState.js
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
"use strict";
|
||||||
|
exports.__esModule = true;
|
||||||
|
exports.useCommonModelState = void 0;
|
||||||
|
var zustand_1 = require("zustand");
|
||||||
|
exports.useCommonModelState = zustand_1.create(function (set) { return ({
|
||||||
|
isOpenBlock: false,
|
||||||
|
isOpenGift: false,
|
||||||
|
isOpenUnBlock: false,
|
||||||
|
setIsopenBlock: function () {
|
||||||
|
return set(function (state) { return ({ isOpenBlock: !state.isOpenBlock }); });
|
||||||
|
},
|
||||||
|
setIsopenUnBlock: function () {
|
||||||
|
return set(function (state) { return ({ isOpenUnBlock: !state.isOpenUnBlock }); });
|
||||||
|
},
|
||||||
|
setIsopenGift: function () {
|
||||||
|
return set(function (state) { return ({ isOpenGift: !state.isOpenGift }); });
|
||||||
|
},
|
||||||
|
setObjectId: function (data) {
|
||||||
|
return set(function (state) { return ({ objectID: data }); });
|
||||||
|
},
|
||||||
|
objectID: 0
|
||||||
|
}); });
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
"country": "بلد",
|
"country": "بلد",
|
||||||
"note": "ملاحظة",
|
"note": "ملاحظة",
|
||||||
"categories": "الفئات",
|
"categories": "الفئات",
|
||||||
"coupon": "الفسيمة",
|
"coupon": "القسيمة",
|
||||||
"orders": "الطلبات",
|
"orders": "الطلبات",
|
||||||
"products": "المنتجات",
|
"products": "المنتجات",
|
||||||
"slider": "الشريحة",
|
"slider": "الشريحة",
|
||||||
|
|
@ -108,6 +108,8 @@
|
||||||
"images": "الصور",
|
"images": "الصور",
|
||||||
"no_records": "لا توجد سجلات",
|
"no_records": "لا توجد سجلات",
|
||||||
"Total": "المجموع",
|
"Total": "المجموع",
|
||||||
"items": "عناصر"
|
"items": "عناصر",
|
||||||
|
"search": "بحث"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -104,5 +104,7 @@
|
||||||
"Add Another Item": "Weiteres Element hinzufügen",
|
"Add Another Item": "Weiteres Element hinzufügen",
|
||||||
"no_records": "Keine Datensätze",
|
"no_records": "Keine Datensätze",
|
||||||
"Total": "Insgesamt",
|
"Total": "Insgesamt",
|
||||||
"items": "Artikel"
|
"items": "Artikel",
|
||||||
|
"search": "Suche"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -104,5 +104,7 @@
|
||||||
"Add Another Item": "Add Another Item",
|
"Add Another Item": "Add Another Item",
|
||||||
"no_records": "No records",
|
"no_records": "No records",
|
||||||
"Total": "Total",
|
"Total": "Total",
|
||||||
"items": "items"
|
"items": "items",
|
||||||
|
"search": "Search"
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user