diff --git a/src/Pages/Product/StickerPrintModal.jsx b/src/Pages/Product/StickerPrintModal.jsx index b9fd032..9d8f628 100644 --- a/src/Pages/Product/StickerPrintModal.jsx +++ b/src/Pages/Product/StickerPrintModal.jsx @@ -6,6 +6,7 @@ import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx'; import Buttons from '../../Components/Forms/Buttons'; import { validateSafeInput } from '../../Services/Others'; import { useEffect } from 'react'; +import "../../Pages/BarcodeSetup/BarcodeTemplateSetup.scss" //Vicky const StickerPrintModel = ({ open, diff --git a/src/Pages/PurchaseOrder/PurchaseOrder.jsx b/src/Pages/PurchaseOrder/PurchaseOrder.jsx index f45fe68..b3f8be0 100644 --- a/src/Pages/PurchaseOrder/PurchaseOrder.jsx +++ b/src/Pages/PurchaseOrder/PurchaseOrder.jsx @@ -110,7 +110,7 @@ const PurchaseOrder = () => { const [isModalOpen, setIsModalOpen] = useState(false); const [isLowStockModel, setisLowStockModel] = useState(false); const [addressModel, setAddressModel] = useState(false); - const [deliveryAddress, setDeliveryAddress] = useState(''); + const [deliveryAddress, setDeliveryAddress] = useState(); const [searchedText, setSearchedText] = useState(''); const [iSEmail, setiSEmail] = useState(false); const [enteredEmail, setEnteredEmail] = useState(''); @@ -972,7 +972,7 @@ const PurchaseOrder = () => { PostData['LocationType'] = Supplierdata?.find( (find) => find.SuppId === selecPurSupplier )?.Type; - PostData['DeliveryAddressDetails'] = [deliveryAddress]; + PostData['DeliveryAddressDetails'] = deliveryAddress ? [deliveryAddress]: []; let PostPurOrder = await dispatch(postPurcOrderData(PostData)).unwrap(); if (PostPurOrder?.data?.statusCode === 1) { setMessage({ type: 'success', data: PostPurOrder?.data?.response }); @@ -997,7 +997,7 @@ const PurchaseOrder = () => { formProductRef?.current?.resetFields(); formRef?.current?.resetFields(); deliveryAddressRef?.current?.resetFields(); - setDeliveryAddress(''); + setDeliveryAddress(); setselecPurSupplier(null); getProductDatas(null); setselecSuppDetails(null); diff --git a/src/Pages/StockMaster/StockList.jsx b/src/Pages/StockMaster/StockList.jsx index 93fd868..068a81a 100644 --- a/src/Pages/StockMaster/StockList.jsx +++ b/src/Pages/StockMaster/StockList.jsx @@ -1,8 +1,8 @@ import { useState, useEffect, useRef, useCallback } from 'react'; import { useNavigate, useLocation } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; -import { PlusOutlined, EyeOutlined, PrinterFilled } from '@ant-design/icons'; -import { Image, Pagination, Space, Table, Tooltip } from 'antd'; +import { PlusOutlined, EyeOutlined, PrinterFilled, CheckSquareOutlined } from '@ant-design/icons'; +import { Checkbox, Image, Pagination, Space, Table, Tooltip } from 'antd'; import { changeBreadCrumb, getEmpAccess, @@ -149,7 +149,8 @@ const StockList = () => { ]); const [SearchText, setSearchText] = useState(null); const [debouncedSearchText, setDebouncedSearchText] = useState(null); - + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [multiQrCode, setMultiQrCode] = useState(false); useEffect(() => { const timer = setTimeout(() => { setDebouncedSearchText(SearchText); @@ -276,7 +277,7 @@ const StockList = () => { }); const filteredData = debouncedSearchText ? countData || [] : data || []; - console.log(data, countData, '1111111111111111', filteredData); + console.log('1111111111111111', filteredData); async function searchData({ queryKey }) { const [_, SearchText] = queryKey; @@ -412,6 +413,62 @@ const StockList = () => { } } }; + + const handleSelectAll = (e) => { + if (e.target.checked) { + const currentPageKeys = filteredData + .filter((record) => + record?.ProdDetails?.some((item) => item?.QRCode != null) + ) + .map((record) => record.OrderId); + + setSelectedRowKeys((prev) => [ + ...new Set([...prev, ...currentPageKeys]) + ]); + } else { + const currentPageKeys = filteredData.map((record) => record.OrderId); + setSelectedRowKeys((prev) => + prev.filter((key) => !currentPageKeys.includes(key)) + ); + } + }; + const handleRowSelect = (checked, record) => { + if (checked) { + setSelectedRowKeys([...selectedRowKeys, record.OrderId]); + } else { + setSelectedRowKeys( + selectedRowKeys.filter((key) => key !== record.OrderId) + ); + } + }; + + const handleAllStickerPrint = async () => { + const Response = await dispatch( + getPurchaseData({ + AppId: AppId, + BranchId: BranchId, + CompId: CompId, + OrderFromDate: formatDateForAPI(dateStrings?.[0]) ?? '', + OrderToDate: formatDateForAPI(dateStrings?.[1]) ?? '', + }) + ).unwrap(); + + if (Response?.data?.statusCode === 1) { + const allData = Response?.data?.data || []; + const selectedRecordsData = allData.filter((record) => + selectedRowKeys.includes(record.OrderId) + ); + + const allProdDetails = selectedRecordsData.flatMap( + (record) => record.ProdDetails + ); + + setSelectedRecords(allProdDetails); + QrandBarcodeDats(allProdDetails); + setOpen(true); + } + }; + const columns = [ { title: 'Sl.No', @@ -503,29 +560,98 @@ const StockList = () => { } }, }, + // { + // title: 'Print', + // key: 'Print', + // dataIndex: 'Print', + // width: '100px', + // align: 'center', + // render: (_, record) => ( + // // productData.length >= 1 ? ( + // + // {record?.ProdDetails?.some((item) => item?.QRCode != null) ? ( + // + // Qrcode(record)} + // /> + // + // ) : ( + // '-' + // )} + // + // ), + // // ) : null, + // }, + { - title: 'Print', - key: 'Print', - dataIndex: 'Print', - width: '100px', - align: 'center', - render: (_, record) => ( - // productData.length >= 1 ? ( - - {record?.ProdDetails?.some((item) => item?.QRCode != null) ? ( - - Qrcode(record)} - /> - - ) : ( - '-' + title: ( + + {multiQrCode && ( + 0 && + filteredData + .filter((record) => + record?.ProdDetails?.some((item) => item?.QRCode != null) + ) + .every((record) => selectedRowKeys.includes(record.OrderId)) + } + /> )} + Print + { + setMultiQrCode((prev) => { + const newValue = !prev; + if (!newValue) { + setSelectedRowKeys([]); + } + return newValue; + }); + }} + /> ), - // ) : null, - }, + key: 'Print', + width: '120px', + align: 'center', + + render: (_, record) => { + const hasQRCode = record?.ProdDetails?.some( + (item) => item?.QRCode != null + ); + + if (!hasQRCode) return '-'; + + return ( + + {multiQrCode && ( + + handleRowSelect(e.target.checked, record) + } + /> + )} + {!multiQrCode && ( + Qrcode(record)} + /> + )} + + ); + }, + } + + ]; const Proddetailcolumns = [ { @@ -890,25 +1016,25 @@ const StockList = () => { PaymentAmount: PaymentAmount.toFixed(2), InvoiceDate: groupInfo.InwardDate ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, SuppInvoiceNo: groupInfo.SupplierInvoiceNumber, SuppInvoiceDate: groupInfo.SupplierInvoiceDate ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DeliveryChallanNo: groupInfo.DeliveryChallanNo, DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DueDate: groupInfo.DueDate ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, InvoiceAmount: Totalamount.toFixed(2), TaxAmount: Totaltax.toFixed(2), @@ -926,13 +1052,13 @@ const StockList = () => { FreeQty: item.FreeQty, ManufDate: item.ManufactureDate ? moment(item.ManufactureDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, ExpDate: item.ExpireDate ? moment(item.ExpireDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, BatchNo: item.BatchNo, ModelNo: item.ModelNo, @@ -1224,7 +1350,7 @@ const StockList = () => { data={filteredData} dataSource={filteredData} onChange={handleChange} - // pagination={handlePageChange} + // pagination={handlePageChange} />{' '} {countOfProduct > 10 && ( { /> )}{' '} + {multiQrCode && selectedRowKeys.length > 0 && ( +
+ handleAllStickerPrint()} + disabled={addnewAccess} + color="901D77" + /> +
+ )} input.ant-input { +.subinputForm .ant-input-affix-wrapper>input.ant-input { font-size: inherit; border: none; padding: 18px 14px 6px 1px !important; @@ -164,3 +164,9 @@ width: max-content !important; } } + +.productMaster-Print { + width: 100%; + display: flex; + justify-content: flex-end; +} \ No newline at end of file