Skip to content

Commit

Permalink
Merge pull request #3964 from mikhailprivalov/count-material-for-tube…
Browse files Browse the repository at this point in the history
…-fix

count material for tube fix
  • Loading branch information
urchinpro authored Jun 20, 2024
2 parents 62cb7c9 + 4714085 commit 93d3e3e
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions l2-frontend/src/construct/ResearchDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
id="laboratoryDuration"
v-model="research.countVolumeMaterialForTube"
class="form-control"
max="1"
step="0.01"
type="number"
>
</div>
Expand Down Expand Up @@ -520,16 +522,28 @@ const validateResearch = () => {
const titleFilled = research.value.title;
const departmentFilled = research.value.departmentId && research.value.departmentId !== -1;
const tubesFilled = research.value.tubes.length > 0;
const countForTubeNormal = research.value.countVolumeMaterialForTube <= 1;
const variants = {
0: { ok: true, message: '' },
1: { ok: false, message: 'Не заполнено название' },
2: { ok: false, message: 'Не выбрано подразделение' },
3: { ok: false, message: 'Не выбрана пробирка' },
4: { ok: false, message: 'Доля в контейнере не может быть больше 1' },
};
let result = 0;
if (!titleFilled) {
return { ok: false, message: 'Не заполнено название' };
result = 1;
}
if (!departmentFilled) {
return { ok: false, message: 'Не выбрано подразделение' };
result = 2;
}
if (!tubesFilled) {
return { ok: false, message: 'Не выбрана пробирка' };
result = 3;
}
if (!countForTubeNormal) {
result = 4;
}
return { ok: true, message: '' };
return variants[result];
};
const updateResearch = async () => {
Expand Down

0 comments on commit 93d3e3e

Please sign in to comment.