diff --git a/src/types/filter.ts b/src/types/filter.ts index 9cd867c..dd4100b 100644 --- a/src/types/filter.ts +++ b/src/types/filter.ts @@ -2,7 +2,7 @@ export type Filter = { period?: string[]; team?: string[]; status?: string[]; - limit?: boolean[]; + safe?: boolean[]; category?: string[]; isSpecial?: boolean[]; hasSpecial?: boolean[]; @@ -12,7 +12,7 @@ export type Filter = { type FilterType = "activity" | "contract"; const initialFilterConfig: Record> = { - contract: { team: [], period: [], status: [], limit: [], total: [], hasSpecial: [] }, + contract: { team: [], period: [], status: [], safe: [], total: [], hasSpecial: [] }, activity: { team: [], category: [], isSpecial: [] }, }; diff --git a/src/views/contract/ListContractView.vue b/src/views/contract/ListContractView.vue index 0ee90a9..7a4d3e8 100644 --- a/src/views/contract/ListContractView.vue +++ b/src/views/contract/ListContractView.vue @@ -61,7 +61,7 @@ scope.row.status == 'UNVERIFIED' && user.position == 'KETUA' && (user.team == scope.row.createdBy || user.team == 'TU') && - !props.row.isExceeded && + (!props.row.isExceeded || props.row.hasSpecial) && ((props.row.hasSpecial && props.row.activities.length == 1) || (!props.row.hasSpecial)) " size="small" type="primary" @click="handleVerifyActivity(props.row._id, scope.row._id)"> Verifikasi @@ -123,13 +123,13 @@ {{ scope.row.hasSpecial ? 'Ada' : 'Tidak Ada' }} - + @@ -275,11 +275,12 @@ const paginatedData = computed(() => { }); } - if (filter.value.limit?.length) { + if (filter.value.safe?.length) { paginatedData = paginatedData.filter((item) => { + const isSafe = item.hasSpecial ? ( item.activities.length == 1 ? true : false) : ( item.isExceeded ? false : true); - return filter.value.limit?.includes(item.isExceeded) + return filter.value.safe?.includes(isSafe) }); } @@ -323,8 +324,8 @@ const handleFilterChange = (newFilters: any) => { filter.value.total = newFilters.total } - if (newFilters.limit) { - filter.value.limit = newFilters.limit + if (newFilters.safe) { + filter.value.safe = newFilters.safe } if (newFilters.hasSpecial) { @@ -390,7 +391,7 @@ const clearFilter = () => { team: [], period: [], status: [], - limit: [], + safe: [], total: [] } }; @@ -418,8 +419,10 @@ const filterTeam = (value: string, row: any) => { return [...new Set(teams)].includes(value); }; -const filterLimit = (value: boolean, row: any) => { - return row.isExceeded === value; +const filterSafe = (value: boolean, row: any) => { + const isSafe = row.hasSpecial ? ( row.activities.length == 1 ? true : false) : ( row.isExceeded ? false : true); + + return isSafe === value; }; const filterHasSpecial = (value: boolean, row: any) => {