diff --git a/src/Pages/Product/ProductList.jsx b/src/Pages/Product/ProductList.jsx index 0851c55..fd68fd3 100644 --- a/src/Pages/Product/ProductList.jsx +++ b/src/Pages/Product/ProductList.jsx @@ -12,6 +12,7 @@ import { Radio, Button, Empty, + message, } from 'antd'; import { debounce } from 'lodash'; import { @@ -99,6 +100,8 @@ import ScannedProductTable from '../../Components/PedalOCR/scannedProductTable.j import MultiCameraCropOCR from '../../Components/PedalOCR/MultiCameraCropOCR.jsx'; import OCRLoader from '../../Components/PedalOCR/OCRLoader.jsx'; import { GiHorizontalFlip, GiVerticalFlip } from 'react-icons/gi'; +import { FaPlus } from "react-icons/fa6"; +import { Tables } from '../../../ownLib/my-ui-lib.js'; const colorText = 'Color : Red'; const ProductList = () => { @@ -129,6 +132,7 @@ const ProductList = () => { const [SearchProdData, setSearchProdData] = useState([]); const [productData, setproductData] = useState([]); const [currentPage, setCurrentPage] = useState(1); + const [activeTab, setActiveTab] = useState('stock'); let SalesStatus = productData?.[0]?.SalesStatus; const UomData = useSelector(uomDataSelector); const ProdCatData = useSelector(prodCatDataSelector); @@ -150,7 +154,7 @@ const ProductList = () => { UomTypePreference?.some?.( (e) => e?.PreferredSubCatName?.toLowerCase() == - item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y' + item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y' ) ); @@ -177,7 +181,6 @@ const ProductList = () => { const [uploadImageModal, setUploadImageModal] = useState(false); const [MultiCode, setMultiCode] = useState(false); const [selectedRecords, setSelectedRecords] = useState([]); - console.log(QrandbarcodeDatas, 'QrandbarcodeDatas'); const [imageModalRowIndex, setImageModalRowIndex] = useState(null); const [rowRecord, setRowRecord] = useState(null); const [sortedInfo, setSortedInfo] = useState({}); @@ -261,11 +264,15 @@ const ProductList = () => { const [imageUrl, setImageUrl] = useState(''); const [recordIndex, setRecordIndex] = useState(null); + const [rangeFrom, setRangeFrom] = useState(''); const [rangeTo, setRangeTo] = useState(''); const [deleteInput, setDeleteInput] = useState(null); + const [stockWiseQrcode, setstockWiseQrcode] = useState(false); + const [productWiseQrcode, setProductWiseQrcode] = useState(false); const lastRangeIdsRef = useRef([]); + const subDirectory = import.meta.env.ENV_BASE_URL; // const [openTour, setOpenTour] = useState(false); @@ -289,6 +296,9 @@ const ProductList = () => { link: `${subDirectory}setting/product-master`, }, ]; + // const stockAvailableCount = selectedRecords?.filter( + // item => item?.StockAvailable === "Y" + // ).length const Qrcode = (record) => { setProName(record?.ProdName); setProdId(record?.QRCode); @@ -882,7 +892,8 @@ const ProductList = () => { } }); }; - const CreateQrcode = async (isChecked, code) => { + const CreateQrcode = async (isChecked, code, productName, StockAvailable, copiesCount = 0) => { + if (!code) return; if (isChecked) { @@ -892,6 +903,9 @@ const ProductList = () => { { key: code, url: data, + productName: productName, + copiesCount: copiesCount, + StockAvailable: StockAvailable }, ]); } else { @@ -905,7 +919,7 @@ const ProductList = () => { for (let i = 0; i < products.length; i += batchSize) { const batch = products.slice(i, i + batchSize); await Promise.all( - batch.map((product) => CreateQrcode(true, product.QRCode)) + batch.map((product) => CreateQrcode(true, product.QRCode, product.ProdName, product.StockAvailable, product.TotalBalanceQty)) ); // Small delay to prevent UI blocking if (i + batchSize < products.length) { @@ -913,7 +927,7 @@ const ProductList = () => { } } } else { - products.forEach((product) => CreateQrcode(false, product.QRCode)); + products.forEach((product) => CreateQrcode(false, product.QRCode, product.ProdName, product.StockAvailable, product.TotalBalanceQty)); } }; @@ -954,19 +968,19 @@ const ProductList = () => { }, ...(brandColumn && subCategory ? [ - { - title: 'Brand', - dataIndex: 'BrandName', - key: 'BrandName', - columnKey: 'BrandName', - width: '100px', - render: (text) => {text}, - sorter: (a, b) => a?.BrandName?.localeCompare(b?.BrandName), - sortOrder: - sortedInfo.columnKey === 'BrandName' ? sortedInfo.order : null, - ellipsis: true, - }, - ] + { + title: 'Brand', + dataIndex: 'BrandName', + key: 'BrandName', + columnKey: 'BrandName', + width: '100px', + render: (text) => {text}, + sorter: (a, b) => a?.BrandName?.localeCompare(b?.BrandName), + sortOrder: + sortedInfo.columnKey === 'BrandName' ? sortedInfo.order : null, + ellipsis: true, + }, + ] : []), { @@ -985,121 +999,121 @@ const ProductList = () => { ...(qrCodeColumn ? [ - { - title: 'QRCode', - dataIndex: 'QRCode', - key: 'QRCode', - width: '100px', - align: 'center', - render: (text) => ( - {text ? text : '-'} - ), - ellipsis: true, - }, - { - title: ( - - - {MultiCode && ( - 0 && - productData - .filter((p) => p?.QRCode) - .every((p) => - selectedRecords.some((r) => r.ProdId === p.ProdId) - ) - } - onChange={(e) => { - const productsWithQR = productData.filter( - (p) => p?.QRCode - ); - if (e.target.checked) { - const newSelections = productsWithQR.filter( - (p) => - !selectedRecords.some( - (r) => r.ProdId === p.ProdId - ) - ); - setSelectedRecords((prev) => [ - ...prev, - ...newSelections, - ]); - // Create QR codes for newly selected products - CreateQrcodesBatch(newSelections, true); - } else { - // Remove QR codes for deselected products - CreateQrcodesBatch(productsWithQR, false); - setSelectedRecords((prev) => - prev.filter( - (r) => - !productsWithQR.some( - (p) => p.ProdId === r.ProdId - ) + { + title: 'QRCode', + dataIndex: 'QRCode', + key: 'QRCode', + width: '100px', + align: 'center', + render: (text) => ( + {text ? text : '-'} + ), + ellipsis: true, + }, + { + title: ( + + + {MultiCode && ( + 0 && + productData + .filter((p) => p?.QRCode) + .every((p) => + selectedRecords.some((r) => r.ProdId === p.ProdId) + ) + } + onChange={(e) => { + const productsWithQR = productData.filter( + (p) => p?.QRCode + ); + if (e.target.checked) { + const newSelections = productsWithQR.filter( + (p) => + !selectedRecords.some( + (r) => r.ProdId === p.ProdId ) - ); - } - }} - /> - )} - Print QRCode - { - setMultiCode((prev) => { - const newValue = !prev; - if (!newValue) { - setSelectedRecords([]); - } - - return newValue; - }); + ); + setSelectedRecords((prev) => [ + ...prev, + ...newSelections, + ]); + // Create QR codes for newly selected products + CreateQrcodesBatch(newSelections, true); + } else { + // Remove QR codes for deselected products + CreateQrcodesBatch(productsWithQR, false); + setSelectedRecords((prev) => + prev.filter( + (r) => + !productsWithQR.some( + (p) => p.ProdId === r.ProdId + ) + ) + ); + } }} /> - - - ), - key: 'Print', - dataIndex: 'Print', - width: '100px', - align: 'center', - render: (_, record) => - productData.length >= 1 ? ( - - {MultiCode ? ( - record?.QRCode ? ( - r.ProdId == record.ProdId - )} - onChange={(e) => { - handleCheckboxChange(record, e.target.checked); - CreateQrcode(e.target.checked, record.QRCode); - }} - /> - ) : ( - '-' - ) - ) : record?.QRCode ? ( - - Qrcode(record)} - /> - + )} + Print QRCode + { + setMultiCode((prev) => { + const newValue = !prev; + if (!newValue) { + setSelectedRecords([]); + } + + return newValue; + }); + }} + /> + + + ), + key: 'Print', + dataIndex: 'Print', + width: '100px', + align: 'center', + render: (_, record) => + productData.length >= 1 ? ( + + {MultiCode ? ( + record?.QRCode ? ( + r.ProdId == record.ProdId + )} + onChange={(e) => { + handleCheckboxChange(record, e.target.checked); + CreateQrcode(e.target.checked, record.QRCode, record?.ProdName, record?.StockAvailable, record?.TotalBalanceQty); + }} + /> ) : ( '-' - )} - - ) : null, - }, - ] + ) + ) : record?.QRCode ? ( + + Qrcode(record)} + /> + + ) : ( + '-' + )} + + ) : null, + }, + ] : []), { @@ -1117,11 +1131,11 @@ const ProductList = () => { style={{ color: '#1292EE' }} onClick={() => UserType === 'Super Admin' || - (UserType === 'Super Admin User' && - SAAccessCommonMaster?.UpdateAccess === 'Y') || - (UserType === 'Employee' && - empData?.UpdateAccess === 'Y') || - UserType === 'Admin' + (UserType === 'Super Admin User' && + SAAccessCommonMaster?.UpdateAccess === 'Y') || + (UserType === 'Employee' && + empData?.UpdateAccess === 'Y') || + UserType === 'Admin' ? actionsFormatter(record, index) : null } @@ -1138,11 +1152,11 @@ const ProductList = () => { }} onClick={() => UserType === 'Super Admin' || - (UserType === 'Super Admin User' && - SAAccessCommonMaster?.DeleteAccess === 'Y') || - (UserType === 'Employee' && - empData?.DeleteAccess === 'Y') || - UserType === 'Admin' + (UserType === 'Super Admin User' && + SAAccessCommonMaster?.DeleteAccess === 'Y') || + (UserType === 'Employee' && + empData?.DeleteAccess === 'Y') || + UserType === 'Admin' ? statusFormatter(record) : null } @@ -1154,11 +1168,11 @@ const ProductList = () => { }} onClick={() => UserType === 'Super Admin' || - (UserType === 'Super Admin User' && - SAAccessCommonMaster?.DeleteAccess === 'Y') || - (UserType === 'Employee' && - empData?.DeleteAccess === 'Y') || - UserType === 'Admin' + (UserType === 'Super Admin User' && + SAAccessCommonMaster?.DeleteAccess === 'Y') || + (UserType === 'Employee' && + empData?.DeleteAccess === 'Y') || + UserType === 'Admin' ? statusFormatter(record) : null } @@ -1735,9 +1749,17 @@ const ProductList = () => { } } }; - const generateQRCode = (code) => - QrandbarcodeDatas?.find((e) => e?.key === code)?.url; + const generateQRCode = (code) => { + let Data = QrandbarcodeDatas?.find((e) => e?.key === code)?.url; + return Data + } + const generateQRCodeCopy = (code) => { + const found = QrandbarcodeDatas?.find((e) => e?.key === code); + const count = Number(found?.copiesCount); + return Number.isFinite(count) && count > 0 ? count : 0; + + }; const imageUrlToBase64 = async (url) => { try { const response = await fetch(url); @@ -2202,6 +2224,11 @@ const ProductList = () => { } }, [ProdId]); + + const totalCopies = QrandbarcodeDatas?.reduce( + (sum, item) => sum + Number(item?.copiesCount || 0), + 0 + ); const convertSvgToBase64 = (svgElement) => { try { const svgData = new XMLSerializer().serializeToString(svgElement); @@ -2302,6 +2329,7 @@ const ProductList = () => { setOpen(false); formRef?.current?.resetFields(); setSelectedRecords([]); + setQrandbarcodeDatas([]) setMultiCode(false); setNickName(null); }; @@ -2612,6 +2640,50 @@ const ProductList = () => { footer={false} children={
+ + {MultiCode &&
+
setActiveTab('stock')} + > + Stock Wise ({selectedRecords?.length}) +
+ +
{ + e.stopPropagation(); + setstockWiseQrcode(true); + }} + style={{ + animation: activeTab === 'stock' ? 'blink 1s infinite' : 'none' + }}> + + Add +
+
+
+ +
setActiveTab('product')} + > + Product Wise ({selectedRecords?.length}) +
{ + e.stopPropagation(); + setProductWiseQrcode(true); + }} style={{ + animation: activeTab === 'product' ? 'blink 1s infinite' : 'none' + }}> + + Add +
+
+ +
}
{ > {nickName ? nickName - : proName} + : (proName || 'Product Name')}
)} {mrp && ( @@ -2895,9 +2967,9 @@ const ProductList = () => {

8 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR579890770'}

{ : 'product-sizeSmall2' } > - ({size}) + ({size || '1 PCS'})

{ }} > barcode -

{ProdId}

+

{ProdId || 'QR8575956'}

) @@ -3169,9 +3241,9 @@ const ProductList = () => {

12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR74478578'}

{ )} {mrp && (
- {'MRP : ' + detail?.MRP} + {'MRP : ' + (detail?.MRP || 10.0)}
)} @@ -3297,9 +3369,9 @@ const ProductList = () => {

12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR987968'}

{ )} {mrp && (
- {'MRP : ' + detail?.MRP} + {'MRP : ' + (detail?.MRP || '10.0')}
)} @@ -3411,9 +3483,9 @@ const ProductList = () => {

12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR8798639'}

{ {sellingPrice && (
{`Selling Price : ` + - detail?.SellPrice} + (detail?.SellPrice || '10.0')}
)} @@ -3510,9 +3582,9 @@ const ProductList = () => {

12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR0970970'}

{ )} {mrp && (
- {'MRP : ' + detail?.MRP} + {'MRP : ' + (detail?.MRP || '10.0')}
)} {sellingPrice && (
{`Selling Price : ` + - detail?.SellPrice} + (detail?.SellPrice || '10.0')}
)} @@ -3618,9 +3690,9 @@ const ProductList = () => {

12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {proName || 'Product Name'} ({size || '1 PCS'})

-

{ProdId}

+

{ProdId || 'QR858755'}

{ )} {mrp && (
- {'MRP : ' + detail?.MRP} + {'MRP : ' + (detail?.MRP || '10.0')}
)} @@ -3773,25 +3845,25 @@ const ProductList = () => {

SIZE:{' '} - {size} + {size || '1 PCS'}

Id:{' '} - {ProdId} + {ProdId || 'QR86868'}

MRP:{' '} - {'MRP : ' + detail?.MRP} + {'MRP : ' + (detail?.MRP || '10.0')}

Selling Price:{' '} - {detail?.SellPrice} + {(detail?.SellPrice || '10.0')}

@@ -3833,7 +3905,7 @@ const ProductList = () => { - { CopiesOnChange(e?.target?.value); }} /> - + } {proName?.length > 12 && printProductName && !MultiCode && ( <>
{ justifyContent: 'flex-end', }} > - -
+ {(!MultiCode || totalCopies > 0) && ( + + )} + {MultiCode && totalCopies === 0 && ( + + )} + + } /> -
+ < div style={{ display: 'none' }}>
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
- -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, "copyCountcopyCountcopyCount") + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
- ))} + )); + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+ +
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array?.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

