effects: for leaseobjectcategory

This commit is contained in:
Chika 2020-09-28 17:47:47 +03:00
parent 4a9b062f41
commit 786ef011ff
3 changed files with 46 additions and 5 deletions

View File

@ -76,6 +76,47 @@ const autorunEffects: IAutorunEffect[] = [
}
}
},
calculationStore => () => {
const {
leaseObjectCategory,
maxMass,
withTrailer,
tonnage,
} = calculationStore.values;
if (leaseObjectCategory === 100000002) {
if (!maxMass) {
calculationStore.setValidation('tbxMaxMass', false);
} else {
calculationStore.setValidation('tbxMaxMass', true);
}
if (!tonnage) {
calculationStore.setValidation('tbxTonnage', false);
} else {
calculationStore.setValidation('tbxTonnage', true);
}
if (!withTrailer) {
calculationStore.setValidation('selectWithTrailer', false);
} else {
calculationStore.setValidation('selectWithTrailer', true);
}
} else {
calculationStore.setValidation('tbxMaxMass', true);
calculationStore.setValidation('tbxTonnage', true);
calculationStore.setValidation('selectWithTrailer', true);
}
},
calculationStore => () => {
const { leaseObjectCategory, countSeats } = calculationStore.values;
if (leaseObjectCategory === 100000003) {
if (!countSeats) {
calculationStore.setValidation('tbxCountSeats', false);
} else {
calculationStore.setValidation('tbxCountSeats', true);
}
} else {
calculationStore.setValidation('tbxCountSeats', true);
}
},
];
export default autorunEffects;

View File

@ -151,10 +151,10 @@ const initialOptions: TElements<IBaseOption[]> = {
],
selectWithTrailer: [
{
name: 'пусто',
value: 100000000,
},
// {
// name: 'пусто',
// value: 100000000,
// },
{
name: 'Да',
value: 100000001,

View File

@ -29,7 +29,7 @@ const initialValues: TValues<TValue> = {
configuration: null,
deliveryTime: 100000000,
leaseObjectCount: 1,
withTrailer: 100000000,
withTrailer: null,
leaseObjectUsed: false,
maxMass: 0,
countSeats: 0,