import axios from 'axios'; import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'; import { axiosRetailInstanceData, axiosCommonInstanceData, } from '../../AuthenicationToken/AuthenticationToken'; import { getSession } from '../../../Services/Others'; const apiUrl = import.meta.env.ENV_API_URL; const apiCommonUrl = import.meta.env.ENV_API_URL_COMMON; const Paymentdevice_POST_URL = import.meta.env.ENV_PAYMENT_DEVICE_URL; const Paymentdevice_GET_URL = import.meta.env.ENV_PAYMENT_STATUS_GET_URL; export const getNotification = createAsyncThunk( 'BookingData/getNotification', async ({ CompId, BranchId, AppId, UserId }) => { return await axiosRetailInstanceData.get( `/Notification?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&userId=${UserId}` ); } ); export const getLayoutCategories = createAsyncThunk( 'BookingData/getLayoutCategories', async ({ CompId, BranchId, AppId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/productCat?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}` ); } } ); export const getLayoutSubCategories = createAsyncThunk( 'BookingData/getLayoutSubCategories', async ({ CompId, BranchId, AppId, ProdCat }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined && ProdCat != null && ProdCat != undefined ) { return await axiosRetailInstanceData.get( `/productSubCat?CompId=${CompId}&BranchId=${BranchId}&ProdCat=${ProdCat}&AppId=${AppId}` ); } } ); export const getLayoutproductCard = createAsyncThunk( 'BookingData/getLayoutproductCard', async (data) => { const { CompId, BranchId, ProdSubCat, AppId, fromDate, toDate } = data || {}; if (CompId && BranchId && ProdSubCat && AppId) { const params = new URLSearchParams({ CompId, BranchId, ProdSubCat, AppId, }); // add fromDate/toDate only when provided if (fromDate) params.append('fromDate', fromDate); if (toDate) params.append('toDate', toDate); return await axiosRetailInstanceData.get( `/productCardList?${params.toString()}` ); } } ); export const getLayoutsearch = createAsyncThunk( 'BookingData/getLayoutsearch', async ({ CompId, BranchId, AppId, ProdName, fromDate = null, toDate = null, }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined && ProdName != null && ProdName != undefined ) { let endPoint = `/productCardList?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&ProdName=${encodeURIComponent(ProdName)}`; if (fromDate) { endPoint += `&fromDate=${fromDate}`; } if (toDate) { endPoint += `&toDate=${toDate}`; } return await axiosRetailInstanceData.get(endPoint); } } ); export const getReprintData = createAsyncThunk( 'BookingData/getReprintData', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/reprint?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}` ); } } ); export const getConfigType = createAsyncThunk( 'BookingData/getConfigType', async ({ TypeName }) => { if (TypeName != null && TypeName != undefined) { return await axiosRetailInstanceData.get( `/configMaster?TypeName=${TypeName}` ); } } ); export const PostBookingData = createAsyncThunk( 'BookingData/PostBookingdata', async (postData) => { return await axiosRetailInstanceData.post(`/Booking`, postData); } ); export const PostSalesCancellation = createAsyncThunk( 'BookingData/PostSalesCancellation', async (postData) => { return await axiosRetailInstanceData.post(`/SalesCancellation`, postData); } ); export const PutBookingData = createAsyncThunk( 'BookingData/PutBookingdata', async (putData) => { return await axiosRetailInstanceData.put(`/Booking`, putData); } ); export const putSalesBillEdit = createAsyncThunk( 'BookingData/putSalesBillEdit', async (putData) => { return await axiosRetailInstanceData.put(`/SalesBillEdit`, putData); } ); export const getEstimateDatewiseReport = createAsyncThunk( 'BookingData/getEstimateDatewiseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined && data?.type != null && data?.type != undefined && data?.filterType != null && data?.filterType != undefined ) { return await axiosRetailInstanceData.get( `/dateWisereport?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&OrderFromDate=${data?.OrderFromDate}&OrderToDate=${data?.OrderToDate}&UserId=${data?.UserId}&type=${data?.type}&filterType=${data.filterType}` ); } } ); export const getDatewiseReport = createAsyncThunk( 'BookingData/getDatewiseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined ) { return await axiosRetailInstanceData.get( `/dateWisereport?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&OrderFromDate=${data?.OrderFromDate}&OrderToDate=${data?.OrderToDate}&UserId=${data?.UserId}&filterType=${data?.filterType}` ); } } ); export const wholesalegetDatewiseReport = createAsyncThunk( 'BookingData/getDatewiseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined ) { return await axiosRetailInstanceData.get( `/WholeSaleDateWiseReport?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&OrderFromDate=${data?.OrderFromDate}&OrderToDate=${data?.OrderToDate}&UserId=${data?.UserId}` ); } } ); export const getWholeSaleSalesReport = createAsyncThunk( 'BookingData/getWholeSaleSalesReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined ) { return await axiosRetailInstanceData.get( `/WholeSaleSalesReport?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}&fromDate=${data?.OrderFromDate}&toDate=${data?.OrderToDate}` ); } } ); export const getWholeSalePurchaseReport = createAsyncThunk( 'BookingData/getDatewiseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined ) { return await axiosRetailInstanceData.get( `/WholeSalePurchaseReport?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}&fromDate=${data?.OrderFromDate}&toDate=${data?.OrderToDate}` ); } } ); export const getPaymentPurchaseReport = createAsyncThunk( 'BookingData/getPaymentPurchaseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined ) { return await axiosRetailInstanceData.get( `/WholeSalePaymentPurchaseReport?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}&fromDate=${data?.OrderFromDate}&toDate=${data?.OrderToDate}&UserId=${data?.UserId}` ); } } ); export const getPaymentSalesReport = createAsyncThunk( 'BookingData/getPaymentPurchaseReport', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.OrderFromDate != null && data?.OrderFromDate != undefined && data?.OrderToDate != null && data?.OrderToDate != undefined && data?.UserId != null && data?.UserId != undefined ) { return await axiosRetailInstanceData.get( `/WholeSalePaymentSalesReport?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}&fromDate=${data?.OrderFromDate}&toDate=${data?.OrderToDate}&UserId=${data?.UserId}` ); } } ); export const othernamedrop = createAsyncThunk('othernamedrop', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.ProdType != null && data?.ProdType != undefined ) { return await axiosRetailInstanceData.get( `/product?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&ProdType=${data?.ProdType}` ); } }); export const getUomData = createAsyncThunk('product/getUomData', async () => { return await axiosRetailInstanceData.get( `/configMaster?TypeName=Unit Of Measure` ); }); export const getAllCustomer = createAsyncThunk( 'product/getAllCustomer', async ({ CompId, AppId, branchId }) => { if ( CompId != null && CompId != undefined && branchId != null && branchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/Customer?compId=${CompId}&branchId=${branchId}&appId=${AppId}&activeStatus=A` ); } } ); export const getCustomerForHold = createAsyncThunk( 'product/getAllCustomer', async ({ CompId, AppId, branchId, OrderId }) => { if ( CompId != null && CompId != undefined && branchId != null && branchId != undefined && AppId != null && AppId != undefined && OrderId != null && OrderId != undefined ) { return await axiosRetailInstanceData.get( `/Customer/HoldCustomer?compId=${CompId}&branchId=${branchId}&appId=${AppId}&OrderId=${OrderId}` ); } } ); export const getAllCustomerAndBranch = createAsyncThunk( 'product/getAllCustomerAndBranch', async ({ CompId, AppId, BranchId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/Customer/AllCustomerBranchDropdown?compId=${CompId}&branchId=${BranchId}&appId=${AppId}` ); } } ); export const PendingOrdersDC = createAsyncThunk( 'product/PendingOrders', async ({ CompId, AppId, BranchId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/PendingOrders?compId=${CompId}&branchId=${BranchId}&appId=${AppId}` ); } } ); export const PendingOrdersPE = createAsyncThunk( 'product/PendingOrders', async ({ CompId, AppId, BranchId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/PendingOrders?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&Type=PE` ); } } ); export const getAllCustomerWithoutActive = createAsyncThunk( 'product/getAllCustomerWithoutActive', async ({ CompId, AppId, branchId }) => { if ( CompId != null && CompId != undefined && branchId != null && branchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/Customer?compId=${CompId}&branchId=${branchId}&appId=${AppId}` ); } } ); export const getAllCustomerPendingBalance = createAsyncThunk( 'product/getAllCustomerPendingBalance', async ({ CompId, AppId, BranchId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/Customer/PendingBalance?compId=${CompId}&branchId=${BranchId}&appId=${AppId}` ); } } ); export const getPaymentFailList = createAsyncThunk( 'product/PaymentFailList', async ({ CompId, AppId, branchId }) => { if ( CompId != null && CompId != undefined && branchId != null && branchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/FailedPaymentList?compId=${CompId}&branchId=${branchId}&appId=${AppId}` ); } } ); export const getAdmin = createAsyncThunk( 'product/adminTax', async ({ CompId, AppId }) => { if ( CompId != null && CompId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/tax?ActiveStatus=A&CompId=${CompId}&AppId=${AppId}` ); } } ); export const postProductData = createAsyncThunk( 'product/postProductData', async (postData) => { return await axiosRetailInstanceData.post(`/product`, postData); } ); export const postCancelReshRules = createAsyncThunk( 'Cancel/postCancelReshRules', async (postData) => { return await axiosRetailInstanceData.post(`/CancelReshRules`, postData); } ); export const putCancelReshRules = createAsyncThunk( 'Cancel/putCancelReshRules', async (putData) => { return await axiosRetailInstanceData.put(`/CancelReshRules`, putData); } ); export const deleteCancelReshRules = createAsyncThunk( 'Cancel/deleteCancelReshRules', async (deleteData) => { return await axiosRetailInstanceData.delete( `/CancelReshRules?UniqueId=${deleteData?.UniqueId}&ActiveStatus=${deleteData?.ActiveStatus}&updatedBy=${deleteData?.UpdatedBy}` ); } ); export const getCancelReshRules = createAsyncThunk( 'product/getCancelReshRules', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/CancelReshRules?CompId=${data?.CompId}&AppId=${data?.AppId}&BranchId=${data?.BranchId}` ); } } ); export const getproducttypeid = createAsyncThunk( 'product/getproducttypeid', async () => { return await axiosRetailInstanceData.get( `/configMaster?TypeName=Product Type` ); } ); export const getsupplierBasedOnCmpIdBrIdAppId = createAsyncThunk( 'supplier/getsupplierBasedOnCmpIdBrIdAppId', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/supplierlist?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}` ); } } ); export const getPaymentOptions = createAsyncThunk( 'BookingData/getPaymentOptions', async () => { return await axiosRetailInstanceData.get( `/configMaster?TypeName=Payment Mode` ); } ); export const getPreOrderPaymentOptions = createAsyncThunk( 'BookingData/getPreOrderPaymentOptions', async (data) => { const UserType = getSession('UserType'); if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && UserType !== 'Super Admin' && UserType !== 'Super Admin User' ) { return await axiosRetailInstanceData.get( `/PaymentOptions?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}` ); } } ); export const getPaymentUpiOptions = createAsyncThunk( 'BookingData/getPaymentUpiOptions', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/upi?ActiveStatus=A&CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&detailType=U` ); } } ); export const putpaymentStatus = createAsyncThunk( 'BookingData/putpaymentStatus', async (putData) => { return await axiosRetailInstanceData.put(`/PaymentStatus`, putData); } ); export const putSplitpaymentStatus = createAsyncThunk( 'BookingData/SplitPaymentStatus', async (putData) => { return await axiosRetailInstanceData.put(`/SplitPaymentStatus`, putData); } ); export const PostFavItemsData = createAsyncThunk( 'BookingData/PostFavItemsData', async (postData) => { return await axiosRetailInstanceData.post(`/allItem`, postData); } ); export const getSelectedFavItems = createAsyncThunk( 'BookingData/getSelectedFavItems', async (data) => { const { CompId, BranchId, AppId, fromDate, toDate } = data || {}; if (CompId && BranchId && AppId) { const params = new URLSearchParams({ CompId, BranchId, AppId, Type: 'A', }); // add fromDate/toDate only when provided if (fromDate) params.append('fromDate', fromDate); if (toDate) params.append('toDate', toDate); // let url = `/productCardList?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&Type=A`; return await axiosRetailInstanceData.get( `/productCardList?${params.toString()}` ); } } ); export const getEditFavItems = createAsyncThunk( 'BookingData/getEditFavItems', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/allItem?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}` ); } } ); export const UserDataBasedOnBranchId = createAsyncThunk( 'Emp/UserData', async (BranchId) => { if (BranchId != null && BranchId != undefined) { return await axiosCommonInstanceData.get( `/login?BranchId=${BranchId}&Type=AE` ); } } ); export const getPreferenceData = createAsyncThunk( 'BookingData/getPreferenceData', async ({ CompId, BranchId, AppId }) => { if ( CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && AppId != null && AppId != undefined ) { return await axiosRetailInstanceData.get( `/settings?BranchId=${BranchId}&CompId=${CompId}&AppId=${AppId}` ); } } ); export const getCardDataWithoutSub = createAsyncThunk( 'BookingData/getCardDataWithoutSub', async (data) => { const { compId, branchId, appId, prodCat, date, fromDate, toDate } = data || {}; if (compId && branchId && appId && prodCat) { const params = new URLSearchParams({ compId, branchId, appId, prodCat, }); // add date or date range when provided (support both for backward compatibility) // add fromDate/toDate only when provided if (fromDate) params.append('fromDate', fromDate); if (toDate) params.append('toDate', toDate); return await axiosRetailInstanceData.get( `/productCardList?${params.toString()}` ); } } ); export const getUnpaidData = createAsyncThunk( 'BookingData/getUnpaidData', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosRetailInstanceData.get( `/UnPaidBill?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}` ); } } ); export const getPaymentOptionFeatureApi = createAsyncThunk( 'BookingData/getPaymentOptionFeatureApi', async (data) => { const UserType = getSession('UserType'); if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && UserType !== 'Super Admin' && UserType !== 'Super Admin User' ) { return await axiosRetailInstanceData.get( `/PaymentOptions?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}` ); } } ); export const getProductsearch = createAsyncThunk( "BookingData/getProductsearch", async ( { CompId, BranchId, AppId, ProdName }, { signal, rejectWithValue } ) => { try { if (!CompId || !BranchId || !AppId || !ProdName) { return rejectWithValue("Invalid params"); } const response = await axiosRetailInstanceData.get( `/productCardList`, { params: { CompId, BranchId, AppId, ProdName, }, signal, // ✅ Abort works here } ); return response.data; // ✅ return only data } catch (error) { // ✅ Abort error – ignore if (error.name === "CanceledError" || error.name === "AbortError") { throw error; } return rejectWithValue(error.response?.data || "API Error"); } } ); export const getCardDataWithoutSubmodule = createAsyncThunk( 'BookingData/getCardDataWithoutSubmodule', async (data) => { if ( data?.compId != null && data?.compId != undefined && data?.branchId != null && data?.branchId != undefined && data?.appId != null && data?.appId != undefined && data?.prodCat != null && data?.prodCat != undefined ) { const params = new URLSearchParams({ compId: data?.compId, branchId: data?.branchId, prodCat: data?.prodCat, appId: data?.appId, ...(data?.fromDate && data?.toDate ? { fromDate: data?.fromDate, toDate: data?.toDate } : {}), }); return await axiosRetailInstanceData.get( `/productCardList?${params.toString()}` ); } } ); export const getSalesDetailData = createAsyncThunk( 'BookingData/getdashboarddate', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.UserId != null && data?.UserId != undefined && data?.FromDate != null && data?.FromDate != undefined && data?.ToDate != null && data?.ToDate != undefined ) { return await axiosRetailInstanceData.get( `/DashBoardReport?AppId=${data?.AppId}&CompId=${data?.CompId}&UserId=${data?.UserId}&BranchId=${data?.BranchId}&fromDate=${data?.FromDate}&toDate=${data?.ToDate}` ); } } ); export const SendPaymentLink = createAsyncThunk( 'SendPaymentLink/SendPaymentLink', async ({ MobileNo, url }) => { if ( MobileNo != null && MobileNo != undefined && url != null && url != undefined ) { return await axiosCommonInstanceData.post(`/verifyOTP/SendPaymentLink`, { MobileNo: MobileNo, MessageHeader: 'PaymentLink', Link: url, }); } } ); export const discountSendOtp = createAsyncThunk( 'discount/verifyOTP', async ({ MobileNo }) => { return await axiosCommonInstanceData.post(`/verifyOTP`, { UserName: MobileNo, }); } ); export const getCreditCustomer = createAsyncThunk( 'getCreditCustomer/getCreditCustomer', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.CustId != null && data?.CustId != undefined ) { return await axiosRetailInstanceData.get( `/CreditCustomer?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&CustId=${data?.CustId}` ); } } ); export const PostCreditCustomerDetails = createAsyncThunk( 'BookingData/PostCreditCustomerDetails', async (postData) => { return await axiosRetailInstanceData.post(`/CreditCustomer`, postData); } ); export const getCreditCustomerReprint = createAsyncThunk( 'BookingData/getCreditCustomerReprint', async ({ AppId, CompId, BranchId, fromDate, toDate }) => { // Validate required parameters if (!AppId || !CompId || !BranchId) { throw new Error('Missing required parameters'); } const params = new URLSearchParams({ AppId, CompId, BranchId, }); if (fromDate && toDate) { params.append('FromDate', fromDate); params.append('ToDate', toDate); } // Make the request return await axiosRetailInstanceData.get( `/CreditCustomer/RePrint?${params.toString()}` ); } ); export const getAppSubscriptionDate = createAsyncThunk( 'getCreditCustomer/getAppSubscriptionDate', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined ) { return await axiosCommonInstanceData.get( `/appAccess?CompId=${data?.CompId}&AppId=${data?.AppId}&BranchId=${data?.BranchId}&type=${'CO'}` ); } } ); export const getSalesDetail = createAsyncThunk( 'getSalesDetail/getSalesDetail', async (data) => { if ( data?.OrderId != null && data?.OrderId != undefined && data?.Type != null && data?.Type != undefined ) { return await axiosRetailInstanceData.get( `/SalesHdr?OrderId=${data?.OrderId}&Type=${data?.Type}` ); } } ); export const getPaymentModeDetail = createAsyncThunk( 'getPaymentModeDetail/getPaymentModeDetail', async (data) => { const { segmentValue, mobileNumber, fromDate, toDate, date, OrderId, AppId, CompId, BranchId, } = data; if (segmentValue === 'Bill No') { if (OrderId != null && OrderId != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr?OrderId=${OrderId}` ); } } else if (segmentValue === 'Mobile') { if ( mobileNumber != null && mobileNumber != undefined && fromDate != null && fromDate != undefined && toDate != null && toDate != undefined ) { return await axiosRetailInstanceData.get( `/SalesHdr?OrderId=${mobileNumber}&fromDate=${fromDate}&toDate=${toDate}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}` ); } } else if (segmentValue === 'Date') { if (date != null && date != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr?date=${date}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}` ); } } } ); export const getReturnBill = createAsyncThunk( 'getReturnBill/getReturnBill', async (data) => { const { segmentValue, mobileNumber, fromDate, toDate, date, OrderId, AppId, CompId, BranchId, ProdName, BatchRef, SerialNumber, } = data; if (segmentValue === 'Bill No') { if (OrderId != null && OrderId != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?OrderId=${OrderId}` ); } } else if (segmentValue === 'Mobile Number') { if ( mobileNumber != null && mobileNumber != undefined && fromDate != null && fromDate != undefined && toDate != null && toDate != undefined ) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?OrderId=${mobileNumber}&fromDate=${fromDate}&toDate=${toDate}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}` ); } } else if (segmentValue === 'Date') { if (date != null && date != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?date=${date}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}` ); } } else if (segmentValue === 'ProdName') { if (ProdName != null && ProdName != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?ProdName=${ProdName}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}&fromDate=${fromDate}&toDate=${toDate}` ); } } else if (segmentValue === 'BatchRef') { if (BatchRef != null && BatchRef != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?BatchRef=${BatchRef}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}&fromDate=${fromDate}&toDate=${toDate}` ); } } else if (segmentValue === 'SerialNumber') { if (SerialNumber != null && SerialNumber != undefined) { return await axiosRetailInstanceData.get( `/SalesHdr/ReturnBill?SerialNumber=${SerialNumber}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}&fromDate=${fromDate}&toDate=${toDate}` ); } } } ); // get /SalesHdr/SlotReschedule // start export const getSlotReschedule = createAsyncThunk( 'getSlotReschedule/SlotReschedule', async (data) => { if ( data?.prodId != null && data?.prodId != undefined && data?.date != null && data?.date != undefined ) { return await axiosRetailInstanceData.get( `/Sales/SlotReschedule?prodId=${data?.prodId}&date=${data?.date}&appId=${data?.AppId}&compId=${data?.CompId}&branchId=${data?.BranchId}` ); } } ); export const getRescheduleSlot = createAsyncThunk( 'getRescheduleSlot/SlotReschedule', async (data) => { const { segmentValue, date, OrderId, AppId, CompId, BranchId } = data; if (segmentValue === 'Bill No') { if (OrderId != null && OrderId != undefined) { return await axiosRetailInstanceData.get( `/SlotReschedule?orderId=${OrderId}` ); } } else if (segmentValue === 'Date') { if (date != null && date != undefined) { return await axiosRetailInstanceData.get( `/SlotReschedule?date=${date}&appId=${AppId}&compId=${CompId}&branchId=${BranchId}` ); } } } ); // end export const CreditCustomerPrintDetails = createAsyncThunk( 'BookingData/CreditCustomerPrintDetails', async (data) => { if (data != null && data != undefined) { return await axios.get(`${apiUrl}/CreditCustomer?uniqueId=${data}`); } } ); export const putpaymentModeChange = createAsyncThunk( 'BookingData/putpaymentModeChange', async (putData) => { return await axiosRetailInstanceData.put(`/bulkPaymentMode`, putData); } ); export const FeatureAddon = createAsyncThunk( 'BookingData/FeatureAddon', async ({ UserId, AppId }) => { const UserType = getSession('UserType'); if ( UserId != null && UserId != undefined && AppId != null && AppId != undefined && UserType !== 'Super Admin' && UserType !== 'Super Admin User' ) { return await axios.get( `${apiCommonUrl}/UAMFeatAddon?AppId=${AppId}&UserId=${UserId}` ); } } ); export const Comboget = createAsyncThunk('Comboget', async (data) => { if ( data?.comboName?.trim() && data?.comboName != undefined && data?.comboName != null && data?.ActiveStatus != undefined && data?.ActiveStatus != null ) { return await axiosRetailInstanceData.get( `/ComboHdr?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}&comboName=${data?.comboName}&ActiveStatus=${data?.ActiveStatus}` ); } else if ( data?.comboName?.trim() && data?.comboName != undefined && data?.comboName != null ) { return await axiosRetailInstanceData.get( `/ComboHdr?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}&comboName=${data?.comboName}` ); } else { if (!data?.comboName) { return await axiosRetailInstanceData.get( `/ComboHdr?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}&ActiveStatus=${data?.ActiveStatus}` ); } } }); export const PaymentOptions = createAsyncThunk( 'BookingData/PaymentOptions', async (data) => { const UserType = getSession('UserType'); if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && UserType !== 'Super Admin' && UserType !== 'Super Admin User' ) { return await axiosRetailInstanceData.get( `/PaymentOptions?AppId=${data?.AppId}&CompId=${data?.CompId}&BranchId=${data?.BranchId}` ); } } ); export const PostPaymentdevice = createAsyncThunk( 'BookingData/PostPaymentdevice', async (data, { rejectWithValue }) => { try { const response = await axios.post(`${Paymentdevice_POST_URL}`, data, { headers: { 'Content-Type': 'application/json', // Set the Content-Type header // Add any other headers here if needed }, }); console.log('Response Data:', response?.data); // Log the response data return response?.data; } catch (error) { console.error('Request Error:', error); return rejectWithValue(error.response?.data || error.message); } } ); export const GetPaymentdeviceResponse = createAsyncThunk( 'BookingData/GetPaymentdeviceResponse', async (data, { rejectWithValue }) => { try { const response = await axios.post(`${Paymentdevice_GET_URL}`, data, { headers: { 'Content-Type': 'application/json', // Set the Content-Type header // Add any other headers here if needed }, }); console.log('Response Data:', response?.data); // Log the response data return response?.data; } catch (error) { console.error('Request Error:', error); return rejectWithValue(error.response?.data || error.message); } } ); export const PutBookingPaymentStatusChange = createAsyncThunk( 'BookingData/PutBookingPaymentStatusChange', async (putData) => { return await axiosRetailInstanceData.put(`/BookingPaymentStatus`, putData); } ); export const PutPendingPaymentList = createAsyncThunk( 'BookingData/PutPendingPaymentList', async (putData) => { return await axiosRetailInstanceData.put(`/PendingPaymentList`, putData); } ); //Payment gateway export const getccavenuePaymentDetails = createAsyncThunk( 'getccavenuePaymentDetails', async () => { return await axiosCommonInstanceData.get( `/ccavenuePaymentDetails?activeStatus=A` ); } ); export const PaymentGatewayGetdetail = createAsyncThunk( 'BookingData/PaymentGatewayGetdetail', async (OrderId) => { if (OrderId != null && OrderId != undefined) { return await axiosRetailInstanceData.get( `/rePrint?orderId=${OrderId}&type=Booking` ); } } ); export const PaymentCardGetdetail = createAsyncThunk( 'BookingData/PaymentGatewayGetdetail', async (OrderId) => { if (OrderId != null && OrderId != undefined) { return await axiosRetailInstanceData.get(`/preOrder?orderId=${OrderId}`); } } ); export const putDisplayProductCat = createAsyncThunk( 'BookingData/putDisplayProductCat', async (putData) => { return await axiosRetailInstanceData.put(`/DisplayProductCat`, putData); } ); export const putDisplaySubcatProduct = createAsyncThunk( '/putDisplaySubcatProduct', async (putData) => { return await axiosRetailInstanceData.put(`/DisplayProductSubCat`, putData); } ); export const putDisplayProduct = createAsyncThunk( '/putDisplayProduct', async (putData) => { return await axiosRetailInstanceData.put(`/DisplayProduct`, putData); } ); export const getCombolist = createAsyncThunk('getCombo', async (data) => { if ( data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.AppId != null && data?.AppId != undefined && data?.ActiveStatus != null && data?.ActiveStatus != undefined ) { return await axiosRetailInstanceData.get( `/comboHdr?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}&ActiveStatus=${data?.ActiveStatus}` ); } else { return await axiosRetailInstanceData.get( `/comboHdr?CompId=${data?.CompId}&BranchId=${data?.BranchId}&AppId=${data?.AppId}` ); } }); export const getReleiveUsersInfo = createAsyncThunk( '/getReleiveUsersInfo', async ({ userId }) => { if (userId) { return await axiosCommonInstanceData.get( `/UserRelieveNotification?adminUserId=${userId}` ); } } ); export const putReleiveUserInfo = createAsyncThunk( '/putReleiveUserInfo', async (putData) => { if (putData) { return await axiosCommonInstanceData.put(`/UserRelievInfo`, putData); } } ); export const getOtherServiceTicket = createAsyncThunk( 'getOtherServiceTicket', async (data) => { if ( data?.AppId != null && data?.AppId != undefined && data?.CompId != null && data?.CompId != undefined && data?.BranchId != null && data?.BranchId != undefined && data?.TicketId != null && data?.TicketId != undefined ) { return await axiosRetailInstanceData.get( `/OtherServicesTicket?ticketNo=${data?.TicketId}&appId=${data?.AppId}&compId=${data?.CompId}&branchId=${data?.BranchId}` ); } } ); export const PostBlockSlots = createAsyncThunk( 'BookingData/PostBlockSlots', async (postData) => { return await axiosRetailInstanceData.post(`/BlockSlot`, postData); } ); export const slotTimeStatus = createAsyncThunk( 'BookingData/slotTimeStatus', async (data) => { return await axiosRetailInstanceData.put(`/SlotTime`, data); } ); export const getPaymentStatusForBusinessUPI = createAsyncThunk( 'BookingData/getPaymentStatusForBusinessUPI', async ({ orderId, Type }) => { if (Type) { return await axiosCommonInstanceData.get( `/PaymentPageStatus?OrderId=${orderId}&Type=${Type}` ); } else { return await axiosRetailInstanceData.get( `/PaymentPageStatus?OrderId=${orderId}` ); } } ); export const getCurrentOrderid = createAsyncThunk( 'BookingData/getcurrentorderid', async (data) => { return await axiosRetailInstanceData.get( `/BranchStartNo?compId=${data?.compId}&branchId=${data?.branchId}` ); } ); export const getMissedOrderids = createAsyncThunk( 'BookingData/getMissedOrderids', async (data) => { return await axiosRetailInstanceData.get( `/OrderNumberReserve?compId=${data?.compId}&branchId=${data?.branchId}&appId=${data?.appId}` ); } ); // get /LastBuyProductList export const CustomerOrderList = createAsyncThunk( 'CustomerOrderList/LastBuyProductList', async (data) => { const { AppId, CompId, BranchId, MobileNo, FromDate, ToDate } = data; if ( AppId != null && AppId != undefined && CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && FromDate != null && FromDate != undefined && ToDate != null && ToDate != undefined && MobileNo != null && MobileNo != undefined ) { return await axiosRetailInstanceData.get( `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}&fromDate=${FromDate}&toDate=${ToDate}` ); } else if ( AppId != null && AppId != undefined && CompId != null && CompId != undefined && BranchId != null && BranchId != undefined && MobileNo != null && MobileNo != undefined ) { return await axiosRetailInstanceData.get( `/LastBuyProductList?compId=${CompId}&branchId=${BranchId}&appId=${AppId}&mobileNo=${MobileNo}` ); } } ); // post /ProductSearch export const PostProductSearch = createAsyncThunk( 'multipleSearch/ProductSearch', async (postData) => { return await axiosRetailInstanceData.post(`/ProductSearch`, postData); } ); // get /GetProductSearch export const getmultipleSearch = createAsyncThunk( 'multipleSearch/GetProductSearch', async (data) => { return await axiosRetailInstanceData.get( `/GetProductSearch?compId=${data?.CompId}&branchId=${data?.BranchId}&appId=${data?.AppId}` ); } ); const initialState = { PrintStyle: null, CustId: null, SelectedCustId: null, SelectedOption: null, CustOrders: null, Delete: null, CategorieData: [], BookingType: 'TakeAway', BookingTypeBoth: false, ProdCat: null, SubcategorieData: [], ProdSubCat: 'NaN', ItemCard: [], WithoutSubCatItemCard: [], searchedData: [], KisoksearchedData: [], OrderCardDetails: [], ReprintData: [], SelectedTableDetails: [], paymentOptionsData: [], paymentUpiOptionsData: [], ReorderHoldDetails: {}, ReorderProductDetails: [], ReprintModal: false, AlldataAccess: false, AllItemData: [], CardAccess: false, SelectedDatas: [], EditfavItems: [], AutoLocatetofav: false, AccessForOthers: false, othersdata: {}, NewQrProduct: {}, PreferenceData: [], WSProduct: {}, NavHoldData: false, SummeryQty: null, SummeryTotalItems: null, SummeryTotalAmount: null, SummeryTotalTaxAmount: null, SummeryTotalWithoutTaxAmount: null, SummeryComboOfferAmount: null, printStatus: false, focusStatusCust: false, focusStatusBalrec: false, PreviousOrderLength: null, HoldOrderDtl: false, UnpaidData: false, combofocus: false, focusCatCard: false, focusStatusCustMouse: false, CompoPaymentIconStatus: false, SelectedCustDisable: false, WeightScalePort: false, WeightScaleWeight: null, SalesDetailData: [], QrPort: null, CreditFocus: false, ExpDateforHeight: null, UpiIDprint: null, EstimateBooking: 'Sales', SelProdWiseEst: [], UpiIDName: '', upiOptionId: null, selectChair: [], selectTable: [], OrderType: null, ComboPreOrderDtlStatus: false, DropDownStatus: false, CommonPaymentOptions: [], Combosearch: false, Paymentloader: false, AllProductTokenAvailable: false, TokenOnly: false, TokenOnlyDisplay: [], PaymentTransactionNumber: null, unpaidflow: false, PreOrderSearchStatus: false, FocusKioskPay: false, InitialPaymentName: 'Cash', FailedTotalAmt: 0, OverAllDiscEstimate: 0, OverAllDiscSales: 0, BookingId: null, OrderStatus: false, UnpaidListData: [], ScreenSize: 0, AppExpDateData: {}, BranchFinancialStatus: 'N', dragging: false, draggingComponent: '', isFavClicked: false, ComboCarddata: [], BtoBQuickProductTransfer: { action: false, selectedProducts: [], }, alphabeticFormat: false, tipAmount: 0, FeatAddOnData: {}, OtherServiceTicketClaim: { TotalAmt: 0, ParkingClaimed: false, OthersType: 'New', }, OtherServices: false, comboRedirectionToDefaultLayoutForParking: false, DineinDefault: false, RetailWSSalesType: 'R', defaultBookingType: 'TakeAway', chairLevelServiceDefault: false, AllCustomers: [], paymentDefaultTrigger: 0, AddBookingDetailsTrigger: false, CurrentOrderId: null, productCardTrigger: 0, salesBillEdit: false, previousOrderPayment: [], previousOrderOfferDetails: [], }; const BookingData = createSlice({ name: 'BookingData', initialState, reducers: { ChangeDineInDefaultFn: (state, action) => { state.DineinDefault = action?.payload; }, changeComboRedirectionToDefaultLayoutForParking: (state, action) => { state.comboRedirectionToDefaultLayoutForParking = action?.payload; }, changeTipAmount: (state, action) => { state.tipAmount = action?.payload; }, changeBtoBQuickProductTransfer: (state, action) => { state.BtoBQuickProductTransfer = action?.payload; }, ChangeSearchFocusKioskPay: (state, action) => { state.FocusKioskPay = action?.payload; }, ChangeSearchFocusPreOrder: (state, action) => { state.PreOrderSearchStatus = action?.payload; }, changePrintStyle: (state, action) => { state.PrintStyle = action?.payload; }, changeQrPort: (state, action) => { state.QrPort = action?.payload; }, changeCustomerID: (state, action) => { state.CustId = action?.payload; }, changeCombofocus: (state, action) => { state.combofocus = action?.payload; }, changeSelectedCustId: (state, action) => { state.SelectedCustId = action?.payload; }, changeSelectedOption: (state, action) => { state.SelectedOption = action?.payload; }, changeCustomerOrders: (state, action) => { state.CustOrders = action?.payload; }, changeCustomerDelete: (state, action) => { state.Delete = action?.payload; }, changeCategorieData: (state, action) => { state.CategorieData = action?.payload; }, changeProductCategorie: (state, action) => { state.ProdCat = action?.payload; }, changeProductSubCategorie: (state, action) => { state.ProdSubCat = action?.payload; }, changeSearchedData: (state, action) => { state.searchedData = action?.payload; }, changeKisokSearchedData: (state, action) => { console.trace('HJI', action?.payload); state.KisoksearchedData = action?.payload; }, changeCardData: (state, action) => { state.ItemCard = action?.payload; }, changeOrderCardDetails: (state, action) => { state.OrderCardDetails = action?.payload; if (action?.payload?.length > 0) { state.OrderStatus = true; } else { state.OrderStatus = false; } const result = action?.payload?.some( (product) => product?.BookingTypeName === 'TakeAway' ) && action?.payload?.some( (product) => product?.BookingTypeName === 'Dine In' ); state.BookingTypeBoth = result ? true : false; const Token = action?.payload?.filter( (product) => product?.TokenAvailable === 'Y' ); state.TokenOnlyDisplay = Token; if (Token?.length === 1) { state.AllProductTokenAvailable = false; } }, changeBookingType: (state, action) => { state.BookingType = action?.payload; }, changeSelectedTableDetails: (state, action) => { state.SelectedTableDetails = action?.payload; }, changeReorderHoldDetails: (state, action) => { state.ReorderHoldDetails = action?.payload; }, changeReorderProductDetails: (state, action) => { state.ReorderProductDetails = action?.payload; }, changeReprintModal: (state, action) => { state.ReprintModal = action?.payload; }, changealldata: (state, action) => { state.AlldataAccess = action?.payload; }, ChangeAllItemData: (state, action) => { state.AllItemData = action?.payload; }, ChangeCardAccess: (state, action) => { state.CardAccess = action?.payload; }, ChangeAutoLocatetofav: (state, action) => { state.AutoLocatetofav = action?.payload; }, changeAccessForOthers: (state, action) => { state.AccessForOthers = action?.payload; }, changeothersdata: (state, action) => { state.othersdata = action?.payload; }, ChangeNewQrProduct: (state, action) => { state.NewQrProduct = action?.payload; }, ChangeWSProduct: (state, action) => { state.WSProduct = action?.payload; }, ChangeNavHoldData: (state, action) => { state.NavHoldData = action?.payload; }, changeSummeryQty: (state, action) => { state.SummeryQty = action?.payload; }, changeSummeryTotalItems: (state, action) => { state.SummeryTotalItems = action?.payload; }, changeSummeryTotalAmount: (state, action) => { state.SummeryTotalAmount = action?.payload; }, changeSummeryTotalTaxAmount: (state, action) => { state.SummeryTotalTaxAmount = action?.payload; }, changeSummeryTotalWithoutTaxAmount: (state, action) => { state.SummeryTotalWithoutTaxAmount = action?.payload; }, changeSummeryComboOfferAmount: (state, action) => { state.SummeryComboOfferAmount = action?.payload; }, changePrintStatus: (state, action) => { state.printStatus = action?.payload; }, changefocusStatusCust: (state, action) => { state.focusStatusCust = action?.payload; }, changefocusStatusBalrec: (state, action) => { state.focusStatusBalrec = action?.payload; }, changePreviousOrderLength: (state, action) => { state.PreviousOrderLength = action?.payload; }, changeHoldOrderDtl: (state, action) => { state.HoldOrderDtl = action?.payload; }, ChangeFocusCatCard: (state, action) => { state.focusCatCard = action?.payload; }, changeUnpaidData: (state, action) => { state.HoldOrderDtl = action?.payload; }, changefocusStatusCustMouse: (state, action) => { state.focusStatusCustMouse = action?.payload; }, changeCompoPaymentIconStatus: (state, action) => { state.CompoPaymentIconStatus = action?.payload; }, ChangeSelectedCustDisable: (state, action) => { state.SelectedCustDisable = action?.payload; }, changeWeightScalePort: (state, action) => { state.WeightScalePort = action?.payload; }, changeWeightScaleWeight: (state, action) => { state.WeightScaleWeight = action?.payload; }, changeCreditFocus: (state, action) => { state.CreditFocus = action?.payload; }, changeHeightforExpDate: (state, action) => { state.ExpDateforHeight = action?.payload; }, changeUpiIDprint: (state, action) => { state.UpiIDprint = action?.payload; }, changeProductSubCategorieProdCatfun: (state, action) => { state.ProdSubCat = isNaN(state.ProdSubCat) ? null : state.ProdSubCat === undefined ? null : undefined; }, changeEstimateBooking: (state, action) => { state.EstimateBooking = action?.payload; }, changeSelProdWiseEst: (state, action) => { state.SelProdWiseEst = action?.payload; }, changeUpiIDName: (state, action) => { state.UpiIDName = action?.payload; }, changeUpiIDoptionId: (state, action) => { state.upiOptionId = action?.payload; }, changeSelectChair: (state, action) => { state.selectChair = action?.payload; }, changeSelectTable: (state, action) => { state.selectTable = action?.payload; }, changeOrderType: (state, action) => { state.OrderType = action?.payload; }, changeCompoPreOrderDtlStatus: (state, action) => { state.ComboPreOrderDtlStatus = action?.payload; }, changeDropDownStatus: (state, action) => { state.DropDownStatus = action?.payload; }, changeCommonPaymentOptions: (state, action) => { state.CommonPaymentOptions = action?.payload; }, changeCombosearch: (state, action) => { state.Combosearch = action?.payload; }, changePaymentloader: (state, action) => { state.Paymentloader = action?.payload; }, changeAllProductTokenAvailable: (state, action) => { state.AllProductTokenAvailable = action?.payload; }, changeTokenOnly: (state, action) => { state.TokenOnly = action?.payload; }, changePaymentTransactionNumber: (state, action) => { state.PaymentTransactionNumber = action?.payload; }, changeunpaidflow: (state, action) => { state.unpaidflow = action?.payload; }, ChangeInitialPaymentName: (state, action) => { state.InitialPaymentName = action?.payload; }, ChangeFailedTotalAmt: (state, action) => { state.FailedTotalAmt = action?.payload; }, ChangeScreenSize: (state, action) => { state.ScreenSize = action?.payload; }, ChangeOverAllDiscEstimate: (state, action) => { state.OverAllDiscEstimate = action?.payload; }, ChangeOverAllDiscSales: (state, action) => { state.OverAllDiscSales = action?.payload; }, ChangeAppExpDateData: (state, action) => { state.AppExpDateData = action?.payload; }, ChangeBranchFinancialStatus: (state, action) => { state.BranchFinancialStatus = action?.payload; }, changeSelectedData: (state, action) => { state.SelectedDatas = action?.payload; }, Changedragging: (state, action) => { state.dragging = action?.payload; }, ChangedraggingComponent: (state, action) => { state.draggingComponent = action?.payload; }, ChangeSubcategoryData: (state, action) => { state.SubcategorieData = action?.payload; }, ChangeisFavClicked: (state, action) => { state.isFavClicked = action?.payload; }, ChangeComboCarddata: (state, action) => { state.ComboCarddata = action?.payload; }, changeAlphabeticFormat: (state, action) => { state.alphabeticFormat = action?.payload; }, changeOtherServiceTicketClaim: (state, action) => { state.OtherServiceTicketClaim = action?.payload; }, changeOtherServices: (state, action) => { state.OtherServices = action?.payload; }, changeRetailWSSalesType: (state, action) => { state.RetailWSSalesType = action?.payload; }, changeDefaultBookingType: (state, action) => { state.defaultBookingType = action?.payload; }, changeChairLevelServiceDefault: (state, action) => { state.chairLevelServiceDefault = action?.payload; }, triggerPaymentDefault: (state) => { state.paymentDefaultTrigger += 1; }, changeAddBookingDetailsTrigger: (state, action) => { state.AddBookingDetailsTrigger = action?.payload; }, changeCurrentOrderId: (state, action) => { state.CurrentOrderId = action?.payload; }, triggerProductCard: (state) => { state.productCardTrigger += 1; }, changeBillEditingMode: (state, action) => { state.salesBillEdit = action?.payload; }, changePreviousOrderPayment: (state, action) => { state.previousOrderPayment = action?.payload; }, changePreviousOrderOfferDetail: (state, action) => { state.previousOrderOfferDetails = action?.payload; }, }, extraReducers: (builder) => { (builder.addCase(getLayoutCategories.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.CategorieData = action?.payload?.data?.data; state.ProdCat = action?.payload?.data?.data[0].ProdCat; } else { state.CategorieData = action?.payload?.data?.data; state.ProdCat = null; state.ItemCard = []; state.SubcategorieData = []; state.ProdSubCat = null; } }), builder.addCase(getLayoutSubCategories.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.SubcategorieData = action?.payload?.data?.data; state.ProdSubCat = action?.payload?.data?.data[0].ProdSubCat ? action?.payload?.data?.data[0].ProdSubCat : isNaN(state.ProdSubCat) ? null : state.ProdSubCat === undefined ? null : undefined; } else { state.SubcategorieData = action?.payload?.data?.data; state.ProdSubCat = null; } }), builder.addCase(getLayoutproductCard.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ItemCard = action?.payload?.data?.data; } else { state.ItemCard = []; } }), builder.addCase(getLayoutsearch.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ItemCard = action?.payload?.data?.data; state.SelectedDatas = action?.payload?.data?.data; } else { state.ItemCard = []; state.SelectedDatas = []; } }), builder.addCase(getProductsearch.fulfilled, (state, action) => { console.log(action?.payload, "mohanaacacacca") if (action?.payload?.statusCode === 1) { state.SelectedDatas = action?.payload?.data; } else { state.SelectedDatas = []; } }), builder.addCase(getReprintData.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ReprintData = action?.payload?.data?.data; } else { state.ReprintData = []; } }), builder.addCase(getPaymentOptions.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.paymentOptionsData = action?.payload?.data?.data; } else { state.paymentOptionsData = []; } }), builder.addCase(getPaymentUpiOptions.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.paymentUpiOptionsData = action?.payload?.data?.data; } else { state.paymentUpiOptionsData = []; } }), builder.addCase(getSelectedFavItems.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.SelectedDatas = action?.payload?.data?.data; } else { state.SelectedDatas = []; } }), builder.addCase(getEditFavItems.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.AllItemData = action?.payload?.data?.data; } else { state.AllItemData = []; } }), builder.addCase(getPreferenceData.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.PreferenceData = action?.payload?.data?.data; } else { state.PreferenceData = []; } })); builder.addCase(getCardDataWithoutSub.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ItemCard = action?.payload?.data?.data?.filter( (item) => item.ProdSubCat === null ); state.WithoutSubCatItemCard = action?.payload?.data?.data; } else { state.ItemCard = []; state.WithoutSubCatItemCard = []; } }); builder.addCase(getCardDataWithoutSubmodule.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ItemCard = action?.payload?.data?.data; } else { state.ItemCard = []; } }); builder.addCase(getSalesDetailData.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.SalesDetailData = action?.payload?.data?.data; } else { state.SalesDetailData = []; } }); builder.addCase(getConfigType.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode == 1) { const checkName = state.BookingTypeBoth ? 'DineIn,TakeAway' : state.BookingType; state.BookingId = action?.payload?.data?.data?.find( (a) => a?.ConfigName === checkName )?.ConfigId; } }); builder.addCase(getUnpaidData.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.UnpaidListData = action?.payload?.data?.data; } else { state.UnpaidListData = []; } }); builder.addCase(getCombolist.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ComboCarddata = action?.payload?.data?.data; } else { state.ComboCarddata = []; } }); builder.addCase(Comboget.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.ComboCarddata = action?.payload?.data?.data; } else { state.ComboCarddata = []; } }); builder.addCase(FeatureAddon.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.FeatAddOnData = action?.payload?.data?.data?.[0]?.FeatAddonHdr?.[0]; } else { state.FeatAddOnData = []; } }); builder.addCase(getAllCustomer.fulfilled, (state, action) => { if (action?.payload?.data?.statusCode === 1) { state.AllCustomers = action?.payload?.data?.data; } else { state.AllCustomers = []; } }); }, }); export const { changeComboRedirectionToDefaultLayoutForParking, changeTipAmount, changeBtoBQuickProductTransfer, changeCustomerID, changeSelectedCustId, changeSelectedOption, changeCustomerOrders, changeCustomerDelete, changeCategorieData, changeProductCategorie, changeProductSubCategorie, changeSearchedData, changeCardData, changeOrderCardDetails, changeBookingType, changeSelectedTableDetails, changeReorderHoldDetails, changeReorderProductDetails, changeReprintModal, changealldata, ChangeAllItemData, ChangeCardAccess, ChangeAutoLocatetofav, changeAccessForOthers, changeothersdata, ChangeWSProduct, ChangeNavHoldData, changeSummeryQty, changeSummeryTotalItems, changeSummeryTotalAmount, changeSummeryTotalTaxAmount, changeSummeryTotalWithoutTaxAmount, changeSummeryComboOfferAmount, ChangeNewQrProduct, changePrintStatus, changefocusStatusCust, changeCombofocus, changefocusStatusBalrec, ChangeFocusCatCard, changePreviousOrderLength, changeHoldOrderDtl, changeUnpaidData, changefocusStatusCustMouse, changeCompoPaymentIconStatus, ChangeSelectedCustDisable, changeWeightScalePort, changeWeightScaleWeight, changeQrPort, changeCreditFocus, changeHeightforExpDate, changePrintStyle, changeUpiIDprint, changeProductSubCategorieProdCatfun, changeEstimateBooking, changeSelProdWiseEst, changeUpiIDName, changeUpiIDoptionId, changeSelectTable, changeSelectChair, changeOrderType, changeCompoPreOrderDtlStatus, changeDropDownStatus, changeCommonPaymentOptions, changeCombosearch, changePaymentloader, changeAllProductTokenAvailable, changeTokenOnly, changePaymentTransactionNumber, changeunpaidflow, ChangeSearchFocusPreOrder, ChangeSearchFocusKioskPay, ChangeInitialPaymentName, ChangeFailedTotalAmt, ChangeScreenSize, ChangeOverAllDiscSales, ChangeOverAllDiscEstimate, ChangeAppExpDateData, ChangeBranchFinancialStatus, Changedragging, ChangedraggingComponent, ChangeSubcategoryData, ChangeisFavClicked, ChangeComboCarddata, changeAlphabeticFormat, changeOtherServiceTicketClaim, changeOtherServices, changeSelectedData, ChangeDineInDefaultFn, changeRetailWSSalesType, changeDefaultBookingType, changeChairLevelServiceDefault, changeKisokSearchedData, triggerPaymentDefault, changeAddBookingDetailsTrigger, changeCurrentOrderId, triggerProductCard, changeBillEditingMode, changePreviousOrderPayment, changePreviousOrderOfferDetail } = BookingData.actions; export const GlobalComboRedirectionToDefaultLayoutForParking = (state) => state?.BookingData?.comboRedirectionToDefaultLayoutForParking; export const GlobaltipAmount = (state) => state?.BookingData?.tipAmount; export const GlobalBtoBQuickProductTransfer = (state) => state?.BookingData?.BtoBQuickProductTransfer; export const GlobalUpiIDprint = (state) => state?.BookingData?.UpiIDprint; export const GlobalPrintStyle = (state) => state?.BookingData?.PrintStyle; export const Globalcombofocus = (state) => state?.BookingData?.combofocus; export const GlobalCustId = (state) => state?.BookingData?.CustId; export const GlobalSelCustId = (state) => state?.BookingData?.SelectedCustId; export const GlobalSelOption = (state) => state?.BookingData?.SelectedOption; export const GlobalCustOrders = (state) => state?.BookingData?.CustOrders; export const GlobalDelete = (state) => state?.BookingData?.Delete; export const GlobalCategorieData = (state) => state?.BookingData?.CategorieData; export const GlobalProductCategorie = (state) => state?.BookingData?.ProdCat; export const GlobalSubcategorieData = (state) => state?.BookingData?.SubcategorieData; export const GlobalProductSubCategorie = (state) => state?.BookingData?.ProdSubCat; export const GlobalItemCard = (state) => state?.BookingData?.ItemCard; export const GlobalWithoutSubCatItemCard = (state) => state?.BookingData?.WithoutSubCatItemCard; export const GlobalSearchData = (state) => state?.BookingData?.searchedData; export const GlobalOrderCardDetails = (state) => state?.BookingData?.OrderCardDetails; export const GlobalReprintData = (state) => state?.BookingData?.ReprintData; export const GlobalBookingType = (state) => state?.BookingData?.BookingType; export const GlobalBookingTypeBoth = (state) => state?.BookingData?.BookingTypeBoth; export const GlobalSelectedTableDetails = (state) => state?.BookingData?.SelectedTableDetails; export const GlobalpaymentOptionData = (state) => state?.BookingData?.paymentOptionsData; export const GlobalpaymentUpiOptionData = (state) => state?.BookingData?.paymentUpiOptionsData; export const GlobalReorderHoldDetails = (state) => state?.BookingData?.ReorderHoldDetails; export const GlobalReorderProductDetails = (state) => state?.BookingData?.ReorderProductDetails; export const GlobalReprintModal = (state) => state?.BookingData?.ReprintModal; export const GlobalAlldat = (state) => state?.BookingData?.AlldataAccess; export const GlobalAllItemData = (state) => state?.BookingData?.AllItemData; export const GlobalCardAccess = (state) => state?.BookingData?.CardAccess; export const GlobalSelectedDatas = (state) => state?.BookingData?.SelectedDatas; export const GlobalEditfavItems = (state) => state?.BookingData?.EditfavItems; export const GlobalAutoLocatetofav = (state) => state?.BookingData?.AutoLocatetofav; export const GlobalAccessForOthers = (state) => state?.BookingData?.AccessForOthers; export const Globalothersdata = (state) => state?.BookingData?.othersdata; export const PreferenceData = (state) => state?.BookingData?.PreferenceData; export const GlobalNewQrProduct = (state) => state?.BookingData?.NewQrProduct; export const GlobalWSProduct = (state) => state?.BookingData?.WSProduct; export const GlobalNavHoldData = (state) => state?.BookingData?.NavHoldData; export const GlobalSummeryQty = (state) => state?.BookingData?.SummeryQty; export const GlobalSummeryTotalItems = (state) => state?.BookingData?.SummeryTotalItems; export const GlobalSummeryTotalAmount = (state) => state?.BookingData?.SummeryTotalAmount; export const GlobalSummeryTotalTaxAmount = (state) => state?.BookingData?.SummeryTotalTaxAmount; export const GlobalSummeryTotalWithoutTaxAmount = (state) => state?.BookingData?.SummeryTotalWithoutTaxAmount; export const GlobalPrintStatus = (state) => state?.BookingData?.printStatus; export const GlobalfocusStatusCust = (state) => state?.BookingData?.focusStatusCust; export const GlobalfocusStatusBalrec = (state) => state?.BookingData?.focusStatusBalrec; export const GlobalFocusCatCard = (state) => state?.BookingData?.focusCatCard; export const GlobalPreviousOrderLength = (state) => state?.BookingData?.PreviousOrderLength; export const GlobalHoldOrderDtl = (state) => state?.BookingData?.HoldOrderDtl; export const GlobalUnpaidData = (state) => state?.BookingData?.HoldOrderDtl; export const GlobalfocusStatusCustMouse = (state) => state?.BookingData?.focusStatusCustMouse; export const GlobalCompoPaymentIconStatus = (state) => state?.BookingData?.CompoPaymentIconStatus; export const GlobalSelectedCustDisable = (state) => state?.BookingData?.SelectedCustDisable; export const GlobalWeightScalePort = (state) => state?.BookingData?.WeightScalePort; export const GlobalWeightScaleWeight = (state) => state?.BookingData?.WeightScaleWeight; export const GlobalSalesDetailData = (state) => state?.BookingData?.SalesDetailData; export const GlobalQrPort = (state) => state?.BookingData?.QrPort; export const GlobalCreditFocus = (state) => state?.BookingData?.CreditFocus; export const GlobalExpDateforHeight = (state) => state?.BookingData?.ExpDateforHeight; export const GlobalEstimateBooking = (state) => state?.BookingData?.EstimateBooking; export const GlobalSelProdWiseEst = (state) => state?.BookingData?.SelProdWiseEst; export const GlobalUpiIDName = (state) => state?.BookingData?.UpiIDName; export const GlobalUpiIDoptionId = (state) => state?.BookingData?.upiOptionId; export const GlobalSelectedTable = (state) => state?.BookingData?.selectTable; export const GlobalSelectedChair = (state) => state?.BookingData?.selectChair; export const GlobalOrderType = (state) => state?.BookingData?.OrderType; export const GlobalCompoPreOrderDtlStatus = (state) => state?.BookingData?.ComboPreOrderDtlStatus; export const GlobalDropDownStatus = (state) => state?.BookingData?.DropDownStatus; export const GlobalCommonPaymentOptions = (state) => state?.BookingData?.CommonPaymentOptions; export const GlobalCombosearch = (state) => state?.BookingData?.Combosearch; export const GlobalPayementloader = (state) => state?.BookingData?.Paymentloader; export const GlobalAllProductTokenAvailable = (state) => state?.BookingData?.AllProductTokenAvailable; export const GlobalTokenOnly = (state) => state?.BookingData?.TokenOnly; export const GlobalTokenOnlyDisplay = (state) => state?.BookingData?.TokenOnlyDisplay; export const GlobalPaymentTransactionNumber = (state) => state?.BookingData?.PaymentTransactionNumber; export const Globalunpaidflow = (state) => state?.BookingData?.unpaidflow; export const GlobalPreOrderSearchStatus = (state) => state?.BookingData?.PreOrderSearchStatus; export const GlobalFocusKioskPay = (state) => state?.BookingData?.FocusKioskPay; export const GlobalInitialPaymentName = (state) => state?.BookingData?.InitialPaymentName; export const GlobalFailedTotalAmt = (state) => state?.BookingData?.FailedTotalAmt; export const GlobalOverAllDiscSales = (state) => state?.BookingData?.OverAllDiscSales; export const GlobalOverAllDiscEstimate = (state) => state?.BookingData?.OverAllDiscEstimate; export const GlobalBookingId = (state) => state?.BookingData?.BookingId; export const GlobalOrderStatus = (state) => state?.BookingData?.OrderStatus; export const GlobalUnpaidListData = (state) => state?.BookingData?.UnpaidListData; export const GlobalScreenSize = (state) => state?.BookingData?.ScreenSize; export const GlobalAppExpDateData = (state) => state?.BookingData?.AppExpDateData; export const GlobalBranchFinancialStatus = (state) => state?.BookingData?.BranchFinancialStatus; export const Globaldragging = (state) => state?.BookingData?.dragging; export const GlobaldraggingComponent = (state) => state?.BookingData?.draggingComponent; export const GlobalComboOfferAmount = (state) => state?.BookingData?.SummeryComboOfferAmount; export const GlobalisFavClicked = (state) => state?.BookingData?.isFavClicked; export const GlobalisAlphabeticFormat = (state) => state?.BookingData?.alphabeticFormat; export const GlobalCombocarddata = (state) => state?.BookingData?.ComboCarddata; export const GlobalFeatAddOnData = (state) => state?.BookingData?.FeatAddOnData; export const GlobalOtherServiceTicketClaim = (state) => state?.BookingData?.OtherServiceTicketClaim; export const GlobalOtherSevices = (state) => state?.BookingData?.OtherServices; export const GlobalDineinDefault = (state) => state?.BookingData?.DineinDefault; export const GlobalRetailWSSalesType = (state) => state?.BookingData?.RetailWSSalesType; export const GlobalDefaultBookingType = (state) => state?.BookingData?.defaultBookingType; export const GlobalChairLevelServiceDefault = (state) => state?.BookingData?.chairLevelServiceDefault; export const GlobalKisoksearchedData = (state) => state?.BookingData?.KisoksearchedData; export const GlobalAllCustomers = (state) => state?.BookingData?.AllCustomers; export const GlobalPaymentTrigger = (state) => state?.BookingData?.paymentDefaultTrigger; export const GlobalProductCardTrigger = (state) => state?.BookingData?.productCardTrigger; export const GlobalAddBookingDetailsTrigger = (state) => state?.BookingData?.AddBookingDetailsTrigger; export const GlobalCurrentOrderId = (state) => state?.BookingData?.CurrentOrderId; export const GlobalSalesBillEdit = (state) => state?.BookingData?.salesBillEdit; export const GlobalPreviousOrderPayment = (state) => state?.BookingData?.previousOrderPayment; export const GlobalPreviousOrderOfferDetails = (state) => state?.BookingData?.previousOrderOfferDetails; export default BookingData.reducer;