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