From b24a5e31e8692ceb4a358dd952360cfb26e92066 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Thu, 14 Jan 2021 15:21:09 +0200 Subject: [PATCH] feat: checkbox show negative in red. --- .../components/NumberFormats/NumberFormatFields.js | 13 +++++++++++++ .../NumberFormats/NumberFormats.schema.js | 1 + client/src/components/NumberFormats/index.js | 4 ++-- client/src/lang/en/index.js | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client/src/components/NumberFormats/NumberFormatFields.js b/client/src/components/NumberFormats/NumberFormatFields.js index e6d380d76..c2a41fea1 100644 --- a/client/src/components/NumberFormats/NumberFormatFields.js +++ b/client/src/components/NumberFormats/NumberFormatFields.js @@ -115,6 +115,19 @@ export default function NumberFormatFields({ )} + {/*------------ show negative in red-----------*/} + + {({ field }) => ( + + } + name={'show_in_red'} + {...field} + /> + + )} + {/*------------ Divide on 1000 -----------*/} {({ field }) => ( diff --git a/client/src/components/NumberFormats/NumberFormats.schema.js b/client/src/components/NumberFormats/NumberFormats.schema.js index bd5412c58..4b67fa97b 100644 --- a/client/src/components/NumberFormats/NumberFormats.schema.js +++ b/client/src/components/NumberFormats/NumberFormats.schema.js @@ -6,6 +6,7 @@ import { defaultTo } from 'lodash'; const Schema = Yup.object().shape({ format_money: Yup.string(), show_zero: Yup.boolean(), + show_in_red: Yup.boolean(), divide_on_1000: Yup.boolean(), negative_format: Yup.string(), precision: Yup.string(), diff --git a/client/src/components/NumberFormats/index.js b/client/src/components/NumberFormats/index.js index 7357cc3d8..1d1a5a87a 100644 --- a/client/src/components/NumberFormats/index.js +++ b/client/src/components/NumberFormats/index.js @@ -14,6 +14,7 @@ function NumberFormats() { () => ({ format_money: '', show_zero: '', + show_in_red: '', divide_on_1000: '', negative_format: '', precision: '', @@ -21,8 +22,7 @@ function NumberFormats() { [], ); // Handle cancel button click. - const handleCancelClick = useCallback(() => { - }, []); + const handleCancelClick = useCallback(() => {}, []); // Handle form submit. const handleFormSubmit = (values, { setSubmitting }) => { diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js index e00248503..fd5942b91 100644 --- a/client/src/lang/en/index.js +++ b/client/src/lang/en/index.js @@ -961,6 +961,7 @@ export default { qty: 'Quantity on hand', money_format: 'Money format', show_zero: 'Show zero', + show_negative_in_red: 'Show negative in red', divide_on_1000: 'Divide on 1000', negative_format: 'Negative format', decimal_places: 'Decimal places',