Skip to content

Commit

Permalink
Merge pull request #1989 from frappe/develop
Browse files Browse the repository at this point in the history
chore(release): dev to main
  • Loading branch information
RitvikSardana committed Sep 19, 2024
2 parents 34c4b11 + a149e7e commit 71ce071
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 11 additions & 3 deletions desk/src/components/AssignmentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
<template #body-content>
<SearchComplete
class="form-control"
value="1"
search-field="is_active"
doctype="HD Agent"
:custom-filters="customFilters"
:reset-input="true"
@change="
(option) => {
Expand Down Expand Up @@ -58,7 +57,7 @@
</template>

<script setup lang="ts">
import { ref } from "vue";
import { ref, computed } from "vue";
import { createResource } from "frappe-ui";
import { UserAvatar, SearchComplete } from "@/components";
import { useUserStore } from "@/stores/user";
Expand Down Expand Up @@ -117,4 +116,13 @@ const removeCurrentAssignee = (value) => {
},
});
};
const customFilters = computed(() => {
const filters = {};
filters["is_active"] = ["=", 1];
if (Boolean(props.assignees?.length)) {
filters["name"] = ["not in", [...props.assignees.map((a) => a.name)]];
}
return filters;
});
</script>
7 changes: 7 additions & 0 deletions desk/src/components/SearchComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ const props = defineProps({
required: false,
default: false,
},
customFilters: {
type: Object,
required: false,
default: {},
},
});
const r = createListResource({
Expand All @@ -66,6 +71,7 @@ const r = createListResource({
fields: [props.labelField, props.searchField, props.valueField],
filters: {
[props.searchField]: ["like", `%${props.value}%`],
...props.customFilters,
},
onSuccess: () => {
selection.value = props.value
Expand All @@ -86,6 +92,7 @@ function onUpdateQuery(query: string) {
r.update({
filters: {
[props.searchField]: ["like", `%${query}%`],
...props.customFilters,
},
});
Expand Down

0 comments on commit 71ce071

Please sign in to comment.