Merge pull request 'product-receipt' (#133) from product-receipt into main
Reviewed-on: Pozomind/pozo-retail-app#133
This commit is contained in:
commit
edfe6a780f
|
|
@ -6,6 +6,7 @@ import { DefaultModal } from '../../Components/Modal/DefaultModal.jsx';
|
||||||
import Buttons from '../../Components/Forms/Buttons';
|
import Buttons from '../../Components/Forms/Buttons';
|
||||||
import { validateSafeInput } from '../../Services/Others';
|
import { validateSafeInput } from '../../Services/Others';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import "../../Pages/BarcodeSetup/BarcodeTemplateSetup.scss" //Vicky
|
||||||
|
|
||||||
const StickerPrintModel = ({
|
const StickerPrintModel = ({
|
||||||
open,
|
open,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ const PurchaseOrder = () => {
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [isLowStockModel, setisLowStockModel] = useState(false);
|
const [isLowStockModel, setisLowStockModel] = useState(false);
|
||||||
const [addressModel, setAddressModel] = useState(false);
|
const [addressModel, setAddressModel] = useState(false);
|
||||||
const [deliveryAddress, setDeliveryAddress] = useState('');
|
const [deliveryAddress, setDeliveryAddress] = useState();
|
||||||
const [searchedText, setSearchedText] = useState('');
|
const [searchedText, setSearchedText] = useState('');
|
||||||
const [iSEmail, setiSEmail] = useState(false);
|
const [iSEmail, setiSEmail] = useState(false);
|
||||||
const [enteredEmail, setEnteredEmail] = useState('');
|
const [enteredEmail, setEnteredEmail] = useState('');
|
||||||
|
|
@ -972,7 +972,7 @@ const PurchaseOrder = () => {
|
||||||
PostData['LocationType'] = Supplierdata?.find(
|
PostData['LocationType'] = Supplierdata?.find(
|
||||||
(find) => find.SuppId === selecPurSupplier
|
(find) => find.SuppId === selecPurSupplier
|
||||||
)?.Type;
|
)?.Type;
|
||||||
PostData['DeliveryAddressDetails'] = [deliveryAddress];
|
PostData['DeliveryAddressDetails'] = deliveryAddress ? [deliveryAddress]: [];
|
||||||
let PostPurOrder = await dispatch(postPurcOrderData(PostData)).unwrap();
|
let PostPurOrder = await dispatch(postPurcOrderData(PostData)).unwrap();
|
||||||
if (PostPurOrder?.data?.statusCode === 1) {
|
if (PostPurOrder?.data?.statusCode === 1) {
|
||||||
setMessage({ type: 'success', data: PostPurOrder?.data?.response });
|
setMessage({ type: 'success', data: PostPurOrder?.data?.response });
|
||||||
|
|
@ -997,7 +997,7 @@ const PurchaseOrder = () => {
|
||||||
formProductRef?.current?.resetFields();
|
formProductRef?.current?.resetFields();
|
||||||
formRef?.current?.resetFields();
|
formRef?.current?.resetFields();
|
||||||
deliveryAddressRef?.current?.resetFields();
|
deliveryAddressRef?.current?.resetFields();
|
||||||
setDeliveryAddress('');
|
setDeliveryAddress();
|
||||||
setselecPurSupplier(null);
|
setselecPurSupplier(null);
|
||||||
getProductDatas(null);
|
getProductDatas(null);
|
||||||
setselecSuppDetails(null);
|
setselecSuppDetails(null);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||||
import { useNavigate, useLocation } from 'react-router-dom';
|
import { useNavigate, useLocation } from 'react-router-dom';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { PlusOutlined, EyeOutlined, PrinterFilled } from '@ant-design/icons';
|
import { PlusOutlined, EyeOutlined, PrinterFilled, CheckSquareOutlined } from '@ant-design/icons';
|
||||||
import { Image, Pagination, Space, Table, Tooltip } from 'antd';
|
import { Checkbox, Image, Pagination, Space, Table, Tooltip } from 'antd';
|
||||||
import {
|
import {
|
||||||
changeBreadCrumb,
|
changeBreadCrumb,
|
||||||
getEmpAccess,
|
getEmpAccess,
|
||||||
|
|
@ -149,7 +149,8 @@ const StockList = () => {
|
||||||
]);
|
]);
|
||||||
const [SearchText, setSearchText] = useState(null);
|
const [SearchText, setSearchText] = useState(null);
|
||||||
const [debouncedSearchText, setDebouncedSearchText] = useState(null);
|
const [debouncedSearchText, setDebouncedSearchText] = useState(null);
|
||||||
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
||||||
|
const [multiQrCode, setMultiQrCode] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setDebouncedSearchText(SearchText);
|
setDebouncedSearchText(SearchText);
|
||||||
|
|
@ -276,7 +277,7 @@ const StockList = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredData = debouncedSearchText ? countData || [] : data || [];
|
const filteredData = debouncedSearchText ? countData || [] : data || [];
|
||||||
console.log(data, countData, '1111111111111111', filteredData);
|
console.log('1111111111111111', filteredData);
|
||||||
async function searchData({ queryKey }) {
|
async function searchData({ queryKey }) {
|
||||||
const [_, SearchText] = 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 = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: 'Sl.No',
|
title: 'Sl.No',
|
||||||
|
|
@ -503,29 +560,98 @@ const StockList = () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// title: 'Print',
|
||||||
|
// key: 'Print',
|
||||||
|
// dataIndex: 'Print',
|
||||||
|
// width: '100px',
|
||||||
|
// align: 'center',
|
||||||
|
// render: (_, record) => (
|
||||||
|
// // productData.length >= 1 ? (
|
||||||
|
// <Space size="middle">
|
||||||
|
// {record?.ProdDetails?.some((item) => item?.QRCode != null) ? (
|
||||||
|
// <a>
|
||||||
|
// <PrinterFilled
|
||||||
|
// style={{ fontSize: '20px' }}
|
||||||
|
// onClick={() => Qrcode(record)}
|
||||||
|
// />
|
||||||
|
// </a>
|
||||||
|
// ) : (
|
||||||
|
// '-'
|
||||||
|
// )}
|
||||||
|
// </Space>
|
||||||
|
// ),
|
||||||
|
// // ) : null,
|
||||||
|
// },
|
||||||
|
|
||||||
{
|
{
|
||||||
title: 'Print',
|
title: (
|
||||||
key: 'Print',
|
<Space>
|
||||||
dataIndex: 'Print',
|
{multiQrCode && (
|
||||||
width: '100px',
|
<Checkbox
|
||||||
align: 'center',
|
onChange={handleSelectAll}
|
||||||
render: (_, record) => (
|
checked={
|
||||||
// productData.length >= 1 ? (
|
filteredData.length > 0 &&
|
||||||
<Space size="middle">
|
filteredData
|
||||||
{record?.ProdDetails?.some((item) => item?.QRCode != null) ? (
|
.filter((record) =>
|
||||||
<a>
|
record?.ProdDetails?.some((item) => item?.QRCode != null)
|
||||||
<PrinterFilled
|
)
|
||||||
style={{ fontSize: '20px' }}
|
.every((record) => selectedRowKeys.includes(record.OrderId))
|
||||||
onClick={() => Qrcode(record)}
|
}
|
||||||
/>
|
/>
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
'-'
|
|
||||||
)}
|
)}
|
||||||
|
Print
|
||||||
|
<CheckSquareOutlined
|
||||||
|
style={{
|
||||||
|
fontSize: '18px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
marginLeft: '8px',
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
setMultiQrCode((prev) => {
|
||||||
|
const newValue = !prev;
|
||||||
|
if (!newValue) {
|
||||||
|
setSelectedRowKeys([]);
|
||||||
|
}
|
||||||
|
return newValue;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
// ) : null,
|
key: 'Print',
|
||||||
},
|
width: '120px',
|
||||||
|
align: 'center',
|
||||||
|
|
||||||
|
render: (_, record) => {
|
||||||
|
const hasQRCode = record?.ProdDetails?.some(
|
||||||
|
(item) => item?.QRCode != null
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!hasQRCode) return '-';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Space size="middle">
|
||||||
|
{multiQrCode && (
|
||||||
|
<Checkbox
|
||||||
|
checked={selectedRowKeys.includes(record.OrderId)}
|
||||||
|
onChange={(e) =>
|
||||||
|
handleRowSelect(e.target.checked, record)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!multiQrCode && (
|
||||||
|
<PrinterFilled
|
||||||
|
style={{ fontSize: '18px', cursor: 'pointer' }}
|
||||||
|
onClick={() => Qrcode(record)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
const Proddetailcolumns = [
|
const Proddetailcolumns = [
|
||||||
{
|
{
|
||||||
|
|
@ -890,25 +1016,25 @@ const StockList = () => {
|
||||||
PaymentAmount: PaymentAmount.toFixed(2),
|
PaymentAmount: PaymentAmount.toFixed(2),
|
||||||
InvoiceDate: groupInfo.InwardDate
|
InvoiceDate: groupInfo.InwardDate
|
||||||
? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format(
|
? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
SuppInvoiceNo: groupInfo.SupplierInvoiceNumber,
|
SuppInvoiceNo: groupInfo.SupplierInvoiceNumber,
|
||||||
SuppInvoiceDate: groupInfo.SupplierInvoiceDate
|
SuppInvoiceDate: groupInfo.SupplierInvoiceDate
|
||||||
? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format(
|
? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
DeliveryChallanNo: groupInfo.DeliveryChallanNo,
|
DeliveryChallanNo: groupInfo.DeliveryChallanNo,
|
||||||
DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate
|
DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate
|
||||||
? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format(
|
? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
DueDate: groupInfo.DueDate
|
DueDate: groupInfo.DueDate
|
||||||
? moment(groupInfo.DueDate, 'YYYY-MM-DD').format(
|
? moment(groupInfo.DueDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
InvoiceAmount: Totalamount.toFixed(2),
|
InvoiceAmount: Totalamount.toFixed(2),
|
||||||
TaxAmount: Totaltax.toFixed(2),
|
TaxAmount: Totaltax.toFixed(2),
|
||||||
|
|
@ -926,13 +1052,13 @@ const StockList = () => {
|
||||||
FreeQty: item.FreeQty,
|
FreeQty: item.FreeQty,
|
||||||
ManufDate: item.ManufactureDate
|
ManufDate: item.ManufactureDate
|
||||||
? moment(item.ManufactureDate, 'YYYY-MM-DD').format(
|
? moment(item.ManufactureDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
ExpDate: item.ExpireDate
|
ExpDate: item.ExpireDate
|
||||||
? moment(item.ExpireDate, 'YYYY-MM-DD').format(
|
? moment(item.ExpireDate, 'YYYY-MM-DD').format(
|
||||||
'YYYY-MM-DDTHH:mm:ss'
|
'YYYY-MM-DDTHH:mm:ss'
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
BatchNo: item.BatchNo,
|
BatchNo: item.BatchNo,
|
||||||
ModelNo: item.ModelNo,
|
ModelNo: item.ModelNo,
|
||||||
|
|
@ -1224,7 +1350,7 @@ const StockList = () => {
|
||||||
data={filteredData}
|
data={filteredData}
|
||||||
dataSource={filteredData}
|
dataSource={filteredData}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
// pagination={handlePageChange}
|
// pagination={handlePageChange}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
{countOfProduct > 10 && (
|
{countOfProduct > 10 && (
|
||||||
<Pagination
|
<Pagination
|
||||||
|
|
@ -1241,6 +1367,16 @@ const StockList = () => {
|
||||||
/>
|
/>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
</div>
|
</div>
|
||||||
|
{multiQrCode && selectedRowKeys.length > 0 && (
|
||||||
|
<div className="productMaster-Print">
|
||||||
|
<Buttons
|
||||||
|
buttonText={'Sticker Print'}
|
||||||
|
handleSubmit={() => handleAllStickerPrint()}
|
||||||
|
disabled={addnewAccess}
|
||||||
|
color="901D77"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<DefaultModal
|
<DefaultModal
|
||||||
open={open}
|
open={open}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subinputForm .ant-input-affix-wrapper > input.ant-input {
|
.subinputForm .ant-input-affix-wrapper>input.ant-input {
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 18px 14px 6px 1px !important;
|
padding: 18px 14px 6px 1px !important;
|
||||||
|
|
@ -164,3 +164,9 @@
|
||||||
width: max-content !important;
|
width: max-content !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.productMaster-Print {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue