mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-21 05:45:46 +00:00
Merge branch 'development' of https://gitlab.com/mbugroup/lti-web-client into fix/marketing
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
import Button from '@/components/Button';
|
||||
|
||||
const PermissionNotFound = () => {
|
||||
return (
|
||||
<div className='w-full h-screen flex flex-col justify-center items-center gap-4'>
|
||||
<h2 className='text-2xl font-bold text-error'>Permission Not Found</h2>
|
||||
<h2 className='text-2xl font-bold text-error'>
|
||||
Hak Akses Tidak Ditemukan
|
||||
</h2>
|
||||
<p className='text-gray-600 text-center'>
|
||||
You do not have permission to access this page.
|
||||
Anda tidak memiliki hak akses untuk mengakses halaman ini.
|
||||
</p>
|
||||
<Button href='/dashboard' className='text-base-100'>
|
||||
Kembali ke Dashboard
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -86,6 +86,15 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
}
|
||||
|
||||
// ===== USE SELECT HOOKS =====
|
||||
const {
|
||||
setInputValue: setSourceWarehouseSelectInputValue,
|
||||
isLoadingOptions: isLoadingSourceWarehouses,
|
||||
loadMore: loadMoreSourceWarehouses,
|
||||
rawData: sourceWarehouses,
|
||||
} = useSelect<Warehouse>(WarehouseApi.basePath, 'id', 'name', 'search', {
|
||||
transfer_context: 'inventory_transfer',
|
||||
});
|
||||
|
||||
const {
|
||||
setInputValue: setWarehouseSelectInputValue,
|
||||
isLoadingOptions: isLoadingWarehouses,
|
||||
@@ -136,6 +145,25 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
return stockMap;
|
||||
}, [allProductWarehouses]);
|
||||
|
||||
const sourceWarehouseOptions = useMemo(() => {
|
||||
if (!isResponseSuccess(sourceWarehouses)) return [];
|
||||
|
||||
return (
|
||||
sourceWarehouses?.data.map((w) => {
|
||||
warehouseStockMap.get(w.id);
|
||||
return {
|
||||
value: w.id,
|
||||
label: w.name,
|
||||
area: w.area?.name,
|
||||
location:
|
||||
'type' in w && (w.type === 'LOKASI' || w.type === 'KANDANG')
|
||||
? w.location?.name
|
||||
: undefined,
|
||||
};
|
||||
}) || []
|
||||
);
|
||||
}, [sourceWarehouses, warehouseStockMap]);
|
||||
|
||||
const warehouseOptions = useMemo(() => {
|
||||
if (!isResponseSuccess(warehouses)) return [];
|
||||
|
||||
@@ -1354,10 +1382,10 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
placeholder='Pilih gudang asal...'
|
||||
value={formik.values.source_warehouse}
|
||||
onChange={handleSourceWarehouseChange}
|
||||
options={warehouseOptions}
|
||||
onInputChange={setWarehouseSelectInputValue}
|
||||
onMenuScrollToBottom={loadMoreWarehouses}
|
||||
isLoading={isLoadingWarehouses}
|
||||
options={sourceWarehouseOptions}
|
||||
onInputChange={setSourceWarehouseSelectInputValue}
|
||||
onMenuScrollToBottom={loadMoreSourceWarehouses}
|
||||
isLoading={isLoadingSourceWarehouses}
|
||||
isError={
|
||||
formik.touched.source_warehouse_id &&
|
||||
Boolean(formik.errors.source_warehouse_id)
|
||||
|
||||
@@ -98,6 +98,7 @@ const TransferToLayingFormModal = () => {
|
||||
'search',
|
||||
{
|
||||
category: 'GROWING',
|
||||
transfer_context: 'transfer_to_laying',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -10,7 +10,13 @@ import DebouncedTextInput from '@/components/input/DebouncedTextInput';
|
||||
import Card from '@/components/Card';
|
||||
import Collapse from '@/components/Collapse';
|
||||
|
||||
import { cn, formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
||||
import {
|
||||
cn,
|
||||
formatCurrency,
|
||||
formatDate,
|
||||
formatNumber,
|
||||
formatVechicleNumber,
|
||||
} from '@/lib/helper';
|
||||
import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { DailyMarketingRow } from '@/types/api/report/marketing';
|
||||
import { MarketingReportApi } from '@/services/api/report/marketing-report';
|
||||
@@ -94,7 +100,9 @@ const DailyMarketingsTable = ({
|
||||
accessorKey: 'vehicle_number',
|
||||
header: 'No. Polisi',
|
||||
cell: (props) => (
|
||||
<span className='text-nowrap'>{props.row.original.vehicle_number}</span>
|
||||
<span className='text-nowrap'>
|
||||
{formatVechicleNumber(props.row.original.vehicle_number)}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user