Skip to content

Commit

Permalink
feat: allow link filter to work in Link Field component
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 27, 2024
1 parent 96c65ff commit 200c931
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/components/Controls/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ const props = defineProps({
type: String,
required: true,
},
filters: {
type: Array,
default: () => [],
},
modelValue: {
type: String,
default: '',
Expand Down Expand Up @@ -122,6 +126,7 @@ const options = createResource({
params: {
txt: text.value,
doctype: props.doctype,
filters: props.filters,
},
transform: (data) => {
let allData = data.map((option) => {
Expand Down Expand Up @@ -152,6 +157,7 @@ function reload(val) {
params: {
txt: val,
doctype: props.doctype,
filters: props.filters,
},
})
options.reload()
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/SectionFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
class="form-control"
:value="data[field.name] && getUser(data[field.name]).full_name"
doctype="User"
:filters="field.filters"
@change="(data) => emit('update', field.name, data)"
:placeholder="'Select' + ' ' + field.label + '...'"
:hideMe="true"
Expand All @@ -88,6 +89,7 @@
class="form-control select-text"
:value="data[field.name]"
:doctype="field.doctype"
:filters="field.filters"
:placeholder="field.placeholder"
@change="(data) => emit('update', field.name, data)"
:onCreate="field.create"
Expand Down Expand Up @@ -144,6 +146,7 @@ const _fields = computed(() => {
if (df?.depends_on) evaluate_depends_on(df.depends_on, field)
all_fields.push({
...field,
filters: df.link_filters && JSON.parse(df.link_filters),
placeholder: field.placeholder || field.label,
})
})
Expand Down

0 comments on commit 200c931

Please sign in to comment.