Merge branch 'bugfix/FE/ISSUE/build-error' into 'feat/FE/US-33/TASK-40-slicing-ui-for-master-data-forms'

[FIX/FE][ISSUE] Fix Issue for Next.js Build

See merge request mbugroup/lti-web-client!4
This commit is contained in:
Rivaldi A N S
2025-10-09 07:50:58 +00:00
8 changed files with 47 additions and 20 deletions
+3 -1
View File
@@ -189,6 +189,8 @@ const MainDrawer = ({
); );
const traverseMenuTitle = (menu: typeof activeMenu) => { const traverseMenuTitle = (menu: typeof activeMenu) => {
if (!menu) return;
const hasSubmenu = menu?.submenu && menu?.submenu.length > 0; const hasSubmenu = menu?.submenu && menu?.submenu.length > 0;
if (!title) { if (!title) {
@@ -197,7 +199,7 @@ const MainDrawer = ({
title += ' - ' + menu?.title; title += ' - ' + menu?.title;
} }
if (!hasSubmenu) return; if (!hasSubmenu || !menu.submenu) return;
const activeSubmenu = menu.submenu?.find((item) => const activeSubmenu = menu.submenu?.find((item) =>
isPathActive(pathname, item.link) isPathActive(pathname, item.link)
@@ -192,7 +192,7 @@ const AreasTable = () => {
} else { } else {
updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc'); updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc');
} }
}, [sorting]); }, [sorting, updateFilter]);
return ( return (
<> <>
@@ -231,7 +231,7 @@ const KandangsTable = () => {
updateSortingFilter('nameSort', nameSortFilter); updateSortingFilter('nameSort', nameSortFilter);
updateSortingFilter('locationSort', locationSortFilter); updateSortingFilter('locationSort', locationSortFilter);
updateSortingFilter('picSort', picSortFilter); updateSortingFilter('picSort', picSortFilter);
}, [sorting]); }, [sorting, updateSortingFilter]);
return ( return (
<> <>
@@ -230,7 +230,7 @@ const LocationsTable = () => {
updateSortingFilter('nameSort', nameSortFilter); updateSortingFilter('nameSort', nameSortFilter);
updateSortingFilter('addressSort', addressSortFilter); updateSortingFilter('addressSort', addressSortFilter);
updateSortingFilter('areaSort', areaSortFilter); updateSortingFilter('areaSort', areaSortFilter);
}, [sorting]); }, [sorting, updateSortingFilter]);
return ( return (
<> <>
@@ -66,7 +66,12 @@ const RowOptionsMenu = ({
color='error' color='error'
className='text-error hover:text-inherit' className='text-error hover:text-inherit'
> >
<Icon icon='mdi:delete-outline' width={16} height={16} className='justify-start text-sm' /> <Icon
icon='mdi:delete-outline'
width={16}
height={16}
className='justify-start text-sm'
/>
Delete Delete
</Button> </Button>
</div> </div>
@@ -96,7 +101,9 @@ const ProductCategoryTable = () => {
const deleteModal = useModal(); const deleteModal = useModal();
const [selectedProductCategory, setSelectedProductCategory] = useState<ProductCategory | undefined>(undefined); const [selectedProductCategory, setSelectedProductCategory] = useState<
ProductCategory | undefined
>(undefined);
const [isDeleteLoading, setIsDeleteLoading] = useState(false); const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const [sorting, setSorting] = useState<SortingState>([]); const [sorting, setSorting] = useState<SortingState>([]);
@@ -186,7 +193,7 @@ const ProductCategoryTable = () => {
} else { } else {
updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc'); updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc');
} }
}, [sorting]); }, [sorting, updateFilter]);
return ( return (
<> <>
@@ -221,18 +228,30 @@ const ProductCategoryTable = () => {
</div> </div>
</div> </div>
<Table<ProductCategory> <Table<ProductCategory>
data={isResponseSuccess(productCategories) ? productCategories?.data : []} data={
isResponseSuccess(productCategories) ? productCategories?.data : []
}
columns={productCategoryColumns} columns={productCategoryColumns}
pageSize={tableFilterState.pageSize} pageSize={tableFilterState.pageSize}
page={isResponseSuccess(productCategories) ? productCategories?.meta?.page : 0} page={
totalItems={isResponseSuccess(productCategories) ? productCategories?.meta?.total_results : 0} isResponseSuccess(productCategories)
? productCategories?.meta?.page
: 0
}
totalItems={
isResponseSuccess(productCategories)
? productCategories?.meta?.total_results
: 0
}
onPageChange={setPage} onPageChange={setPage}
isLoading={isLoading} isLoading={isLoading}
sorting={sorting} sorting={sorting}
setSorting={setSorting} setSorting={setSorting}
className={{ className={{
containerClassName: cn({ containerClassName: cn({
'mb-20': isResponseSuccess(productCategories) && productCategories?.data?.length === 0, 'mb-20':
isResponseSuccess(productCategories) &&
productCategories?.data?.length === 0,
}), }),
tableWrapperClassName: 'overflow-x-auto min-h-full!', tableWrapperClassName: 'overflow-x-auto min-h-full!',
tableClassName: 'font-inter w-full table-auto min-h-full!', tableClassName: 'font-inter w-full table-auto min-h-full!',
@@ -263,4 +282,4 @@ const ProductCategoryTable = () => {
); );
}; };
export default ProductCategoryTable; export default ProductCategoryTable;
@@ -116,7 +116,9 @@ const ProductsTable = () => {
); );
const deleteModal = useModal(); const deleteModal = useModal();
const [selectedProduct, setSelectedProduct] = useState<Product | undefined>(undefined); const [selectedProduct, setSelectedProduct] = useState<Product | undefined>(
undefined
);
const [isDeleteLoading, setIsDeleteLoading] = useState(false); const [isDeleteLoading, setIsDeleteLoading] = useState(false);
const [sorting, setSorting] = useState<SortingState>([]); const [sorting, setSorting] = useState<SortingState>([]);
@@ -153,12 +155,14 @@ const ProductsTable = () => {
{ {
accessorKey: 'product_price', accessorKey: 'product_price',
header: 'Harga Produk', header: 'Harga Produk',
cell: (props) => props.row.original.product_price?.toLocaleString() ?? '-', cell: (props) =>
props.row.original.product_price?.toLocaleString() ?? '-',
}, },
{ {
accessorKey: 'selling_price', accessorKey: 'selling_price',
header: 'Harga Jual', header: 'Harga Jual',
cell: (props) => props.row.original.selling_price?.toLocaleString() ?? '-', cell: (props) =>
props.row.original.selling_price?.toLocaleString() ?? '-',
}, },
{ {
accessorKey: 'tax', accessorKey: 'tax',
@@ -261,13 +265,15 @@ const ProductsTable = () => {
const nameSortFilter = sorting.find((sortItem) => sortItem.id === 'name'); const nameSortFilter = sorting.find((sortItem) => sortItem.id === 'name');
const skuSortFilter = sorting.find((sortItem) => sortItem.id === 'sku'); const skuSortFilter = sorting.find((sortItem) => sortItem.id === 'sku');
const brandSortFilter = sorting.find((sortItem) => sortItem.id === 'brand'); const brandSortFilter = sorting.find((sortItem) => sortItem.id === 'brand');
const categorySortFilter = sorting.find((sortItem) => sortItem.id === 'product_category'); const categorySortFilter = sorting.find(
(sortItem) => sortItem.id === 'product_category'
);
updateSortingFilter('nameSort', nameSortFilter); updateSortingFilter('nameSort', nameSortFilter);
updateSortingFilter('skuSort', skuSortFilter); updateSortingFilter('skuSort', skuSortFilter);
updateSortingFilter('brandSort', brandSortFilter); updateSortingFilter('brandSort', brandSortFilter);
updateSortingFilter('categorySort', categorySortFilter); updateSortingFilter('categorySort', categorySortFilter);
}, [sorting]); }, [sorting, updateSortingFilter]);
return ( return (
<> <>
@@ -347,4 +353,4 @@ const ProductsTable = () => {
); );
}; };
export default ProductsTable; export default ProductsTable;
@@ -192,7 +192,7 @@ const UomsTable = () => {
} else { } else {
updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc'); updateFilter('nameSort', isNameSorted.desc ? 'desc' : 'asc');
} }
}, [sorting]); }, [sorting, updateFilter]);
return ( return (
<> <>
@@ -270,7 +270,7 @@ const WarehousesTable = () => {
updateSortingFilter('areaSort', areaSortFilter); updateSortingFilter('areaSort', areaSortFilter);
updateSortingFilter('locationSort', locationSortFilter); updateSortingFilter('locationSort', locationSortFilter);
updateSortingFilter('kandangSort', kandangSortFilter); updateSortingFilter('kandangSort', kandangSortFilter);
}, [sorting]); }, [sorting, updateSortingFilter]);
return ( return (
<> <>