8 ? 'text-ellipsis' : ''}`} - > - {record.ProdName} ({record.Size} - {record.UomName}) -

-

{record.QRCode}

-
- -
- )) - ) - : Array?.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + return Array?.from({ length: copyCount })?.map((_, copyIndex) => ( +

8 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {record.ProdName} ({record.Size} + {record.UomName})

-

{ProdId}

+

{record.QRCode}

- ))} + )) + } + ) + : Array?.from({ length: copies })?.map((_, index) => ( +
+
+

8 ? 'text-ellipsis' : ''}`} + > + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))}
- {selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-

14 ? 'text-ellipsis' : ''}`} - > - - {record?.NickName || record?.ProdName} - - - ({record?.Size} - {record?.UomName}) - -

-
- barcode -

- {record?.QRCode || record?.ProdId} -

-
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ {(selectedRecords?.length > 0) + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount2') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +

14 ? 'text-ellipsis' : ''}`} + className={`sticker25x25-name ${nickName ? '' : (record?.ProdName + '(' + record?.Size + '' + record?.UomName + ')')?.length > 14 ? 'text-ellipsis' : ''}`} > - {nickName - ? nickName - : proName - ? proName - : 'Product Name'} + {record?.NickName || record?.ProdName} - ({size}) + ({record?.Size} + {record?.UomName})

