|
@@ -36,11 +36,11 @@ import Access from '~/models/Access/Access'
|
|
|
import * as _ from 'lodash-es'
|
|
import * as _ from 'lodash-es'
|
|
|
import Query from '~/services/data/Query'
|
|
import Query from '~/services/data/Query'
|
|
|
import OrderBy from '~/services/data/Filters/OrderBy'
|
|
import OrderBy from '~/services/data/Filters/OrderBy'
|
|
|
-import {ORDER_BY_DIRECTION, SEARCH_STRATEGY} from '~/types/enum/data'
|
|
|
|
|
-import PageFilter from '~/services/data/Filters/PageFilter';
|
|
|
|
|
-import InArrayFilter from '~/services/data/Filters/InArrayFilter';
|
|
|
|
|
-import SearchFilter from '~/services/data/Filters/SearchFilter';
|
|
|
|
|
-import UserSearchItem from '~/models/Custom/Search/UserSearchItem';
|
|
|
|
|
|
|
+import { ORDER_BY_DIRECTION, SEARCH_STRATEGY } from '~/types/enum/data'
|
|
|
|
|
+import PageFilter from '~/services/data/Filters/PageFilter'
|
|
|
|
|
+import InArrayFilter from '~/services/data/Filters/InArrayFilter'
|
|
|
|
|
+import SearchFilter from '~/services/data/Filters/SearchFilter'
|
|
|
|
|
+import UserSearchItem from '~/models/Custom/Search/UserSearchItem'
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
/**
|
|
/**
|
|
@@ -147,7 +147,9 @@ const i18n = useI18n()
|
|
|
const accessToItem = (userSearchItem: UserSearchItem): UserListItem => {
|
|
const accessToItem = (userSearchItem: UserSearchItem): UserListItem => {
|
|
|
return {
|
|
return {
|
|
|
id: userSearchItem.id,
|
|
id: userSearchItem.id,
|
|
|
- title: userSearchItem.fullName ? userSearchItem.fullName : `(${i18n.t('missing_name')})`,
|
|
|
|
|
|
|
+ title: userSearchItem.fullName
|
|
|
|
|
+ ? userSearchItem.fullName
|
|
|
|
|
+ : `(${i18n.t('missing_name')})`,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -169,14 +171,14 @@ const activeIds = computed(() => {
|
|
|
const queryActive = new Query(
|
|
const queryActive = new Query(
|
|
|
new OrderBy('fullName', ORDER_BY_DIRECTION.ASC),
|
|
new OrderBy('fullName', ORDER_BY_DIRECTION.ASC),
|
|
|
new PageFilter(ref(1), ref(20)),
|
|
new PageFilter(ref(1), ref(20)),
|
|
|
- new InArrayFilter('id', activeIds)
|
|
|
|
|
|
|
+ new InArrayFilter('id', activeIds),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-const {
|
|
|
|
|
- data: collectionActive,
|
|
|
|
|
- pending: pendingActive,
|
|
|
|
|
-} = fetchCollection(UserSearchItem, null, queryActive)
|
|
|
|
|
-
|
|
|
|
|
|
|
+const { data: collectionActive, pending: pendingActive } = fetchCollection(
|
|
|
|
|
+ UserSearchItem,
|
|
|
|
|
+ null,
|
|
|
|
|
+ queryActive,
|
|
|
|
|
+)
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Query transmise à l'API lors des changements de filtre de recherche
|
|
* Query transmise à l'API lors des changements de filtre de recherche
|
|
@@ -184,7 +186,7 @@ const {
|
|
|
const querySearch = new Query(
|
|
const querySearch = new Query(
|
|
|
new OrderBy('fullName', ORDER_BY_DIRECTION.ASC),
|
|
new OrderBy('fullName', ORDER_BY_DIRECTION.ASC),
|
|
|
new PageFilter(ref(1), ref(20)),
|
|
new PageFilter(ref(1), ref(20)),
|
|
|
- new SearchFilter('fullName', nameFilter, SEARCH_STRATEGY.IPARTIAL)
|
|
|
|
|
|
|
+ new SearchFilter('fullName', nameFilter, SEARCH_STRATEGY.IPARTIAL),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -198,7 +200,6 @@ const {
|
|
|
|
|
|
|
|
const pending = computed(() => pendingSearch.value || pendingActive.value)
|
|
const pending = computed(() => pendingSearch.value || pendingActive.value)
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Contenu de la liste autocomplete
|
|
* Contenu de la liste autocomplete
|
|
|
*/
|
|
*/
|
|
@@ -207,10 +208,14 @@ const items: ComputedRef<Array<UserListItem>> = computed(() => {
|
|
|
return []
|
|
return []
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const activeItems: UserListItem[] = collectionActive.value.items.map(accessToItem)
|
|
|
|
|
|
|
+ const activeItems: UserListItem[] =
|
|
|
|
|
+ collectionActive.value.items.map(accessToItem)
|
|
|
const searchedItems: UserListItem[] = collectionSearch.value.items
|
|
const searchedItems: UserListItem[] = collectionSearch.value.items
|
|
|
.map(accessToItem)
|
|
.map(accessToItem)
|
|
|
- .filter(item => !collectionActive.value!.items.find(other => other.id === item.id))
|
|
|
|
|
|
|
+ .filter(
|
|
|
|
|
+ (item) =>
|
|
|
|
|
+ !collectionActive.value!.items.find((other) => other.id === item.id),
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
return activeItems.concat(searchedItems)
|
|
return activeItems.concat(searchedItems)
|
|
|
})
|
|
})
|