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