mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 23:05:46 +00:00
refactor(FE-64): update MovementTable and TableRowOptions to conditionally show edit and delete options
This commit is contained in:
@@ -157,8 +157,9 @@ const MovementTable = () => {
|
|||||||
type='dropdown'
|
type='dropdown'
|
||||||
recordId={props.row.original.id}
|
recordId={props.row.original.id}
|
||||||
basePath='/inventory/movement'
|
basePath='/inventory/movement'
|
||||||
onDelete={deleteClickHandler}
|
|
||||||
queryParam='movementId'
|
queryParam='movementId'
|
||||||
|
showEdit={false}
|
||||||
|
showDelete={false}
|
||||||
/>
|
/>
|
||||||
</RowDropdownOptions>
|
</RowDropdownOptions>
|
||||||
)}
|
)}
|
||||||
@@ -169,8 +170,9 @@ const MovementTable = () => {
|
|||||||
type='collapse'
|
type='collapse'
|
||||||
recordId={props.row.original.id}
|
recordId={props.row.original.id}
|
||||||
basePath='/inventory/movement'
|
basePath='/inventory/movement'
|
||||||
onDelete={deleteClickHandler}
|
|
||||||
queryParam='movementId'
|
queryParam='movementId'
|
||||||
|
showEdit={false}
|
||||||
|
showDelete={false}
|
||||||
/>
|
/>
|
||||||
</RowCollapseOptions>
|
</RowCollapseOptions>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ interface TableRowOptionsProps {
|
|||||||
basePath: string;
|
basePath: string;
|
||||||
onDelete?: () => void;
|
onDelete?: () => void;
|
||||||
queryParam?: string;
|
queryParam?: string;
|
||||||
|
showEdit?: boolean;
|
||||||
|
showDelete?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TableRowOptions = ({
|
export const TableRowOptions = ({
|
||||||
@@ -16,6 +18,8 @@ export const TableRowOptions = ({
|
|||||||
basePath,
|
basePath,
|
||||||
onDelete,
|
onDelete,
|
||||||
queryParam = 'id',
|
queryParam = 'id',
|
||||||
|
showEdit = true,
|
||||||
|
showDelete = true,
|
||||||
}: TableRowOptionsProps) => (
|
}: TableRowOptionsProps) => (
|
||||||
<div
|
<div
|
||||||
tabIndex={type === 'dropdown' ? 0 : undefined}
|
tabIndex={type === 'dropdown' ? 0 : undefined}
|
||||||
@@ -36,16 +40,18 @@ export const TableRowOptions = ({
|
|||||||
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{showEdit && (
|
||||||
href={`${basePath}/detail/edit/?${queryParam}=${recordId}`}
|
<Button
|
||||||
variant='ghost'
|
href={`${basePath}/detail/edit/?${queryParam}=${recordId}`}
|
||||||
color='warning'
|
variant='ghost'
|
||||||
className='justify-start text-sm'
|
color='warning'
|
||||||
>
|
className='justify-start text-sm'
|
||||||
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
>
|
||||||
Edit
|
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
||||||
</Button>
|
Edit
|
||||||
{onDelete && (
|
</Button>
|
||||||
|
)}
|
||||||
|
{showDelete && onDelete && (
|
||||||
<Button
|
<Button
|
||||||
onClick={onDelete}
|
onClick={onDelete}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
|
|||||||
Reference in New Issue
Block a user