Commit c352fd0b authored by Matija Obreza's avatar Matija Obreza

IMP: Form and display fields reorganized

parent 022855e5
......@@ -82,31 +82,25 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
{ inventoryPolicy.maintenanceName }
</PropertiesItem>
}
{ inventoryPolicy.curatorCooperator &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }>
<CooperatorLink cooperator={ inventoryPolicy.curatorCooperator }/>
</PropertiesItem>
}
{ inventoryPolicy.isAutoDeducted &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.isAutoDeducted') }>
{ YesNoToBoolean(inventoryPolicy.isAutoDeducted) ? t('common:label.yes') : t('common:label.no') }
</PropertiesItem>
}
{ inventoryPolicy.distributionDefaultQuantity &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }>
<Number value={ inventoryPolicy.distributionDefaultQuantity }/>
</PropertiesItem>
}
{ inventoryPolicy.regenerationCriticalQuantity &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }>
<Number value={ inventoryPolicy.regenerationCriticalQuantity }/>
{ ['webAvailabilityNote', 'note'].map((property) => inventoryPolicy[property] && (
<PropertiesItem key={ property } title={ t(`client:model.InventoryMaintenancePolicy.${property}`, `client:model._.${property}`) }>
{ inventoryPolicy[property] }
</PropertiesItem>
}
)) }
{ inventoryPolicy.formTypeCode &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.formTypeCode') }>
{ inventoryPolicy.formTypeCode }
</PropertiesItem>
}
{ inventoryPolicy.quantityOnHandUnitCode &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }>
<CodeValueDisplay
codeGroup={ InventoryMaintenancePolicy.CodeValues.quantityOnHandUnitCode }
value={ inventoryPolicy.quantityOnHandUnitCode }
/>
</PropertiesItem>
}
{ inventoryPolicy.distributionDefaultFormCode &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.distributionDefaultFormCode') }>
<CodeValueDisplay
......@@ -115,6 +109,11 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
/>
</PropertiesItem>
}
{ inventoryPolicy.distributionDefaultQuantity &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }>
<Number value={ inventoryPolicy.distributionDefaultQuantity }/>
</PropertiesItem>
}
{ inventoryPolicy.distributionUnitCode &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.distributionUnitCode') }>
<CodeValueDisplay
......@@ -123,17 +122,27 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
/>
</PropertiesItem>
}
{ inventoryPolicy.isAutoDeducted &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.isAutoDeducted') }>
{ YesNoToBoolean(inventoryPolicy.isAutoDeducted) ? t('common:label.yes') : t('common:label.no') }
</PropertiesItem>
}
{ inventoryPolicy.distributionCriticalQuantity &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.distributionCriticalQuantity') }>
<Number value={ inventoryPolicy.distributionCriticalQuantity }/>
</PropertiesItem>
}
{ inventoryPolicy.quantityOnHandUnitCode &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }>
<CodeValueDisplay
codeGroup={ InventoryMaintenancePolicy.CodeValues.quantityOnHandUnitCode }
value={ inventoryPolicy.quantityOnHandUnitCode }
/>
{ inventoryPolicy.regenerationCriticalQuantity &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }>
<Number value={ inventoryPolicy.regenerationCriticalQuantity }/>
</PropertiesItem>
}
{ inventoryPolicy.curatorCooperator &&
<PropertiesItem title={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }>
<CooperatorLink cooperator={ inventoryPolicy.curatorCooperator }/>
</PropertiesItem>
}
{ inventoryPolicy.regenerationMethodCode &&
......@@ -144,6 +153,7 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
/>
</PropertiesItem>
}
{ inventoryPolicy.createdDate &&
<PropertiesItem title={ t('client:model._.createdDate') }>
<PrettyDate value={ inventoryPolicy.createdDate } />
......@@ -164,11 +174,6 @@ class InventoryPolicyDetailsPage extends React.Component<IInventoryPolicyDetails
<CooperatorLink cooperator={ inventoryPolicy.ownedBy }/>
</PropertiesItem>
}
{ ['webAvailabilityNote', 'note'].map((property) => inventoryPolicy[property] && (
<PropertiesItem key={ property } title={ t(`client:model.InventoryMaintenancePolicy.${property}`, `client:model._.${property}`) }>
{ inventoryPolicy[property] }
</PropertiesItem>
)) }
</Properties>
</CardContent>
<CardActions>
......
......@@ -26,7 +26,7 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
return (
<form onSubmit={ handleSubmit }>
<Grid container spacing={ 4 }>
<Grid item xs={ 12 } sm={ 6 }>
<Grid item xs={ 12 }>
<Field
name="maintenanceName"
label={ t('client:model.InventoryMaintenancePolicy.maintenanceName') }
......@@ -37,23 +37,7 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
validate={ required }
/>
</Grid>
<Grid item xs={ 12 } sm={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }
name="curatorCooperator"
component={ CooperatorAutocomplete }
label={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 3 }>
<Field
label={ t('client:model.InventoryMaintenancePolicy.isAutoDeducted') }
name="isAutoDeducted"
component={ YesNoSwitch }
labelPlacement="end"
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 6 }>
<Field
name="formTypeCode"
label={ t('client:model.InventoryMaintenancePolicy.formTypeCode') }
......@@ -64,7 +48,17 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
validate={ required }
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }
name="quantityOnHandUnitCode"
component={ CodeValueField }
codeGroup={ InventoryMaintenancePolicy.CodeValues.quantityOnHandUnitCode }
label={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.distributionDefaultFormCode') }
name="distributionDefaultFormCode"
......@@ -75,7 +69,17 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
validate={ required }
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }
name="distributionDefaultQuantity"
type="text"
validate={ composeValidators(decimalNumber, minValue(0)) }
component={ TextField }
label={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.distributionUnitCode') }
name="distributionUnitCode"
......@@ -84,17 +88,16 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
label={ t('client:model.InventoryMaintenancePolicy.distributionUnitCode') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }
name="distributionDefaultQuantity"
type="text"
validate={ composeValidators(decimalNumber, minValue(0)) }
component={ TextField }
label={ t('client:model.InventoryMaintenancePolicy.distributionDefaultQuantity') }
label={ t('client:model.InventoryMaintenancePolicy.isAutoDeducted') }
name="isAutoDeducted"
component={ YesNoSwitch }
labelPlacement="end"
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.distributionCriticalQuantity') }
name="distributionCriticalQuantity"
......@@ -104,16 +107,26 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
label={ t('client:model.InventoryMaintenancePolicy.distributionCriticalQuantity') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 4 }>
<Grid item xs={ 12 } sm={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }
name="quantityOnHandUnitCode"
component={ CodeValueField }
codeGroup={ InventoryMaintenancePolicy.CodeValues.quantityOnHandUnitCode }
label={ t('client:model.InventoryMaintenancePolicy.quantityOnHandUnitCode') }
placeholder={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }
name="regenerationCriticalQuantity"
type="text"
validate={ composeValidators(decimalNumber, minValue(0)) }
component={ TextField }
label={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 6 } md={ 3 }>
<Grid item xs={ 12 } sm={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }
name="curatorCooperator"
component={ CooperatorAutocomplete }
label={ t('client:model.InventoryMaintenancePolicy.curatorCooperator') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.regenerationMethodCode') }
name="regenerationMethodCode"
......@@ -122,17 +135,8 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
label={ t('client:model.InventoryMaintenancePolicy.regenerationMethodCode') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 6 } md={ 3 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }
name="regenerationCriticalQuantity"
type="text"
validate={ composeValidators(decimalNumber, minValue(0)) }
component={ TextField }
label={ t('client:model.InventoryMaintenancePolicy.regenerationCriticalQuantity') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 6 }>
<Grid item xs={ 12 } md={ 6 }>
<Field
placeholder={ t('client:model.InventoryMaintenancePolicy.webAvailabilityNote') }
name="webAvailabilityNote"
......@@ -141,7 +145,7 @@ function InventoryPolicyFormInternal(props: FormRenderProps & WithStyles) {
label={ t('client:model.InventoryMaintenancePolicy.webAvailabilityNote') }
/>
</Grid>
<Grid item xs={ 12 } sm={ 6 }>
<Grid item xs={ 12 } md={ 6 }>
<Field
placeholder={ t('client:model._.note') }
name="note"
......
Markdown is supported
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