업데이트

This commit is contained in:
익희 김 2025-01-19 21:14:31 +09:00
parent 03baa76f6f
commit e02942786f
5 changed files with 13 additions and 13 deletions

View File

@ -15,7 +15,6 @@ import SubCategory from 'src/components/table/rows/subCategory';
const TABLE_HEAD = [ const TABLE_HEAD = [
{ id: 'name', label: 'Category', alignRight: false, sort: true }, { id: 'name', label: 'Category', alignRight: false, sort: true },
{ id: 'description', label: 'Description', alignRight: false },
{ id: 'status', label: 'Status', alignRight: false }, { id: 'status', label: 'Status', alignRight: false },
{ id: 'createdAt', label: 'Date', alignRight: false, sort: true }, { id: 'createdAt', label: 'Date', alignRight: false, sort: true },
{ id: '', label: 'Actions', alignRight: true } { id: '', label: 'Actions', alignRight: true }

View File

@ -79,6 +79,11 @@ export default function ProductForm({
} }
} }
); );
useEffect(() => {
console.log('currentProduct', currentProduct)
}, [currentProduct])
const NewProductSchema = Yup.object().shape({ const NewProductSchema = Yup.object().shape({
name: Yup.string().required('Product name is required'), name: Yup.string().required('Product name is required'),
code: Yup.string().required('Product code is required'), code: Yup.string().required('Product code is required'),
@ -117,9 +122,9 @@ export default function ProductForm({
brand: currentProduct?.brand || brands[0]?._id || 'brand', brand: currentProduct?.brand || brands[0]?._id || 'brand',
tags: currentProduct?.tags || [], tags: currentProduct?.tags || [],
gender: currentProduct?.gender || '', gender: currentProduct?.gender || '',
category: currentProduct?.category || (categories.length && categories[0]?._id) || '', category: currentProduct?.category || '',
shop: isVendor ? null : currentProduct?.shop || (shops?.length && shops[0]?._id) || '', shop: isVendor ? null : currentProduct?.shop || (shops?.length && shops[0]?._id) || '',
subCategory: currentProduct?.subCategory || (categories.length && categories[0].subCategories[0]?._id) || '', subCategory: currentProduct?.subCategory || '',
status: currentProduct?.status || STATUS_OPTIONS[0], status: currentProduct?.status || STATUS_OPTIONS[0],
blob: currentProduct?.blob || [], blob: currentProduct?.blob || [],
isFeatured: currentProduct?.isFeatured || true, isFeatured: currentProduct?.isFeatured || true,
@ -208,10 +213,6 @@ export default function ProductForm({
formik.handleChange(event); // handle the change in formik formik.handleChange(event); // handle the change in formik
}; };
useEffect(() => {
console.log('this Value', values)
}, [values])
return ( return (
<Stack spacing={3}> <Stack spacing={3}>
<FormikProvider value={formik}> <FormikProvider value={formik}>

View File

@ -109,7 +109,7 @@ export default function SubCategoryForm({
file: currentCategory?.cover || '', file: currentCategory?.cover || '',
slug: currentCategory?.slug || '', slug: currentCategory?.slug || '',
status: currentCategory?.status || STATUS_OPTIONS[0], status: currentCategory?.status || STATUS_OPTIONS[0],
parentCategory: currentCategory?.parentCategory || (categories && categories[0]?._id) || '' parentCategory: currentCategory?.parentCategory || ''
}, },
enableReinitialize: true, enableReinitialize: true,
validationSchema: NewCategorySchema, validationSchema: NewCategorySchema,

View File

@ -46,6 +46,7 @@ const ThumbImgStyle = styled(Box)(({ theme }) => ({
export default function Category({ isLoading, row, handleClickOpen }) { export default function Category({ isLoading, row, handleClickOpen }) {
const router = useRouter(); const router = useRouter();
const theme = useTheme(); const theme = useTheme();
return ( return (
<TableRow hover key={Math.random()}> <TableRow hover key={Math.random()}>
<TableCell component="th" scope="row"> <TableCell component="th" scope="row">
@ -64,7 +65,6 @@ export default function Category({ isLoading, row, handleClickOpen }) {
fill fill
alt={row?.name} alt={row?.name}
src={row?.cover?.url} src={row?.cover?.url}
blurDataURL={row?.cover.blurDataURL} blurDataURL={row?.cover.blurDataURL}
objectFit="cover" objectFit="cover"
/> />
@ -75,7 +75,7 @@ export default function Category({ isLoading, row, handleClickOpen }) {
</Typography> </Typography>
</Box> </Box>
</TableCell> </TableCell>
<TableCell>{isLoading ? <Skeleton variant="text" /> : row.description.slice(0, 50)}</TableCell> {/* <TableCell>{row.parentCategory}</TableCell> */}
<TableCell> <TableCell>
{isLoading ? ( {isLoading ? (
<Skeleton variant="text" /> <Skeleton variant="text" />

View File

@ -105,13 +105,13 @@ export default function UploadMultiFile({ onAnnotationsChange, ...props }) {
// //
ctx.strokeStyle = 'red'; ctx.strokeStyle = 'red';
ctx.lineWidth = 2; ctx.lineWidth = 1;
ctx.strokeRect(x, y, width, height); ctx.strokeRect(x - 50, y - 80, width, height);
// //
ctx.fillStyle = 'red'; ctx.fillStyle = 'red';
ctx.font = '16px Arial'; ctx.font = '16px Arial';
ctx.fillText(`${label} (${(confidence * 100).toFixed(2)}%)`, x, y > 10 ? y - 5 : 10); ctx.fillText(`${label} (${(confidence * 100).toFixed(2)}%)`, x - 50, y - 80 > 10 ? y - 5 : 10);
}); });
} }
} catch (error) { } catch (error) {