diff --git a/apps/web/Components/Calculation/Settings/config.ts b/apps/web/Components/Calculation/Settings/config.ts index 8af3868..6684545 100644 --- a/apps/web/Components/Calculation/Settings/config.ts +++ b/apps/web/Components/Calculation/Settings/config.ts @@ -8,7 +8,12 @@ export const rows: FormTabRows = [ [['selectOpportunity'], defaultRowStyle], [['cbxRecalcWithRevision'], defaultRowStyle], [['selectQuote'], defaultRowStyle], - [['btnCalculate'], defaultRowStyle], + [ + ['btnCalculate', 'btnCreateKPMini'], + { + gridTemplateColumns: ['1fr 0.15fr'], + }, + ], { title: 'Параметры расчета' }, [['labelIrrInfo'], defaultRowStyle], diff --git a/apps/web/Components/Calculation/config/elements-components.ts b/apps/web/Components/Calculation/config/elements-components.ts index b74ebc2..56d946a 100644 --- a/apps/web/Components/Calculation/config/elements-components.ts +++ b/apps/web/Components/Calculation/config/elements-components.ts @@ -142,6 +142,7 @@ const components = wrapComponentsMap({ /** Button Elements */ btnCreateKP: e.Button, + btnCreateKPMini: e.Button, btnCalculate: e.Button, /** Link Elements */ diff --git a/apps/web/Components/Calculation/config/elements-props.tsx b/apps/web/Components/Calculation/config/elements-props.tsx index 9c80f93..95c1a7c 100644 --- a/apps/web/Components/Calculation/config/elements-props.tsx +++ b/apps/web/Components/Calculation/config/elements-props.tsx @@ -5,7 +5,7 @@ import type { ElementsProps } from './elements-components'; import { MAX_FRANCHISE, MAX_LEASING_PERIOD } from '@/constants/values'; import dayjs from 'dayjs'; import { formatter, formatterExtra, parser } from 'tools/number'; -import { DownloadOutlined } from 'ui/elements/icons'; +import { DownloadOutlined, PlusOutlined } from 'ui/elements/icons'; const props: Partial = { tbxLeaseObjectPrice: { @@ -296,9 +296,21 @@ const props: Partial = { optionType: 'button', buttonStyle: 'solid', }, + btnCalculate: { + text: 'Рассчитать график', + type: 'primary', + block: true, + }, btnCreateKP: { type: 'primary', text: 'Создать КП', + icon: , + }, + btnCreateKPMini: { + text: '', + type: 'primary', + icon: , + block: true, }, tbxCreditRate: { min: 0, @@ -345,10 +357,6 @@ const props: Partial = { showSearch: true, optionFilterProp: 'label', }, - btnCalculate: { - text: 'Рассчитать график', - type: 'primary', - }, tbxIRR_Perc: { min: 0, max: 500, diff --git a/apps/web/Components/Calculation/config/elements-titles.ts b/apps/web/Components/Calculation/config/elements-titles.ts index c65b33a..ba37e87 100644 --- a/apps/web/Components/Calculation/config/elements-titles.ts +++ b/apps/web/Components/Calculation/config/elements-titles.ts @@ -143,6 +143,7 @@ const titles: Record = { /** Action Elements */ btnCalculate: '', btnCreateKP: '', + btnCreateKPMini: '', }; export default titles; diff --git a/apps/web/Components/Calculation/config/elements-types.ts b/apps/web/Components/Calculation/config/elements-types.ts index fe954b1..8142aa5 100644 --- a/apps/web/Components/Calculation/config/elements-types.ts +++ b/apps/web/Components/Calculation/config/elements-types.ts @@ -171,6 +171,7 @@ const types = wrapElementsTypes({ tbxSubsidySum: t.Readonly, btnCreateKP: t.Action, + btnCreateKPMini: t.Action, btnCalculate: t.Action, linkDownloadKp: t.Readonly, diff --git a/apps/web/Components/Calculation/config/map/actions.ts b/apps/web/Components/Calculation/config/map/actions.ts index 24b9adf..843b2e0 100644 --- a/apps/web/Components/Calculation/config/map/actions.ts +++ b/apps/web/Components/Calculation/config/map/actions.ts @@ -5,6 +5,7 @@ function wrapElementsMap>(arg: T) { const elementsToActions = wrapElementsMap({ btnCalculate: 'calculate', btnCreateKP: 'create-kp', + btnCreateKPMini: 'create-kp', }); export default elementsToActions; diff --git a/apps/web/process/calculate/action.ts b/apps/web/process/calculate/action.ts index ec64b97..5948d2d 100644 --- a/apps/web/process/calculate/action.ts +++ b/apps/web/process/calculate/action.ts @@ -11,6 +11,7 @@ export async function action({ store, trpcClient }: ProcessContext) { $calculation.$status.setStatus('btnCalculate', 'Loading'); $calculation.$status.setStatus('btnCreateKP', 'Loading'); + $calculation.$status.setStatus('btnCreateKPMini', 'Loading'); $results.clear(); const values = $calculation.$values.getValues(); @@ -57,5 +58,6 @@ export async function action({ store, trpcClient }: ProcessContext) { .finally(() => { $calculation.$status.setStatus('btnCalculate', 'Default'); $calculation.$status.setStatus('btnCreateKP', 'Default'); + $calculation.$status.setStatus('btnCreateKPMini', 'Default'); }); } diff --git a/apps/web/process/create-kp/action.ts b/apps/web/process/create-kp/action.ts index 357d79f..2b2881c 100644 --- a/apps/web/process/create-kp/action.ts +++ b/apps/web/process/create-kp/action.ts @@ -12,6 +12,7 @@ export function action({ store, trpcClient, apolloClient }: ProcessContext) { $calculation.$status.setStatus('btnCalculate', 'Loading'); $calculation.$status.setStatus('btnCreateKP', 'Loading'); + $calculation.$status.setStatus('btnCreateKPMini', 'Loading'); $results.clear(); const values = $calculation.$values.getValues(); @@ -63,5 +64,6 @@ export function action({ store, trpcClient, apolloClient }: ProcessContext) { .finally(() => { $calculation.$status.setStatus('btnCalculate', 'Default'); $calculation.$status.setStatus('btnCreateKP', 'Default'); + $calculation.$status.setStatus('btnCreateKPMini', 'Default'); }); } diff --git a/packages/ui/elements/Button.tsx b/packages/ui/elements/Button.tsx index a992f96..a4907b6 100644 --- a/packages/ui/elements/Button.tsx +++ b/packages/ui/elements/Button.tsx @@ -12,7 +12,7 @@ type ElementProps = { type ButtonProps = BaseButtonProps & Pick; function Button({ status, action, text, ...props }: BaseElementProps & ElementProps) { - const throttledAction = useThrottledCallback(action, 1_200, { + const throttledAction = useThrottledCallback(action, 1200, { trailing: false, });