{ }} > barcode -

{ProdId}

+

+ {record?.QRCode || record?.ProdId} +

- ))} + )) + } + + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+

14 ? 'text-ellipsis' : ''}`} + > + + {nickName + ? nickName + : proName + ? proName + : 'Product Name'} + + + ({size}) + +

+
+ barcode +

{ProdId}

+
+
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} ({record?.Size} - {record?.UomName}) -

-

{record?.QRCode || record?.ProdId}

-
- -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount3') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +

12 ? 'text-ellipsis' : ''}`} + className={`${nickName ? '' : ((record?.NickName || record?.ProdName) + ' (' + record?.Size + ')')?.length > 12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {record?.NickName || record?.ProdName} ({record?.Size} + {record?.UomName})

-

{ProdId}

+

{record?.QRCode || record?.ProdId}

- ))} + )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} + > + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} ({record?.Size} - {record?.UomName}) -

-

{record?.QRCode || record?.ProdId}

-
- -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount4') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +

12 ? 'text-ellipsis' : ''}`} + className={`${nickName ? '' : (record?.ProdName + ' (' + record?.Size + ')')?.length > 12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {record?.NickName || record?.ProdName} ({record?.Size} + {record?.UomName})

-

{ProdId}

+

{record?.QRCode || record?.ProdId}

- ))} + )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} + > + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} ({record?.Size} - {record?.UomName}) -

-

{record?.QRCode || record?.ProdId}

-
- -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount5') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +

12 ? 'text-ellipsis' : ''}`} + className={`${nickName ? '' : (record?.ProdName + ' (' + record?.Size + ')')?.length > 12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {record?.NickName || record?.ProdName} ({record?.Size} + {record?.UomName})

-

{ProdId}

+

{record?.QRCode || record?.ProdId}

- ))} + )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} + > + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} ({record?.Size} - {record?.UomName}) -

-

{record?.QRCode || record?.ProdId}

-
- -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount6') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +

12 ? 'text-ellipsis' : ''}`} + className={`${nickName ? '' : (record?.ProdName + ' (' + record?.Size + ')')?.length > 12 ? 'text-ellipsis' : ''}`} > - {proName} ({size}) + {record?.NickName || record?.ProdName} ({record?.Size} + {record?.UomName})

