bug fix
This commit is contained in:
@@ -25,7 +25,8 @@ interface Props {
|
|||||||
selectedProducts: number[];
|
selectedProducts: number[];
|
||||||
setSelectedProducts: Dispatch<SetStateAction<number[]>>;
|
setSelectedProducts: Dispatch<SetStateAction<number[]>>;
|
||||||
handleBulkDelete: () => void;
|
handleBulkDelete: () => void;
|
||||||
totalCount?: number;
|
totalCount: number;
|
||||||
|
count: number;
|
||||||
handleSelectAllPages: () => void;
|
handleSelectAllPages: () => void;
|
||||||
isAllPagesSelected: boolean;
|
isAllPagesSelected: boolean;
|
||||||
}
|
}
|
||||||
@@ -41,7 +42,7 @@ const ProductTable = ({
|
|||||||
selectedProducts,
|
selectedProducts,
|
||||||
setSelectedProducts,
|
setSelectedProducts,
|
||||||
handleBulkDelete,
|
handleBulkDelete,
|
||||||
totalCount = 0,
|
totalCount,
|
||||||
handleSelectAllPages,
|
handleSelectAllPages,
|
||||||
isAllPagesSelected,
|
isAllPagesSelected,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
@@ -96,9 +97,7 @@ const ProductTable = ({
|
|||||||
<div className="mb-4 space-y-2">
|
<div className="mb-4 space-y-2">
|
||||||
<div className="flex items-center justify-between bg-blue-50 p-4 rounded-lg border border-blue-200">
|
<div className="flex items-center justify-between bg-blue-50 p-4 rounded-lg border border-blue-200">
|
||||||
<span className="text-sm font-medium text-blue-900">
|
<span className="text-sm font-medium text-blue-900">
|
||||||
{isAllPagesSelected
|
{`${selectedProducts.length} ta mahsulot tanlandi`}
|
||||||
? `Barcha ${totalCount} ta mahsulot tanlandi`
|
|
||||||
: `${selectedProducts.length} ta mahsulot tanlandi`}
|
|
||||||
</span>
|
</span>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
{!isAllPagesSelected && totalCount > products.length && (
|
{!isAllPagesSelected && totalCount > products.length && (
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ const ProductList = () => {
|
|||||||
setPlanDelete(product);
|
setPlanDelete(product);
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(selectedProducts);
|
|
||||||
|
|
||||||
const handleSelectAllPages = async () => {
|
const handleSelectAllPages = async () => {
|
||||||
try {
|
try {
|
||||||
if (!data?.total) return;
|
if (!data?.total) return;
|
||||||
@@ -100,6 +98,7 @@ const ProductList = () => {
|
|||||||
|
|
||||||
<ProductTable
|
<ProductTable
|
||||||
products={data?.results || []}
|
products={data?.results || []}
|
||||||
|
count={data?.total || 0}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
isFetching={isFetching}
|
isFetching={isFetching}
|
||||||
isError={isError}
|
isError={isError}
|
||||||
|
|||||||
Reference in New Issue
Block a user