| | |
| | | import { getApprovalModuleConfig } from "../_utils/approvalModuleRegistry.js"; |
| | | import { |
| | | createModuleSearchForm, |
| | | filterRowsByModuleSearch, |
| | | formatDateRangeLabel, |
| | | getModuleSearchMeta, |
| | | } from "../_utils/approvalModuleListSearch.js"; |
| | |
| | | canEditReimbursementRow, |
| | | deleteFinReimbursement, |
| | | getReimbursementTypeByModuleKey, |
| | | enrichReimbursementListRowsWithApprovalFlow, |
| | | filterReimbursementRowsBySearch, |
| | | filterRowsByReimbursementType, |
| | | hasActiveReimbursementSearch, |
| | | mapFinReimbursementFromApi, |
| | | resolveReimbursementDeleteId, |
| | | unwrapFinReimbursementPage, |
| | |
| | | } |
| | | |
| | | const displayList = computed(() => |
| | | filterRowsByModuleSearch(props.moduleKey, list.value, searchForm) |
| | | filterReimbursementRowsBySearch(list.value, searchForm) |
| | | ); |
| | | |
| | | const hasActiveFilter = computed(() => Boolean(filterSummary.value)); |
| | |
| | | }) |
| | | ); |
| | | const { records, total } = unwrapFinReimbursementPage(res); |
| | | const mapped = filterRowsByReimbursementType( |
| | | const filtered = filterRowsByReimbursementType( |
| | | records, |
| | | reimbursementType.value |
| | | ).map(row => |
| | | ); |
| | | let mapped = filtered.map(row => |
| | | mapFinReimbursementFromApi(row, { |
| | | reimbursementType: reimbursementType.value, |
| | | moduleKey: props.moduleKey, |
| | | }) |
| | | ); |
| | | mapped = await enrichReimbursementListRowsWithApprovalFlow( |
| | | mapped, |
| | | reimbursementType.value |
| | | ); |
| | | if (hasActiveReimbursementSearch(searchForm)) { |
| | | mapped = filterReimbursementRowsBySearch(mapped, searchForm); |
| | | } |
| | | |
| | | if (page.current === 1) { |
| | | list.value = mapped; |
| | | } else { |
| | | list.value = [...list.value, ...mapped]; |
| | | } |
| | | page.total = total; |
| | | const dropped = records.length - filtered.length; |
| | | let nextTotal = |
| | | dropped > 0 ? Math.max(0, Number(total) - dropped) : Number(total); |
| | | if (hasActiveReimbursementSearch(searchForm)) { |
| | | nextTotal = list.value.length; |
| | | } |
| | | page.total = nextTotal; |
| | | |
| | | if (list.value.length >= total || records.length < page.size) { |
| | | pageStatus.value = "nomore"; |