mirror of
https://github.com/inventree/InvenTree.git
synced 2026-05-28 03:49:20 +00:00
[UI] Lock action (#11981)
- Toggle part lock directly from existing icon
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
IconListDetails,
|
||||
IconListTree,
|
||||
IconLock,
|
||||
IconLockOpen,
|
||||
IconPackages,
|
||||
IconSearch,
|
||||
IconShoppingCart,
|
||||
@@ -1132,9 +1133,20 @@ export default function PartDetail() {
|
||||
<PageDetail
|
||||
title={`${t`Part`}: ${part.full_name}`}
|
||||
icon={
|
||||
part?.locked ? (
|
||||
<IconLock aria-label='part-lock-icon' />
|
||||
) : undefined
|
||||
<ActionIcon
|
||||
aria-label='part-lock-icon'
|
||||
variant='transparent'
|
||||
disabled={!user.hasChangeRole(UserRoles.part)}
|
||||
onClick={() => {
|
||||
api
|
||||
.patch(apiUrl(ApiEndpoints.part_list, part.pk), {
|
||||
locked: !part.locked
|
||||
})
|
||||
.then(refreshInstance);
|
||||
}}
|
||||
>
|
||||
{part?.locked ? <IconLock /> : <IconLockOpen />}
|
||||
</ActionIcon>
|
||||
}
|
||||
subtitle={part.description}
|
||||
imageUrl={part.image}
|
||||
|
||||
Reference in New Issue
Block a user