Added Policy Details
This commit is contained in:
parent
286fefede5
commit
b52f4f8521
|
|
@ -17,6 +17,7 @@ import { DatePicProd } from "../../Components/Forms/DatePickerProduct";
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import { FaEye, FaPlus } from "react-icons/fa";
|
||||
import { DefaultModal } from "../../Components/Modal/DefaultModal";
|
||||
import { IoEye } from "react-icons/io5";
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
const SEARCH_OPTIONS = [
|
||||
|
|
@ -70,6 +71,8 @@ const SalesBillProductsReturn = () => {
|
|||
const [currentEditingItem, setCurrentEditingItem] = useState(null);
|
||||
const [modalDescription, setModalDescription] = useState('');
|
||||
const [modalImageUrl, setModalImageUrl] = useState('');
|
||||
const [policyDeatilModal, setPolicyDeatilModal] = useState(false);
|
||||
const [selectedPolicyDetails, setSelectedPolicyDetails] = useState(null);
|
||||
|
||||
console.log(selectedItems, "selectedItemsselectedItemsselectedItems")
|
||||
|
||||
|
|
@ -108,7 +111,15 @@ const SalesBillProductsReturn = () => {
|
|||
const description = product?.Description || ""
|
||||
return { ReturnEligible: eligible, Description: description };
|
||||
};
|
||||
|
||||
const handleOrdermodalCancel = () => {
|
||||
setPolicyDeatilModal(false);
|
||||
setSelectedPolicyDetails(null);
|
||||
};
|
||||
const Viewdetails = (item) => {
|
||||
const policy = policybasedprodcuts?.find(p => p.ProdId === item.ProdId) || null;
|
||||
setSelectedPolicyDetails(policy);
|
||||
setPolicyDeatilModal(true);
|
||||
};
|
||||
useEffect(() => {
|
||||
const fetchPaymentOptions = async () => {
|
||||
try {
|
||||
|
|
@ -192,12 +203,11 @@ const SalesBillProductsReturn = () => {
|
|||
|
||||
try {
|
||||
const res = await dispatch(getReturnBill(data)).unwrap();
|
||||
|
||||
if (res?.data?.statusCode === 1) {
|
||||
const modifiedData = res?.data?.data?.map(item => {
|
||||
return {
|
||||
...item,
|
||||
productDetails: item?.productDetails.map(product => {
|
||||
productDetails: item?.productDetails?.map(product => {
|
||||
return {
|
||||
...product,
|
||||
ExchangeQty: 0,
|
||||
|
|
@ -577,8 +587,9 @@ const SalesBillProductsReturn = () => {
|
|||
<table className="custom-product-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Select</th>
|
||||
<th style={{ width: "30px", whiteSpace: "normal", wordWrap: "break-word" }}>Sl.No</th>
|
||||
<th style={{ width: "100px", whiteSpace: "normal", wordWrap: "break-word" }}>Policy Details</th>
|
||||
<th style={{ width: "100px", whiteSpace: "normal", wordWrap: "break-word" }}>Product Name</th>
|
||||
<th style={{ width: "70px", whiteSpace: "normal", wordWrap: "break-word" }}>Sales-Qty</th>
|
||||
<th style={{ width: "80px", whiteSpace: "normal", wordWrap: "break-word" }}>Rate</th>
|
||||
|
|
@ -597,17 +608,23 @@ const SalesBillProductsReturn = () => {
|
|||
disabled={!ReturnEligible}
|
||||
onChange={(e) => handleCheckboxChange(item, e.target.checked)}
|
||||
/>
|
||||
{!ReturnEligible && (
|
||||
{/* {(
|
||||
<span style={{ marginLeft: 4 }}>
|
||||
<Tooltip title={Description}>
|
||||
{/* <span style={{ color: '#faad14', cursor: 'pointer', fontSize: 18, verticalAlign: 'middle' }}> */}
|
||||
<RiErrorWarningLine />
|
||||
{/* </span> */}
|
||||
<IoEye
|
||||
style={{ color: '#1292EE', fontSize: '25px', cursor: 'pointer' }}
|
||||
onClick={() => Viewdetails(item)}
|
||||
/>
|
||||
</Tooltip>
|
||||
</span>
|
||||
)}
|
||||
)} */}
|
||||
</td>
|
||||
<td style={{ textAlignLast: "center", width: "30px", whiteSpace: "normal", wordWrap: "break-word" }}>{index + 1}</td>
|
||||
<td style={{ width: "100px", wordWrap: "break-word" }}>
|
||||
<IoEye
|
||||
style={{ color: '#1292EE', fontSize: '25px', cursor: 'pointer' }}
|
||||
onClick={() => Viewdetails(item)}
|
||||
/></td>
|
||||
<td style={{ width: "100px", wordWrap: "break-word" }}>{item.ProdNameQty}</td>
|
||||
<td style={{ textAlignLast: "center" }}>{item.SalesQty}</td>
|
||||
<td style={{ textAlignLast: "end" }}>₹{item.Rate}</td>
|
||||
|
|
@ -638,7 +655,7 @@ const SalesBillProductsReturn = () => {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{selectedItems.map((item, index) => {
|
||||
{selectedItems?.map((item, index) => {
|
||||
return (
|
||||
<tr key={item.ProdId} >
|
||||
<td>{index + 1}</td>
|
||||
|
|
@ -816,6 +833,43 @@ const SalesBillProductsReturn = () => {
|
|||
handleCancel={handleCancel}
|
||||
handleSubmit={handleModalSubmit}
|
||||
/>
|
||||
|
||||
<DefaultModal
|
||||
open={policyDeatilModal}
|
||||
title="Product Policy Details"
|
||||
handleCancel={handleOrdermodalCancel}
|
||||
footer={false}
|
||||
children={
|
||||
<div style={{ padding: '8px' }}>
|
||||
{selectedPolicyDetails?.ProdName ? (
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '14px' }}>
|
||||
<tbody>
|
||||
{[
|
||||
['Product Name', selectedPolicyDetails.ProdName],
|
||||
['Policy Name', selectedPolicyDetails.PolicyName],
|
||||
['Description', selectedPolicyDetails.Description],
|
||||
['Return Allowed', selectedPolicyDetails.IsReturnAllowed === 'Y' ? 'Yes' : 'No'],
|
||||
['Exchange Allowed', selectedPolicyDetails.IsExchangeAllowed === 'Y' ? 'Yes' : 'No'],
|
||||
['Return Window (Days)', selectedPolicyDetails.ReturnWindowDays],
|
||||
['Exchange Window (Days)', selectedPolicyDetails.ExchangeWindowDays],
|
||||
['Exchange Limit Count', selectedPolicyDetails.ExchangeLimitCount ?? 'N/A'],
|
||||
['Return Eligible', selectedPolicyDetails.ReturnEligible ? 'Yes' : 'No'],
|
||||
// ['Effective From', selectedPolicyDetails.EffectiveFrom ? dayjs(selectedPolicyDetails.EffectiveFrom).format('DD-MM-YYYY') : 'N/A'],
|
||||
// ['Effective To', selectedPolicyDetails.EffectiveTo ? dayjs(selectedPolicyDetails.EffectiveTo).format('DD-MM-YYYY') : 'N/A'],
|
||||
].map(([label, value]) => (
|
||||
<tr key={label} style={{ borderBottom: '1px solid #f0f0f0' }}>
|
||||
<td style={{ padding: '8px', fontWeight: 600, color: '#555', width: '45%' }}>{label}</td>
|
||||
<td style={{ padding: '8px', color: '#222' }}>{value}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<p style={{ textAlign: 'center', color: '#888' }}>No policy found for this product.</p>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue