diff --git a/src/components/helper/PermissionNotFound.tsx b/src/components/helper/PermissionNotFound.tsx index 75e48c62..e2823b8b 100644 --- a/src/components/helper/PermissionNotFound.tsx +++ b/src/components/helper/PermissionNotFound.tsx @@ -1,10 +1,17 @@ +import Button from '@/components/Button'; + const PermissionNotFound = () => { return (
-

Permission Not Found

+

+ Hak Akses Tidak Ditemukan +

- You do not have permission to access this page. + Anda tidak memiliki hak akses untuk mengakses halaman ini.

+
); }; diff --git a/src/components/pages/inventory/movement/form/MovementForm.tsx b/src/components/pages/inventory/movement/form/MovementForm.tsx index b2f50361..dbb30314 100644 --- a/src/components/pages/inventory/movement/form/MovementForm.tsx +++ b/src/components/pages/inventory/movement/form/MovementForm.tsx @@ -86,6 +86,15 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => { } // ===== USE SELECT HOOKS ===== + const { + setInputValue: setSourceWarehouseSelectInputValue, + isLoadingOptions: isLoadingSourceWarehouses, + loadMore: loadMoreSourceWarehouses, + rawData: sourceWarehouses, + } = useSelect(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) diff --git a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx index 87541d8c..399468c7 100644 --- a/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx +++ b/src/components/pages/production/transfer-to-laying/TransferToLayingFormModal.tsx @@ -98,6 +98,7 @@ const TransferToLayingFormModal = () => { 'search', { category: 'GROWING', + transfer_context: 'transfer_to_laying', } ); diff --git a/src/components/pages/report/DailyMarketingsTable.tsx b/src/components/pages/report/DailyMarketingsTable.tsx index 67702035..2ed5a9cb 100644 --- a/src/components/pages/report/DailyMarketingsTable.tsx +++ b/src/components/pages/report/DailyMarketingsTable.tsx @@ -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) => ( - {props.row.original.vehicle_number} + + {formatVechicleNumber(props.row.original.vehicle_number)} + ), }, { diff --git a/src/config/constant.ts b/src/config/constant.ts index fff9fa92..120b6b6a 100644 --- a/src/config/constant.ts +++ b/src/config/constant.ts @@ -5,6 +5,7 @@ export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [ text: 'Dashboard', link: '/dashboard', icon: 'heroicons-outline:chart-bar-square', + permission: ['lti.dashboard.list'], }, { text: 'Daily Checklist', @@ -114,11 +115,13 @@ export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [ text: 'Penjualan', link: '/marketing', icon: 'heroicons-outline:currency-dollar', + permission: ['lti.marketing.delivery_order.list'], }, { text: 'Keuangan', link: '/finance', icon: 'heroicons-outline:banknotes', + permission: ['lti.finance.transactions.list'], }, { text: 'Biaya', @@ -136,26 +139,46 @@ export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [ text: 'Laporan', link: '/report', icon: 'mdi:chart-box-outline', + permission: [ + 'lti.repport.debtsupplier.list', + 'lti.repport.customerpayment.list', + 'lti.repport.purchasesupplier.list', + 'lti.repport.expense.list', + 'lti.repport.delivery.list', + 'lti.repport.gethppperkandang.list', + 'lti.repport.production_result.list', + ], submenu: [ { text: 'Keuangan', link: '/report/finance', + permission: [ + 'lti.repport.debtsupplier.list', + 'lti.repport.customerpayment.list', + ], }, { text: 'Logistik & Persediaan', link: '/report/logistic-stock', + permission: ['lti.repport.purchasesupplier.list'], }, { text: 'Biaya Operasional', link: '/report/expense', + permission: ['lti.repport.expense.list'], }, { text: 'Penjualan', link: '/report/marketing', + permission: [ + 'lti.repport.delivery.list', + 'lti.repport.gethppperkandang.list', + ], }, { text: 'Hasil Produksi', link: '/report/production-result', + permission: ['lti.repport.production_result.list'], }, ], }, @@ -204,6 +227,7 @@ export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [ 'lti.master.suppliers.list', 'lti.master.uoms.list', 'lti.master.warehouses.list', + 'lti.master.production_standards.list', ], submenu: [ { @@ -274,6 +298,7 @@ export const MAIN_DRAWER_LINKS: SidebarMenuItem[] = [ { text: 'Standar Produksi', link: '/master-data/production-standard', + permission: ['lti.master.production_standards.list'], }, ], }, diff --git a/src/config/route-permission.ts b/src/config/route-permission.ts index 44f3728e..20ee5292 100644 --- a/src/config/route-permission.ts +++ b/src/config/route-permission.ts @@ -116,7 +116,10 @@ export const ROUTE_PERMISSIONS: Record = { // Report '/report/logistic-stock/': ['lti.repport.purchasesupplier.list'], '/report/expense/': ['lti.repport.expense.list'], - '/report/marketing/': ['lti.repport.delivery.list'], + '/report/marketing/': [ + 'lti.repport.delivery.list', + 'lti.repport.gethppperkandang.list', + ], '/report/production-result/': ['lti.repport.production_result.list'], '/report/finance/': [ 'lti.repport.finance.list', diff --git a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx index 79049480..266b8740 100644 --- a/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx +++ b/src/figma-make/components/pages/daily-checklist/DailyChecklistContent.tsx @@ -1478,6 +1478,8 @@ export function DailyChecklistContent() { inputWrapper: 'flex items-center', label: 'font-semibold text-gray-900', }} + maxSize={5242880} // 5 MB + bottomLabel='Ukuran file maksimal 5MB' /> )}