add createKPMini button
This commit is contained in:
parent
859b5cf7f6
commit
b2e6cee3ae
@ -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],
|
||||
|
||||
@ -142,6 +142,7 @@ const components = wrapComponentsMap({
|
||||
|
||||
/** Button Elements */
|
||||
btnCreateKP: e.Button,
|
||||
btnCreateKPMini: e.Button,
|
||||
btnCalculate: e.Button,
|
||||
|
||||
/** Link Elements */
|
||||
|
||||
@ -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<ElementsProps> = {
|
||||
tbxLeaseObjectPrice: {
|
||||
@ -296,9 +296,21 @@ const props: Partial<ElementsProps> = {
|
||||
optionType: 'button',
|
||||
buttonStyle: 'solid',
|
||||
},
|
||||
btnCalculate: {
|
||||
text: 'Рассчитать график',
|
||||
type: 'primary',
|
||||
block: true,
|
||||
},
|
||||
btnCreateKP: {
|
||||
type: 'primary',
|
||||
text: 'Создать КП',
|
||||
icon: <PlusOutlined />,
|
||||
},
|
||||
btnCreateKPMini: {
|
||||
text: '',
|
||||
type: 'primary',
|
||||
icon: <PlusOutlined />,
|
||||
block: true,
|
||||
},
|
||||
tbxCreditRate: {
|
||||
min: 0,
|
||||
@ -345,10 +357,6 @@ const props: Partial<ElementsProps> = {
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
},
|
||||
btnCalculate: {
|
||||
text: 'Рассчитать график',
|
||||
type: 'primary',
|
||||
},
|
||||
tbxIRR_Perc: {
|
||||
min: 0,
|
||||
max: 500,
|
||||
|
||||
@ -143,6 +143,7 @@ const titles: Record<ActionElements | ValuesElements, string> = {
|
||||
/** Action Elements */
|
||||
btnCalculate: '',
|
||||
btnCreateKP: '',
|
||||
btnCreateKPMini: '',
|
||||
};
|
||||
|
||||
export default titles;
|
||||
|
||||
@ -171,6 +171,7 @@ const types = wrapElementsTypes({
|
||||
tbxSubsidySum: t.Readonly,
|
||||
|
||||
btnCreateKP: t.Action,
|
||||
btnCreateKPMini: t.Action,
|
||||
btnCalculate: t.Action,
|
||||
|
||||
linkDownloadKp: t.Readonly,
|
||||
|
||||
@ -5,6 +5,7 @@ function wrapElementsMap<T extends Record<string, string>>(arg: T) {
|
||||
const elementsToActions = wrapElementsMap({
|
||||
btnCalculate: 'calculate',
|
||||
btnCreateKP: 'create-kp',
|
||||
btnCreateKPMini: 'create-kp',
|
||||
});
|
||||
|
||||
export default elementsToActions;
|
||||
|
||||
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ type ElementProps = {
|
||||
type ButtonProps = BaseButtonProps & Pick<ElementProps, 'text'>;
|
||||
|
||||
function Button({ status, action, text, ...props }: BaseElementProps<never> & ElementProps) {
|
||||
const throttledAction = useThrottledCallback(action, 1_200, {
|
||||
const throttledAction = useThrottledCallback(action, 1200, {
|
||||
trailing: false,
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user