-

{ProdId}

+

{record?.QRCode || record?.ProdId}

- ))} + )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} + > + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
{ + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount7') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} + > + {record?.NickName || record?.ProdName} ({record?.Size} + {record?.UomName}) +

+

{record?.QRCode || record?.ProdId}

+
+ +
+ )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

12 ? 'text-ellipsis' : ''}`} > -

-

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} ({record?.Size} - {record?.UomName}) + {proName} ({size}) +

+

{ProdId}

+
+ +
+ ))} +
+
+
+
+ {selectedRecords?.length > 0 + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + console.log(copyCount, 'copyCount8') + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
+
+

{record?.BrName || detail?.BrName}

+
+
+
+

+ Product Name:{' '} +

12 ? 'text-ellipsis' : ''}`} + > + {record?.NickName || record?.ProdName} +

+

+

+ SIZE:{' '} + + {record?.Size} + {record?.UomName} + +

+

+ Id:{' '} + + {record?.QRCode || record?.ProdId} + +

+

+ MRP:{' '} + + {'MRP : ' + record?.MRP} + +

+

+ Selling Price:{' '} + + {record?.SellPrice} +

-

{record?.QRCode || record?.ProdId}

{ templateOptions?.codeType ) || base64Image } - style={{ width: '12mm', height: '12mm' }} - /> -
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
-
-

12 ? 'text-ellipsis' : ''}`} - > - {proName} ({size}) -

-

{ProdId}

-
- -
- ))} -
-
-
-
- {selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
-

{record?.BrName || detail?.BrName}

-
-
-
-

- Product Name:{' '} -

12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} -

-

-

- SIZE:{' '} - - {record?.Size} - {record?.UomName} - -

-

- Id:{' '} - - {record?.QRCode || record?.ProdId} - -

-

- MRP:{' '} - - {'MRP : ' + record?.MRP} - -

-

- Selling Price:{' '} - - {record?.SellPrice} - -

-
- -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
-
-

{detail?.BrName}

-
-
-
-

- Product Name:{' '} -

12 ? 'text-ellipsis' : ''}`} - > - {proName} -

-

-

- SIZE: {size} -

-

- Id: {ProdId} -

-

- MRP:{' '} - - {'MRP : ' + detail?.MRP} - -

-

- Selling Price:{' '} - - {detail?.SellPrice} - -

-
-
- ))} + )) + }) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+

{detail?.BrName}

+
+
+
+

+ Product Name:{' '} +

