Commit eff7a5f3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '414-type-of-container' into 'main'

Type of Container

Closes #414

See merge request grin-global/grin-global-ui!404
parents 17713dbb 40d5c27b
......@@ -753,7 +753,9 @@
"generation": "Generation",
"names": "Names",
"barcode": "Inventory barcode",
"barcode_hint": "The unique reference to this inventory item to be encoded in the barcode."
"barcode_hint": "The unique reference to this inventory item to be encoded in the barcode.",
"containerTypeCode": "Type of Container",
"containerTypeCode_hint": "The type of packaging container used for this inventory. Defined in CONTAINER_TYPE Code Group."
},
"InventoryAction": {
"inventoryAction": "Inventory Action",
......@@ -1052,7 +1054,9 @@
"sourceCooperator": "External Source",
"sourceCooperator_hint": "source_cooperator_id -- The field associating the cooperator (person or organization) who was the source of the order request item",
"webUserNote": "Web User Note",
"webUserNote_hint": "web_user_note -- Note entered on the order on the Public Website order from"
"webUserNote_hint": "web_user_note -- Note entered on the order on the Public Website order from",
"containerTypeCode": "Type of Container",
"containerTypeCode_hint": "The type of packaging container used for outgoing material. Defined in CONTAINER_TYPE Code Group."
},
"Site": {
"faoInstituteNumber": "FAO WIEWS code",
......
......@@ -63,8 +63,10 @@ class Inventory {
public barcode: string;
public preferredName: string;
public groups: AccessionInvGroup[];
public containerTypeCode: string;
public static CodeGroup = {
containerTypeCode: 'CONTAINER_TYPE',
formTypeCode: 'GERMPLASM_FORM',
availabilityStatusCode: 'INVENTORY_AVAILABILITY_STATUS',
distributionDefaultFormCode: 'GERMPLASM_FORM',
......
......@@ -65,8 +65,10 @@ class OrderRequestItem {
public statusDate: Date;
public webOrderRequestItem: WebOrderRequestItem;
public webUserNote: string;
public containerTypeCode: string;
public static CodeValue = {
containerTypeCode: 'CONTAINER_TYPE',
statusCode: 'ORDER_REQUEST_ITEM_STATUS',
quantityShippedUnitCode: 'UNIT_OF_QUANTITY',
}
......
......@@ -740,7 +740,9 @@
"generation": "Generation",
"names": "Names",
"barcode": "Inventory barcode",
"barcode_hint": "The unique reference to this inventory item to be encoded in the barcode."
"barcode_hint": "The unique reference to this inventory item to be encoded in the barcode.",
"containerTypeCode": "Type of Container",
"containerTypeCode_hint": "The type of packaging container used for this inventory. Defined in CONTAINER_TYPE Code Group."
},
"InventoryAction": {
"inventoryAction": "Inventory Action",
......@@ -1039,7 +1041,9 @@
"sourceCooperator": "External Source",
"sourceCooperator_hint": "source_cooperator_id -- The field associating the cooperator (person or organization) who was the source of the order request item",
"webUserNote": "Web User Note",
"webUserNote_hint": "web_user_note -- Note entered on the order on the Public Website order from"
"webUserNote_hint": "web_user_note -- Note entered on the order on the Public Website order from",
"containerTypeCode": "Type of Container",
"containerTypeCode_hint": "The type of packaging container used for outgoing material. Defined in CONTAINER_TYPE Code Group."
},
"Site": {
"faoInstituteNumber": "FAO WIEWS code",
......
......@@ -45,6 +45,7 @@ export const InventoryTableDefaultConfig = {
'preferredName',
'quantityOnHand',
'quantityOnHandUnitCode',
'containerTypeCode',
'availabilityStatusCode',
'taxonomySpecies',
'inventoryNumberPart1',
......@@ -83,6 +84,7 @@ export const InventoryTableDefaultConfig = {
distributionUnitCode: ({ value: codeValue }: { value: string }) => <CodeValueDisplay codeGroup="UNIT_OF_QUANTITY" value={ codeValue } description />,
quantityOnHand: ({ value }: { value: number }) => <Number value={ value } />,
quantityOnHandUnitCode: ({ value: codeValue }: { value: string }) => <CodeValueDisplay codeGroup="UNIT_OF_QUANTITY" value={ codeValue } description />,
containerTypeCode: ({ value: codeValue }: { value: string }) => <CodeValueDisplay codeGroup={ Inventory.CodeGroup.containerTypeCode } value={ codeValue } />,
propagationDate: ({ value: propagationDate, row }: { value: Date, row: Inventory }) => <PrettyDate value={ propagationDate } format={ row.propagationDateCode } />,
isAutoDeducted: Renderers.STRING_BOOL_RENDERER,
isAvailable: Renderers.STRING_BOOL_RENDERER,
......
......@@ -654,6 +654,11 @@ class InventoryDetailsPage extends React.Component<PropsFromRedux & IWithTabs &
<CodeValueDisplay codeGroup={Inventory.CodeGroup.quantityOnHandUnitCode} value={inventory.quantityOnHandUnitCode}/>
</PropertiesItem>
}
{ inventory.containerTypeCode &&
<PropertiesItem title={ t(['client:model.Inventory.containerTypeCode', 'client:model._.containerTypeCode']) }>
<CodeValueDisplay codeGroup={ Inventory.CodeGroup.containerTypeCode } value={ inventory.containerTypeCode }/>
</PropertiesItem>
}
<PropertiesItem title={t(['client:model.Inventory.hundredSeedWeight', 'client:model._.hundredSeedWeight'])} keepEmpty>
{inventory.hundredSeedWeight}
</PropertiesItem>
......
......@@ -339,7 +339,7 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
!initialValues.systemInventory &&
<PageSection title={ t('inventory.public.p.edit.availability') }>
<Grid container spacing={ 2 }>
<Grid item xs={ 6 } md={ 6 }>
<Grid item xs={ 6 } md={ 3 }>
<Field
name="quantityOnHand"
type="text"
......@@ -359,6 +359,16 @@ const InventoryForm = ({ t, onSubmit, initialValues, error, classes }: IInventor
helperText={ t(['client:model.Inventory.quantityOnHandUnitCode_hint', 'client:model._.quantityOnHandUnitCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item xs={ 6 } md={ 3 }>
<Field
name="containerTypeCode"
type="text"
component={ CodeValueField }
codeGroup={ Inventory.CodeGroup.containerTypeCode }
label={ t(['client:model.Inventory.containerTypeCode', 'client:model._.containerTypeCode']) }
helperText={ t(['client:model.Inventory.containerTypeCode_hint', 'client:model._.containerTypeCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item xs={ 6 } md={ 3 }>
<Field
name="hundredSeedWeight"
......
......@@ -98,7 +98,7 @@ export const OrderRequestItemTableConfig = new TableConfiguration({
defaultColumns: [
'sequenceNumber', 'statusCode',
'accession', 'improvementStatusCode', 'taxonomySpecies',
'inventory', 'withdrawnInventory', 'name', 'quantityOnHand', 'quantityShipped', 'quantityShippedUnitCode'
'inventory', 'withdrawnInventory', 'name', 'quantityOnHand', 'quantityShipped', 'quantityShippedUnitCode', 'containerTypeCode'
],
ignoredColumns: [
'id', '_class', 'createdBy', 'modifiedBy', 'ownedBy', 'ownedDate',
......@@ -121,7 +121,8 @@ export const OrderRequestItemTableConfig = new TableConfiguration({
improvementStatusCode: ({ row }: { row: OrderRequestItem }) => <CodeValueDisplay codeGroup={ Accession.CodeGroup.improvementStatusCode } value={ row?.inventory?.accession?.improvementStatusCode } />,
quantityOnHand: ({ row }: { row: OrderRequestItem }) => <Number value={ row?.inventory?.quantityOnHand } />,
sourceCooperator: ({ value }: { value: Cooperator }): JSX.Element => <CooperatorLink cooperator={ value } />,
webOrderRequestItem: ({ value }: { value: WebOrderRequestItem}) => value && <span>{ value.id } { value.name }</span>
webOrderRequestItem: ({ value }: { value: WebOrderRequestItem}) => value && <span>{ value.id } { value.name }</span>,
containerTypeCode: ({ value }: { value: string }) => <CodeValueDisplay codeGroup={ OrderRequestItem.CodeValue.containerTypeCode } value={ value } />,
},
});
......
......@@ -82,6 +82,17 @@ const OrderRequestItemFormWithDetails = ({ t, onSubmit, initialValues, classes }
</Grid>
<Grid item xs={ 12 } sm={ 6 }>
<Field
name="containerTypeCode"
type="text"
component={ CodeValueField }
codeGroup={ OrderRequestItem.CodeValue.containerTypeCode }
label={ t(['client:model.Inventory.containerTypeCode', 'client:model._.containerTypeCode']) }
helperText={ t(['client:model.Inventory.containerTypeCode_hint', 'client:model._.containerTypeCode_hint' , 'client:model._._hint']) }
/>
</Grid>
<Grid item xs={ 12 }>
<Field
placeholder={ t(['client:model.OrderRequestItem.sourceCooperator', 'client:model._.sourceCooperator']) }
name="sourceCooperator"
......
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