mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'development' of gitlab.com:mbugroup/lti-web-client into dev/restu
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import Card from '@/components/Card';
|
||||
|
||||
import Table from '@/components/Table';
|
||||
import { formatCurrency, formatNumber } from '@/lib/helper';
|
||||
import { formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
||||
import {
|
||||
RowSapronakCalculation,
|
||||
TotalSapronakCalculation,
|
||||
@@ -38,23 +38,29 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'Tanggal',
|
||||
accessorKey: 'tanggal',
|
||||
cell: (props) => (props.getValue() as string) || '-',
|
||||
cell: (props) =>
|
||||
props.row.original.tanggal
|
||||
? formatDate(props.row.original.tanggal, 'DD MMM YYYY')
|
||||
: '-',
|
||||
footer: 'Total',
|
||||
},
|
||||
{
|
||||
header: 'No. Referensi',
|
||||
accessorKey: 'no_referensi',
|
||||
cell: (props) => (props.getValue() as string) || '-',
|
||||
cell: (props) => (props.row.original.no_referensi as string) || '-',
|
||||
footer: '',
|
||||
},
|
||||
{
|
||||
header: 'QTY Masuk',
|
||||
accessorKey: 'qty_masuk',
|
||||
cell: (props) => formatNumber(props.getValue() as number),
|
||||
cell: (props) =>
|
||||
props.row.original.qty_masuk
|
||||
? formatNumber(props.row.original.qty_masuk as number)
|
||||
: '-',
|
||||
footer: total
|
||||
? () => (
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{formatNumber(total?.qty_masuk)}
|
||||
{total?.qty_masuk ? formatNumber(total?.qty_masuk) : '-'}
|
||||
</div>
|
||||
)
|
||||
: '',
|
||||
@@ -62,11 +68,14 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'QTY Keluar',
|
||||
accessorKey: 'qty_keluar',
|
||||
cell: (props) => formatNumber(props.getValue() as number),
|
||||
cell: (props) =>
|
||||
props.row.original.qty_keluar
|
||||
? formatNumber(props.row.original.qty_keluar as number)
|
||||
: '-',
|
||||
footer: total
|
||||
? () => (
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{formatNumber(total?.qty_keluar)}
|
||||
{total?.qty_keluar ? formatNumber(total?.qty_keluar) : '-'}
|
||||
</div>
|
||||
)
|
||||
: '',
|
||||
@@ -74,11 +83,14 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'QTY Pakai',
|
||||
accessorKey: 'qty_pakai',
|
||||
cell: (props) => formatNumber(props.getValue() as number),
|
||||
cell: (props) =>
|
||||
props.row.original.qty_pakai
|
||||
? formatNumber(props.row.original.qty_pakai as number)
|
||||
: '-',
|
||||
footer: total
|
||||
? () => (
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{formatNumber(total?.qty_pakai)}
|
||||
{total?.qty_pakai ? formatNumber(total?.qty_pakai) : '-'}
|
||||
</div>
|
||||
)
|
||||
: '',
|
||||
@@ -86,23 +98,28 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'Uraian',
|
||||
accessorKey: 'uraian',
|
||||
cell: (props) => (props.getValue() as string) || '-',
|
||||
cell: (props) => (props.row.original.uraian as string) || '-',
|
||||
footer: '',
|
||||
},
|
||||
{
|
||||
header: 'Kategori Produk',
|
||||
accessorKey: 'kategori_produk',
|
||||
cell: (props) => (props.getValue() as string) || '-',
|
||||
cell: (props) => (props.row.original.kategori_produk as string) || '-',
|
||||
footer: '',
|
||||
},
|
||||
{
|
||||
header: 'Harga Beli/Qty (Rp)',
|
||||
accessorKey: 'harga_beli_per_qty',
|
||||
cell: (props) => formatCurrency(props.getValue() as number),
|
||||
cell: (props) =>
|
||||
props.row.original.harga_beli_per_qty
|
||||
? formatCurrency(props.row.original.harga_beli_per_qty as number)
|
||||
: '-',
|
||||
footer: total
|
||||
? () => (
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{formatCurrency(total?.harga_beli_per_qty)}
|
||||
{total?.harga_beli_per_qty
|
||||
? formatCurrency(total?.harga_beli_per_qty)
|
||||
: '-'}
|
||||
</div>
|
||||
)
|
||||
: '',
|
||||
@@ -110,11 +127,14 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'Total Harga (Rp)',
|
||||
accessorKey: 'total_harga',
|
||||
cell: (props) => formatCurrency(props.getValue() as number),
|
||||
cell: (props) =>
|
||||
props.row.original.total_harga
|
||||
? formatCurrency(props.row.original.total_harga as number)
|
||||
: '-',
|
||||
footer: total
|
||||
? () => (
|
||||
<div className='font-semibold text-gray-900'>
|
||||
{formatCurrency(total?.total_harga)}
|
||||
{total?.total_harga ? formatCurrency(total?.total_harga) : '-'}
|
||||
</div>
|
||||
)
|
||||
: '',
|
||||
@@ -122,7 +142,7 @@ const ClosingSapronakCalculationTable = ({
|
||||
{
|
||||
header: 'Keterangan',
|
||||
accessorKey: 'keterangan',
|
||||
cell: (props) => (props.getValue() as string) || '-',
|
||||
cell: (props) => (props.row.original.keterangan as string) || '-',
|
||||
footer: '',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -188,6 +188,8 @@ const FormFinanceAdd = ({
|
||||
value={formik.values.party_type_option}
|
||||
onChange={(value) => {
|
||||
formik.setFieldValue('party_type_option', value);
|
||||
formik.setFieldValue('party_id_option', null);
|
||||
formik.setFieldValue('party_account_number', '');
|
||||
}}
|
||||
isError={Boolean(
|
||||
formik.touched.party_type_option &&
|
||||
|
||||
@@ -189,6 +189,8 @@ const FormFinanceAddInitialBalance = ({
|
||||
value={formik.values.party_type_option}
|
||||
onChange={(value) => {
|
||||
formik.setFieldValue('party_type_option', value);
|
||||
formik.setFieldValue('party_id_option', null);
|
||||
formik.setFieldValue('party_account_number', '');
|
||||
}}
|
||||
isError={Boolean(
|
||||
formik.touched.party_type_option &&
|
||||
|
||||
@@ -52,7 +52,7 @@ const RowsOptionsMenu = ({
|
||||
)}
|
||||
>
|
||||
<div className='flex flex-col gap-1'>
|
||||
<RequirePermission permissions='lti.marketing.delivery_order.detail'>
|
||||
{/* <RequirePermission permissions='lti.marketing.delivery_order.detail'>
|
||||
<Button
|
||||
href={`/marketing/detail?marketingId=${props.row.original.id}`}
|
||||
variant='ghost'
|
||||
@@ -62,15 +62,46 @@ const RowsOptionsMenu = ({
|
||||
<Icon icon='mdi:eye-outline' width={16} height={16} />
|
||||
Detail
|
||||
</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 && (
|
||||
<RequirePermission
|
||||
permissions={
|
||||
props.row.original.latest_approval.step_number == 3
|
||||
? 'lti.marketing.delivery_order.update'
|
||||
: 'lti.marketing.delivery_order.create'
|
||||
}
|
||||
>
|
||||
<>
|
||||
{/* <RequirePermission
|
||||
permissions={
|
||||
props.row.original.latest_approval.step_number == 3
|
||||
? '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
|
||||
href={
|
||||
props.row.original.latest_approval.step_number == 3
|
||||
@@ -91,10 +122,21 @@ const RowsOptionsMenu = ({
|
||||
<Icon icon='mdi:truck' width={16} height={16} />
|
||||
Deliver
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</>
|
||||
)}
|
||||
{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
|
||||
href={`/marketing/detail/sales-orders/edit?marketingId=${props.row.original.id}`}
|
||||
variant='ghost'
|
||||
@@ -104,9 +146,9 @@ const RowsOptionsMenu = ({
|
||||
<Icon icon='mdi:pencil-outline' width={16} height={16} />
|
||||
Edit
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</>
|
||||
)}
|
||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
<Button
|
||||
onClick={deleteClickHandler}
|
||||
variant='ghost'
|
||||
@@ -116,7 +158,16 @@ const RowsOptionsMenu = ({
|
||||
<Icon icon='mdi:delete-outline' width={16} height={16} />
|
||||
Delete
|
||||
</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>
|
||||
);
|
||||
@@ -302,7 +353,7 @@ const MarketingTable = () => {
|
||||
}}
|
||||
/>
|
||||
<div className='flex flex-row gap-2'>
|
||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||
<Button
|
||||
color='success'
|
||||
onClick={approveClickHandler}
|
||||
@@ -312,9 +363,18 @@ const MarketingTable = () => {
|
||||
<Icon icon='material-symbols:check' width={24} height={24} />
|
||||
Approve
|
||||
</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
|
||||
color='error'
|
||||
onClick={rejectClickHandler}
|
||||
@@ -324,7 +384,16 @@ const MarketingTable = () => {
|
||||
<Icon icon='material-symbols:close' width={24} height={24} />
|
||||
Reject
|
||||
</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>
|
||||
<TableRowSizeSelector
|
||||
value={pageSize}
|
||||
|
||||
@@ -135,7 +135,7 @@ const MarketingDetail = ({
|
||||
<div className='flex-row flex gap-3'>
|
||||
{initialValues?.latest_approval?.step_number == 1 && (
|
||||
<>
|
||||
<RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||
{/* <RequirePermission permissions='lti.marketing.sales_order.approve'>
|
||||
<Button
|
||||
color='success'
|
||||
onClick={approveClickHandler}
|
||||
@@ -147,9 +147,20 @@ const MarketingDetail = ({
|
||||
<Icon icon='mdi:check' width={24} height={24} />
|
||||
Approve
|
||||
</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
|
||||
color='error'
|
||||
onClick={rejectClickHandler}
|
||||
@@ -161,17 +172,44 @@ const MarketingDetail = ({
|
||||
<Icon icon='mdi:close' width={24} height={24} />
|
||||
Reject
|
||||
</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 && (
|
||||
<RequirePermission
|
||||
permissions={
|
||||
initialValues?.latest_approval?.step_number == 3
|
||||
? 'lti.marketing.delivery_order.update'
|
||||
: 'lti.marketing.delivery_order.create'
|
||||
}
|
||||
>
|
||||
<>
|
||||
{/* <RequirePermission
|
||||
permissions={
|
||||
initialValues?.latest_approval?.step_number == 3
|
||||
? '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
|
||||
color='success'
|
||||
href={
|
||||
@@ -186,7 +224,7 @@ const MarketingDetail = ({
|
||||
: 'Tambah '}
|
||||
Delivery Order
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -427,7 +465,17 @@ const MarketingDetail = ({
|
||||
)}
|
||||
<div className='flex flex-row gap-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
|
||||
color='warning'
|
||||
type='button'
|
||||
@@ -436,14 +484,18 @@ const MarketingDetail = ({
|
||||
<Icon icon='mdi:pencil' width={24} height={24} />
|
||||
Edit
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</>
|
||||
)}
|
||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
<Button color='error' onClick={deleteClickHandler}>
|
||||
<Icon icon='mdi:delete' width={24} height={24} />
|
||||
Hapus
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</RequirePermission> */}
|
||||
<Button color='error' onClick={deleteClickHandler}>
|
||||
<Icon icon='mdi:delete' width={24} height={24} />
|
||||
Hapus
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<ConfirmationModal
|
||||
|
||||
@@ -690,7 +690,7 @@ const MarketingForm = ({
|
||||
{/* Actions button */}
|
||||
{formType == 'edit' && (
|
||||
<div className='flex flex-row justify-start'>
|
||||
<RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
{/* <RequirePermission permissions='lti.marketing.sales_order.delete'>
|
||||
<Button
|
||||
type='button'
|
||||
color='error'
|
||||
@@ -700,7 +700,16 @@ const MarketingForm = ({
|
||||
<Icon icon='mdi:trash' width={24} height={24} />
|
||||
Hapus
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</RequirePermission> */}
|
||||
<Button
|
||||
type='button'
|
||||
color='error'
|
||||
onClick={handleDelete}
|
||||
isLoading={isLoading}
|
||||
>
|
||||
<Icon icon='mdi:trash' width={24} height={24} />
|
||||
Hapus
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -421,8 +421,8 @@ const WarehouseForm = ({ type = 'add', initialValues }: WarehouseFormProps) => {
|
||||
value={formik.values.kandang ?? undefined}
|
||||
onChange={kandangChangeHandler}
|
||||
options={kandangOptions}
|
||||
onInputChange={setLocationSelectInputValue}
|
||||
isLoading={isLoadingLocations}
|
||||
onInputChange={setKandangSelectInputValue}
|
||||
isLoading={isLoadingKandangs}
|
||||
isError={
|
||||
formik.touched.kandangId && Boolean(formik.errors.kandangId)
|
||||
}
|
||||
|
||||
@@ -228,11 +228,18 @@ const ProjectFlockTable = ({ refresh }: { refresh?: () => void }) => {
|
||||
const confirmationModalDeleteClickHandler = async () => {
|
||||
setIsDeleteLoading(true);
|
||||
|
||||
await ProjectFlockApi.delete(selectedSingleRow?.id as number);
|
||||
const response = await ProjectFlockApi.delete(
|
||||
selectedSingleRow?.id as number
|
||||
);
|
||||
if (isResponseSuccess(response)) {
|
||||
toast.success(response?.message as string);
|
||||
}
|
||||
if (isResponseError(response)) {
|
||||
toast.error(response?.message as string);
|
||||
}
|
||||
refreshProjectFlocks();
|
||||
|
||||
deleteModal.closeModal();
|
||||
toast.success('Successfully delete Project Flock!');
|
||||
setIsDeleteLoading(false);
|
||||
setRowSelection({});
|
||||
};
|
||||
|
||||
@@ -58,14 +58,27 @@ export const ROUTE_PERMISSIONS: Record<string, string[]> = {
|
||||
'/purchase/detail/edit/': ['lti.purchase.update'],
|
||||
|
||||
// Marketing
|
||||
'/marketing/': ['lti.marketing.delivery_order.list'],
|
||||
'/marketing/add/delivery-orders/': ['lti.marketing.delivery_order.create'],
|
||||
'/marketing/add/sales-orders/': ['lti.marketing.sales_order.create'],
|
||||
'/marketing/detail/': ['lti.marketing.delivery_order.detail'],
|
||||
'/marketing/': ['lti.dashboard.list', 'lti.marketing.delivery_order.list'],
|
||||
'/marketing/add/delivery-orders/': [
|
||||
'lti.dashboard.list',
|
||||
'lti.marketing.delivery_order.create',
|
||||
],
|
||||
'/marketing/add/sales-orders/': [
|
||||
'lti.dashboard.list',
|
||||
'lti.marketing.sales_order.create',
|
||||
],
|
||||
'/marketing/detail/': [
|
||||
'lti.dashboard.list',
|
||||
'lti.marketing.delivery_order.detail',
|
||||
],
|
||||
'/marketing/detail/delivery-orders/edit/': [
|
||||
'lti.dashboard.list',
|
||||
'lti.marketing.delivery_order.update',
|
||||
],
|
||||
'/marketing/detail/sales-orders/edit/': ['lti.marketing.sales_order.update'],
|
||||
'/marketing/detail/sales-orders/edit/': [
|
||||
'lti.dashboard.list',
|
||||
'lti.marketing.sales_order.update',
|
||||
],
|
||||
|
||||
// Expense
|
||||
'/expense/': ['lti.expense.list'],
|
||||
|
||||
Reference in New Issue
Block a user