fixed bugs

This commit is contained in:
unknown 2026-02-25 18:34:35 +05:30
parent 65eb86ffdd
commit 7a6a888e34
9 changed files with 66 additions and 24 deletions

View File

@ -11,6 +11,7 @@ import '../../Styles/Product/Product.scss';
import { Messages } from '../Notifications/Messages.jsx'; import { Messages } from '../Notifications/Messages.jsx';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import Camera from '../MobileComponent/Camera.jsx'; import Camera from '../MobileComponent/Camera.jsx';
import useHasCamera from '../../utils/useHasCamera.js';
const allowedTypes = [ const allowedTypes = [
'image/jpeg', 'image/jpeg',
'image/png', 'image/png',
@ -27,6 +28,7 @@ const CropUpload = ({
handleClose = () => { } handleClose = () => { }
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const hasCamera = useHasCamera();
const [messageType, setMessageType] = useState(null); const [messageType, setMessageType] = useState(null);
const [messageData, setMessageData] = useState(null); const [messageData, setMessageData] = useState(null);
const [fileList, setFileList] = useState([]); const [fileList, setFileList] = useState([]);
@ -407,7 +409,7 @@ const CropUpload = ({
<Modal visible={previewVisible} onCancel={handleCancel} footer={null}> <Modal visible={previewVisible} onCancel={handleCancel} footer={null}>
<img alt="Preview" style={{ width: '100%' }} src={previewImage} /> <img alt="Preview" style={{ width: '100%' }} src={previewImage} />
</Modal> </Modal>
{isMobile && fileList?.length == 0 && <> {isMobile && fileList?.length == 0 && hasCamera && <>
<div style={{ textAlign: "center", margin: "6px 0", fontFamily: "Poppins", fontWeight: "500" }}>OR</div> <div style={{ textAlign: "center", margin: "6px 0", fontFamily: "Poppins", fontWeight: "500" }}>OR</div>
<Camera <Camera
handleCapture={async (e) => { handleCapture={async (e) => {

View File

@ -5,6 +5,8 @@ import { PlusOutlined } from '@ant-design/icons';
import { uploadImage } from '../../Features/upload/upload'; import { uploadImage } from '../../Features/upload/upload';
import Camera from '../MobileComponent/Camera'; import Camera from '../MobileComponent/Camera';
import { isMobile } from 'react-device-detect'; import { isMobile } from 'react-device-detect';
import useHasCamera from '../../utils/useHasCamera';
const allowedTypes = [ const allowedTypes = [
'image/jpeg', 'image/jpeg',
'image/png', 'image/png',
@ -27,6 +29,7 @@ const App = ({ singleImage, updateImageUrl, ImageLink = '', listType }) => {
const [previewImage, setPreviewImage] = useState(''); const [previewImage, setPreviewImage] = useState('');
const [previewTitle, setPreviewTitle] = useState(''); const [previewTitle, setPreviewTitle] = useState('');
const [fileList, setFileList] = useState([]); const [fileList, setFileList] = useState([]);
const hasCamera = useHasCamera();
console.log(fileList, "fileList") console.log(fileList, "fileList")
useEffect(() => { useEffect(() => {
@ -141,7 +144,7 @@ const App = ({ singleImage, updateImageUrl, ImageLink = '', listType }) => {
src={previewImage} src={previewImage}
/> />
</Modal> </Modal>
{isMobile && fileList?.length == 0 && <> {isMobile && fileList?.length == 0 && hasCamera && <>
<div style={{ textAlign: "center", margin: "6px 0", fontFamily: "Poppins", fontWeight: "500" }}>OR</div> <div style={{ textAlign: "center", margin: "6px 0", fontFamily: "Poppins", fontWeight: "500" }}>OR</div>
<Camera <Camera
handleCapture={(e) => { handleCapture={(e) => {

View File

@ -268,8 +268,6 @@ const ComboEditQtyAndRate = (props) => {
} }
const AddProductQuantity = async () => { const AddProductQuantity = async () => {
// debugger
let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate; let newPrice = editedPrice > 0 ? editedPrice : props.Productdata.OrderRate;
await dispatch(changeHoldOrderDtl(false)); await dispatch(changeHoldOrderDtl(false));

View File

@ -123,6 +123,12 @@ const PrintStyle1 = ({
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader' setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
)?.SettingValue === 'Y'; )?.SettingValue === 'Y';
const estimateTitle =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
)?.SettingValue === 'Y';
const keysLength = Object.keys(table2Data ?? {}).length; const keysLength = Object.keys(table2Data ?? {}).length;
const paymentTypeUPI = PaymentStatus?.find( const paymentTypeUPI = PaymentStatus?.find(
(ps) => ps.PaymentTypeName === 'UPI' (ps) => ps.PaymentTypeName === 'UPI'
@ -479,7 +485,7 @@ const PrintStyle1 = ({
Mobile : +91{' '} Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>} </div>}
{table2Data?.OrderType === 'E' && ( {table2Data?.OrderType === 'E' && estimateTitle && (
<div <div
style={{ style={{
fontSize: '14px', fontSize: '14px',
@ -521,7 +527,7 @@ const PrintStyle1 = ({
</div> </div>
)} )}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && ( {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
<div <div
style={{ style={{
fontSize: '14px', fontSize: '14px',
@ -1267,7 +1273,7 @@ const PrintStyle1 = ({
<span> <span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span> </span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
@ -2131,7 +2137,7 @@ const PrintStyle1 = ({
<span> <span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span> </span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
@ -2960,7 +2966,7 @@ const PrintStyle1 = ({
<span> <span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span> </span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
@ -3727,7 +3733,7 @@ const PrintStyle1 = ({
Mobile : +91{' '} Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile} {GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>} </div>}
{table2Data?.OrderType === 'E' && ( {table2Data?.OrderType === 'E' && estimateTitle && (
<div <div
style={{ style={{
fontSize: '14px', fontSize: '14px',
@ -3768,7 +3774,7 @@ const PrintStyle1 = ({
</div> </div>
)} )}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && ( {!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
<div <div
style={{ style={{
fontSize: '14px', fontSize: '14px',
@ -4446,7 +4452,7 @@ const PrintStyle1 = ({
<span> <span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'} {lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) - {Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)} (lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span> </span>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>

View File

@ -33,8 +33,6 @@ import { getCommonAppPreference } from '../../Features/BrachLogin/BranchLogin.js
import { AiOutlineDownCircle, AiOutlineUpCircle } from 'react-icons/ai'; import { AiOutlineDownCircle, AiOutlineUpCircle } from 'react-icons/ai';
// import TextArea from 'antd/es/input/TextArea.js'; // import TextArea from 'antd/es/input/TextArea.js';
import CropUpload from '../../Components/Forms/CropUpload.jsx'; import CropUpload from '../../Components/Forms/CropUpload.jsx';
import { isMobile } from 'react-device-detect';
import Camera from '../../Components/MobileComponent/Camera.jsx';
const { Panel } = Collapse; const { Panel } = Collapse;
const { TextArea } = Input; const { TextArea } = Input;
const subDirectory = import.meta.env.BASE_URL; const subDirectory = import.meta.env.BASE_URL;

View File

@ -96,7 +96,7 @@ const PaymentDetails = ({ formType }) => {
}, },
{ {
name: 'PaymentDetails', name: 'Payment Details',
link: `${subDirectory}setting/payment-details`, link: `${subDirectory}setting/payment-details`,
}, },
{ {

View File

@ -81,7 +81,7 @@ const PaymentDetailsList = () => {
}, },
{ {
name: 'PaymentDetails', name: 'Payment Details',
link: `${subDirectory}setting/payment-details`, link: `${subDirectory}setting/payment-details`,
}, },
]; ];

View File

@ -102,7 +102,10 @@ const PreferenceList = () => {
(k) => allSettingsMap[k]?.value === 'Y' (k) => allSettingsMap[k]?.value === 'Y'
), ),
mobilea4: allSettingsMap['mobilea4']?.value === 'Y', mobilea4: allSettingsMap['mobilea4']?.value === 'Y',
estimateprintheader: allSettingsMap['estimateprintheader']?.value === 'Y', estimateSettings: [
...(allSettingsMap['estimateprintheader']?.value === 'Y' ? ['estimateprintheader'] : []),
...(allSettingsMap['estimatetitle']?.value === 'Y' ? ['estimatetitle'] : []),
],
scanlayout: allSettingsMap['scanlayout']?.value === 'Y', scanlayout: allSettingsMap['scanlayout']?.value === 'Y',
verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y', verifyproduct: allSettingsMap['verifyproduct']?.value === 'Y',
customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y', customisedbillnumber: allSettingsMap['customisedbillnumber']?.value === 'Y',
@ -304,7 +307,6 @@ const PreferenceList = () => {
tokenonly: values.tokenonly, tokenonly: values.tokenonly,
allproductindividualtoken: values.allproductindividualtoken, allproductindividualtoken: values.allproductindividualtoken,
mobilea4: values.mobilea4, mobilea4: values.mobilea4,
estimateprintheader: values.estimateprintheader,
scanlayout: values.scanlayout, scanlayout: values.scanlayout,
verifyproduct: values.verifyproduct, verifyproduct: values.verifyproduct,
customisedbillnumber: values.customisedbillnumber, customisedbillnumber: values.customisedbillnumber,
@ -321,6 +323,8 @@ const PreferenceList = () => {
dinein: values.enabledModules, dinein: values.enabledModules,
estimation: values.enabledModules, estimation: values.enabledModules,
parking: values.enabledFeatures, parking: values.enabledFeatures,
estimateprintheader: values.estimateSettings,
estimatetitle: values.estimateSettings,
offer: values.enabledFeatures, offer: values.enabledFeatures,
whatsapp: values.pdfSendOptions, whatsapp: values.pdfSendOptions,
sms: values.pdfSendOptions, sms: values.pdfSendOptions,
@ -653,8 +657,8 @@ const PreferenceList = () => {
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="maxquantity" name="maxquantity"
label="Maximum quantity allowed:" label="Maximum quantity allowed:"
rules={[ rules={[
{ required: true, message: 'Please enter maximum quantity' }, { required: true, message: 'Please enter maximum quantity' },
@ -783,10 +787,22 @@ const PreferenceList = () => {
'mobilea4', 'mobilea4',
'Prefer printing in A4/A5 on mobile?' 'Prefer printing in A4/A5 on mobile?'
)} )}
{renderCheckbox( {(allSettingsMap['estimateprintheader'] !== undefined ||
'estimateprintheader', allSettingsMap['estimatetitle'] !== undefined) && (
'Do you want to include a header when printing Estimate bills?' <Form.Item
)} name="estimateSettings"
label="Estimate Print Settings :"
>
<Checkbox.Group>
{allSettingsMap['estimateprintheader'] !== undefined && (
<Checkbox value="estimateprintheader">Show shop header (Name, Address, GST)</Checkbox>
)}
{allSettingsMap['estimatetitle'] !== undefined && (
<Checkbox value="estimatetitle">Show Estimate (R/W) title</Checkbox>
)}
</Checkbox.Group>
</Form.Item>
)}
</div> </div>
<div className="PreferencesBTN"> <div className="PreferencesBTN">
<Buttons <Buttons

19
src/utils/useHasCamera.js Normal file
View File

@ -0,0 +1,19 @@
import { useState, useEffect } from "react";
export default function useHasCamera() {
const [hasCamera, setHasCamera] = useState(null);
useEffect(() => {
async function detectCamera() {
try {
const devices = await navigator.mediaDevices.enumerateDevices();
setHasCamera(devices.some(d => d.kind === "videoinput"));
} catch {
setHasCamera(false);
}
}
detectCamera();
}, []);
return hasCamera;
}