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