const StickerPrintTemplates = ({ selectedRecords, copies, nickName, proName, ProdId, size, detail, templateOptions, base64Image, QrandbarcodeDatas, MultiCode, generateQRCodeCopy, generateCodeImage, imageTagBarcodeAndQR, dropdownValue, barcodeTemplateDetails, }) => { const template = barcodeTemplateDetails?.find( (find) => find.SessionName === dropdownValue ); const templateAvailable = template === undefined ? false : true; function choosenPrintStyle(dropdownValue, templateAvailable) { switch (dropdownValue) { case '15X15 6cross': return templateAvailable ? 'label-15X156cross' : 'StickerPrints0'; case '22X35 3cross': return templateAvailable ? '22X353cross' : 'StickerPrints1'; case '25X25 4cross': return templateAvailable ? '25X254cross' : 'StickerPrints2'; case '25X50 2cross': return templateAvailable ? '25X502cross' : 'StickerPrints3'; case '50X30 Single': return templateAvailable ? '50X30Single' : 'StickerPrints4'; case '50X25 Single': return templateAvailable ? '50X25Single' : 'StickerPrints5'; case '100X13 (55MM Printable)': return templateAvailable ? '100X13(55MMPrintable)' : 'StickerPrints6'; case '100X15 (70MM Printable)': return templateAvailable ? '100X15(70MMPrintable)' : 'StickerPrints7'; case '100X150': return templateAvailable ? '100X150' : 'StickerPrints8'; default: return null; } } const selectStyle = choosenPrintStyle(dropdownValue, templateAvailable); const secondValueStyle = { flexDirection: templateOptions.secondValue === 'R' ? 'row' : 'row-reverse', }; const valueStyleRow = { flexDirection: templateOptions.value === 'R' ? 'row' : 'row-reverse', }; const valueStyleColumn = { flexDirection: templateOptions.value === 'T' ? 'column' : 'column-reverse', }; 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 colorText = 'Color : Red'; console.log(selectStyle, 'selectStyle'); return (
{selectStyle == 'StickerPrints0' && (
{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) => (
))}
)} {selectStyle == 'StickerPrints1' && (
{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}

))}
)} {selectStyle == 'StickerPrints2' && (
{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})

barcode

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

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

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

barcode

{ProdId}

))}
)} {selectStyle == 'StickerPrints3' && (
{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}

))}
)} {selectStyle == 'StickerPrints4' && (
{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}

))}
)} {selectStyle == 'StickerPrints5' && (
{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}

))}
)} {selectStyle == 'StickerPrints6' && (
{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}

))}
)} {selectStyle == 'StickerPrints7' && (
{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}

))}
)} {selectStyle == 'StickerPrints8' && (
{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) => (

{detail?.BrName}

Product Name:{' '}

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

SIZE: {size}

Id: {ProdId}

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

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

))}
)} {selectStyle == '25X254cross' && (
{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' )}
)}
); })}
)} {selectStyle == '25X502cross' && (
{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}
)}
))}
)} {selectStyle == '50X30Single' && (
{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}
)}
))}
)} {selectStyle == '50X25Single' && (
{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}
)}
))}
)} {selectStyle == '100X13(55MMPrintable)' && (
{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}
)}
))}
)} {selectStyle == '100X15(70MMPrintable)' && (
{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()}
))}
)} {selectStyle == '100X150' && (
{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}
)}
))}
)} {selectStyle == 'label-15X156cross' && (
{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' )}
))}
)} {selectStyle == '22X353cross' && (
{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}
)}
)}
))}
)}
); }; export default StickerPrintTemplates;