mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 14:55:44 +00:00
fix(FE): remove bypass permission in marketing detail and form page
This commit is contained in:
@@ -77,10 +77,6 @@ const MarketingDetail = ({
|
|||||||
confirmationModal.openModal();
|
confirmationModal.openModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
const deliveryClickHandler = () => {
|
|
||||||
deliveryModal.openModal();
|
|
||||||
};
|
|
||||||
|
|
||||||
const deleteClickHandler = () => {
|
const deleteClickHandler = () => {
|
||||||
deleteModal.openModal();
|
deleteModal.openModal();
|
||||||
};
|
};
|
||||||
@@ -135,7 +131,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,20 +143,9 @@ 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}
|
||||||
@@ -172,23 +157,12 @@ 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
|
<RequirePermission
|
||||||
permissions={
|
permissions={
|
||||||
initialValues?.latest_approval?.step_number == 3
|
initialValues?.latest_approval?.step_number == 3
|
||||||
? 'lti.marketing.delivery_order.update'
|
? 'lti.marketing.delivery_order.update'
|
||||||
@@ -209,21 +183,7 @@ const MarketingDetail = ({
|
|||||||
: 'Tambah '}
|
: 'Tambah '}
|
||||||
Delivery Order
|
Delivery Order
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission> */}
|
</RequirePermission>
|
||||||
<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>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -466,7 +426,7 @@ 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
|
<Button
|
||||||
color='warning'
|
color='warning'
|
||||||
type='button'
|
type='button'
|
||||||
@@ -475,27 +435,15 @@ const MarketingDetail = ({
|
|||||||
<Icon icon='mdi:pencil' width={24} height={24} />
|
<Icon icon='mdi:pencil' width={24} height={24} />
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
</RequirePermission> */}
|
</RequirePermission>
|
||||||
<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 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
|
||||||
|
|||||||
@@ -635,12 +635,6 @@ const MarketingForm = ({
|
|||||||
wrapper: 'bg-white w-full',
|
wrapper: 'bg-white w-full',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* <div className='text-blue-500'>
|
|
||||||
{JSON.stringify(formik.values)}
|
|
||||||
</div>
|
|
||||||
<div className='text-red-500'>
|
|
||||||
{JSON.stringify(formik.errors)}
|
|
||||||
</div> */}
|
|
||||||
<MemoizedDeliveryOrderProductTable
|
<MemoizedDeliveryOrderProductTable
|
||||||
formType={formType}
|
formType={formType}
|
||||||
data={deliveryOrderValues}
|
data={deliveryOrderValues}
|
||||||
@@ -690,7 +684,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,16 +694,7 @@ 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>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import SelectInput, {
|
|||||||
useSelect,
|
useSelect,
|
||||||
} from '@/components/input/SelectInput';
|
} from '@/components/input/SelectInput';
|
||||||
import { Kandang } from '@/types/api/master-data/kandang';
|
import { Kandang } from '@/types/api/master-data/kandang';
|
||||||
import { KandangApi, WarehouseApi } from '@/services/api/master-data';
|
import { WarehouseApi } from '@/services/api/master-data';
|
||||||
import { ProductWarehouse } from '@/types/api/inventory/product-warehouse';
|
import { ProductWarehouse } from '@/types/api/inventory/product-warehouse';
|
||||||
import { ProductWarehouseApi } from '@/services/api/inventory';
|
import { ProductWarehouseApi } from '@/services/api/inventory';
|
||||||
import NumberInput from '@/components/input/NumberInput';
|
import NumberInput from '@/components/input/NumberInput';
|
||||||
@@ -180,9 +180,6 @@ const SalesOrderProductForm = ({
|
|||||||
</Alert>
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{/* <small className='block text-rose-500'>
|
|
||||||
{JSON.stringify(formik.errors)}
|
|
||||||
</small> */}
|
|
||||||
<div className='grid sm:grid-cols-2 gap-4 z-200'>
|
<div className='grid sm:grid-cols-2 gap-4 z-200'>
|
||||||
<PatternInput
|
<PatternInput
|
||||||
name='vehicle_number'
|
name='vehicle_number'
|
||||||
|
|||||||
@@ -32,38 +32,6 @@ const DeliveryOrderProductTable = ({
|
|||||||
|
|
||||||
const columns = useMemo(() => {
|
const columns = useMemo(() => {
|
||||||
const cols = [
|
const cols = [
|
||||||
// {
|
|
||||||
// id: 'select',
|
|
||||||
// header: ({
|
|
||||||
// table,
|
|
||||||
// }: {
|
|
||||||
// table: TanStack.Table<DeliveryOrderProductFormValues>;
|
|
||||||
// }) => (
|
|
||||||
// <div className='w-full flex flex-row justify-center'>
|
|
||||||
// <CheckboxInput
|
|
||||||
// name='allRow'
|
|
||||||
// checked={table.getIsAllRowsSelected()}
|
|
||||||
// indeterminate={table.getIsSomeRowsSelected()}
|
|
||||||
// onChange={table.getToggleAllRowsSelectedHandler()}
|
|
||||||
// />
|
|
||||||
// </div>
|
|
||||||
// ),
|
|
||||||
// cell: ({
|
|
||||||
// row,
|
|
||||||
// }: {
|
|
||||||
// row: TanStack.Row<DeliveryOrderProductFormValues>;
|
|
||||||
// }) => (
|
|
||||||
// <div>
|
|
||||||
// <CheckboxInput
|
|
||||||
// name='row'
|
|
||||||
// checked={row.getIsSelected()}
|
|
||||||
// disabled={!row.getCanSelect()}
|
|
||||||
// indeterminate={row.getIsSomeSelected()}
|
|
||||||
// onChange={row.getToggleSelectedHandler()}
|
|
||||||
// />
|
|
||||||
// </div>
|
|
||||||
// ),
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
accessorFn: (row: DeliveryOrderProductFormValues) => row.do_number,
|
accessorFn: (row: DeliveryOrderProductFormValues) => row.do_number,
|
||||||
header: 'No. Pengiriman',
|
header: 'No. Pengiriman',
|
||||||
@@ -188,18 +156,6 @@ const DeliveryOrderProductTable = ({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!props.row.original.qty && '-'}
|
{!props.row.original.qty && '-'}
|
||||||
{/* {formType == 'add_deliver' && (
|
|
||||||
<Button
|
|
||||||
color='error'
|
|
||||||
className='p-1'
|
|
||||||
onClick={() =>
|
|
||||||
onDeleteRef.current(props.row.original.id as number)
|
|
||||||
}
|
|
||||||
type='button'
|
|
||||||
>
|
|
||||||
<Icon icon='mdi:trash' width={16} height={16} />
|
|
||||||
</Button>
|
|
||||||
)} */}
|
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@@ -248,22 +204,6 @@ const DeliveryOrderProductTable = ({
|
|||||||
<Icon icon='mdi:plus' width={16} height={16} />
|
<Icon icon='mdi:plus' width={16} height={16} />
|
||||||
Tambah Pengiriman
|
Tambah Pengiriman
|
||||||
</Button>
|
</Button>
|
||||||
{/* {selectedRowIds.length > 0 && (
|
|
||||||
<Button
|
|
||||||
type='button'
|
|
||||||
variant='outline'
|
|
||||||
color='error'
|
|
||||||
className='justify-start w-fit py-1 text-sm'
|
|
||||||
onClick={onBulkDelete}
|
|
||||||
>
|
|
||||||
<Icon icon='mdi:trash' width={16} height={16} />
|
|
||||||
Hapus
|
|
||||||
{selectedRowIds.length > 0
|
|
||||||
? ` (${selectedRowIds.length})`
|
|
||||||
: ''}{' '}
|
|
||||||
Pengiriman
|
|
||||||
</Button>
|
|
||||||
)} */}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user