diff --git a/src/Pages/Offer/CodeBase/CodeBaseListList.scss b/src/Pages/Offer/CodeBase/CodeBaseListList.scss
index 86b82f6..4d819cb 100644
--- a/src/Pages/Offer/CodeBase/CodeBaseListList.scss
+++ b/src/Pages/Offer/CodeBase/CodeBaseListList.scss
@@ -8,6 +8,12 @@
padding-bottom: 5rem !important;
border-radius: 12px;
height: 85vh;
+ .ant-table-thead .ant-table-cell {
+ background-color: #2c88ee !important;
+ &:hover {
+ background-color: #2c88ee !important;
+ }
+ }
@media (max-width: 768px) {
margin: 10px 0 0 0;
@@ -60,7 +66,7 @@
font-size: 13px;
border-radius: 8px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
@media (max-width: 600px) {
padding: 8px 12px;
@@ -104,7 +110,7 @@
font-size: 24px;
font-weight: 500;
color: #000000;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
line-height: 1.2;
letter-spacing: -0.5px;
}
@@ -114,7 +120,7 @@
font-size: 14px;
font-weight: 500;
color: #6c6c6c;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
line-height: 1.4;
letter-spacing: -0.5px;
margin-top: 2px;
@@ -177,14 +183,14 @@
font-weight: 500;
color: #6c6c6c; // Gray text for inactive state
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
transition: all 0.2s ease;
}
@@ -209,14 +215,14 @@
font-size: 20px;
font-weight: 600;
color: #1f2937;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
p {
// margin: 0 0 16px 0;
font-size: 13px;
color: #000000;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
line-height: 1.5;
}
@@ -228,14 +234,14 @@
font-size: 14px;
color: #6c6c6c;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
line-height: 1.6;
margin-bottom: 8px;
@@ -291,7 +297,7 @@
padding: 4px 4px !important;
font-size: 12.5px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.ant-select {
@@ -327,7 +333,7 @@
border: none;
border-radius: 6px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
transition: all 0.2s ease;
flex-shrink: 0;
font-size: 24px;
@@ -365,7 +371,7 @@
font-size: 13px;
letter-spacing: -0.3px;
color: #000000;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
}
@@ -379,14 +385,14 @@
cursor: pointer;
transition: all 0.2s ease;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
&:hover {
@@ -401,7 +407,7 @@
border-radius: 6px;
font-size: 14px;
color: #374151;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
width: 190px;
&:focus {
@@ -436,7 +442,7 @@
background-color: #2563ea !important;
height: 42px !important;
padding: 10px !important;
- font-family: 'Poppins', sans-serif !important;
+ font-family: "Poppins", sans-serif !important;
}
button:nth-child(1) {
@@ -455,7 +461,7 @@
cursor: pointer;
border-radius: 8px;
font-size: 14px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
display: flex;
align-items: center;
gap: 6px;
@@ -476,10 +482,13 @@
width: max-content;
.offercount {
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
font-size: 14px;
color: #878787;
}
+ .ant-input {
+ padding: 2px 14px 6px 11px !important;
+ }
}
// Table Styles
@@ -487,8 +496,6 @@
margin-top: 10px;
grid-column: 1 / -1;
background-color: #fff;
- border: 1px solid #bbbbbb80;
- padding: 10px 10px;
border-radius: 10px;
width: 100%;
.ant-table-thead {
@@ -512,7 +519,7 @@
cursor: pointer;
font-size: 11px;
font-weight: 400;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
transition: all 0.2s ease;
&:hover {
@@ -583,14 +590,14 @@
color: #374151;
border-bottom: 1px solid #e2e8f0;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
}
@@ -600,14 +607,14 @@
color: #374151;
border-bottom: 1px solid #e2e8f0;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
}
@@ -709,7 +716,7 @@
border: 1px solid #565656 !important;
border-radius: 8px;
font-size: 13px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
&:focus {
outline: none;
@@ -731,7 +738,7 @@
border: 1px solid #565656 !important;
border-radius: 8px;
font-size: 13px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
&:focus {
outline: none;
@@ -752,7 +759,7 @@
border-radius: 8px;
cursor: pointer;
font-size: 13px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
svg {
width: 16px;
@@ -777,7 +784,7 @@
border-radius: 10px;
font-size: 12px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
.chip-remove {
background: none;
@@ -801,7 +808,7 @@
color: #6b7280;
margin-top: 6px;
margin-bottom: 0;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.modal-button-group {
@@ -818,7 +825,7 @@
color: #6b7280;
font-size: 14px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.modal-submit-button {
@@ -829,7 +836,7 @@
font-size: 13px;
border-radius: 8px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.modal-title {
@@ -838,7 +845,7 @@
color: #1f2937;
margin: 0 0 8px 0;
-webkit-text-stroke-width: 0.1px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.modal-label {
@@ -847,7 +854,7 @@
font-weight: 500;
color: #374151;
margin-bottom: 8px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.modal-input-row {
@@ -887,7 +894,7 @@
font-weight: 500;
border-radius: 6px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.radio-options {
@@ -906,14 +913,14 @@
gap: 10px;
font-size: 14px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
background-color: #2563ea1a;
border: 1px solid #2563ea40;
padding: 4px 8px;
border-radius: 6px;
color: #000000;
font-weight: 400;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
// -webkit-text-stroke-width: 0.2px;
}
@@ -930,10 +937,10 @@
cursor: pointer;
font-size: 14px;
color: #374151;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
-.radio-option input[type='radio'] {
+.radio-option input[type="radio"] {
width: 16px;
height: 16px;
accent-color: #2563ea;
@@ -948,7 +955,7 @@
font-weight: 500;
border-radius: 6px;
cursor: pointer;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
// Days Section Styles
@@ -966,14 +973,14 @@
font-weight: 500;
color: #374151;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
}
@@ -987,14 +994,14 @@
cursor: pointer;
transition: all 0.2s ease;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
&:hover {
@@ -1024,17 +1031,17 @@
font-size: 14px;
color: #374151;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
- input[type='checkbox'] {
+ input[type="checkbox"] {
width: 16px;
height: 16px;
accent-color: #3b82f6;
@@ -1056,14 +1063,14 @@
font-size: 12px;
color: #6b7280;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
}
}
@@ -1076,14 +1083,14 @@
color: #374151;
background: #ffffff;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
&:focus {
@@ -1101,14 +1108,14 @@
font-weight: 500;
color: #2563ea;
font-family:
- 'Poppins',
+ "Poppins",
-apple-system,
BlinkMacSystemFont,
- 'Segoe UI',
- 'Roboto',
- 'Oxygen',
- 'Ubuntu',
- 'Cantarell',
+ "Segoe UI",
+ "Roboto",
+ "Oxygen",
+ "Ubuntu",
+ "Cantarell",
sans-serif;
margin-top: 8px;
}
@@ -1116,11 +1123,11 @@
.days-selected {
font-size: 14px;
color: #6b7280;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
background-color: rgba(37, 99, 234, 0.1019607843);
padding: 8px 8px;
color: #2563ea;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
border-radius: 8px;
line-height: 1.5;
border: rgba(37, 99, 234, 0.4431372549) 1px solid;
@@ -1157,7 +1164,7 @@
font-size: 13px;
font-weight: 400;
-webkit-text-stroke-width: 0.2px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
position: relative;
bottom: 6px;
}
@@ -1173,7 +1180,7 @@
background: rgba(37, 99, 234, 0.1019607843);
border: rgba(37, 99, 234, 0.4431372549) 1px solid;
border-radius: 6px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.applied-label {
@@ -1265,7 +1272,7 @@
color: #000000;
-webkit-text-stroke-width: 0.2px;
margin-bottom: 0;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
display: flex;
align-items: center;
gap: 4px;
@@ -1294,7 +1301,7 @@
padding: 4px 4px !important;
font-size: 12.5px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
}
@@ -1302,7 +1309,7 @@
font-size: 14px;
color: #6b7280;
margin: 0;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.mapping-label {
@@ -1310,7 +1317,7 @@
font-size: 13px;
font-weight: 400;
color: #374151;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.product-list {
@@ -1327,7 +1334,7 @@
border-radius: 4px;
font-size: 14px;
color: #374151;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
display: flex;
align-items: center;
justify-content: space-between;
@@ -1386,7 +1393,7 @@
font-weight: 400;
cursor: pointer;
transition: all 0.2s ease;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
&:hover {
background: #1d4ed8;
@@ -1431,7 +1438,7 @@
background: #f3f4f6;
padding: 2px 8px;
border-radius: 12px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.OfferBreadcrumbs {
@@ -1450,7 +1457,7 @@
gap: 2px;
font-size: 10px;
font-weight: 400;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
cursor: pointer;
color: #676767;
@@ -1480,7 +1487,7 @@
font-weight: 400;
// -webkit-text-stroke-width: 0.1px;
transition: all 0.2s ease;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
&.active {
background: #2563ea;
@@ -1539,7 +1546,7 @@
color: #1e1e1e;
margin: 17px 6px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
-webkit-text-stroke-width: 0.1px;
}
@@ -1645,7 +1652,7 @@
cursor: pointer;
font-size: 12px;
font-weight: 400;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
transition: all 0.2s ease;
}
}
@@ -1665,7 +1672,7 @@
border-radius: 6px;
transition: all 0.2s ease;
- input[type='checkbox'] {
+ input[type="checkbox"] {
width: 16px;
height: 16px;
accent-color: #2563ea;
@@ -1695,7 +1702,7 @@
font-size: 12px;
-webkit-text-stroke-width: 0.1px;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.edit-days-button {
@@ -1724,7 +1731,7 @@
font-size: 13px;
font-weight: 400;
-webkit-text-stroke-width: 0.2px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
position: relative;
bottom: 6px;
}
@@ -1739,7 +1746,7 @@
gap: 8px;
cursor: pointer;
- input[type='radio'] {
+ input[type="radio"] {
width: 16px;
height: 16px;
accent-color: #2563ea;
@@ -1749,7 +1756,7 @@
font-size: 12px;
color: #000000;
font-weight: 500;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
}
}
@@ -1773,11 +1780,11 @@
.date-picker {
width: 100%;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
.ant-picker-input {
font-size: 14px;
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
&:focus {
outline: none;
@@ -1792,11 +1799,11 @@
// Override Ant Design default styles
.ant-picker {
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
.ant-picker-input > input {
- font-family: 'Poppins', sans-serif;
+ font-family: "Poppins", sans-serif;
}
}
}
diff --git a/src/Pages/Offer/LoyaltyBased/LoyaltiPointList.scss b/src/Pages/Offer/LoyaltyBased/LoyaltiPointList.scss
index 52a3dd6..2d67257 100644
--- a/src/Pages/Offer/LoyaltyBased/LoyaltiPointList.scss
+++ b/src/Pages/Offer/LoyaltyBased/LoyaltiPointList.scss
@@ -484,9 +484,7 @@
margin-top: 10px;
grid-column: 1 / -1;
background-color: #fff;
- border: 1px solid #bbbbbb80;
- padding: 10px 10px;
- border-radius: 10px;
+ border-radius: 10px;
width: 100%;
.ant-table-thead {
position: unset !important;
diff --git a/src/Pages/Offer/Offer/OfferFormNew.jsx b/src/Pages/Offer/Offer/OfferFormNew.jsx
index 3908265..7c7692d 100644
--- a/src/Pages/Offer/Offer/OfferFormNew.jsx
+++ b/src/Pages/Offer/Offer/OfferFormNew.jsx
@@ -1,14 +1,21 @@
-import React, { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';
+import React, {
+ useCallback,
+ useEffect,
+ useMemo,
+ useReducer,
+ useRef,
+ useState,
+} from 'react';
import dayjs from 'dayjs';
import { useLocation, useNavigate } from 'react-router-dom';
-import { LuGift } from "react-icons/lu";
-import { IoAdd, IoClose } from "react-icons/io5";
-import { IoRefresh } from "react-icons/io5";
-import { FiEdit } from "react-icons/fi";
+import { LuGift } from 'react-icons/lu';
+import { IoAdd, IoClose } from 'react-icons/io5';
+import { IoRefresh } from 'react-icons/io5';
+import { FiEdit } from 'react-icons/fi';
import { useDispatch } from 'react-redux';
import { AutoComplete, DatePicker, Input, Space, Tooltip } from 'antd';
import { Form, message } from 'antd';
-import { debounce } from "lodash";
+import { debounce } from 'lodash';
import {
EditFilled,
DeleteFilled,
@@ -19,39 +26,54 @@ import { InputField } from '../../../Components/Forms/InputField.jsx';
import { DropDowns } from '../../../Components/Forms/DropDown.jsx';
import { Tables } from '../../../Components/Tables/Table.jsx';
import { DefaultModal } from '../../../Components/Modal/DefaultModal.jsx';
-import "./OfferList.scss";
+import './OfferList.scss';
import { getSession } from '../../../Services/Others.js';
-import { PostOfferNew, PutOfferNew, getProdDatas, getLayoutCategories } from '../../../Features/Offer/Offernew/Offernew.js';
+import {
+ PostOfferNew,
+ PutOfferNew,
+ getProdDatas,
+ getLayoutCategories,
+} from '../../../Features/Offer/Offernew/Offernew.js';
import { changeBreadCrumb } from '../../../Features/AppPage/CenterPage.js';
import { BuyXGetXOffer } from '../../BookingScreen/Components/UtillComponents/BSNavBarOffer/BSNavBarOffer_ReusableComponents.jsx';
import FloatLabel from '../../../Components/Forms/FloatLabel/index.jsx';
-import { GiBoxUnpacking } from "react-icons/gi";
+import { GiBoxUnpacking } from 'react-icons/gi';
import { BsUpcScan } from 'react-icons/bs';
const subDirectory = import.meta.env.ENV_BASE_URL;
const OfferList = ({ formType }) => {
// BOGO state
- const [productSearchText, setProductSearchText] = useState("");
- const [bogoBuyProduct, setBogoBuyProduct] = useState({ label: null, prodId: null });
+ const [productSearchText, setProductSearchText] = useState('');
+ const [bogoBuyProduct, setBogoBuyProduct] = useState({
+ label: null,
+ prodId: null,
+ });
-
- const [bogoFreeProduct, setBogoFreeProduct] = useState({ label: null, prodId: null });
- console.log(bogoBuyProduct, "bogoBuyProduct")
+ const [bogoFreeProduct, setBogoFreeProduct] = useState({
+ label: null,
+ prodId: null,
+ });
+ console.log(bogoBuyProduct, 'bogoBuyProduct');
// State for toggling stock info in product table
const [showStockInfo, setShowStockInfo] = useState(true);
- const [productSearch, setProductSearch] = useState("");
+ const [productSearch, setProductSearch] = useState('');
const navigate = useNavigate();
const dispatch = useDispatch();
const location = useLocation();
const formRef = useRef(null);
const state = location?.state;
const editstate = state?.editstate;
- const [scanner, setScanner] = useState({ "BUY": false, "FREE": false });
- const [active, setActive] = useState("all");
+ const [scanner, setScanner] = useState({ BUY: false, FREE: false });
+ const [active, setActive] = useState('all');
const [editStateInside, seteditStateInside] = useState(false);
- const [BuyXGETX, dispatchBuyXGETX] = useReducer(BUYXGETXreducer, { modal: false, Prodvariant: [], ProdId: null, type: null });
+ const [BuyXGETX, dispatchBuyXGETX] = useReducer(BUYXGETXreducer, {
+ modal: false,
+ Prodvariant: [],
+ ProdId: null,
+ type: null,
+ });
//
- const AppId = getSession("AppId")
+ const AppId = getSession('AppId');
const CompId = getSession('CompId');
const BranchId = getSession('BranchId');
const UserId = getSession('UserId');
@@ -59,17 +81,17 @@ const OfferList = ({ formType }) => {
// General Offer states
const [generalOfferName, setGeneralOfferName] = useState('');
const [generalOfferType, setGeneralOfferType] = useState('Item');
- const [generalDiscountType, setGeneralDiscountType] = useState("fixed");
+ const [generalDiscountType, setGeneralDiscountType] = useState('fixed');
const [generalOfferSchedule, setGeneralOfferSchedule] = useState('date');
const [generalDateRange, setGeneralDateRange] = useState(null);
- const [limitUsage, setLimitUsage] = useState("");
- const [generalDiscountValue, setGeneralDiscountValue] = useState("");
- const [applyFirstValue, setApplyFirstValue] = useState("");
- const [applySecondValue, setApplySecondValue] = useState("");
+ const [limitUsage, setLimitUsage] = useState('');
+ const [generalDiscountValue, setGeneralDiscountValue] = useState('');
+ const [applyFirstValue, setApplyFirstValue] = useState('');
+ const [applySecondValue, setApplySecondValue] = useState('');
const [MappingModalOpen, setMappingModalOpen] = useState(false);
const [selectedProductsNew, setSelectedProductsNew] = useState([]);
- console.log(selectedProductsNew, "selectedProductsNew")
+ console.log(selectedProductsNew, 'selectedProductsNew');
//buyxGeTX
const [bogoBuyQuantity, setBogoBuyQuantity] = useState(1);
@@ -77,7 +99,7 @@ const OfferList = ({ formType }) => {
const [BUYXGetTX, setBUYXGetTX] = useState([]);
// Offer mapping states
- const [mappingType, setMappingType] = useState("all");
+ const [mappingType, setMappingType] = useState('all');
const [selectedCategories, setSelectedCategories] = useState([]);
const [selectedProducts, setSelectedProducts] = useState([]);
@@ -98,24 +120,23 @@ const OfferList = ({ formType }) => {
link: `${subDirectory}setting/productBased-offer`,
},
{
- name: formType === "edit" ? "update" : "new",
+ name: formType === 'edit' ? 'update' : 'new',
link: `${subDirectory}setting/productBased-offer/create`,
- }
+ },
];
function BUYXGETXreducer(state, action) {
-
switch (action.type) {
- case "modal":
+ case 'modal':
return { ...state, modal: action.payload };
- case "Prodvariant":
+ case 'Prodvariant':
return { ...state, Prodvariant: action.payload };
- case "ProdId":
+ case 'ProdId':
return { ...state, ProdId: action.payload };
- case "type":
- return { ...state, type: action.payload }
- case "TOGGLE_ACTIVE_STATUS": {
+ case 'type':
+ return { ...state, type: action.payload };
+ case 'TOGGLE_ACTIVE_STATUS': {
const { prodVariantIndex, stockIndex, checked } = action.payload;
return {
@@ -123,26 +144,26 @@ const OfferList = ({ formType }) => {
Prodvariant: state.Prodvariant.map((pv, i) =>
i === prodVariantIndex
? {
- ...pv,
- StockDetails: pv.StockDetails.map((sd, j) =>
- j === stockIndex
- ? { ...sd, ActiveStatus: checked ? "A" : "D" }
- : sd
- ),
- }
+ ...pv,
+ StockDetails: pv.StockDetails.map((sd, j) =>
+ j === stockIndex
+ ? { ...sd, ActiveStatus: checked ? 'A' : 'D' }
+ : sd
+ ),
+ }
: pv
),
};
}
- case "Reset":
+ case 'Reset':
return {
...state,
ProdId: null,
Prodvariant: [],
modal: false,
- type: null
- }
+ type: null,
+ };
default:
return state;
@@ -153,33 +174,34 @@ const OfferList = ({ formType }) => {
CategoryFn();
getPrdtsFn();
- if (formType === "edit" && editstate?.ProdOffers[0]?.OfferType == "B") {
+ if (formType === 'edit' && editstate?.ProdOffers[0]?.OfferType == 'B') {
setGeneralOfferName(editstate.OfferName || '');
- setLimitUsage(editstate.LimitUsage !== undefined ? String(editstate.LimitUsage) : '');
+ setLimitUsage(
+ editstate.LimitUsage !== undefined ? String(editstate.LimitUsage) : ''
+ );
setGeneralOfferType('bogo');
let dateRange = null;
if (editstate.OfferFrom && editstate.OfferTo) {
dateRange = [
editstate.OfferFrom.substring(0, 10),
- editstate.OfferTo.substring(0, 10)
+ editstate.OfferTo.substring(0, 10),
];
setGeneralDateRange(dateRange);
}
- setSelectedDays(Array.isArray(editstate.WeekWiseOffer) ? editstate.WeekWiseOffer : []);
- setGeneralOfferSchedule(editstate.WeekWiseOffer?.length > 0 ? 'days' : 'date');
+ setSelectedDays(
+ Array.isArray(editstate.WeekWiseOffer) ? editstate.WeekWiseOffer : []
+ );
+ setGeneralOfferSchedule(
+ editstate.WeekWiseOffer?.length > 0 ? 'days' : 'date'
+ );
formRef.current?.setFieldsValue({
OfferName: editstate.OfferName || '',
- OfferType: "bogo",
+ OfferType: 'bogo',
generalDateRange: dateRange,
});
-
-
- setBUYXGetTX(editstate?.ProdOffers || [])
-
- }
- else if (formType === "edit" && editstate) {
-
+ setBUYXGetTX(editstate?.ProdOffers || []);
+ } else if (formType === 'edit' && editstate) {
// if (editstate?.ProdOffers?.length && category?.length && editstate?.ProdOffers[0]?.OfferType !== "S") {
// let selectedCats = [];
@@ -196,24 +218,30 @@ const OfferList = ({ formType }) => {
// setMappingType(editstate?.MappingType =="C"? "category":editstate?.MappingType =="P"? "product":"all");
// setSelectedCategories(selectedCats);
// }
- setActive("product")
- setMappingType("product");
+ setActive('product');
+ setMappingType('product');
setGeneralOfferName(editstate.OfferName || '');
- setGeneralDiscountValue(editstate.OfferAmt !== undefined ? String(editstate.OfferAmt) : '');
- setGeneralDiscountType(editstate.ValueType === 'F' ? 'fixed' : 'percentage');
- setLimitUsage(editstate.LimitUsage !== undefined ? String(editstate.LimitUsage) : '');
+ setGeneralDiscountValue(
+ editstate.OfferAmt !== undefined ? String(editstate.OfferAmt) : ''
+ );
+ setGeneralDiscountType(
+ editstate.ValueType === 'F' ? 'fixed' : 'percentage'
+ );
+ setLimitUsage(
+ editstate.LimitUsage !== undefined ? String(editstate.LimitUsage) : ''
+ );
let offerTypeValue = 'Item';
let applyFirst = '';
let applySecond = '';
- const preSelectedProducts = (editstate?.ProdOffers || []).map(prod => ({
+ const preSelectedProducts = (editstate?.ProdOffers || []).map((prod) => ({
...prod,
- checked: prod.ActiveStatus === "A",
- ProdVariantDetails: (prod.ProdVariantDetails || []).map(variant => ({
+ checked: prod.ActiveStatus === 'A',
+ ProdVariantDetails: (prod.ProdVariantDetails || []).map((variant) => ({
...variant,
- StockDetails: (variant.StockDetails || []).map(stock => ({
+ StockDetails: (variant.StockDetails || []).map((stock) => ({
...stock,
- checked: stock.ActiveStatus === "A"
- }))
+ checked: stock.ActiveStatus === 'A',
+ })),
})),
}));
@@ -226,30 +254,42 @@ const OfferList = ({ formType }) => {
else if (offerTypeCode === 'bogo') offerTypeValue = 'bogo';
setGeneralOfferType(offerTypeValue);
if (offerTypeValue === 'Item') {
- applyFirst = prodOffer.MinQty !== undefined ? String(prodOffer.MinQty) : '';
- applySecond = prodOffer.MinPurchase !== undefined ? String(prodOffer.MinPurchase) : '';
+ applyFirst =
+ prodOffer.MinQty !== undefined ? String(prodOffer.MinQty) : '';
+ applySecond =
+ prodOffer.MinPurchase !== undefined
+ ? String(prodOffer.MinPurchase)
+ : '';
} else if (offerTypeValue === 'Sales') {
- applyFirst = prodOffer.AmountFrom !== undefined ? String(prodOffer.AmountFrom) : '';
- applySecond = prodOffer.AmountTo !== undefined ? String(prodOffer.AmountTo) : '';
+ applyFirst =
+ prodOffer.AmountFrom !== undefined
+ ? String(prodOffer.AmountFrom)
+ : '';
+ applySecond =
+ prodOffer.AmountTo !== undefined ? String(prodOffer.AmountTo) : '';
} else if (offerTypeValue === 'Quantity') {
- applyFirst = prodOffer.FromQty !== undefined ? String(prodOffer.FromQty) : '';
- applySecond = prodOffer.ToQty !== undefined ? String(prodOffer.ToQty) : '';
+ applyFirst =
+ prodOffer.FromQty !== undefined ? String(prodOffer.FromQty) : '';
+ applySecond =
+ prodOffer.ToQty !== undefined ? String(prodOffer.ToQty) : '';
}
setApplyFirstValue(applyFirst);
setApplySecondValue(applySecond);
-
-
let dateRange = null;
if (editstate.OfferFrom && editstate.OfferTo) {
dateRange = [
editstate.OfferFrom.substring(0, 10),
- editstate.OfferTo.substring(0, 10)
+ editstate.OfferTo.substring(0, 10),
];
setGeneralDateRange(dateRange);
}
- setSelectedDays(Array.isArray(editstate.WeekWiseOffer) ? editstate.WeekWiseOffer : []);
- setGeneralOfferSchedule(editstate.WeekWiseOffer?.length > 0 ? 'days' : 'date');
+ setSelectedDays(
+ Array.isArray(editstate.WeekWiseOffer) ? editstate.WeekWiseOffer : []
+ );
+ setGeneralOfferSchedule(
+ editstate.WeekWiseOffer?.length > 0 ? 'days' : 'date'
+ );
formRef.current?.setFieldsValue({
OfferName: editstate.OfferName || '',
OfferType: offerTypeValue,
@@ -261,7 +301,6 @@ const OfferList = ({ formType }) => {
}
}, []);
const debouncedScannerSearch = useCallback(
-
debounce((value, type) => {
const qr = value?.trim();
const matchedProduct = Prods.find(
@@ -269,7 +308,7 @@ const OfferList = ({ formType }) => {
);
if (matchedProduct) {
let productName = {};
- productName.label = `${matchedProduct?.ProdName}`
+ productName.label = `${matchedProduct?.ProdName}`;
ProductDropDownChange(matchedProduct.ProdId, productName, type);
if (matchedProduct?.ProdVariantPriceDetails?.length < 2) {
// setSelectedProductName("");
@@ -278,79 +317,61 @@ const OfferList = ({ formType }) => {
} else {
// setMessageType("error");
// setMessageData("The Scanned Product not Available in Product List")
- message.error("The Scanned Product not Available in Product List")
+ message.error('The Scanned Product not Available in Product List');
}
}, 300),
[Prods]
);
const getPrdtsFn = async () => {
- const Prods = await dispatch(getProdDatas({
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- })
+ const Prods = await dispatch(
+ getProdDatas({
+ CompId: CompId,
+ BranchId: BranchId,
+ AppId: AppId,
+ })
).unwrap();
if (Prods?.data?.statusCode == 1) {
-
const cleanedData = Prods.data?.data
- .map(product => ({
+ .map((product) => ({
...product,
ProdVariantDetails: product.ProdVariantDetails.filter(
- v => Array.isArray(v.StockDetails) && v.StockDetails.length > 0
- )
+ (v) => Array.isArray(v.StockDetails) && v.StockDetails.length > 0
+ ),
}))
- .filter(product => product.ProdVariantDetails.length > 0);
+ .filter((product) => product.ProdVariantDetails.length > 0);
setProds([...cleanedData]);
}
-
-
-
-
-
};
-
const CategoryFn = async () => {
- const Category = await dispatch(getLayoutCategories({
- CompId: CompId,
- BranchId: BranchId,
- AppId: AppId,
- })
+ const Category = await dispatch(
+ getLayoutCategories({
+ CompId: CompId,
+ BranchId: BranchId,
+ AppId: AppId,
+ })
).unwrap();
if (Category?.data?.statusCode == 1) {
setcategory(Category.data?.data);
}
-
-
- }
-
+ };
// useEffect(() => {
// if (mappingType !== 'category') return;
-
// const productIds = (Prods || [])
// .filter((p) => (selectedCategories || []).includes(p?.ProdCat))
// .map((p) => p?.ProdId);
-
-
-
// setSelectedProducts(productIds);
// }, [mappingType, Prods]);
-
-
-
-
-
const BogoFreeAddFn = (bogoBuyProduct, bogoFreeProduct) => {
-
if (
- !bogoBuyProduct.startsWith(`P${getSession("AppId")}`) ||
- !bogoFreeProduct.startsWith(`P${getSession("AppId")}`)
+ !bogoBuyProduct.startsWith(`P${getSession('AppId')}`) ||
+ !bogoFreeProduct.startsWith(`P${getSession('AppId')}`)
) {
- message.error("Please select both Buy and Free products");
+ message.error('Please select both Buy and Free products');
return;
}
@@ -358,17 +379,20 @@ const OfferList = ({ formType }) => {
let Freeprdt = Prods?.filter((e) => e?.ProdId == bogoFreeProduct);
// const existingOfferId = BUYXGetTX?.find(e => e?.OfferId)?.ProdVariantDetails?.[0]?.StockDetails[0]?.ProdOfferId || null
// Check if editing (editStateInside is true and entry exists)
- if (editStateInside && BUYXGetTX?.some(e => e?.ProdId === bogoBuyProduct)) {
+ if (
+ editStateInside &&
+ BUYXGetTX?.some((e) => e?.ProdId === bogoBuyProduct)
+ ) {
// Update only the Buy Qty and Free Qty for the existing entry
- const updated = BUYXGetTX.map(item => {
+ const updated = BUYXGetTX.map((item) => {
if (item.ProdId === bogoBuyProduct) {
return {
...item,
MinQty: bogoBuyQuantity,
- FreeProductDetails: item.FreeProductDetails?.map(free => ({
+ FreeProductDetails: item.FreeProductDetails?.map((free) => ({
...free,
- FreeQty: bogoFreeQuantity
- }))
+ FreeQty: bogoFreeQuantity,
+ })),
};
}
return item;
@@ -378,8 +402,12 @@ const OfferList = ({ formType }) => {
} else {
// Prevent duplicate add
- if (BUYXGetTX?.some(e => e?.FreeProductDetails?.[0]?.FreeProdId === bogoFreeProduct)) {
- message.error("This Free Product is already added");
+ if (
+ BUYXGetTX?.some(
+ (e) => e?.FreeProductDetails?.[0]?.FreeProdId === bogoFreeProduct
+ )
+ ) {
+ message.error('This Free Product is already added');
return;
}
let data = {
@@ -390,32 +418,32 @@ const OfferList = ({ formType }) => {
ProdVariantName: v?.ProdVariantName,
StockDetails: v?.StockDetails?.map((s) => ({
InwardDtlId: s?.InwardDtlId,
- ActiveStatus: "A",
+ ActiveStatus: 'A',
// ProdOfferId: existingOfferId || ""
-
-
})),
})),
MinQty: bogoBuyQuantity,
OfferType: 'B',
- ActiveStatus: "A",
+ ActiveStatus: 'A',
BuyNGetName: `BUY ${bogoBuyQuantity} GET ${bogoFreeQuantity} `,
- HalfPrice: "N",
- FreeProductDetails: [{
- FreeProdId: Freeprdt?.[0]?.ProdId,
- FreeProdName: Freeprdt?.[0]?.ProdName,
- FreeQty: bogoFreeQuantity,
- ActiveStatus: "A",
- ProdVariantDetails: Freeprdt?.[0]?.ProdVariantDetails?.map((v) => ({
- FreeProdVariantName: v?.ProdVariantName,
+ HalfPrice: 'N',
+ FreeProductDetails: [
+ {
+ FreeProdId: Freeprdt?.[0]?.ProdId,
+ FreeProdName: Freeprdt?.[0]?.ProdName,
+ FreeQty: bogoFreeQuantity,
+ ActiveStatus: 'A',
+ ProdVariantDetails: Freeprdt?.[0]?.ProdVariantDetails?.map((v) => ({
+ FreeProdVariantName: v?.ProdVariantName,
- StockDetails: v?.StockDetails?.map((s) => ({
- FreeProdInwardDtlId: s?.InwardDtlId,
- ActiveStatus: "A",
- // ProdOfferId: existingOfferId || ""
+ StockDetails: v?.StockDetails?.map((s) => ({
+ FreeProdInwardDtlId: s?.InwardDtlId,
+ ActiveStatus: 'A',
+ // ProdOfferId: existingOfferId || ""
+ })),
})),
- })),
- }],
+ },
+ ],
};
setBUYXGetTX((prev) => [...prev, data]);
@@ -424,7 +452,7 @@ const OfferList = ({ formType }) => {
setBogoFreeProduct({ label: null, prodId: null });
setBogoBuyQuantity(1);
setBogoFreeQuantity(1);
- }
+ };
const handleChange = (pagination, filters, sorter) => {
setSortedInfo(sorter);
};
@@ -433,100 +461,93 @@ const OfferList = ({ formType }) => {
setpage(current);
};
-
const handleDelete = (record) => {
const recordData = record?.FreeProductDetails;
if (record.OfferId) {
- const updatedBUYXGetTX = BUYXGetTX.map(item => {
+ const updatedBUYXGetTX = BUYXGetTX.map((item) => {
if (item.ProdId === record.ProdId) {
- return { ...item, ActiveStatus: "D" }; // mark whole item inactive
+ return { ...item, ActiveStatus: 'D' }; // mark whole item inactive
}
return item;
});
setBUYXGetTX(updatedBUYXGetTX);
} else {
- const updatedBUYXGetTX = BUYXGetTX.filter(item =>
+ const updatedBUYXGetTX = BUYXGetTX.filter((item) =>
item.FreeProductDetails.every(
- freeItem => freeItem.FreeProdId !== recordData?.[0]?.FreeProdId
+ (freeItem) => freeItem.FreeProdId !== recordData?.[0]?.FreeProdId
)
);
setBUYXGetTX(updatedBUYXGetTX);
}
};
-
-
-
const statusFormatter = (record) => {
-
- if (record.ActiveStatus === "A") {
+ if (record.ActiveStatus === 'A') {
handleDelete(record);
} else {
- const updatedBUYXGetTX = BUYXGetTX?.map(item => {
+ const updatedBUYXGetTX = BUYXGetTX?.map((item) => {
if (item.ProdId === record.ProdId) {
return {
...item,
- ActiveStatus: "A",
- ProdVariantDetails: item.ProdVariantDetails?.map(variant => ({
+ ActiveStatus: 'A',
+ ProdVariantDetails: item.ProdVariantDetails?.map((variant) => ({
...variant,
- StockDetails: variant.StockDetails?.map(stock => ({
+ StockDetails: variant.StockDetails?.map((stock) => ({
...stock,
- ActiveStatus: "A"
- }))
+ ActiveStatus: 'A',
+ })),
})),
- FreeProductDetails: item.FreeProductDetails?.map(free => ({
+ FreeProductDetails: item.FreeProductDetails?.map((free) => ({
...free,
- ActiveStatus: "A",
- ProdVariantDetails: free.ProdVariantDetails?.map(freeVar => ({
+ ActiveStatus: 'A',
+ ProdVariantDetails: free.ProdVariantDetails?.map((freeVar) => ({
...freeVar,
- StockDetails: freeVar.StockDetails?.map(freeStock => ({
+ StockDetails: freeVar.StockDetails?.map((freeStock) => ({
...freeStock,
- ActiveStatus: "A"
- }))
- }))
- }))
+ ActiveStatus: 'A',
+ })),
+ })),
+ })),
};
}
return item;
});
setBUYXGetTX(updatedBUYXGetTX);
}
-
-
-
- }
+ };
const actionsFormatter = (record, index) => {
seteditStateInside(true);
setBogoBuyProduct({ label: record?.ProdName, prodId: record?.ProdId });
- setBogoFreeProduct({ label: record?.FreeProductDetails[0]?.FreeProdName, prodId: record?.FreeProductDetails[0]?.FreeProdId })
+ setBogoFreeProduct({
+ label: record?.FreeProductDetails[0]?.FreeProdName,
+ prodId: record?.FreeProductDetails[0]?.FreeProdId,
+ });
setBogoBuyQuantity(record.MinQty || 1);
setBogoFreeQuantity(record?.FreeProductDetails?.[0]?.FreeQty);
- }
+ };
function validate50PercentageOffer(buyDetails, getDetails) {
-
if (!buyDetails?.length || !getDetails?.length) return false;
// Collect active stock IDs for buy products
const buyStockIds = new Set(
- buyDetails.flatMap(variant =>
+ buyDetails.flatMap((variant) =>
(variant.StockDetails || [])
- .filter(stock => stock.ActiveStatus === "A")
- .map(stock => stock.InwardDtlId)
+ .filter((stock) => stock.ActiveStatus === 'A')
+ .map((stock) => stock.InwardDtlId)
)
);
// Collect active stock IDs for free products
const getStockIds = new Set(
- getDetails.flatMap(variant =>
+ getDetails.flatMap((variant) =>
(variant.StockDetails || [])
- .filter(stock => stock.ActiveStatus === "A")
- .map(stock => stock.FreeProdInwardDtlId)
+ .filter((stock) => stock.ActiveStatus === 'A')
+ .map((stock) => stock.FreeProdInwardDtlId)
)
);
-
// If counts differ, no need to check further
if (buyStockIds.size !== getStockIds.size) return false;
@@ -538,258 +559,247 @@ const OfferList = ({ formType }) => {
return true;
}
+ const Columns = useMemo(
+ () => [
+ {
+ title: 'Name',
+ dataIndex: 'BuyNGetName',
+ key: 'BuyNGetName',
+ // render: (_, record, index) => (
+ // <>
+ // BUY
+ // {record?.MinQty}
+ // GET
+ // {record?.FreeProductDetails?.[0]?.FreeQty || "-"}
- const Columns = useMemo(() => [
- {
- title: "Name",
- dataIndex: "BuyNGetName",
- key: "BuyNGetName",
- // render: (_, record, index) => (
- // <>
- // BUY
- // {record?.MinQty}
- // GET
- // {record?.FreeProductDetails?.[0]?.FreeQty || "-"}
+ // >
-
-
- // >
-
- // )
- },
-
- {
- title: "BUY PRODUCT",
- dataIndex: "ProdName",
- key: "ProdName",
- render: (_, record, index) => {
-
-
- const hasMultipleStock =
- (record?.ProdVariantDetails?.length || 0) > 1 || // multiple variants
- record?.ProdVariantDetails?.some(
- (variant) => (variant?.StockDetails?.length || 0) > 1 // multiple stocks in a variant
- );
-
-
- return (
- <>
- {record?.ProdName}
-
- {hasMultipleStock && (
- {
- dispatchBuyXGETX({
- type: "Prodvariant",
- payload: record?.ProdVariantDetails,
- });
- dispatchBuyXGETX({ type: "modal", payload: true });
- dispatchBuyXGETX({ type: "ProdId", payload: record?.ProdId });
- dispatchBuyXGETX({ type: "type", payload: "BUY" });
- }}
- >
-