Lines 12-17
Link Here
|
12 |
<KohaTable |
12 |
<KohaTable |
13 |
ref="table" |
13 |
ref="table" |
14 |
v-bind="tableOptions" |
14 |
v-bind="tableOptions" |
|
|
15 |
:searchable_additional_fields="searchable_additional_fields" |
16 |
:searchable_av_options="searchable_av_options" |
15 |
@show="goToResourceShow" |
17 |
@show="goToResourceShow" |
16 |
@edit="goToResourceEdit" |
18 |
@edit="goToResourceEdit" |
17 |
@delete="doResourceDelete" |
19 |
@delete="doResourceDelete" |
Lines 68-76
export default {
Link Here
|
68 |
vendor_count: 0, |
70 |
vendor_count: 0, |
69 |
initialized: false, |
71 |
initialized: false, |
70 |
searchTerm: null, |
72 |
searchTerm: null, |
|
|
73 |
searchable_av_options: [], |
74 |
searchable_additional_fields: [], |
71 |
tableOptions: { |
75 |
tableOptions: { |
72 |
columns: this.getTableColumns(), |
76 |
columns: this.getTableColumns(), |
73 |
options: { embed: "aliases,baskets,subscriptions+count" }, |
77 |
options: { |
|
|
78 |
embed: "aliases,baskets,subscriptions+count,extended_attributes,+strings", |
79 |
}, |
74 |
url: () => this.tableURL(), |
80 |
url: () => this.tableURL(), |
75 |
add_filters: true, |
81 |
add_filters: true, |
76 |
filters_options: { |
82 |
filters_options: { |
Lines 117-123
export default {
Link Here
|
117 |
}, |
123 |
}, |
118 |
beforeRouteEnter(to, from, next) { |
124 |
beforeRouteEnter(to, from, next) { |
119 |
next(vm => { |
125 |
next(vm => { |
120 |
vm.getVendorCount().then(() => (vm.initialized = true)) |
126 |
vm.getVendorCount().then(() => |
|
|
127 |
vm |
128 |
.getSearchableAdditionalFields() |
129 |
.then(() => |
130 |
vm |
131 |
.getSearchableAVOptions() |
132 |
.then(() => (vm.initialized = true)) |
133 |
) |
134 |
) |
121 |
if (to.query.supplier) { |
135 |
if (to.query.supplier) { |
122 |
vm.searchTerm = to.query.supplier |
136 |
vm.searchTerm = to.query.supplier |
123 |
} |
137 |
} |
Lines 231-236
export default {
Link Here
|
231 |
}, |
245 |
}, |
232 |
] |
246 |
] |
233 |
}, |
247 |
}, |
|
|
248 |
async getSearchableAdditionalFields() { |
249 |
const client = APIClient.additional_fields |
250 |
await client.additional_fields.getAll("vendor").then( |
251 |
searchable_additional_fields => { |
252 |
this.searchable_additional_fields = |
253 |
searchable_additional_fields.filter( |
254 |
field => field.searchable |
255 |
) |
256 |
}, |
257 |
error => {} |
258 |
) |
259 |
}, |
260 |
async getSearchableAVOptions() { |
261 |
const client_av = APIClient.authorised_values |
262 |
let av_cat_array = this.searchable_additional_fields |
263 |
.filter(field => field.authorised_value_category_name) |
264 |
.map(field => field.authorised_value_category_name) |
265 |
|
266 |
await client_av.values |
267 |
.getCategoriesWithValues([ |
268 |
...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')), |
269 |
]) // unique |
270 |
.then(av_categories => { |
271 |
av_cat_array.forEach(av_cat => { |
272 |
let av_match = av_categories.find( |
273 |
element => element.category_name == av_cat |
274 |
) |
275 |
this.searchable_av_options[av_cat] = |
276 |
av_match.authorised_values.map(av => ({ |
277 |
value: av.value, |
278 |
label: av.description, |
279 |
})) |
280 |
}) |
281 |
}) |
282 |
}, |
234 |
}, |
283 |
}, |
235 |
components: { flatPickr, Toolbar, ToolbarButton, KohaTable }, |
284 |
components: { flatPickr, Toolbar, ToolbarButton, KohaTable }, |
236 |
name: "VendorList", |
285 |
name: "VendorList", |