Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #157 from bcgov/quantity-below-zero-fix
Browse files Browse the repository at this point in the history
Quantity gives error message if it is below zero
  • Loading branch information
dbarkowsky authored Aug 17, 2022
2 parents 3b73dac + de31c4c commit 93083dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/formik/FormikContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,13 @@ export const FormikContainer = (props) => {
);
}}
</Formik>
{errorMessage ? (
{errorMessage && formFields[1].name === 'title' ? (
<Alert severity="error">
<AlertTitle>Error</AlertTitle>
Software Title already in use.
</Alert>
) : null}
{errorMessage && formFields[2].name === 'email' ? (
<Alert severity="error">
<AlertTitle>Error</AlertTitle>
Email already in use.
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useSoftware/softwareFields.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Yup from 'yup';
import { DateCell } from '../../components/common/DateCell';
import { LogoAvatar } from '../../components/common/LogoAvatar';
import { QuantityAssigned } from '../../components/common/QuantityAssigned';
Expand Down Expand Up @@ -26,6 +27,7 @@ export const softwareFields = [
form: {
control: 'text',
fullWidth: true,
validation: Yup.string().required('Required'),
show: true,
sortOrder: 0,
column: 0,
Expand Down Expand Up @@ -83,6 +85,7 @@ export const softwareFields = [
form: {
control: 'number',
show: true,
validation: Yup.number().min(0, 'Quantity cannot be below zero.'),
sortOrder: 0,
column: 0,
},
Expand Down

0 comments on commit 93083dc

Please sign in to comment.