import { Table, message } from 'antd';
import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
const QRCodeCopiesModal = ({
open,
onClose,
type = 'stock', // 'stock' or 'product'
onFinish,
QrandbarcodeDatas,
setQrandbarcodeDatas,
}) => {
const title = type === 'stock' ? 'Stock Wise Qrcode' : 'Product Wise Qrcode';
const showStockIndication = type === 'stock';
const totalCopies = QrandbarcodeDatas?.reduce(
(sum, item) => sum + Number(item?.copiesCount || 0),
0
);
const handleSubmit = () => {
if (totalCopies == 0) {
message.error('Please enter copies count');
return;
} else {
onClose();
onFinish();
}
};
const columns = [
{ title: 'Product Name', dataIndex: 'productName', key: 'productName' },
{
title: 'Copies Count',
dataIndex: 'copiesCount',
key: 'copiesCount',
render: (text, record) => (
{
const newValue =
type === 'product'
? parseInt(e.target.value) || 1
: parseInt(e.target.value);
setQrandbarcodeDatas((prev) =>
prev.map((item) =>
item.key === record.key
? { ...item, copiesCount: newValue }
: item
)
);
}}
style={{ width: '80px' }}
/>
),
},
];
return (
(record.StockAvailable === 'N' ? 'row-red' : '')
: undefined
}
/>
{showStockIndication && (
)}
>
}
/>
);
};
export default QRCodeCopiesModal;