From 11827a7d1a634a1dcbf7b2a8d8fc35cb9e8b08ed Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sat, 28 Nov 2020 20:39:49 +0200 Subject: [PATCH] Fix: Opening balance at in Customer & Vendor. --- .../src/containers/Customers/CustomerFinancialPanel.js | 8 +++++++- client/src/containers/Vendors/VendorFinanicalPanelTab.js | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/client/src/containers/Customers/CustomerFinancialPanel.js b/client/src/containers/Customers/CustomerFinancialPanel.js index 295479938..7c8da19d3 100644 --- a/client/src/containers/Customers/CustomerFinancialPanel.js +++ b/client/src/containers/Customers/CustomerFinancialPanel.js @@ -3,6 +3,7 @@ import classNames from 'classnames'; import { FormGroup, Position, Classes, ControlGroup } from '@blueprintjs/core'; import { DateInput } from '@blueprintjs/datetime'; import { FastField, ErrorMessage } from 'formik'; +import moment from 'moment'; import { MoneyInputGroup, InputPrependText, @@ -27,7 +28,6 @@ function CustomerFinancialPanel({ customerId, }) { - return (
@@ -44,6 +44,12 @@ function CustomerFinancialPanel({ > { + form.setFieldValue( + 'opening_balance_at', + moment(date).format('YYYY-MM-DD'), + ); + }} value={tansformDateValue(value)} popoverProps={{ position: Position.BOTTOM, minimal: true }} disabled={customerId} diff --git a/client/src/containers/Vendors/VendorFinanicalPanelTab.js b/client/src/containers/Vendors/VendorFinanicalPanelTab.js index 86929939e..095ac72b6 100644 --- a/client/src/containers/Vendors/VendorFinanicalPanelTab.js +++ b/client/src/containers/Vendors/VendorFinanicalPanelTab.js @@ -3,6 +3,7 @@ import classNames from 'classnames'; import { FormGroup, ControlGroup, Position, Classes } from '@blueprintjs/core'; import { DateInput } from '@blueprintjs/datetime'; import { FastField, ErrorMessage } from 'formik'; +import moment from 'moment'; import { MoneyInputGroup, InputPrependText, @@ -47,6 +48,12 @@ function VendorFinanicalPanelTab({ > { + form.setFieldValue( + 'opening_balance_at', + moment(date).format('YYYY-MM-DD'), + ); + }} value={tansformDateValue(value)} popoverProps={{ position: Position.BOTTOM, minimal: true }} disabled={vendorId} @@ -72,7 +79,7 @@ function VendorFinanicalPanelTab({ inline={true} > - +