Commit 8af78184 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Disabled "Assign barcode" button for system inventories

parent 5a7f3c42
......@@ -102,7 +102,7 @@ class BrowsePage extends React.Component<PropsFromRedux & WithTranslation & With
inventoryDialogIsOpen: false,
inventoryActionDialogIsOpen: false,
error: null,
selected: [],
selected: [] as Inventory[],
};
protected static needs = [
......@@ -138,7 +138,7 @@ class BrowsePage extends React.Component<PropsFromRedux & WithTranslation & With
};
private handleScheduleAction = (actionData: InventoryAction) => {
const { selected }: { selected: Inventory[] } = this.state;
const { selected } = this.state;
this.setState({ error: null });
const { id: ignoreId, ...usableActionData } = actionData;
......
......@@ -489,7 +489,7 @@ class InventoryDetailsPage extends React.Component<PropsFromRedux & IWithTabs &
<GridContainer>
<GridItem>
<Card>
{ inventory.barcode &&
{ (inventory.barcode && !inventory.systemInventory) &&
<div style={ { float: 'left' } }>
<QRCode width="100px" value={ inventory.barcode } />
</div>
......@@ -501,14 +501,12 @@ class InventoryDetailsPage extends React.Component<PropsFromRedux & IWithTabs &
/>
<CardActions>
<ButtonBar>
{
! inventory.barcode && <Button onClick={ this.assignBarcode } variant="contained">{ t('common:action.assignBarcode') }</Button>
}
<Button variant="outlined" color="secondary" onClick={ () => showDialog(printDialogKey) }>
{ (inventory.barcode && !inventory.systemInventory) && <Button variant="outlined" color="secondary" onClick={ () => showDialog(printDialogKey) }>
{ t('common:action.printLabel') }
</Button>
</Button> }
<P.HasAccess action={ P.InventoryData } permission={ P.write } siteId={ inventory.site.id }>
<Button onClick={ this.openInventoryDialog } variant="contained" color="primary">{ t('common:action.edit') }</Button>
{ (!inventory.barcode && !inventory.systemInventory) && <Button onClick={ this.assignBarcode } variant="contained">{ t('common:action.assignBarcode') }</Button> }
</P.HasAccess>
{ !inventory.systemInventory && <P.HasAccess action={ P.InventoryData } permission={ P.delete } siteId={ inventory.site.id }>
<Button onClick={ this.handleRemove } variant="text" color="secondary">{ t('common:action.delete') }</Button>
......
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