diff --git a/src/Pages/Product/ProductList.jsx b/src/Pages/Product/ProductList.jsx
index cced5d0..67b24f8 100644
--- a/src/Pages/Product/ProductList.jsx
+++ b/src/Pages/Product/ProductList.jsx
@@ -100,10 +100,18 @@ 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 { FaPlus } from 'react-icons/fa6';
import { Tables } from '../../../ownLib/my-ui-lib.js';
+import StickerPrintModel from './StickerPrintModal.jsx';
+import StickerPrintTemplates from './StickerTemplates.jsx';
+import QRCodeCopiesModal from './QRCodeCopiesModal.jsx';
+import {
+ generateBarcode,
+ generateCodeImage,
+ generateQRCode,
+ generateQRCodeCopy,
+} from '../../Services/utils.js';
-const colorText = 'Color : Red';
const ProductList = () => {
const { SadminuserAccess } = useAuth();
let SAAccessCommonMaster = SadminuserAccess?.find(
@@ -114,11 +122,7 @@ const ProductList = () => {
const navigateTo = useNavigate();
const dispatch = useDispatch();
const location = useLocation();
- const barCodeImage =
- 'https://cdn.pixabay.com/photo/2014/04/02/16/19/barcode-306926_1280.png';
- const qrCodeImage =
- 'https://cdn.pixabay.com/photo/2015/03/21/09/34/qr-683354_640.png';
- const previewText = 'Barcode Preview';
+
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const AppId = getSession('AppId');
@@ -154,7 +158,7 @@ const ProductList = () => {
UomTypePreference?.some?.(
(e) =>
e?.PreferredSubCatName?.toLowerCase() ==
- item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y'
+ item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y'
)
);
@@ -242,7 +246,6 @@ const ProductList = () => {
const valueStyleColumn = {
flexDirection: templateOptions.value === 'T' ? 'column' : 'column-reverse',
};
-
const [base64Image, setBase64Image] = useState(null);
const [barcodeBase64Image, setBarcodeBase64Image] = useState(null);
const [deleteProductPages, setDeleteProductPages] = useState([]);
@@ -263,7 +266,7 @@ const ProductList = () => {
const [onlineImage, setOnlineImage] = useState(null);
const [imageUrl, setImageUrl] = useState('');
const [recordIndex, setRecordIndex] = useState(null);
-
+ const [printReady, setPrintReady] = useState(false);
const [rangeFrom, setRangeFrom] = useState('');
const [rangeTo, setRangeTo] = useState('');
@@ -272,7 +275,6 @@ const ProductList = () => {
const [productWiseQrcode, setProductWiseQrcode] = useState(false);
const lastRangeIdsRef = useRef([]);
-
const subDirectory = import.meta.env.ENV_BASE_URL;
// const [openTour, setOpenTour] = useState(false);
@@ -284,7 +286,7 @@ const ProductList = () => {
// placement: 'top',
// },
// ];
-
+ console.log(QrandbarcodeDatas, 'QrandbarcodeDatas');
const items = [
{
name: 'Home',
@@ -318,6 +320,10 @@ const ProductList = () => {
setPopUp(true);
};
+ const Datas = Array.from({ length: 5 }, (_, i) => i + 10);
+ const ModifiedData = Datas?.map((e) => ({ value: e }));
+ console.log(ModifiedData, 'Datas');
+
useEffect(() => {
if (deleteProductPages?.length > 0) {
getForDeleteProduct(deleteProductPages);
@@ -327,12 +333,6 @@ const ProductList = () => {
}
}, [deleteProductPages]);
- useEffect(() => {
- if (coresdata?.length > 0 && open) {
- CoresOnChange(coresdata?.[0].ConfigName);
- }
- }, [open]);
-
useEffect(() => {
if (!AllProdIds?.length) return;
const cleaned = deleteInput?.replace(/\s+/g, '');
@@ -858,31 +858,7 @@ const ProductList = () => {
// onlineImage,
// ]
// );
- const formatDate = (dateStr) => {
- const d = new Date(dateStr);
- const day = String(d.getDate()).padStart(2, '0');
-
- const months = [
- 'JAN',
- 'FEB',
- 'MAR',
- 'APR',
- 'MAY',
- 'JUN',
- 'JUL',
- 'AUG',
- 'SEP',
- 'OCT',
- 'NOV',
- 'DEC',
- ];
- const month = months[d.getMonth()];
-
- const year = String(d.getFullYear()).slice(-2);
-
- return `${day}-${month}-${year}`;
- };
const handleCheckboxChange = (record, checked) => {
setSelectedRecords((prev) => {
if (checked) {
@@ -892,8 +868,13 @@ const ProductList = () => {
}
});
};
- const CreateQrcode = async (isChecked, code, productName, StockAvailable, copiesCount = 0) => {
-
+ const CreateQrcode = async (
+ isChecked,
+ code,
+ productName,
+ StockAvailable,
+ copiesCount = 0
+ ) => {
if (!code) return;
if (isChecked) {
@@ -905,7 +886,7 @@ const ProductList = () => {
url: data,
productName: productName,
copiesCount: copiesCount,
- StockAvailable: StockAvailable
+ StockAvailable: StockAvailable,
},
]);
} else {
@@ -919,7 +900,15 @@ 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, product.ProdName, product.StockAvailable, product.TotalBalanceQty))
+ batch.map((product) =>
+ CreateQrcode(
+ true,
+ product.QRCode,
+ product.ProdName,
+ product.StockAvailable,
+ product.TotalBalanceQty
+ )
+ )
);
// Small delay to prevent UI blocking
if (i + batchSize < products.length) {
@@ -927,7 +916,15 @@ const ProductList = () => {
}
}
} else {
- products.forEach((product) => CreateQrcode(false, product.QRCode, product.ProdName, product.StockAvailable, product.TotalBalanceQty));
+ products.forEach((product) =>
+ CreateQrcode(
+ false,
+ product.QRCode,
+ product.ProdName,
+ product.StockAvailable,
+ product.TotalBalanceQty
+ )
+ );
}
};
@@ -968,19 +965,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,
+ },
+ ]
: []),
{
@@ -999,121 +996,127 @@ 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
- )
- )
- );
- }
- }}
- />
- )}
- 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 ? (
+ {
+ title: 'QRCode',
+ dataIndex: 'QRCode',
+ key: 'QRCode',
+ width: '100px',
+ align: 'center',
+ render: (text) => (
+ {text ? text : '-'}
+ ),
+ ellipsis: true,
+ },
+ {
+ title: (
+
+
+ {MultiCode && (
r.ProdId == record.ProdId
- )}
+ checked={
+ selectedRecords.length > 0 &&
+ productData
+ .filter((p) => p?.QRCode)
+ .every((p) =>
+ selectedRecords.some((r) => r.ProdId === p.ProdId)
+ )
+ }
onChange={(e) => {
- handleCheckboxChange(record, e.target.checked);
- CreateQrcode(e.target.checked, record.QRCode, record?.ProdName, record?.StockAvailable, record?.TotalBalanceQty);
+ 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
+ )
+ )
+ );
+ }
}}
/>
+ )}
+ 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
+ );
+ }}
+ />
+ ) : (
+ '-'
+ )
+ ) : record?.QRCode ? (
+
+ Qrcode(record)}
+ />
+
) : (
'-'
- )
- ) : record?.QRCode ? (
-
- Qrcode(record)}
- />
-
- ) : (
- '-'
- )}
-
- ) : null,
- },
- ]
+ )}
+
+ ) : null,
+ },
+ ]
: []),
{
@@ -1131,11 +1134,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
}
@@ -1152,11 +1155,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
}
@@ -1168,11 +1171,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
}
@@ -1421,17 +1424,6 @@ const ProductList = () => {
onlineImage,
]);
- const handleImageTag = (w, h = '40px', barcodeOrQr) => {
- return (
-
- );
- };
-
const updateImageUrl = (url) => {
setImageUrl(url);
};
@@ -1749,17 +1741,7 @@ const ProductList = () => {
}
}
};
- 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);
@@ -1948,70 +1930,79 @@ const ProductList = () => {
});
}
- switch (dropdownValue) {
- case '15X15 6cross': // COMPLETE
- await printDiv(
- templateAvailable ? 'label-15X156cross' : 'StickerPrints0',
- (style + getPageStyle(92))
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '22X35 3cross': // Need to check
- await printDiv(
- templateAvailable ? '22X353cross' : 'StickerPrints1',
- style + getPageStyle(105)
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '25X25 4cross': // COMPLETE
- await printDiv(
- templateAvailable ? '25X254cross' : 'StickerPrints2',
- style + getPageStyle(100)
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '25X50 2cross': //Need to check
- await printDiv(
- templateAvailable ? '25X502cross' : 'StickerPrints3',
- style + getPageStyle(100)
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '50X30 Single': // COMPLETE
- await printDiv(
- templateAvailable ? '50X30Single' : 'StickerPrints4',
- style
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '50X25 Single': // COMPLETE
- await printDiv(
- templateAvailable ? '50X25Single' : 'StickerPrints5',
- style
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '100X13 (55MM Printable)': //Need to check
- await printDiv(
- templateAvailable ? '100X13(55MMPrintable)' : 'StickerPrints6',
- style
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '100X15 (70MM Printable)': // COMPLETE
- await printDiv(
- templateAvailable ? '100X15(70MMPrintable)' : 'StickerPrints7',
- style
- );
- handleQRStickerPrinterModelCancel();
- break;
- case '100X150': // COMPLETE
- await printDiv(templateAvailable ? '100X150' : 'StickerPrints8', style);
- handleQRStickerPrinterModelCancel();
- break;
- default:
- alert('! Select correct cross ');
- }
+ setPrintReady(true);
+
+ setTimeout(async () => {
+ switch (dropdownValue) {
+ case '15X15 6cross': // COMPLETE
+ await printDiv(
+ templateAvailable ? 'label-15X156cross' : 'StickerPrints0',
+ style + getPageStyle(92)
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '22X35 3cross': // Need to check
+ await printDiv(
+ templateAvailable ? '22X353cross' : 'StickerPrints1',
+ style + getPageStyle(105)
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '25X25 4cross': // COMPLETE
+ await printDiv(
+ templateAvailable ? '25X254cross' : 'StickerPrints2',
+ style + getPageStyle(100)
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '25X50 2cross': //Need to check
+ await printDiv(
+ templateAvailable ? '25X502cross' : 'StickerPrints3',
+ style + getPageStyle(100)
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '50X30 Single': // COMPLETE
+ await printDiv(
+ templateAvailable ? '50X30Single' : 'StickerPrints4',
+ style
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '50X25 Single': // COMPLETE
+ await printDiv(
+ templateAvailable ? '50X25Single' : 'StickerPrints5',
+ style
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '100X13 (55MM Printable)': //Need to check
+ await printDiv(
+ templateAvailable ? '100X13(55MMPrintable)' : 'StickerPrints6',
+ style
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '100X15 (70MM Printable)': // COMPLETE
+ await printDiv(
+ templateAvailable ? '100X15(70MMPrintable)' : 'StickerPrints7',
+ style
+ );
+ handleQRStickerPrinterModelCancel();
+ break;
+ case '100X150': // COMPLETE
+ await printDiv(
+ templateAvailable ? '100X150' : 'StickerPrints8',
+ style
+ );
+ handleQRStickerPrinterModelCancel();
+ setPrintReady(false);
+ break;
+ default:
+ alert('! Select correct cross ');
+ setPrintReady(false);
+ }
+ }, 100);
};
useEffect(() => {
@@ -2052,7 +2043,7 @@ const ProductList = () => {
};
const handleSubmitbulk = (excelData) => {
- setExceldatasubmit(excelData);
+ setExceldatasubmit(excelData?.filter((e) => e?.isModified));
};
const handleSubmit = async () => {
@@ -2136,6 +2127,7 @@ const ProductList = () => {
handleResetExcelData();
handleCancel();
} else {
+ setBulkpost(false);
setMessageType('error');
setMessageData('No data to submit. Please upload an Excel file.');
}
@@ -2224,7 +2216,6 @@ const ProductList = () => {
}
}, [ProdId]);
-
const totalCopies = QrandbarcodeDatas?.reduce(
(sum, item) => sum + Number(item?.copiesCount || 0),
0
@@ -2263,65 +2254,36 @@ const ProductList = () => {
console.error('Error fetching barcode session data:', error);
}
};
- const imageTagBarcodeAndQR = (w = 'auto', fs = '6px', codeData = null) => {
- const currentCode = codeData || ProdId;
-
- console.log(currentCode, '1111111111', codeData);
- return (
- (templateOptions.barcode || templateOptions.qrcode) && (
- <>
-
- {templateOptions.codeType !== 'B' && (
-
- {currentCode}
-
- )}
- >
- )
- );
- };
-
- const generateBarcode = (code) => {
- try {
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
- JsBarcode(svg, code, {
- format: 'CODE128',
- displayValue: false,
- lineColor: '#030303',
- width: 2,
- height: 40,
- });
- const svgData = new XMLSerializer().serializeToString(svg);
- return `data:image/svg+xml;base64,${btoa(svgData)}`;
- } catch (error) {
- return null;
- }
- };
-
- // const generateQRCode = (code) => {
-
- // return base64Image;
- // };
-
- const generateCodeImage = (code, codeType = 'Q') => {
- if (codeType === 'B') {
- return generateBarcode(code);
- } else {
- return generateQRCode(code);
- }
- };
+ const imageTagBarcodeAndQR = useCallback(
+ (w = 'auto', fs = '6px', codeData = null) => {
+ const currentCode = codeData || ProdId;
+ return (
+ (templateOptions.barcode || templateOptions.qrcode) && (
+ <>
+
+ {templateOptions.codeType !== 'B' && (
+
+ {currentCode}
+
+ )}
+ >
+ )
+ );
+ },
+ [templateOptions, MultiCode, barcodeBase64Image, base64Image, ProdId]
+ );
const handleQRStickerPrinterModelCancel = () => {
setDropdownValue();
@@ -2329,9 +2291,10 @@ const ProductList = () => {
setOpen(false);
formRef?.current?.resetFields();
setSelectedRecords([]);
- setQrandbarcodeDatas([])
+ setQrandbarcodeDatas([]);
setMultiCode(false);
setNickName(null);
+ setPrintReady(false);
};
const handleProcessMultipleOCR = async (formDataArray) => {
@@ -2632,3022 +2595,59 @@ const ProductList = () => {
{/* */}
{/* */}
-
-
- {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
-
-
-
-
}
-
-
-
-
-
-
- {coresdata?.map((option) => (
-
CoresOnChange(option.ConfigName)}
- className={`radio-sidebar-item ${dropdownValue === option.ConfigName ? 'selected' : ''}`}
- >
-
- {option.ConfigName}
-
-
- ))}
-
-
-
-
PREVIEW
- {(() => {
- const template = barcodeTemplateDetails?.find(
- (find) => find.SessionName === dropdownValue
- );
- const templateAvailable =
- template === undefined ? false : true;
- // Define constants using the lookup map
- const checkComponent = (name) =>
- template?.OptionDetails?.some(
- (some) => some.OptionName === name
- );
-
- const mrp = checkComponent('MRP');
- const qrcode = checkComponent('Qrcode');
- const barcode = checkComponent('Barcode');
- const color = checkComponent('Color');
- const eDate = checkComponent('E Date');
- const mDate = checkComponent('M Date');
- const sellingPrice = checkComponent('Selling Price');
- const productName = checkComponent('Product Name');
- const barcodeOrQr = template?.CodeType
- ? template?.CodeType === 'B'
- : true;
- // setPreviewTemplateOptions({
- // mrp: mrp,
- // barcode: barcode,
- // color: color,
- // eDate: eDate,
- // mDate: mDate,
- // sellingPrice: sellingPrice,
- // productName: productName,
- // value: template?.Position !== '' ? template?.Position : '',
- // secondValue:
- // template?.PositionString !== ''
- // ? template?.PositionString
- // : '',
- // qrcode: qrcode,
- // codeType: template?.CodeType,
- // });
- const templateValue =
- template?.Position !== '' ? template?.Position : '';
- switch (dropdownValue) {
- case '15X15 6cross':
- return templateAvailable ? (
- !(productName || barcode || qrcode || mrp) ? (
-
- ) : (
- <>
-
- {[...Array(6)].map((_, index) => (
-
-
- {(barcode || qrcode) &&
- templateValue === 'T' &&
- handleImageTag(
- barcodeOrQr ? 50 : 20,
- 20,
- barcodeOrQr
- )}
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {(barcode || qrcode) &&
- templateValue === 'C' &&
- handleImageTag(
- barcodeOrQr ? 50 : 20,
- 20,
- barcodeOrQr
- )}
- {mrp && (
-
- {'₹:' +
- (detail?.MRP
- ? detail?.MRP
- : 0.0)}
-
- )}
- {(barcode || qrcode) &&
- templateValue === 'B' &&
- handleImageTag(
- barcodeOrQr ? 50 : 20,
- 20,
- barcodeOrQr
- )}
-
-
- ))}
-
-
-
- Vertical
-
- {' '}
-
- - {'15mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'15mm'}
-
-
- >
- )
- ) : (
- <>
-
- {Array.from({ length: 6 }).map(
- (_, index) => (
-
-

-
- )
- )}
-
-
-
- Vertical
-
- {' '}
-
- - {'15mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'15mm'}
-
-
- >
- );
- case '22X35 3cross':
- return templateAvailable ? (
- //"B","T"
- !(barcode || qrcode || mrp) ? (
-
- ) : (
- <>
-
- {[...Array(3)].map((_, index) => (
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 100 : 35,
- 35,
- barcodeOrQr
- )}
- {(productName || mrp) && (
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : (proName || 'Product Name')}
-
- )}
- {mrp && (
-
- {'₹:' +
- (detail?.MRP
- ? detail?.MRP
- : 10.0)}
-
- )}
-
- )}
-
-
- ))}
-
-
-
- Vertical
-
- {' '}
-
- - {'22mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'35mm'}
-
-
- >
- )
- ) : (
- <>
-
- {Array?.from({ length: 3 })?.map(
- (_, index) => (
-
-
-
8 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR579890770'}
-
-

-
- )
- )}
-
-
-
- Vertical
-
- {' '}
-
- - {'22mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'35mm'}
-
-
- >
- );
- case '25X25 4cross':
- return templateAvailable ? (
- !(
- productName ||
- mDate ||
- eDate ||
- barcode ||
- qrcode ||
- mrp
- ) ? (
-
- ) : (
- // 4 Cross idhu 25 * 25 * 25 * 25 = 1 inch
- <>
-
- {[...Array(4)].map((_, index) => (
-
-
- {(barcode || qrcode) &&
- templateValue === 'T' &&
- handleImageTag(
- barcodeOrQr ? 60 : 35,
- 35,
- barcodeOrQr
- )}
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {mrp && (
-
- {'₹:' +
- (detail?.MRP
- ? detail?.MRP
- : 10.0)}
-
- )}
- {(barcode || qrcode) &&
- templateValue === 'C' &&
- handleImageTag(
- barcodeOrQr ? 60 : 35,
- 35,
- barcodeOrQr
- )}
- {mDate && (
-
- )}
- {eDate && (
-
- DD-MM-YYYY
-
- )}
- {(barcode || qrcode) &&
- templateValue === 'B' &&
- handleImageTag(
- barcodeOrQr ? 60 : 35,
- 35,
- barcodeOrQr
- )}
-
-
- ))}
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'25mm'}
-
-
- >
- )
- ) : (
- <>
-
- {Array.from({ length: 4 })?.map(
- (_, index) => (
-
-
12 ? 'text-ellipsis' : ''}`}
- >
-
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
-
- ({size || '1 PCS'})
-
-
-
-

-
{ProdId || 'QR8575956'}
-
-
- )
- )}
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'25mm'}
-
-
- >
- );
- case '25X50 2cross':
- return templateAvailable ? (
- //"B","T"
- !(productName || barcode || qrcode || mrp) ? (
-
- ) : (
- <>
-
- {[...Array(2)].map((_, index) => (
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 140 : 30,
- 30,
- barcodeOrQr
- )}
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {mrp && (
-
- {'₹:' +
- (detail?.MRP
- ? detail?.MRP
- : 10.0)}
-
- )}
-
-
- ))}
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- )
- ) : (
- <>
-
- {Array.from({ length: 2 })?.map(
- (_, index) => (
-
-
-
12 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR74478578'}
-
-

-
- )
- )}
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- );
- case '50X30 Single':
- return templateAvailable ? (
- !(
- productName ||
- mDate ||
- eDate ||
- barcode ||
- qrcode ||
- mrp
- ) ? (
-
- ) : (
- <>
-
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {mDate &&
- detail?.ProdVariantPriceDetails?.[0]
- ?.ManufDate && (
-
- {formatDate(
- detail
- ?.ProdVariantPriceDetails?.[0]
- ?.ManufDate
- )}
-
- )}
- {eDate &&
- detail?.ProdVariantPriceDetails?.[0]
- ?.ExpDate && (
-
- {formatDate(
- detail
- ?.ProdVariantPriceDetails?.[0]
- ?.ExpDate
- )}
-
- )}
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 70 : 35,
- 35,
- barcodeOrQr
- )}
- {mrp && (
-
- {'MRP : ' + (detail?.MRP || 10.0)}
-
- )}
-
-
-
-
- Vertical
-
- {' '}
-
- - {'30mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- )
- ) : (
- <>
-
-
-
-
12 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR987968'}
-
-

-
-
-
-
- Vertical
-
- {' '}
-
- - {'30mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- );
- case '50X25 Single':
- return templateAvailable ? (
- !(
- productName ||
- mDate ||
- barcode ||
- qrcode ||
- mrp
- ) ? (
-
- ) : (
- <>
-
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {mDate &&
- detail?.ProdVariantPriceDetails?.[0]
- ?.ManufDate && (
-
- {formatDate(
- detail
- ?.ProdVariantPriceDetails?.[0]
- ?.ManufDate
- )}
-
- )}
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 70 : 35,
- 35,
- barcodeOrQr
- )}
- {mrp && (
-
- {'MRP : ' + (detail?.MRP || '10.0')}
-
- )}
-
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- )
- ) : (
- <>
-
-
-
-
12 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR8798639'}
-
-

-
-
-
-
- Vertical
-
- {' '}
-
- - {'25mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'50mm'}
-
-
- >
- );
- case '100X13 (55MM Printable)':
- return templateAvailable ? (
- //"C", "T", "B"
- !(
- productName ||
- sellingPrice ||
- barcode ||
- qrcode
- ) ? (
-
- ) : (
- <>
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 140 : 35,
- 35,
- barcodeOrQr
- )}
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {sellingPrice && (
-
- {`Selling Price : ` +
- (detail?.SellPrice || '10.0')}
-
- )}
-
-
-
-
- Vertical
-
- {' '}
-
- - {'13mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- )
- ) : (
- <>
-
-
-
-
12 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR0970970'}
-
-

-
-
-
-
- Vertical
-
- {' '}
-
- - {'13mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- );
- case '100X15 (70MM Printable)':
- return templateAvailable ? (
- // "L","R"
- !(
- productName ||
- sellingPrice ||
- barcode ||
- qrcode ||
- mrp
- ) ? (
-
- ) : (
- <>
-
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {mrp && (
-
- {'MRP : ' + (detail?.MRP || '10.0')}
-
- )}
- {sellingPrice && (
-
- {`Selling Price : ` +
- (detail?.SellPrice || '10.0')}
-
- )}
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 90 : 40,
- null,
- barcodeOrQr
- )}
-
-
-
-
- Vertical
-
- {' '}
-
- - {'15mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- )
- ) : (
- <>
-
-
-
-
12 ? 'text-ellipsis' : ''}`}
- >
- {proName || 'Product Name'} ({size || '1 PCS'})
-
-
{ProdId || 'QR858755'}
-
-

-
-
-
-
- Vertical
-
- {' '}
-
- - {'15mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- );
- case '100X150':
- return templateAvailable ? (
- !(
- productName ||
- sellingPrice ||
- mDate ||
- eDate ||
- color ||
- barcode ||
- qrcode ||
- mrp
- ) ? (
-
- ) : (
- <>
-
-
- {productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {sellingPrice && (
-
- {`Selling Price : ` +
- detail?.SellPrice}
-
- )}
- {mDate &&
- detail?.ProdVariantPriceDetails?.[0]
- ?.ManufDate && (
-
- {formatDate(
- detail
- ?.ProdVariantPriceDetails?.[0]
- ?.ManufDate
- )}
-
- )}
- {eDate &&
- detail?.ProdVariantPriceDetails?.[0]
- ?.ExpDate && (
-
- {formatDate(
- detail
- ?.ProdVariantPriceDetails?.[0]
- ?.ExpDate
- )}
-
- )}
- {color && (
-
- {colorText}
-
- )}
-
-
- {(barcode || qrcode) &&
- handleImageTag(
- barcodeOrQr ? 140 : 35,
- 35,
- barcodeOrQr
- )}
- {mrp && (
-
- {'MRP : ' + (detail?.MRP || '10.0')}
-
- )}
-
-
-
-
- Vertical
-
- {' '}
-
- - {'150mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- )
- ) : (
- <>
-
-
-
-
-
-
- Product Name:{' '}
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
-
-
- SIZE:{' '}
-
- {size || '1 PCS'}
-
-
-
- Id:{' '}
-
- {ProdId || 'QR86868'}
-
-
-
- MRP:{' '}
-
- {'MRP : ' + (detail?.MRP || '10.0')}
-
-
-
- Selling Price:{' '}
-
- {(detail?.SellPrice || '10.0')}
-
-
-
-

-
-
-
-
-
- Vertical
-
- {' '}
-
- - {'150mm'}
-
-
- Horizontal
-
- {' '}
-
- - {'100mm'}
-
-
- >
- );
- default:
- return
;
- }
- })()}
-
{dropdownValue}
-
-
-
-
-
- {!MultiCode &&
{
- await validateSafeInput(value); // To block HTML tags & SQL keywords
- return Promise.resolve();
- },
- },
- ]}
- >
- Copies}
- isOnChange={false}
- onChange={(e) => {
- CopiesOnChange(e?.target?.value);
- }}
- />
- }
- {proName?.length > 12 && printProductName && !MultiCode && (
- <>
-
- Note: Product name is very long. Please add a short/nick
- name to proceed print.
-
-
- {
- setNickName(e?.target?.value);
- }}
- maxLength={12}
- />
-
- >
- )}
-
-
- {(!MultiCode || totalCopies > 0) && (
-
- )}
- {MultiCode && totalCopies === 0 && (
-
- )}
-
-
-
- }
+ formRef={formRef}
+ onFinish={onFinish}
+ MultiCode={MultiCode}
+ activeTab={activeTab}
+ setActiveTab={setActiveTab}
+ selectedRecords={selectedRecords}
+ coresdata={coresdata}
+ dropdownValue={dropdownValue}
+ CoresOnChange={CoresOnChange}
+ barcodeTemplateDetails={barcodeTemplateDetails}
+ detail={detail}
+ proName={proName}
+ nickName={nickName}
+ ProdId={ProdId}
+ size={size}
+ // valueStyleColumn={valueStyleColumn}
+ // secondValueStyle={secondValueStyle}
+ // valueStyleRow={valueStyleRow}
+ CopiesOnChange={CopiesOnChange}
+ printProductName={printProductName}
+ totalCopies={totalCopies}
+ setstockWiseQrcode={setstockWiseQrcode}
+ setProductWiseQrcode={setProductWiseQrcode}
+ setNickName={setNickName}
+ templateOptions={templateOptions}
/>
- < div style={{ display: 'none' }}>
-
-
- {selectedRecords?.length > 0
- ? 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) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- return Array?.from({ length: copyCount })?.map((_, copyIndex) => (
-
-
-
8 ? 'text-clamp-2' : ''}`}
- >
- {record.ProdName} ({record.Size}
- {record.UomName})
-
-
{record.QRCode}
-
-

-
- ))
- }
- )
- : Array?.from({ length: copies })?.map((_, index) => (
-
-
-
8 ? 'text-ellipsis' : ''}`}
- >
- {proName} ({size})
-
-
{ProdId}
-
-

-
- ))}
-
-
-
-
- {(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' : ''}`}
- >
-
- {record?.NickName || record?.ProdName}
-
-
- ({record?.Size}
- {record?.UomName})
-
-
-
-

-
- {record?.QRCode || record?.ProdId}
-
-
-
- ))
- }
+ {printReady && (
+
+ generateQRCodeCopy(QrandbarcodeDatas, code)
+ }
+ generateCodeImage={generateCodeImage}
+ imageTagBarcodeAndQR={imageTagBarcodeAndQR}
+ dropdownValue={dropdownValue}
+ barcodeTemplateDetails={barcodeTemplateDetails}
+ />
+ )}
- )
- : Array.from({ length: copies })?.map((_, index) => (
-
-
14 ? 'text-ellipsis' : ''}`}
- >
-
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
-
- ({size})
-
-
-
-

-
{ProdId}
-
-
- ))}
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- console.log(copyCount, 'copyCount3')
- return Array.from({ length: copyCount })?.map((_, copyIndex) => (
-
-
-
12 ? 'text-clamp-2' : ''}`}
- >
- {record?.NickName || record?.ProdName} ({record?.Size}
- {record?.UomName})
-
-
{record?.QRCode || record?.ProdId}
-
-

-
- ))
- })
- : Array.from({ length: copies })?.map((_, index) => (
-
-
-
12 ? 'text-clamp-2' : ''}`}
- >
- {proName} ({size})
-
-
{ProdId}
-
-

-
- ))}
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- console.log(copyCount, 'copyCount4')
- 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' : ''}`}
- >
- {proName} ({size})
-
-
{ProdId}
-
-

-
- ))}
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- console.log(copyCount, 'copyCount5')
- 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' : ''}`}
- >
- {proName} ({size})
-
-
{ProdId}
-
-

-
- ))}
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- console.log(copyCount, 'copyCount6')
- 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' : ''}`}
- >
- {proName} ({size})
-
-
{ProdId}
-
-

