- fixed issue with new table skips decimals;
This commit is contained in:
3
src/helpers/parseCommaDecimal.js
Normal file
3
src/helpers/parseCommaDecimal.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const parseCommaDecimal = (value = '') => parseFloat(String(value).replace(',', '.'));
|
||||
|
||||
export default parseCommaDecimal;
|
||||
@@ -46,6 +46,7 @@ import { Dialog } from 'primereact/dialog';
|
||||
import FileuploadApplicationSignedPdf from '../../components/FileuploadApplicationSignedPdf';
|
||||
|
||||
import { defaultMaxFileSize } from '../../configData';
|
||||
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||
|
||||
const BandoApplication = () => {
|
||||
const chosenCompanyId = useStore().main.chosenCompanyId();
|
||||
@@ -541,9 +542,10 @@ const BandoApplication = () => {
|
||||
context = getTokens(formula.value)
|
||||
.filter(v => !['false', 'null', 'true'].includes(v))
|
||||
.reduce((acc, cur) => {
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseFloat(context[cur]);
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseCommaDecimal(context[cur]);
|
||||
return acc;
|
||||
}, context);
|
||||
|
||||
const mathFormula = renderWithDataVars(formula.value, context);
|
||||
try {
|
||||
updatedFormValues[o.id] = evaluate(mathFormula);
|
||||
|
||||
@@ -38,6 +38,7 @@ import getTokens from '../../helpers/getTokens';
|
||||
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
||||
import { evaluate } from 'mathjs';
|
||||
import equal from 'fast-deep-equal';
|
||||
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||
|
||||
const BandoApplicationPreview = () => {
|
||||
const { id } = useParams();
|
||||
@@ -272,7 +273,7 @@ const BandoApplicationPreview = () => {
|
||||
context = getTokens(formula.value)
|
||||
.filter(v => !['false', 'null', 'true'].includes(v))
|
||||
.reduce((acc, cur) => {
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseFloat(context[cur]);
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseCommaDecimal(context[cur]);
|
||||
return acc;
|
||||
}, context);
|
||||
const mathFormula = renderWithDataVars(formula.value, context);
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
import renderHtmlContent from '../../helpers/renderHtmlContent';
|
||||
import renderWithDataVars from '../../helpers/renderWithDataVars';
|
||||
import getTokens from '../../helpers/getTokens';
|
||||
import parseCommaDecimal from '../../helpers/parseCommaDecimal';
|
||||
|
||||
const BandoFormsPreview = () => {
|
||||
const { id, formId } = useParams();
|
||||
@@ -105,7 +106,7 @@ const BandoFormsPreview = () => {
|
||||
context = getTokens(formula.value)
|
||||
.filter(v => !['false', 'null', 'true'].includes(v))
|
||||
.reduce((acc, cur) => {
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseFloat(context[cur]);
|
||||
acc[cur] = isNil(context[cur]) ? 0 : parseCommaDecimal(context[cur]);
|
||||
return acc;
|
||||
}, context);
|
||||
const mathFormula = renderWithDataVars(formula.value, context);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { __ } from '@wordpress/i18n';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { is, isEmpty, isNil } from 'ramda';
|
||||
import 'quill/dist/quill.core.css';
|
||||
|
||||
@@ -27,15 +27,10 @@ const REACT_APP_HUB_ID = process.env.REACT_APP_HUB_ID;
|
||||
const BandoViewPreInstructor = () => {
|
||||
const isAsyncRequest = useStore().main.isAsyncRequest();
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [data, setData] = useState({});
|
||||
const [newQuestion, setNewQuestion] = useState('');
|
||||
const bandoMsgs = useRef(null);
|
||||
|
||||
/*const closePreview = () => {
|
||||
navigate(`/bandi/${id}`);
|
||||
}*/
|
||||
|
||||
const getCallback = (data) => {
|
||||
if (data.status === 'SUCCESS') {
|
||||
setData(getFormattedBandiData(data.data));
|
||||
|
||||
Reference in New Issue
Block a user