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

View File

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

View File

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

View File

@ -123,6 +123,12 @@ const PrintStyle1 = ({
setting?.SettingIdName?.toLowerCase() === 'estimateprintheader'
)?.SettingValue === 'Y';
const estimateTitle =
SettingData?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'estimatetitle'
)?.SettingValue === 'Y';
const keysLength = Object.keys(table2Data ?? {}).length;
const paymentTypeUPI = PaymentStatus?.find(
(ps) => ps.PaymentTypeName === 'UPI'
@ -479,7 +485,7 @@ const PrintStyle1 = ({
Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>}
{table2Data?.OrderType === 'E' && (
{table2Data?.OrderType === 'E' && estimateTitle && (
<div
style={{
fontSize: '14px',
@ -521,7 +527,7 @@ const PrintStyle1 = ({
</div>
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && (
{!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
<div
style={{
fontSize: '14px',
@ -1267,7 +1273,7 @@ const PrintStyle1 = ({
<span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px' }}>
@ -2131,7 +2137,7 @@ const PrintStyle1 = ({
<span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
@ -2960,7 +2966,7 @@ const PrintStyle1 = ({
<span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop: '4px', }}>
@ -3727,7 +3733,7 @@ const PrintStyle1 = ({
Mobile : +91{' '}
{GlobaldummyData ? '986XXXXXXX' : table2Data?.BrMobile}
</div>}
{table2Data?.OrderType === 'E' && (
{table2Data?.OrderType === 'E' && estimateTitle && (
<div
style={{
fontSize: '14px',
@ -3768,7 +3774,7 @@ const PrintStyle1 = ({
</div>
)}
{!estimatePrintHeader && table2Data?.OrderType === 'E' && (
{!estimatePrintHeader && table2Data?.OrderType === 'E' && estimateTitle && (
<div
style={{
fontSize: '14px',
@ -4446,7 +4452,7 @@ const PrintStyle1 = ({
<span>
{lastTransaction?.AdjustmentType === 'REFUND' ? '-' : '+'}
{Math.abs((lastTransaction?.BeforeAdjustment ?? 0) -
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
(lastTransaction?.AfterAdjustment ?? 0)).toFixed(2)}
</span>
</div>
<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 TextArea from 'antd/es/input/TextArea.js';
import CropUpload from '../../Components/Forms/CropUpload.jsx';
import { isMobile } from 'react-device-detect';
import Camera from '../../Components/MobileComponent/Camera.jsx';
const { Panel } = Collapse;
const { TextArea } = Input;
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`,
},
{

View File

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

View File

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