12 ? 'text-ellipsis' : ''}`} + > + {proName} +

+

+

+ SIZE: {size} +

+

+ Id: {ProdId} +

+

+ MRP:{' '} + + {'MRP : ' + detail?.MRP} + +

+

+ Selling Price:{' '} + + {detail?.SellPrice} + +

+
+ +
+
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => { - const hasProductName = !!templateOptions.productName; - const hasMrp = !!templateOptions.mrp; - - const hasMDate = templateOptions.mDate && record?.ManufDate; - - const hasEDate = templateOptions.eDate && record?.ExpDate; - - // IMAGE SIZE LOGIC - let imageSize = 50; - if (!hasMDate && !hasEDate) { - imageSize = 52; - } - - if (!hasProductName || !hasMrp) { - imageSize = 60; - } - - if (!hasProductName && !hasMrp) { - imageSize = 80; - } - - // FLEX DIRECTION LOGIC - const forceColumnLayout = - !hasProductName || !hasMrp || (!hasMDate && !hasEDate); - return ( -
-
- {templateOptions.value === 'T' && ( -
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '90%' - : `${imageSize}%`, - '7px', - record?.QRCode || record?.ProdId - )} -
- )} - {hasProductName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} -
- )} - {hasMrp && ( -
- {'₹' + record?.MRP} -
- )} - {templateOptions.value === 'C' && ( -
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '90%' - : `${imageSize}%`, - '7px', - record?.QRCode || record?.ProdId - )} -
- )} - {(hasMDate || hasEDate) && ( -
- {hasMDate && ( -
- {hasMDate && !hasEDate ? 'MFG: ' : ''} - {formatDate(record?.ManufDate)} -
- )} - {hasMDate && hasEDate && ( - | - )} - {hasEDate && ( -
- {!hasMDate && hasEDate ? 'EXP: ' : ''} - {formatDate(record?.ExpDate)} -
- )} -
- )} - {templateOptions.value === 'B' && ( -
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '25mm' - : `${imageSize}%`, - '7px', - record?.QRCode || record?.ProdId - )} -
- )} -
-
- ); - }) - ) - : Array.from({ length: copies })?.map((_, index) => { + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + return Array.from({ length: copyCount })?.map((_, copyIndex) => { const hasProductName = !!templateOptions.productName; const hasMrp = !!templateOptions.mrp; - const hasMDate = - templateOptions.mDate && - detail?.ProdVariantPriceDetails?.[0]?.ManufDate; + const hasMDate = templateOptions.mDate && record?.ManufDate; - const hasEDate = - templateOptions.eDate && - detail?.ProdVariantPriceDetails?.[0]?.ExpDate; + const hasEDate = templateOptions.eDate && record?.ExpDate; // IMAGE SIZE LOGIC let imageSize = 50; @@ -4642,7 +4579,7 @@ const ProductList = () => { return (
{templateOptions.value === 'T' && ( @@ -4661,7 +4598,8 @@ const ProductList = () => { templateOptions.codeType === 'B' ? '90%' : `${imageSize}%`, - '7px' + '7px', + record?.QRCode || record?.ProdId )}
)} @@ -4672,13 +4610,9 @@ const ProductList = () => { textAlign: 'center', width: '100%', }} - className={`productNameBQ ${nickName ? '' : proName?.length > 12 ? 'text-ellipsis' : ''}`} + className={`productNameBQ ${nickName ? '' : record?.ProdName?.length > 12 ? 'text-ellipsis' : ''}`} > - {nickName - ? nickName - : proName - ? proName - : 'Product Name'} + {record?.NickName || record?.ProdName}
)} {hasMrp && ( @@ -4690,7 +4624,7 @@ const ProductList = () => { }} className="MRPBQ" > - {'₹' + detail?.MRP} + {'₹' + record?.MRP}
)} {templateOptions.value === 'C' && ( @@ -4709,7 +4643,8 @@ const ProductList = () => { templateOptions.codeType === 'B' ? '90%' : `${imageSize}%`, - '7px' + '7px', + record?.QRCode || record?.ProdId )}
)} @@ -4733,10 +4668,7 @@ const ProductList = () => { className="MandateBQ" > {hasMDate && !hasEDate ? 'MFG: ' : ''} - {formatDate( - detail?.ProdVariantPriceDetails?.[0] - ?.ManufDate - )} + {formatDate(record?.ManufDate)}
)} {hasMDate && hasEDate && ( @@ -4753,9 +4685,7 @@ const ProductList = () => { className="ExpdateBQ" > {!hasMDate && hasEDate ? 'EXP: ' : ''} - {formatDate( - detail?.ProdVariantPriceDetails?.[0]?.ExpDate - )} + {formatDate(record?.ExpDate)}
)}
@@ -4776,83 +4706,212 @@ const ProductList = () => { templateOptions.codeType === 'B' ? '25mm' : `${imageSize}%`, - '7px' + '7px', + record?.QRCode || record?.ProdId )}
)}
); - })} + }) + } + + ) + : Array.from({ length: copies })?.map((_, index) => { + const hasProductName = !!templateOptions.productName; + const hasMrp = !!templateOptions.mrp; + + const hasMDate = + templateOptions.mDate && + detail?.ProdVariantPriceDetails?.[0]?.ManufDate; + + const hasEDate = + templateOptions.eDate && + detail?.ProdVariantPriceDetails?.[0]?.ExpDate; + + // IMAGE SIZE LOGIC + let imageSize = 50; + if (!hasMDate && !hasEDate) { + imageSize = 52; + } + + if (!hasProductName || !hasMrp) { + imageSize = 60; + } + + if (!hasProductName && !hasMrp) { + imageSize = 80; + } + + // FLEX DIRECTION LOGIC + const forceColumnLayout = + !hasProductName || !hasMrp || (!hasMDate && !hasEDate); + return ( +
+
+ {templateOptions.value === 'T' && ( +
+ {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '90%' + : `${imageSize}%`, + '7px' + )} +
+ )} + {hasProductName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {nickName + ? nickName + : proName + ? proName + : 'Product Name'} +
+ )} + {hasMrp && ( +
+ {'₹' + detail?.MRP} +
+ )} + {templateOptions.value === 'C' && ( +
+ {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '90%' + : `${imageSize}%`, + '7px' + )} +
+ )} + {(hasMDate || hasEDate) && ( +
+ {hasMDate && ( +
+ {hasMDate && !hasEDate ? 'MFG: ' : ''} + {formatDate( + detail?.ProdVariantPriceDetails?.[0] + ?.ManufDate + )} +
+ )} + {hasMDate && hasEDate && ( + | + )} + {hasEDate && ( +
+ {!hasMDate && hasEDate ? 'EXP: ' : ''} + {formatDate( + detail?.ProdVariantPriceDetails?.[0]?.ExpDate + )} +
+ )} +
+ )} + {templateOptions.value === 'B' && ( +
+ {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '25mm' + : `${imageSize}%`, + '7px' + )} +
+ )} +
+
+ ); + })}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '90%' : '35%', - '6px', - record?.QRCode || record?.ProdId - )} - {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} -
- )} - {templateOptions.mrp && ( -
{'MRP : ' + record?.MRP}
- )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + return Array.from({ length: copyCount })?.map((_, copyIndex) => (
{imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '90%' : '35%' + templateOptions.codeType === 'B' ? '90%' : '35%', + '6px', + record?.QRCode || record?.ProdId )} - {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {proName} -
- )} - {templateOptions.mrp && ( -
{'MRP : ' + detail?.MRP}
- )} -
-
- ))} -
-
- -
- {selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
{templateOptions.productName && (
12 ? 'text-ellipsis' : ''}`} @@ -4860,9 +4919,172 @@ const ProductList = () => { {record?.NickName || record?.ProdName}
)} + {templateOptions.mrp && ( +
{'MRP : ' + record?.MRP}
+ )} +
+
+ )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' ? '90%' : '35%' + )} + {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {proName} +
+ )} + {templateOptions.mrp && ( +
{'MRP : ' + detail?.MRP}
+ )} +
+
+ ))} +
+
+ +
+ {selectedRecords?.length > 0 + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( + +
+
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {record?.NickName || record?.ProdName} +
+ )} + {templateOptions.mDate && record?.ManufDate && ( +
+ {record?.ManufDate} +
+ )} + {templateOptions.eDate && record?.ExpDate && ( +
+ {record?.ExpDate} +
+ )} +
+
+ {imageTagBarcodeAndQR( + '70%', + '6px', + record?.QRCode || record?.ProdId + )} + {templateOptions.mrp && ( +
{'MRP : ' + record?.MRP}
+ )} +
+
+ )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {nickName + ? nickName + : proName + ? proName + : 'Product Name'} +
+ )} + {templateOptions.mDate && + detail?.ProdVariantPriceDetails?.[0]?.ManufDate && ( +
+ {detail?.ProdVariantPriceDetails?.[0]?.ManufDate} +
+ )} + {templateOptions.eDate && + detail?.ProdVariantPriceDetails?.[0]?.ExpDate && ( +
+ {detail?.ProdVariantPriceDetails?.[0]?.ExpDate} +
+ )} +
+
+ {imageTagBarcodeAndQR('70%')} + {templateOptions.mrp && ( +
{'MRP : ' + detail?.MRP}
+ )} +
+
+ ))} +
+ +
+
+ {selectedRecords?.length > 0 + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
+
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {record?.NickName || record?.ProdName} +
+ )} {templateOptions.mDate && record?.ManufDate && (
{record?.ManufDate} @@ -4870,7 +5092,7 @@ const ProductList = () => { )} {templateOptions.eDate && record?.ExpDate && (
{record?.ExpDate} @@ -4878,11 +5100,15 @@ const ProductList = () => { )}
{imageTagBarcodeAndQR( - '70%', + '90%', '6px', record?.QRCode || record?.ProdId )} @@ -4892,14 +5118,19 @@ const ProductList = () => {
)) + } + ) - : Array.from({ length: copies })?.map((_, index) => ( + : Array.from({ length: copies })?.map((_, index) => (
-
+
{templateOptions.productName && (
12 ? 'text-ellipsis' : ''}`} @@ -4914,7 +5145,7 @@ const ProductList = () => { {templateOptions.mDate && detail?.ProdVariantPriceDetails?.[0]?.ManufDate && (
{detail?.ProdVariantPriceDetails?.[0]?.ManufDate} @@ -4923,7 +5154,7 @@ const ProductList = () => { {templateOptions.eDate && detail?.ProdVariantPriceDetails?.[0]?.ExpDate && (
{detail?.ProdVariantPriceDetails?.[0]?.ExpDate} @@ -4931,326 +5162,165 @@ const ProductList = () => { )}
- {imageTagBarcodeAndQR('70%')} + {imageTagBarcodeAndQR('90%')} {templateOptions.mrp && (
{'MRP : ' + detail?.MRP}
)}
))} -
- -
-
- {selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
- {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {record?.NickName || record?.ProdName} -
- )} - {templateOptions.mDate && record?.ManufDate && ( -
- {record?.ManufDate} -
- )} - {templateOptions.eDate && record?.ExpDate && ( -
- {record?.ExpDate} -
- )} -
-
- {imageTagBarcodeAndQR( - '90%', - '6px', - record?.QRCode || record?.ProdId - )} - {templateOptions.mrp && ( -
{'MRP : ' + record?.MRP}
- )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
-
- {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {nickName - ? nickName - : proName - ? proName - : 'Product Name'} -
- )} - {templateOptions.mDate && - detail?.ProdVariantPriceDetails?.[0]?.ManufDate && ( -
- {detail?.ProdVariantPriceDetails?.[0]?.ManufDate} -
- )} - {templateOptions.eDate && - detail?.ProdVariantPriceDetails?.[0]?.ExpDate && ( -
- {detail?.ProdVariantPriceDetails?.[0]?.ExpDate} -
- )} -
-
- {imageTagBarcodeAndQR('90%')} - {templateOptions.mrp && ( -
{'MRP : ' + detail?.MRP}
- )} -
-
- ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
- {imageTagBarcodeAndQR( - 'auto', - '6px', - record?.QRCode || record?.ProdId - )} -
- {templateOptions.productName && ( -
- {'Product Name :' + - (record?.NickName || record?.ProdName)} -
- )} - {templateOptions.sellingPrice && ( -
- {'Selling Price :' + record?.SellPrice} -
- )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + return Array.from({ length: copyCount })?.map((_, copyIndex) => (
- {imageTagBarcodeAndQR()} + {imageTagBarcodeAndQR( + 'auto', + '6px', + record?.QRCode || record?.ProdId + )}
{templateOptions.productName && (
- {'Product Name :' + proName} + {'Product Name :' + + (record?.NickName || record?.ProdName)}
)} {templateOptions.sellingPrice && (
- {'Selling Price :' + detail?.SellPrice} + {'Selling Price :' + record?.SellPrice}
)}
- ))} + )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+ {imageTagBarcodeAndQR()} +
+ {templateOptions.productName && ( +
+ {'Product Name :' + proName} +
+ )} + {templateOptions.sellingPrice && ( +
+ {'Selling Price :' + detail?.SellPrice} +
+ )} +
+
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
- {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {'Product Name: ' + - (record?.NickName || record?.ProdName)} -
- )} - {templateOptions.mrp && ( -
{'MRP : ' + record?.MRP}
- )} - {templateOptions.sellingPrice && ( -
- {'Selling Price :' + record?.SellPrice} -
- )} -
-
- {imageTagBarcodeAndQR( - 'auto', - '6px', - record?.QRCode || record?.ProdId - )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => (
{templateOptions.productName && (
12 ? 'text-ellipsis' : ''}`} + className={`productNameBQ ${nickName ? '' : record?.ProdName?.length > 12 ? 'text-ellipsis' : ''}`} > - {'Product Name' + proName} + {'Product Name: ' + + (record?.NickName || record?.ProdName)}
)} {templateOptions.mrp && ( -
{'MRP : ' + detail?.MRP}
+
{'MRP : ' + record?.MRP}
)} {templateOptions.sellingPrice && (
- {'Selling Price :' + detail?.SellPrice} + {'Selling Price :' + record?.SellPrice}
)}
- {imageTagBarcodeAndQR()} + {imageTagBarcodeAndQR( + 'auto', + '6px', + record?.QRCode || record?.ProdId + )}
- ))} + )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {'Product Name' + proName} +
+ )} + {templateOptions.mrp && ( +
{'MRP : ' + detail?.MRP}
+ )} + {templateOptions.sellingPrice && ( +
+ {'Selling Price :' + detail?.SellPrice} +
+ )} +
+
+ {imageTagBarcodeAndQR()} +
+
+ ))}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
- {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {'Product Name: ' + - (record?.NickName || record?.ProdName)} -
- )} - {templateOptions.sellingPrice && ( -
- {'Selling Price :' + record?.SellPrice} -
- )} - {templateOptions.mDate && record?.ManufDate && ( -
{record?.ManufDate}
- )} - {templateOptions.eDate && record?.ExpDate && ( -
{record?.ExpDate}
- )} - {templateOptions.color && ( -
- {record?.Color || colorText} -
- )} -
-
- { -
- {imageTagBarcodeAndQR( - '70%', - '6px', - record?.QRCode || record?.ProdId - )} -
- } - {templateOptions.mrp && ( -
{'MRP : ' + record?.MRP}
- )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => (
{ > {templateOptions.productName && (
12 ? 'text-ellipsis' : ''}`} + className={`productNameBQ ${nickName ? '' : record?.ProdName?.length > 12 ? 'text-ellipsis' : ''}`} > - {'Product Name' + (nickName ? nickName : proName)} + {'Product Name: ' + + (record?.NickName || record?.ProdName)}
)} {templateOptions.sellingPrice && (
- {'Selling Price :' + detail?.SellPrice} + {'Selling Price :' + record?.SellPrice}
)} - {templateOptions.mDate && - detail?.ProdVariantPriceDetails?.[0]?.ManufDate && ( -
- {detail?.ProdVariantPriceDetails?.[0]?.ManufDate} -
- )} - {templateOptions.eDate && - detail?.ProdVariantPriceDetails?.[0]?.ExpDate && ( -
- {detail?.ProdVariantPriceDetails?.[0]?.ExpDate} -
- )} + {templateOptions.mDate && record?.ManufDate && ( +
{record?.ManufDate}
+ )} + {templateOptions.eDate && record?.ExpDate && ( +
{record?.ExpDate}
+ )} {templateOptions.color && ( -
{colorText}
+
+ {record?.Color || colorText} +
)}
{ flexDirection: 'column', }} > - {
{imageTagBarcodeAndQR('70%')}
} + { +
+ {imageTagBarcodeAndQR( + '70%', + '6px', + record?.QRCode || record?.ProdId + )} +
+ } {templateOptions.mrp && ( -
{'MRP : ' + detail?.MRP}
+
{'MRP : ' + record?.MRP}
)}
- ))} + )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {'Product Name' + (nickName ? nickName : proName)} +
+ )} + {templateOptions.sellingPrice && ( +
+ {'Selling Price :' + detail?.SellPrice} +
+ )} + {templateOptions.mDate && + detail?.ProdVariantPriceDetails?.[0]?.ManufDate && ( +
+ {detail?.ProdVariantPriceDetails?.[0]?.ManufDate} +
+ )} + {templateOptions.eDate && + detail?.ProdVariantPriceDetails?.[0]?.ExpDate && ( +
+ {detail?.ProdVariantPriceDetails?.[0]?.ExpDate} +
+ )} + {templateOptions.color && ( +
{colorText}
+ )} +
+
+ {
{imageTagBarcodeAndQR('70%')}
} + {templateOptions.mrp && ( +
{'MRP : ' + detail?.MRP}
+ )} +
+
+ ))}
@@ -5312,75 +5443,20 @@ const ProductList = () => { }} > {selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( -
-
- {templateOptions.value === 'T' && - imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '100%' : '50%', - '6px', - record?.QRCode || record?.ProdId - )} - {templateOptions.productName && ( -
- {record?.NickName - ? record?.NickName - : record?.ProdName} -
- )} - {templateOptions.value === 'C' && - imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '80%' - : !templateOptions.productName && - !templateOptions.mrp - ? '80%' - : '35%', - '6px', - record?.QRCode || record?.ProdId - )} - {templateOptions.mrp && ( -
- {'₹:' + record?.MRP} -
- )} - {templateOptions.value === 'B' && - imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '100%' : '50%', - '6px', - record?.QRCode || record?.ProdId - )} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
+ ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
{templateOptions.value === 'T' && imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '100%' : '50%' + templateOptions.codeType === 'B' ? '100%' : '50%', + '6px', + record?.QRCode || record?.ProdId )} {templateOptions.productName && (
{ whiteSpace: 'nowrap', width: '90%', }} - className={`productNameBQ ${nickName ? '' : proName?.length > 12 ? 'text-ellipsis' : ''}`} + className="productNameBQ" > - {nickName - ? nickName - : proName - ? proName - : 'Product Name'} + {record?.NickName + ? record?.NickName + : record?.ProdName}
)} {templateOptions.value === 'C' && @@ -5406,9 +5480,11 @@ const ProductList = () => { templateOptions.codeType === 'B' ? '80%' : !templateOptions.productName && - !templateOptions.mrp + !templateOptions.mrp ? '80%' - : '35%' + : '35%', + '6px', + record?.QRCode || record?.ProdId )} {templateOptions.mrp && (
{ }} className="MRPBQ" > - {'₹:' + (detail?.MRP ? detail?.MRP : 10.0)} + {'₹:' + record?.MRP}
)} {templateOptions.value === 'B' && imageTagBarcodeAndQR( - templateOptions.codeType === 'B' ? '100%' : '50%' + templateOptions.codeType === 'B' ? '100%' : '50%', + '6px', + record?.QRCode || record?.ProdId )}
- ))} + )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {templateOptions.value === 'T' && + imageTagBarcodeAndQR( + templateOptions.codeType === 'B' ? '100%' : '50%' + )} + {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {nickName + ? nickName + : proName + ? proName + : 'Product Name'} +
+ )} + {templateOptions.value === 'C' && + imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '80%' + : !templateOptions.productName && + !templateOptions.mrp + ? '80%' + : '35%' + )} + {templateOptions.mrp && ( +
+ {'₹:' + (detail?.MRP ? detail?.MRP : 10.0)} +
+ )} + {templateOptions.value === 'B' && + imageTagBarcodeAndQR( + templateOptions.codeType === 'B' ? '100%' : '50%' + )} +
+
+ ))}
{/* //Qrcode */}
{selectedRecords?.length > 0 - ? selectedRecords?.map((record, recordIndex) => - Array.from({ length: copies })?.map((_, copyIndex) => ( + ? selectedRecords?.map((record, recordIndex) => { + const copyCount = generateQRCodeCopy(record?.QRCode); + + return Array.from({ length: copyCount })?.map((_, copyIndex) => ( +
-
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '100%' - : !templateOptions.mrp && - !templateOptions.productName - ? '60%' - : '40%', - '8px', - record?.QRCode || record?.ProdId - )} - {(templateOptions.productName || - templateOptions.mrp) && ( + {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '100%' + : !templateOptions.mrp && + !templateOptions.productName + ? '60%' + : '40%', + '8px', + record?.QRCode || record?.ProdId + )} + {(templateOptions.productName || + templateOptions.mrp) && (
{ )}
)} -
-
- )) - ) - : Array.from({ length: copies })?.map((_, index) => ( -
-
- {imageTagBarcodeAndQR( - templateOptions.codeType === 'B' - ? '100%' - : !templateOptions.mrp && !templateOptions.productName - ? '60%' - : '40%', - '8px' - )} - {(templateOptions.productName || templateOptions.mrp) && ( -
- {templateOptions.productName && ( -
12 ? 'text-ellipsis' : ''}`} - > - {nickName - ? nickName - : proName - ? proName - : 'Product Name'} -
- )} - {templateOptions.mrp && ( -
- {'MRP : ' + detail?.MRP} -
- )} -
- )}
- ))} + )) + } + + ) + : Array.from({ length: copies })?.map((_, index) => ( +
+
+ {imageTagBarcodeAndQR( + templateOptions.codeType === 'B' + ? '100%' + : !templateOptions.mrp && !templateOptions.productName + ? '60%' + : '40%', + '8px' + )} + {(templateOptions.productName || templateOptions.mrp) && ( +
+ {templateOptions.productName && ( +
12 ? 'text-ellipsis' : ''}`} + > + {nickName + ? nickName + : proName + ? proName + : 'Product Name'} +
+ )} + {templateOptions.mrp && ( +
+ {'MRP : ' + detail?.MRP} +
+ )} +
+ )} +
+
+ ))}
-
+
{ }} onlineImage={onlineImage} ImageLink={rowRecord?.ProdLogo || null} - updateImageUrl={imageModalRowIndex ? updateImageUrl : () => {}} + updateImageUrl={imageModalRowIndex ? updateImageUrl : () => { }} handleClose={handleImageModalClose} />