Commit 46334f53 authored by Matija Obreza's avatar Matija Obreza
Browse files

Inventory: Display and Form updated for order of UI elements

- Do not autocomplete System Inventories in the Form
parent 9b660ded
......@@ -703,11 +703,11 @@
"longitude": "Longitude",
"longitude_hint": "The decimal longitude of the location of the item.",
"isAvailable": "Is Available?",
"isAvailable_hint": "The flag indicating if the inventory item is available for distribution.",
"isAvailable_hint": "Automatic flag indicating if the inventory item is available for distribution.",
"webAvailabilityNote": "Web Availability Note",
"webAvailabilityNote_hint": "The availability note for sharing with external users.",
"availabilityStatusCode": "Availability Status",
"availabilityStatusCode_hint": "Status of the item availability. A value in the INVENTORY_AVAILABILITY_STATUS Code Group.",
"availabilityStatusCode_hint": "Status of the item availability, depending on quantity on hand. A value in the INVENTORY_AVAILABILITY_STATUS Code Group.",
"availabilityStatusNote": "Availability Status Note",
"availabilityStatusNote_hint": "General remarks on the availability status.",
"availabilityStartDate": "Availability Start Date",
......
......@@ -690,11 +690,11 @@
"longitude": "Longitude",
"longitude_hint": "The decimal longitude of the location of the item.",
"isAvailable": "Is Available?",
"isAvailable_hint": "The flag indicating if the inventory item is available for distribution.",
"isAvailable_hint": "Automatic flag indicating if the inventory item is available for distribution.",
"webAvailabilityNote": "Web Availability Note",
"webAvailabilityNote_hint": "The availability note for sharing with external users.",
"availabilityStatusCode": "Availability Status",
"availabilityStatusCode_hint": "Status of the item availability. A value in the INVENTORY_AVAILABILITY_STATUS Code Group.",
"availabilityStatusCode_hint": "Status of the item availability, depending on quantity on hand. A value in the INVENTORY_AVAILABILITY_STATUS Code Group.",
"availabilityStatusNote": "Availability Status Note",
"availabilityStatusNote_hint": "General remarks on the availability status.",
"availabilityStartDate": "Availability Start Date",
......
......@@ -3,12 +3,15 @@ import { useTranslation } from 'react-i18next';
// Prints 'Yes'/'No' for boolean value
function Boolean({ value }: { value: boolean }) {
function Boolean({ value }: { value: boolean | string }) {
const { t } = useTranslation();
if (typeof value === 'boolean') {
return <span>{ value ? t('common:label.yes') : t('common:label.no') }</span>;
}
if (typeof value === 'string') {
return <span>{ value === 'Y' ? t('common:label.yes') : (value === 'N' ? t('common:label.no') : '&mdash;') }</span>;
}
return <span>&mdash;</span>;
}
......
......@@ -577,7 +577,6 @@
"edit": {
"title": "New inventory item",
"inventory": "Inventory item",
"switches": "Switches",
"availability": "Current quantity of germplasm",
"site": "Site",
"error": "Error",
......
......@@ -16,7 +16,7 @@ interface IInventoryField {
const InventoryField = (props: IInventoryField & FieldRenderProps<any>) => {
const autocomplete = (text: string) => {
const filter = { _text: text, includeSystem: props.includeSystem }
const filter = { _text: text, includeSystem: props.includeSystem || false }
return InventoryService.filterInventories(props.currentInventoryId ? { ...filter, NOT: { id: [ props.currentInventoryId ] } } : filter, { page: 0, size: 10 });
};
......
......@@ -54,7 +54,6 @@
"edit": {
"title": "New inventory item",
"inventory": "Inventory item",
"switches": "Switches",
"availability": "Current quantity of germplasm",
"site": "Site",
"error": "Error",
......
......@@ -98,7 +98,7 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
name="parentInventory"
type="text"
component={ InventoryField }
includeSystem
includeSystem={ false }
currentInventoryId={ initialValues && initialValues.id }
label={ t(['client:model.Inventory.parentInventory', 'client:model._.parentInventory']) }
helperText={ t(['client:model.Inventory.parentInventory_hint', 'client:model._.parentInventory_hint' , 'client:model._._hint']) }
......@@ -233,44 +233,6 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
</Grid>
</PageSection>
{
!initialValues.systemInventory &&
<PageSection title={ t('inventory.public.p.edit.switches') }>
<Grid container spacing={ 2 }>
{/* <Grid item xs={ 12 } sm={ 4 }>
<Field
label={ t(['client:model.Inventory.systemInventory', 'client:model._.systemInventory']) }
name="systemInventory"
component={ Toggle }
type="checkbox"
labelPlacement="end"
disabled
/>
</Grid> */}
<Grid item xs={ 12 } md={ 6 }>
<Field
name="pathogenStatusCode"
type="text"
component={ CodeValueField }
codeGroup={ Inventory.CodeGroup.pathogenStatusCode }
label={ t(['client:model.Inventory.pathogenStatusCode', 'client:model._.pathogenStatusCode']) }
helperText={ t(['client:model.Inventory.pathogenStatusCode_hint', 'client:model._.pathogenStatusCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item xs={ 12 } md={ 6 }>
<Field
name="plantSexCode"
type="text"
component={ CodeValueField }
codeGroup={ Inventory.CodeGroup.plantSexCode }
label={ t(['client:model.Inventory.plantSexCode', 'client:model._.plantSexCode']) }
helperText={ t(['client:model.Inventory.plantSexCode_hint', 'client:model._.plantSexCode_hint' , 'client:model._._hint']) }
/>
</Grid>
</Grid>
</PageSection>
}
{
!initialValues.systemInventory &&
<PageSection title={ t('inventory.public.p.edit.storageLocation') }>
......@@ -379,14 +341,7 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
helperText={ t(['client:model.Inventory.hundredSeedWeight_hint', 'client:model._.hundredSeedWeight_hint' , 'client:model._._hint']) }
/>
</Grid>
</Grid>
</PageSection>
}
{ !initialValues.systemInventory &&
<PageSection title={ t('inventory.public.p.edit.distribution') }>
<Grid container spacing={ 2 }>
<Grid item xs={ 6 } sm={ 3 }>
<Grid item xs={ 6 } sm={ 3 }>
<Field
name="availabilityStatusCode"
type="text"
......@@ -403,10 +358,18 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
label={ t(['client:model.Inventory.isAvailable', 'client:model._.isAvailable']) }
name="isAvailable"
component={ YesNoSwitch }
disabled
labelPlacement="end"
helperText={ t(['client:model.Inventory.isAvailable_hint', 'client:model._.isAvailable_hint' , 'client:model._._hint']) }
/>
</Grid>
</Grid>
</PageSection>
}
{ !initialValues.systemInventory &&
<PageSection title={ t('inventory.public.p.edit.distribution') }>
<Grid container spacing={ 2 }>
<Grid item xs={ 6 } md={ 3 }>
<Field
label={ t(['client:model.Inventory.isDistributable', 'client:model._.isDistributable']) }
......@@ -528,6 +491,27 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
/>
</Grid>
<Grid item xs={ 12 } md={ 6 }>
<Field
name="pathogenStatusCode"
type="text"
component={ CodeValueField }
codeGroup={ Inventory.CodeGroup.pathogenStatusCode }
label={ t(['client:model.Inventory.pathogenStatusCode', 'client:model._.pathogenStatusCode']) }
helperText={ t(['client:model.Inventory.pathogenStatusCode_hint', 'client:model._.pathogenStatusCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item xs={ 12 } md={ 6 }>
<Field
name="plantSexCode"
type="text"
component={ CodeValueField }
codeGroup={ Inventory.CodeGroup.plantSexCode }
label={ t(['client:model.Inventory.plantSexCode', 'client:model._.plantSexCode']) }
helperText={ t(['client:model.Inventory.plantSexCode_hint', 'client:model._.plantSexCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item sm={ 12 } xs={ 12 } md={ 12 }>
<Grid container spacing={ 2 }>
<Grid item xs={ 6 } md={ 6 }>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment