mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
hotfix(FE): bypass permission marketinh
This commit is contained in:
@@ -52,7 +52,7 @@ const RowsOptionsMenu = ({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className='flex flex-col gap-1'>
|
<div className='flex flex-col gap-1'>
|
||||||
<RequirePermission permissions='lti.marketing.delivery_order.detail'>
|
{/* <RequirePermission permissions='lti.marketing.delivery_order.detail'>
|
||||||
<Button
|
<Button
|
||||||
href={`/marketing/detail?marketingId=${props.row.original.id}`}
|
href={`/marketing/detail?marketingId=${props.row.original.id}`}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
@@ -62,15 +62,46 @@ const RowsOptionsMenu = ({
|
|||||||
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
||||||
Detail
|
Detail
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
href={`/marketing/detail?marketingId=${props.row.original.id}`}
|
||||||
|
variant='ghost'
|
||||||
|
color='primary'
|
||||||
|
className='justify-start text-sm'
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
||||||
|
Detail
|
||||||
|
</Button>
|
||||||
{props.row.original.latest_approval.step_number != 1 && (
|
{props.row.original.latest_approval.step_number != 1 && (
|
||||||
<RequirePermission
|
<>
|
||||||
permissions={
|
{/* <RequirePermission
|
||||||
props.row.original.latest_approval.step_number == 3
|
permissions={
|
||||||
? 'lti.marketing.delivery_order.update'
|
props.row.original.latest_approval.step_number == 3
|
||||||
: 'lti.marketing.delivery_order.create'
|
? 'lti.marketing.delivery_order.update'
|
||||||
}
|
: 'lti.marketing.delivery_order.create'
|
||||||
>
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
href={
|
||||||
|
props.row.original.latest_approval.step_number == 3
|
||||||
|
? `/marketing/detail/delivery-orders/edit?marketingId=${props.row.original.id}`
|
||||||
|
: props.row.original.latest_approval.step_number == 2
|
||||||
|
? `/marketing/add/delivery-orders?marketingId=${props.row.original.id}`
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
if (props.row.original.latest_approval.step_number == 2) {
|
||||||
|
deliveryClickHandler?.();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
variant='ghost'
|
||||||
|
color='success'
|
||||||
|
className='justify-start text-sm'
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:truck' width={16} height={16} />
|
||||||
|
Deliver
|
||||||
|
</Button>
|
||||||
|
</RequirePermission> */}
|
||||||
<Button
|
<Button
|
||||||
href={
|
href={
|
||||||
props.row.original.latest_approval.step_number == 3
|
props.row.original.latest_approval.step_number == 3
|
||||||
@@ -91,10 +122,21 @@ const RowsOptionsMenu = ({
|
|||||||
<Icon icon='mdi:truck' width={16} height={16} />
|
<Icon icon='mdi:truck' width={16} height={16} />
|
||||||
Deliver
|
Deliver
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</>
|
||||||
)}
|
)}
|
||||||
{props.row.original.latest_approval.step_number != 3 && (
|
{props.row.original.latest_approval.step_number != 3 && (
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.update'>
|
<>
|
||||||
|
{/* <RequirePermission permissions='lti.marketing.sales_order.update'>
|
||||||
|
<Button
|
||||||
|
href={`/marketing/detail/sales-orders/edit?marketingId=${props.row.original.id}`}
|
||||||
|
variant='ghost'
|
||||||
|
color='warning'
|
||||||
|
className='justify-start text-sm'
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
</RequirePermission> */}
|
||||||
<Button
|
<Button
|
||||||
href={`/marketing/detail/sales-orders/edit?marketingId=${props.row.original.id}`}
|
href={`/marketing/detail/sales-orders/edit?marketingId=${props.row.original.id}`}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
@@ -104,9 +146,9 @@ const RowsOptionsMenu = ({
|
|||||||
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</>
|
||||||
)}
|
)}
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||||
<Button
|
<Button
|
||||||
onClick={deleteClickHandler}
|
onClick={deleteClickHandler}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
@@ -116,7 +158,16 @@ const RowsOptionsMenu = ({
|
|||||||
<Icon icon='mdi:delete-outline' width={16} height={16} />
|
<Icon icon='mdi:delete-outline' width={16} height={16} />
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
onClick={deleteClickHandler}
|
||||||
|
variant='ghost'
|
||||||
|
color='error'
|
||||||
|
className='text-error hover:text-inherit justify-start text-sm'
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:delete-outline' width={16} height={16} />
|
||||||
|
Delete
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -302,7 +353,7 @@ const MarketingTable = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className='flex flex-row gap-2'>
|
<div className='flex flex-row gap-2'>
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||||
<Button
|
<Button
|
||||||
color='success'
|
color='success'
|
||||||
onClick={approveClickHandler}
|
onClick={approveClickHandler}
|
||||||
@@ -312,9 +363,18 @@ const MarketingTable = () => {
|
|||||||
<Icon icon='material-symbols:check' width={24} height={24} />
|
<Icon icon='material-symbols:check' width={24} height={24} />
|
||||||
Approve
|
Approve
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
color='success'
|
||||||
|
onClick={approveClickHandler}
|
||||||
|
className='justify-start text-sm'
|
||||||
|
disabled={disableApprove}
|
||||||
|
>
|
||||||
|
<Icon icon='material-symbols:check' width={24} height={24} />
|
||||||
|
Approve
|
||||||
|
</Button>
|
||||||
|
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||||
<Button
|
<Button
|
||||||
color='error'
|
color='error'
|
||||||
onClick={rejectClickHandler}
|
onClick={rejectClickHandler}
|
||||||
@@ -324,7 +384,16 @@ const MarketingTable = () => {
|
|||||||
<Icon icon='material-symbols:close' width={24} height={24} />
|
<Icon icon='material-symbols:close' width={24} height={24} />
|
||||||
Reject
|
Reject
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
color='error'
|
||||||
|
onClick={rejectClickHandler}
|
||||||
|
className='justify-start text-sm'
|
||||||
|
disabled={disableReject}
|
||||||
|
>
|
||||||
|
<Icon icon='material-symbols:close' width={24} height={24} />
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<TableRowSizeSelector
|
<TableRowSizeSelector
|
||||||
value={pageSize}
|
value={pageSize}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ const MarketingDetail = ({
|
|||||||
<div className='flex-row flex gap-3'>
|
<div className='flex-row flex gap-3'>
|
||||||
{initialValues?.latest_approval?.step_number == 1 && (
|
{initialValues?.latest_approval?.step_number == 1 && (
|
||||||
<>
|
<>
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||||
<Button
|
<Button
|
||||||
color='success'
|
color='success'
|
||||||
onClick={approveClickHandler}
|
onClick={approveClickHandler}
|
||||||
@@ -147,9 +147,20 @@ const MarketingDetail = ({
|
|||||||
<Icon icon='mdi:check' width={24} height={24} />
|
<Icon icon='mdi:check' width={24} height={24} />
|
||||||
Approve
|
Approve
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
color='success'
|
||||||
|
onClick={approveClickHandler}
|
||||||
|
disabled={
|
||||||
|
initialValues?.latest_approval?.step_number == 1 &&
|
||||||
|
initialValues?.latest_approval?.action == 'REJECTED'
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:check' width={24} height={24} />
|
||||||
|
Approve
|
||||||
|
</Button>
|
||||||
|
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||||
<Button
|
<Button
|
||||||
color='error'
|
color='error'
|
||||||
onClick={rejectClickHandler}
|
onClick={rejectClickHandler}
|
||||||
@@ -161,17 +172,44 @@ const MarketingDetail = ({
|
|||||||
<Icon icon='mdi:close' width={24} height={24} />
|
<Icon icon='mdi:close' width={24} height={24} />
|
||||||
Reject
|
Reject
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
color='error'
|
||||||
|
onClick={rejectClickHandler}
|
||||||
|
disabled={
|
||||||
|
initialValues?.latest_approval?.step_number == 1 &&
|
||||||
|
initialValues?.latest_approval?.action == 'REJECTED'
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:close' width={24} height={24} />
|
||||||
|
Reject
|
||||||
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{initialValues?.latest_approval?.step_number != 1 && (
|
{initialValues?.latest_approval?.step_number != 1 && (
|
||||||
<RequirePermission
|
<>
|
||||||
permissions={
|
{/* <RequirePermission
|
||||||
initialValues?.latest_approval?.step_number == 3
|
permissions={
|
||||||
? 'lti.marketing.delivery_order.update'
|
initialValues?.latest_approval?.step_number == 3
|
||||||
: 'lti.marketing.delivery_order.create'
|
? 'lti.marketing.delivery_order.update'
|
||||||
}
|
: 'lti.marketing.delivery_order.create'
|
||||||
>
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
color='success'
|
||||||
|
href={
|
||||||
|
initialValues?.latest_approval?.step_number == 3
|
||||||
|
? `/marketing/detail/delivery-orders/edit?marketingId=${initialValues?.id}`
|
||||||
|
: `/marketing/add/delivery-orders?marketingId=${initialValues?.id}`
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:truck' width={24} height={24} />
|
||||||
|
{initialValues?.latest_approval?.step_number == 3
|
||||||
|
? 'Edit '
|
||||||
|
: 'Tambah '}
|
||||||
|
Delivery Order
|
||||||
|
</Button>
|
||||||
|
</RequirePermission> */}
|
||||||
<Button
|
<Button
|
||||||
color='success'
|
color='success'
|
||||||
href={
|
href={
|
||||||
@@ -186,7 +224,7 @@ const MarketingDetail = ({
|
|||||||
: 'Tambah '}
|
: 'Tambah '}
|
||||||
Delivery Order
|
Delivery Order
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -427,7 +465,17 @@ const MarketingDetail = ({
|
|||||||
)}
|
)}
|
||||||
<div className='flex flex-row gap-3'>
|
<div className='flex flex-row gap-3'>
|
||||||
{initialValues?.latest_approval?.step_number != 3 && (
|
{initialValues?.latest_approval?.step_number != 3 && (
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.update'>
|
<>
|
||||||
|
{/* <RequirePermission permissions='lti.marketing.sales_order.update'>
|
||||||
|
<Button
|
||||||
|
color='warning'
|
||||||
|
type='button'
|
||||||
|
href={`/marketing/detail/${initialValues?.latest_approval?.step_number == 3 ? 'delivery-orders' : 'sales-orders'}/edit?marketingId=${initialValues?.id}`}
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:pencil' width={24} height={24} />
|
||||||
|
Edit
|
||||||
|
</Button>
|
||||||
|
</RequirePermission> */}
|
||||||
<Button
|
<Button
|
||||||
color='warning'
|
color='warning'
|
||||||
type='button'
|
type='button'
|
||||||
@@ -436,14 +484,18 @@ const MarketingDetail = ({
|
|||||||
<Icon icon='mdi:pencil' width={24} height={24} />
|
<Icon icon='mdi:pencil' width={24} height={24} />
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</>
|
||||||
)}
|
)}
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||||
<Button color='error' onClick={deleteClickHandler}>
|
<Button color='error' onClick={deleteClickHandler}>
|
||||||
<Icon icon='mdi:delete' width={24} height={24} />
|
<Icon icon='mdi:delete' width={24} height={24} />
|
||||||
Hapus
|
Hapus
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button color='error' onClick={deleteClickHandler}>
|
||||||
|
<Icon icon='mdi:delete' width={24} height={24} />
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ const MarketingForm = ({
|
|||||||
{/* Actions button */}
|
{/* Actions button */}
|
||||||
{formType == 'edit' && (
|
{formType == 'edit' && (
|
||||||
<div className='flex flex-row justify-start'>
|
<div className='flex flex-row justify-start'>
|
||||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||||
<Button
|
<Button
|
||||||
type='button'
|
type='button'
|
||||||
color='error'
|
color='error'
|
||||||
@@ -700,7 +700,16 @@ const MarketingForm = ({
|
|||||||
<Icon icon='mdi:trash' width={24} height={24} />
|
<Icon icon='mdi:trash' width={24} height={24} />
|
||||||
Hapus
|
Hapus
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission> */}
|
||||||
|
<Button
|
||||||
|
type='button'
|
||||||
|
color='error'
|
||||||
|
onClick={handleDelete}
|
||||||
|
isLoading={isLoading}
|
||||||
|
>
|
||||||
|
<Icon icon='mdi:trash' width={24} height={24} />
|
||||||
|
Hapus
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user