import React from 'react'; import { FastField, Field } from 'formik'; import { FormGroup, Checkbox } from '@blueprintjs/core'; import styled from 'styled-components'; import { FormattedMessage as T } from 'components'; import { Row, Col, FieldHint } from '../../../components'; import { handlePreviousYearCheckBoxChange, handlePreviousPeriodCheckBoxChange, } from './utils'; /** * Balance sheet header - Comparison panal. */ export default function BalanceSheetHeaderComparisonPanal() { return ( {/**----------- Previous Year -----------*/} {({ form, field }) => ( }> } {...field} onChange={handlePreviousYearCheckBoxChange(form)} /> )} {({ form: { setFieldValue }, field }) => ( }> } {...field} onChange={({ currentTarget }) => { setFieldValue('previous_year', currentTarget.checked); setFieldValue( 'previous_year_amount_change', currentTarget.checked, ); }} /> )} {({ form: { setFieldValue }, field }) => ( }> } {...field} onChange={({ currentTarget }) => { setFieldValue('previous_year', currentTarget.checked); setFieldValue( 'previous_year_percentage_change', currentTarget.checked, ); }} /> )} {/*------------ Previous Period -----------*/} {({ form, field }) => ( }> } {...field} onChange={handlePreviousPeriodCheckBoxChange(form)} /> )} {({ form: { setFieldValue }, field }) => ( }> } {...field} onChange={({ currentTarget }) => { setFieldValue('previous_period', currentTarget.checked); setFieldValue( 'previous_period_amount_change', currentTarget.checked, ); }} /> )} {({ form: { setFieldValue }, field }) => ( }> } {...field} onChange={({ currentTarget }) => { setFieldValue('previous_period', currentTarget.checked); setFieldValue( 'previous_period_percentage_change', currentTarget.checked, ); }} /> )} {/**----------- % of Column -----------*/} {({ field }) => ( }> } {...field} /> )} {/**----------- % of Row -----------*/} {({ field }) => ( }> } {...field} /> )} ); } const BalanceSheetComparisonWrap = styled.div` .row { margin-left: 0.15rem; .col { min-width: 150px !important; max-width: 190px !important; } } .bp3-form-group { margin-bottom: 3px; } `;