shop 업데이트
This commit is contained in:
parent
3d6afdd61d
commit
ff2c1ee2ee
@ -17,7 +17,7 @@ const TABLE_HEAD = [
|
|||||||
{ id: 'name', label: 'Shop', alignRight: false, sort: true },
|
{ id: 'name', label: 'Shop', alignRight: false, sort: true },
|
||||||
{ id: 'owner', label: 'Owner', alignRight: false, sort: true },
|
{ id: 'owner', label: 'Owner', alignRight: false, sort: true },
|
||||||
{ id: 'products', label: 'products', alignRight: false, sort: true },
|
{ id: 'products', label: 'products', alignRight: false, sort: true },
|
||||||
{ id: 'status', label: 'Status', alignRight: false, sort: false },
|
// { id: 'status', label: 'Status', alignRight: false, sort: false },
|
||||||
{ id: '', label: 'Actions', alignRight: true }
|
{ id: '', label: 'Actions', alignRight: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export default function AdminProducts() {
|
|||||||
onError: (err) => toast.error(err.response.data.message || 'Something went wrong!')
|
onError: (err) => toast.error(err.response.data.message || 'Something went wrong!')
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
console.log(data, 'data123');
|
console.log(data);
|
||||||
const handleClickOpen = (prop) => () => {
|
const handleClickOpen = (prop) => () => {
|
||||||
setId(prop);
|
setId(prop);
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
@ -82,32 +82,32 @@ export default function AdminShopForm({ data: currentShop, isLoading: shopLoadin
|
|||||||
});
|
});
|
||||||
const ShopSettingScema = Yup.object().shape({
|
const ShopSettingScema = Yup.object().shape({
|
||||||
title: Yup.string().required('title is required'),
|
title: Yup.string().required('title is required'),
|
||||||
cover: Yup.mixed().required('Cover is required'),
|
// cover: Yup.mixed().required('Cover is required'),
|
||||||
logo: Yup.mixed().required('logo is required'),
|
// logo: Yup.mixed().required('logo is required'),
|
||||||
slug: Yup.string().required('Slug is required'),
|
// slug: Yup.string().required('Slug is required'),
|
||||||
message: Yup.string().min(10, 'Message must be at least 10 words').max(50, 'Message must be at most 50 words'),
|
// message: Yup.string().min(10, 'Message must be at least 10 words').max(50, 'Message must be at most 50 words'),
|
||||||
description: Yup.string().required('Description is required'),
|
// description: Yup.string().required('Description is required'),
|
||||||
metaTitle: Yup.string().required('Meta title is required'),
|
// metaTitle: Yup.string().required('Meta title is required'),
|
||||||
metaDescription: Yup.string().required('Meta description is required'),
|
// metaDescription: Yup.string().required('Meta description is required'),
|
||||||
phone: Yup.string().required('Phone Number is required'),
|
phone: Yup.string().required('Phone Number is required'),
|
||||||
paymentInfo: Yup.object().shape({
|
paymentInfo: Yup.object().shape({
|
||||||
holderName: Yup.string().required('Holder Name is required'),
|
// holderName: Yup.string().required('Holder Name is required')
|
||||||
holderEmail: Yup.string().required('Holder email is required'),
|
// holderEmail: Yup.string().required('Holder email is required'),
|
||||||
bankName: Yup.string().required('Bank name is required'),
|
// bankName: Yup.string().required('Bank name is required'),
|
||||||
AccountNo: Yup.number().required('Account No is required')
|
// AccountNo: Yup.number().required('Account No is required')
|
||||||
}),
|
}),
|
||||||
address: Yup.object().shape({
|
address: Yup.object().shape({
|
||||||
country: Yup.string().required('Country is required'),
|
// country: Yup.string().required('Country is required'),
|
||||||
city: Yup.string().required('City is required'),
|
// city: Yup.string().required('City is required'),
|
||||||
state: Yup.string().required('State is required'),
|
// state: Yup.string().required('State is required'),
|
||||||
streetAddress: Yup.string().required('Street Address is required')
|
streetAddress: Yup.string().required('Street Address is required')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
const formik = useFormik({
|
const formik = useFormik({
|
||||||
initialValues: {
|
initialValues: {
|
||||||
title: currentShop?.title || '',
|
title: currentShop?.title || '',
|
||||||
metaTitle: currentShop?.metaTitle || '',
|
// metaTitle: currentShop?.metaTitle || '',
|
||||||
cover: currentShop?.cover || null,
|
// cover: currentShop?.cover || null,
|
||||||
logo: currentShop?.logo || null,
|
logo: currentShop?.logo || null,
|
||||||
description: currentShop?.description || '',
|
description: currentShop?.description || '',
|
||||||
metaDescription: currentShop?.metaDescription || '',
|
metaDescription: currentShop?.metaDescription || '',
|
||||||
@ -228,10 +228,7 @@ export default function AdminShopForm({ data: currentShop, isLoading: shopLoadin
|
|||||||
};
|
};
|
||||||
const handleTitleChange = (event) => {
|
const handleTitleChange = (event) => {
|
||||||
const title = event.target.value;
|
const title = event.target.value;
|
||||||
const slug = title
|
const slug = title.toLowerCase().replace(/\s+/g, '-'); // convert to lowercase, remove special characters, and replace spaces with hyphens
|
||||||
.toLowerCase()
|
|
||||||
.replace(/[^a-zA-Z0-9\s]+/g, '')
|
|
||||||
.replace(/\s+/g, '-'); // convert to lowercase, remove special characters, and replace spaces with hyphens
|
|
||||||
formik.setFieldValue('slug', slug); // set the value of slug in the formik state
|
formik.setFieldValue('slug', slug); // set the value of slug in the formik state
|
||||||
formik.handleChange(event); // handle the change in formik
|
formik.handleChange(event); // handle the change in formik
|
||||||
};
|
};
|
||||||
|
@ -86,7 +86,7 @@ export default function RegisterForm() {
|
|||||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
|
||||||
<Stack gap={0.5} width={1}>
|
<Stack gap={0.5} width={1}>
|
||||||
<Typography variant="overline" color="text.primary" htmlFor="firstName" component={'label'}>
|
<Typography variant="overline" color="text.primary" htmlFor="firstName" component={'label'}>
|
||||||
First Name
|
{lang['First Name']}
|
||||||
</Typography>
|
</Typography>
|
||||||
<TextField
|
<TextField
|
||||||
id="firstName"
|
id="firstName"
|
||||||
|
@ -96,7 +96,7 @@ export default function ProductRow({ isLoading, row, handleClickOpen }) {
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>{isLoading ? <Skeleton variant="text" /> : <>{row.products.length || 0}</>}</TableCell>
|
<TableCell>{isLoading ? <Skeleton variant="text" /> : <>{row.products.length || 0}</>}</TableCell>
|
||||||
|
|
||||||
<TableCell>
|
{/* <TableCell>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<Skeleton variant="text" />
|
<Skeleton variant="text" />
|
||||||
) : (
|
) : (
|
||||||
@ -125,7 +125,7 @@ export default function ProductRow({ isLoading, row, handleClickOpen }) {
|
|||||||
{row?.status}
|
{row?.status}
|
||||||
</Label>
|
</Label>
|
||||||
)}
|
)}
|
||||||
</TableCell>
|
</TableCell> */}
|
||||||
<TableCell align="right">
|
<TableCell align="right">
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<Stack direction="row" justifyContent="flex-end">
|
<Stack direction="row" justifyContent="flex-end">
|
||||||
|
Loading…
Reference in New Issue
Block a user