-
- ))}
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- 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' : ''}`}
- >
- {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}
-
-
-
-

-
-
- ))
- })
- : Array.from({ length: copies })?.map((_, index) => (
-
-
-
-
-
- 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) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- return Array.from({ length: copyCount })?.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) => {
- 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) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- return Array.from({ length: copyCount })?.map((_, copyIndex) => (
-
-
- {imageTagBarcodeAndQR(
- templateOptions.codeType === 'B' ? '45mm' : '16mm',
- '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) => (
-
-
- {imageTagBarcodeAndQR(
- templateOptions.codeType === 'B' ? '45mm' : '16mm'
- )}
- {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}
-
- )}
- {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) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
- return Array.from({ length: copyCount })?.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) => (
-
- {imageTagBarcodeAndQR()}
-
- {templateOptions.productName && (
-
- {'Product Name :' + proName}
-
- )}
- {templateOptions.sellingPrice && (
-
- {'Selling Price :' + detail?.SellPrice}
-
- )}
-
-
- ))}
-
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
-
- return Array.from({ length: copyCount })?.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) => (
-
-
- {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) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
-
- return Array.from({ length: copyCount })?.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) => (
-
-
- {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}
- )}
-
-
- ))}
-
-
-
-
-
- {selectedRecords?.length > 0
- ? selectedRecords?.map((record, recordIndex) => {
- const copyCount = generateQRCodeCopy(record?.QRCode);
-
- return Array.from({ length: copyCount })?.map((_, copyIndex) => (
-
- {templateOptions.value === 'T' &&
- imageTagBarcodeAndQR(
- templateOptions.codeType === 'B' ? '100%' : '6mm',
- '6px',
- record?.QRCode || record?.ProdId
- )}
- {templateOptions.productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {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) => (
-
- {templateOptions.value === 'T' &&
- imageTagBarcodeAndQR(
- templateOptions.codeType === 'B' ? '100%' : '6mm'
- )}
- {templateOptions.productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {nickName
- ? nickName
- : proName
- ? proName
- : 'Product Name'}
-
- )}
- {templateOptions.value === 'C' &&
- imageTagBarcodeAndQR(
- (templateOptions.codeType === 'B'
- ? '80%'
- : (!templateOptions.productName &&
- !templateOptions.mrp)
- ? '80%'
- : '7.5mm'), '5px'
- )}
- {templateOptions.mrp && (
-
- {'₹:' + (detail?.MRP ? detail?.MRP : 10.0)}
-
- )}
- {templateOptions.value === 'B' &&
- imageTagBarcodeAndQR(
- templateOptions.codeType === 'B' ? '100%' : '7.5mm'
- )}
-
- ))}
-
-
- {/* //Qrcode */}
-
-
- {selectedRecords?.length > 0
- ? 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) && (
-
- {templateOptions.productName && (
-
12 ? 'text-ellipsis' : ''}`}
- >
- {record?.NickName
- ? record?.NickName
- : record?.ProdName}
-
- )}
- {templateOptions.mrp && (
-
- {'MRP : ' + record?.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}
/>