values, elements names, statuses interfaces
This commit is contained in:
parent
46fd88c088
commit
f69e4aeaa4
@ -1,6 +1,6 @@
|
||||
import { Button as AntButton } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import React from 'react';
|
||||
|
||||
const Button = ({ type, size, name, text, onClick }) => {
|
||||
|
||||
@ -2,7 +2,7 @@ import { Checkbox as AntCheckbox } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Box } from 'client/UIKit/grid';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Input as AntInput } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { InputNumber as AntInputNumber } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import { Radio as AntRadio } from 'antd';
|
||||
import { useOptions } from 'client/hooks/useOptions';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from "core/types/statuses";
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Select as AntSelect } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from "core/types/statuses";
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
import { useOptions } from 'client/hooks/useOptions';
|
||||
|
||||
@ -2,7 +2,7 @@ import { Switch as AntSwitch } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Box } from 'client/UIKit/grid';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from "core/types/statuses";
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Input as AntInput } from 'antd';
|
||||
import { useStatus } from 'client/hooks/useStatus';
|
||||
import { useStoreValue } from 'client/hooks/useStoreValue';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { Status } from "core/types/statuses";
|
||||
import { observer } from 'mobx-react';
|
||||
import React from 'react';
|
||||
|
||||
|
||||
@ -2,7 +2,8 @@ import assignProperties from 'client/tools/assignProps';
|
||||
import initialOptions from 'core/config/initialOptions';
|
||||
import initialStatuses from 'core/config/initialStatuses';
|
||||
import initialValues from 'core/config/initialValues';
|
||||
import { Status } from 'core/types/elements';
|
||||
import { ElementsNames } from 'core/types/elements';
|
||||
import { Status } from 'core/types/statuses';
|
||||
import { ValuesNames } from 'core/types/values';
|
||||
import { autorun, observable, reaction, when } from 'mobx';
|
||||
import CommonStore from '../CommonStore';
|
||||
@ -22,14 +23,14 @@ const CalculationStore = observable(
|
||||
getValue(sourceValueName: ValuesNames) {
|
||||
return this.values[sourceValueName];
|
||||
},
|
||||
getStatus(elementName: string) {
|
||||
getStatus(elementName: ElementsNames) {
|
||||
return this.statuses[elementName];
|
||||
},
|
||||
|
||||
setValue(sourceValueName: ValuesNames, newValue: any) {
|
||||
this.values[sourceValueName] = newValue;
|
||||
},
|
||||
setStatus(elementName: string, status: Status) {
|
||||
setStatus(elementName: ElementsNames, status: Status) {
|
||||
this.statuses[elementName] = status;
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
const initialOptions: any = {
|
||||
import { TElements } from 'core/types/elements';
|
||||
|
||||
const initialOptions: TElements = {
|
||||
selectChannel: [
|
||||
{
|
||||
name: 'От агента-ФЛ-сотрудника поставщика',
|
||||
@ -207,6 +209,7 @@ const initialOptions: any = {
|
||||
value: 100000004,
|
||||
},
|
||||
],
|
||||
|
||||
selectLeaseObjectUseFor: [
|
||||
{
|
||||
name: 'Для представительских целей',
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
import { Status } from '../types/elements';
|
||||
import { Status, TStatuses } from '../types/statuses';
|
||||
|
||||
interface IInitialStatuses {
|
||||
[elementName: string]: Status;
|
||||
}
|
||||
|
||||
const initialStatuses: IInitialStatuses = {
|
||||
const initialStatuses: TStatuses = {
|
||||
selectIndAgent: Status.Disabled,
|
||||
selectCalcBroker: Status.Disabled,
|
||||
selectCalcFinDepartment: Status.Disabled,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { ValuesMap } from 'core/types/values';
|
||||
const initialValues: any = {
|
||||
import { TValues } from 'core/types/values';
|
||||
const initialValues: TValues = {
|
||||
recalcWithRevision: false,
|
||||
contactGender: 100000000,
|
||||
leaseObjectPrice: 1000000,
|
||||
|
||||
@ -1,6 +1,138 @@
|
||||
export enum Status {
|
||||
Default,
|
||||
Disabled,
|
||||
Hidden,
|
||||
Readonly,
|
||||
}
|
||||
export type ElementsNames =
|
||||
| 'SelectLead'
|
||||
| 'SelectOpportunity'
|
||||
| 'selectQuote'
|
||||
| 'cbxRecalcWthtRevision'
|
||||
| 'selectTemplate'
|
||||
| 'selectChannel'
|
||||
| 'tbxNewClient'
|
||||
| 'selectAccount'
|
||||
| 'tbxINN'
|
||||
| 'tbxKPP'
|
||||
| 'selectContactClient'
|
||||
| 'tbxContact'
|
||||
| 'radioContactGender'
|
||||
| 'tbxPhoneNumber'
|
||||
| 'tbxEmailAddress'
|
||||
| 'selectSupplier'
|
||||
| 'selectFinDepartment'
|
||||
| 'selectAgent'
|
||||
| 'selectDoubleAgent'
|
||||
| 'selectBroker'
|
||||
| 'tbxCommentLead'
|
||||
| 'btnCreateLead'
|
||||
| 'selectProduct'
|
||||
| 'selectClientRisk'
|
||||
| 'selectClientType'
|
||||
| 'tbxLeaseObjectPrice'
|
||||
| 'selectSupplierCurrency'
|
||||
| 'tbxSupplierDiscountRub'
|
||||
| 'tbxSupplierDiscountPerc'
|
||||
| 'selectAddEquipmentCurrency'
|
||||
| 'tbxAddEquipmentPrice'
|
||||
| 'radioAddEquipmentPayer'
|
||||
| 'tbxLeasingPeriod'
|
||||
| 'tbxFirstPaymentPerc'
|
||||
| 'tbxFirstPaymentRub'
|
||||
| 'tbxLastPaymentPerc'
|
||||
| 'tbxLastPaymentRub'
|
||||
| 'radioLastPaymentRule'
|
||||
| 'radioBalanceHolder'
|
||||
| 'radioGraphType'
|
||||
| 'tbxParmentsDecreasePercent'
|
||||
| 'radioSeasonType'
|
||||
| 'selectHighSeasonStart'
|
||||
| 'tbxComissionPerc'
|
||||
| 'tbxComissionRub'
|
||||
| 'tbxSaleBonus'
|
||||
| 'tbxIRR_Perc'
|
||||
| 'tablePaymentGraph'
|
||||
| 'selectLeaseObjectType'
|
||||
| 'radioDeliveryTime'
|
||||
| 'labelLeaseObjectRisk'
|
||||
| 'labelDepreciationGroup'
|
||||
| 'tbxLeaseObjectCount'
|
||||
| 'selectWithTrailer'
|
||||
| 'cbxLeaseObjectUsed'
|
||||
| 'tbxMaxMass'
|
||||
| 'tbxCountSeats'
|
||||
| 'tbxMaxSpeed'
|
||||
| 'tbxTonnage'
|
||||
| 'selectBrand'
|
||||
| 'selectModel'
|
||||
| 'selectConfiguration'
|
||||
| 'tbxLeaseObjectYear'
|
||||
| 'selectEngineType'
|
||||
| 'selectLeaseObjectCategory'
|
||||
| 'tbxLeaseObjectMotorPower'
|
||||
| 'tbxEngineVolume'
|
||||
| 'selectLeaseObjectUseFor'
|
||||
| 'selectDealer'
|
||||
| 'selectDealerPerson'
|
||||
| 'selectDealerRewardСondition'
|
||||
| 'tbxDealerRewardSumm'
|
||||
| 'selectDealerBroker'
|
||||
| 'selectDealerBrokerRewardСondition'
|
||||
| 'tbxDealerBrokerRewardSumm'
|
||||
| 'selectIndAgent'
|
||||
| 'SelectIndAgentRewardCondition'
|
||||
| 'tbxIndAgentRewardSumm'
|
||||
| 'selectCalcDoubleAgent'
|
||||
| 'selectCalcDoubleAgentRewardCondition'
|
||||
| 'tbxCalcDoubleAgentRewardSumm'
|
||||
| 'selectCalcBroker'
|
||||
| 'selectCalcBrokerRewardCondition'
|
||||
| 'tbxCalcBrokerRewardSum'
|
||||
| 'selectCalcFinDepartment'
|
||||
| 'selectFinDepartmentRewardCondtion'
|
||||
| 'tbxFinDepartmentRewardSumm'
|
||||
| 'selectGPSBrand'
|
||||
| 'selectGPSModel'
|
||||
| 'selectRegionRegistration'
|
||||
| 'selectTownRegistration'
|
||||
| 'selectInfuranceOPF'
|
||||
| 'radioInsKaskoType'
|
||||
| 'tbxInsKaskoPriceLeasePeriod'
|
||||
| 'cbxInsDecentral'
|
||||
| 'btnInsCalculation'
|
||||
| 'selectInsPeriod'
|
||||
| 'tbxInsFranchise'
|
||||
| 'tbxInsAddEquipmentPrice'
|
||||
| 'cbxInsUnlimitDrivers'
|
||||
| 'tbxInsAgeDrivers'
|
||||
| 'tbxInsExpDrivers'
|
||||
| 'tbxINNForCalc'
|
||||
| 'TableAddProduct'
|
||||
| 'cbxLastPaymentRedemption'
|
||||
| 'cbxPriceWithDiscount'
|
||||
| 'cbxCostIncrease'
|
||||
| 'cbxInsurance'
|
||||
| 'cbxAddEquipment'
|
||||
| 'cbxRegistrationQuote'
|
||||
| 'cbxTechnicalCardQuote'
|
||||
| 'cbxNSiB'
|
||||
| 'tbxQuoteName'
|
||||
| 'radioQuoteContactGender'
|
||||
| 'btnCreateKP'
|
||||
| 'cbxQuoteRedemptionGraph'
|
||||
| 'selectTarif'
|
||||
| 'tbxCreditRate'
|
||||
| 'selectRate'
|
||||
| 'SelectUserSession'
|
||||
| 'radioRequirementTelematic'
|
||||
| 'cbxInsuranceDecentral'
|
||||
| 'tbxMaxPriceChange'
|
||||
| 'tbxImporterRewardPerc'
|
||||
| 'tbxImrovterRewardRub'
|
||||
| 'cbxDisableChecks'
|
||||
| 'btnFranschise'
|
||||
| 'btnDriversApplication'
|
||||
| 'tbxSystemUser'
|
||||
| 'tbxBusinessUnit'
|
||||
| 'tbxLeadNumber'
|
||||
| 'tbxOpportunityNumber'
|
||||
| 'radioInsuranceOPF';
|
||||
|
||||
export type TElements = {
|
||||
[elementName in ElementsNames]?: any;
|
||||
};
|
||||
|
||||
12
src/core/types/statuses.ts
Normal file
12
src/core/types/statuses.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { ElementsNames } from './elements';
|
||||
|
||||
export enum Status {
|
||||
Default,
|
||||
Disabled,
|
||||
Hidden,
|
||||
Readonly,
|
||||
}
|
||||
|
||||
export type TStatuses = {
|
||||
[elementName in ElementsNames]?: any;
|
||||
};
|
||||
@ -1,5 +1,152 @@
|
||||
export type ValuesNames = 'one' | 'two' | 'three' | 'price' | 'cbx';
|
||||
export type ValuesNames =
|
||||
| 'lead'
|
||||
| 'opportunity'
|
||||
| 'quote'
|
||||
| 'recalcWithRevision'
|
||||
| 'template'
|
||||
| 'channel'
|
||||
| 'newClient'
|
||||
| 'account'
|
||||
| 'INN'
|
||||
| 'KPP'
|
||||
| 'contactClient'
|
||||
| 'contact'
|
||||
| 'contactGender'
|
||||
| 'phoneNumber'
|
||||
| 'emailAddress'
|
||||
| 'supplier'
|
||||
| 'finDepartment'
|
||||
| 'agent'
|
||||
| 'doubleAgent'
|
||||
| 'broker'
|
||||
| 'commentLead'
|
||||
| 'product'
|
||||
| 'clientRisk'
|
||||
| 'clientType'
|
||||
| 'leaseObjectPrice'
|
||||
| 'supplierCurrency'
|
||||
| 'supplierDiscountRub'
|
||||
| 'supplierDiscountPerc'
|
||||
| 'addEquipmentCurrency'
|
||||
| 'addEquipmentPrice'
|
||||
| 'addEquipmentPayer'
|
||||
| 'leasingPeriod'
|
||||
| 'firstPaymentPerc'
|
||||
| 'firstPaymentRub'
|
||||
| 'lastPaymentPerc'
|
||||
| 'lastPaymentRub'
|
||||
| 'lastPaymentRule'
|
||||
| 'balanceHolder'
|
||||
| 'graphType'
|
||||
| 'parmentsDecreasePercent'
|
||||
| 'seasonType'
|
||||
| 'highSeasonStart'
|
||||
| 'comissionPerc'
|
||||
| 'comissionRub'
|
||||
| 'saleBonus'
|
||||
| 'IRR_Perc'
|
||||
| 'paymentGraph'
|
||||
| 'leaseObjectType'
|
||||
| 'deliveryTime'
|
||||
| 'leaseObjectRisk'
|
||||
| 'depreciationGroup'
|
||||
| 'leaseObjectCount'
|
||||
| 'withTrailer'
|
||||
| 'leaseObjectUsed'
|
||||
| 'maxMass'
|
||||
| 'countSeats'
|
||||
| 'maxSpeed'
|
||||
| 'tonnage'
|
||||
| 'brand'
|
||||
| 'model'
|
||||
| 'configuration'
|
||||
| 'leaseObjectYear'
|
||||
| 'engineType'
|
||||
| 'leaseObjectCategory'
|
||||
| 'leaseObjectMotorPower'
|
||||
| 'engineVolume'
|
||||
| 'leaseObjectUseFor'
|
||||
| 'dealer'
|
||||
| 'dealerPerson'
|
||||
| 'dealerRewardСondition'
|
||||
| 'dealerRewardSumm'
|
||||
| 'dealerBroker'
|
||||
| 'dealerBrokerRewardСondition'
|
||||
| 'dealerBrokerRewardSumm'
|
||||
| 'indAgent'
|
||||
| 'indAgentRewardCondition'
|
||||
| 'indAgentRewardSumm'
|
||||
| 'calcDoubleAgent'
|
||||
| 'calcDoubleAgentRewardCondition'
|
||||
| 'calcDoubleAgentRewardSumm'
|
||||
| 'calcBroker'
|
||||
| 'calcBrokerRewardCondition'
|
||||
| 'calcBrokerRewardSum'
|
||||
| 'calcFinDepartment'
|
||||
| 'finDepartmentRewardCondtion'
|
||||
| 'finDepartmentRewardSumm'
|
||||
| 'GPSBrand'
|
||||
| 'GPSModel'
|
||||
| 'regionRegistration'
|
||||
| 'townRegistration'
|
||||
| 'infuranceOPF'
|
||||
| 'insKaskoType'
|
||||
| 'insKaskoPriceLeasePeriod'
|
||||
| 'insDecentral'
|
||||
| 'insPeriod'
|
||||
| 'insFranchise'
|
||||
| 'insAddEquipmentPrice'
|
||||
| 'insUnlimitDrivers'
|
||||
| 'insAgeDrivers'
|
||||
| 'insExpDrivers'
|
||||
| 'INNForCalc'
|
||||
| 'lastPaymentRedemption'
|
||||
| 'priceWithDiscount'
|
||||
| 'costIncrease'
|
||||
| 'insurance'
|
||||
| 'addEquipment'
|
||||
| 'registrationQuote'
|
||||
| 'technicalCardQuote'
|
||||
| 'NSIB'
|
||||
| 'quoteName'
|
||||
| 'quoteContactGender'
|
||||
| 'quoteRedemptionGraph'
|
||||
| 'Tarif'
|
||||
| 'creditRate'
|
||||
| 'rate'
|
||||
| 'userSession'
|
||||
| 'requirementTelematic'
|
||||
| 'insuranceDecentral'
|
||||
| 'maxPriceChange'
|
||||
| 'importerRewardPerc'
|
||||
| 'importerRewardRub'
|
||||
| 'disableChecks'
|
||||
| 'OSAGO'
|
||||
| 'KASKO'
|
||||
| 'DGO'
|
||||
| 'NS'
|
||||
| 'InsAddEquipment'
|
||||
| 'insuranceCompanyOSAGO'
|
||||
| 'insuranceCompanyKASKO'
|
||||
| 'insuranceCompanyDGO'
|
||||
| 'insuranceCompanyNS'
|
||||
| 'insuranceCompanyAddEquipment'
|
||||
| 'insuredOSAGO'
|
||||
| 'insuredKASKO'
|
||||
| 'insuredDGO'
|
||||
| 'insuredNS'
|
||||
| 'insuredAddEquipment'
|
||||
| 'costOSAGO'
|
||||
| 'costKASKO'
|
||||
| 'costDGO'
|
||||
| 'costNS'
|
||||
| 'costAddEquipment'
|
||||
| 'insuranceTermOSAGO'
|
||||
| 'insuranceTermKASKO'
|
||||
| 'insuranceTermDGO'
|
||||
| 'insuranceTermNS'
|
||||
| 'insuranceTermAddEquipment';
|
||||
|
||||
export type ValuesMap = {
|
||||
export type TValues = {
|
||||
[valueName in ValuesNames]?: any;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user