ui: Output/Results: sort results values
This commit is contained in:
parent
8e3fb86169
commit
feb72a3021
@ -69,3 +69,31 @@ export const formatters = {
|
||||
resultTerm: Intl.NumberFormat('ru').format,
|
||||
resultTotalGraphwithNDS: moneyFormatter,
|
||||
};
|
||||
|
||||
export const elements: Array<keyof ResultValues> = [
|
||||
'_resultContractEconomy',
|
||||
'_resultContractEconomyWithVAT',
|
||||
'_resultPi',
|
||||
'_resultSumCredit',
|
||||
'_resultSumCreditPayment',
|
||||
'_resultVatRecoverable',
|
||||
'resultTotalGraphwithNDS',
|
||||
'resultPlPrice',
|
||||
'resultPriceUpPr',
|
||||
'resultIRRGraphPerc',
|
||||
'resultIRRNominalPerc',
|
||||
'resultInsKasko',
|
||||
'resultInsOsago',
|
||||
'resultDopProdSum',
|
||||
'resultFirstPayment',
|
||||
'resultLastPayment',
|
||||
'resultFirstPaymentRiskPolicy',
|
||||
'resultTerm',
|
||||
'resultAB_FL',
|
||||
'resultAB_UL',
|
||||
'resultBonusMPL',
|
||||
'resultDopMPLLeasing',
|
||||
'resultBonusDopProd',
|
||||
'resultBonusSafeFinance',
|
||||
'resultParticipationAmount',
|
||||
];
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { formatters, id, title, titles } from './config';
|
||||
import { elements, formatters, id, title, titles } from './config';
|
||||
import { Container, Head } from '@/Components/Layout/Element';
|
||||
import { useStore } from '@/stores/hooks';
|
||||
import { min } from '@/styles/mq';
|
||||
import { toJS } from 'mobx';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { omit } from 'radash';
|
||||
import styled from 'styled-components';
|
||||
import { Text } from 'ui/elements';
|
||||
import { Box } from 'ui/grid';
|
||||
@ -27,18 +26,13 @@ const Results = observer(() => {
|
||||
|
||||
const resultsValues = toJS($results.values);
|
||||
// eslint-disable-next-line no-negated-condition
|
||||
const values = !$process.has('Unlimited')
|
||||
? omit(
|
||||
resultsValues,
|
||||
Object.keys(resultsValues).filter((x) => x.includes('_'))
|
||||
)
|
||||
: resultsValues;
|
||||
const values = !$process.has('Unlimited') ? elements.filter((x) => !x.startsWith('_')) : elements;
|
||||
|
||||
return (
|
||||
<Grid>
|
||||
{Object.keys(values).map((valueName) => {
|
||||
{values.map((valueName) => {
|
||||
const formatter = formatters[valueName];
|
||||
const storeValue = values[valueName];
|
||||
const storeValue = resultsValues[valueName];
|
||||
const value = formatter(storeValue);
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user