diff --git a/src/app/expense/detail/edit/page.tsx b/src/app/expense/detail/edit/page.tsx index e254f01d..2fb33484 100644 --- a/src/app/expense/detail/edit/page.tsx +++ b/src/app/expense/detail/edit/page.tsx @@ -38,9 +38,11 @@ const ExpenseEditPage = () => { !isLoadingExpense && isResponseSuccess(expense) && expense.data.latest_approval.step_number !== 5 && + expense.data.latest_approval.step_number !== 6 && (expense.data.latest_approval.step_number === 1 || expense.data.latest_approval.step_number === 2 || - expense.data.latest_approval.step_number === 3); + expense.data.latest_approval.step_number === 3 || + expense.data.latest_approval.step_number === 4); if (!isLoadingExpense && !isExpenseCanBeEdited) { router.back(); diff --git a/src/components/Card.tsx b/src/components/Card.tsx index ff4c35f2..e04fa4c7 100644 --- a/src/components/Card.tsx +++ b/src/components/Card.tsx @@ -148,7 +148,11 @@ const Card = ({ const hasContent = children || actions || footer; const titleContent = ( -
+
{title &&

{title}

} {subtitle &&

{subtitle}

} @@ -156,7 +160,7 @@ const Card = ({ {collapsible && ( + ); +}; + +export default ButtonFilter; diff --git a/src/components/helper/form/FormErrors.tsx b/src/components/helper/form/FormErrors.tsx index 4b97d033..1fd7b58f 100644 --- a/src/components/helper/form/FormErrors.tsx +++ b/src/components/helper/form/FormErrors.tsx @@ -18,7 +18,7 @@ const AlertErrorList = ({ if (formErrorList.length === 0) return null; return ( - +
diff --git a/src/components/input/SelectInput.tsx b/src/components/input/SelectInput.tsx index d35e7589..9cc9fda5 100644 --- a/src/components/input/SelectInput.tsx +++ b/src/components/input/SelectInput.tsx @@ -9,15 +9,20 @@ import Select, { SingleValue, components as ReactSelectComponents, ControlProps, + MenuListProps, } from 'react-select'; import CreatableSelect from 'react-select/creatable'; import makeAnimated from 'react-select/animated'; import { useDebounce } from 'use-debounce'; import { cn, getByPath } from '@/lib/helper'; -import useSWR from 'swr'; +import useSWRInfinite from 'swr/infinite'; import { httpClientFetcher } from '@/services/http/client'; -import { BaseApiResponse } from '@/types/api/api-general'; -import { isResponseSuccess } from '@/lib/api-helper'; +import { + BaseApiResponse, + ErrorApiResponse, + SuccessApiResponse, +} from '@/types/api/api-general'; +import { isResponseError, isResponseSuccess } from '@/lib/api-helper'; export interface OptionType { value: string | number; @@ -35,6 +40,7 @@ interface SelectInputBaseProps { bottomLabel?: ReactNode; options: T[]; optionComponent?: OptionComponent; + components?: Partial; isDisabled?: boolean; isLoading?: boolean; isClearable?: boolean; @@ -56,9 +62,13 @@ interface SelectInputBaseProps { onInputChange?: (search: string) => void; startAdornment?: ReactNode; menuPortalTarget?: HTMLElement | null; + closeMenuOnSelect?: boolean; + hideSelectedOptions?: boolean; + onMenuScrollToBottom?: ((event: WheelEvent | TouchEvent) => void) | undefined; } -interface SelectInputProps extends SelectInputBaseProps { +export interface SelectInputProps + extends SelectInputBaseProps { createables?: boolean; value?: T | T[] | null; onChange?: (val: T | T[] | null) => void; @@ -93,6 +103,29 @@ const CustomControl = < ); }; +const CustomMenuList = < + Option, + IsMulti extends boolean, + Group extends GroupBase