|
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="doShow" |
17 |
@show="doShow" |
| 16 |
@edit="doEdit" |
18 |
@edit="doEdit" |
| 17 |
@delete="doDelete" |
19 |
@delete="doDelete" |
|
Lines 64-73
export default {
Link Here
|
| 64 |
button_title: this.$__("New license"), |
66 |
button_title: this.$__("New license"), |
| 65 |
}, |
67 |
}, |
| 66 |
], |
68 |
], |
|
|
69 |
searchable_additional_fields: [], |
| 70 |
searchable_av_options: [], |
| 67 |
tableOptions: { |
71 |
tableOptions: { |
| 68 |
columns: this.getTableColumns(), |
72 |
columns: this.getTableColumns(), |
| 69 |
url: "/api/v1/erm/licenses", |
73 |
url: "/api/v1/erm/licenses", |
| 70 |
options: { embed: "vendor" }, |
74 |
options: { embed: "vendor,extended_attributes,+strings" }, |
| 71 |
table_settings: this.license_table_settings, |
75 |
table_settings: this.license_table_settings, |
| 72 |
add_filters: true, |
76 |
add_filters: true, |
| 73 |
filters_options: { |
77 |
filters_options: { |
|
Lines 89-95
export default {
Link Here
|
| 89 |
}, |
93 |
}, |
| 90 |
beforeRouteEnter(to, from, next) { |
94 |
beforeRouteEnter(to, from, next) { |
| 91 |
next(vm => { |
95 |
next(vm => { |
| 92 |
vm.getLicenseCount().then(() => (vm.initialized = true)) |
96 |
vm.getLicenseCount().then(() => |
|
|
97 |
vm |
| 98 |
.getSearchableAdditionalFields() |
| 99 |
.then(() => |
| 100 |
vm |
| 101 |
.getSearchableAVOptions() |
| 102 |
.then(() => (vm.initialized = true)) |
| 103 |
) |
| 104 |
) |
| 93 |
}) |
105 |
}) |
| 94 |
}, |
106 |
}, |
| 95 |
methods: { |
107 |
methods: { |
|
Lines 102-107
export default {
Link Here
|
| 102 |
error => {} |
114 |
error => {} |
| 103 |
) |
115 |
) |
| 104 |
}, |
116 |
}, |
|
|
117 |
async getSearchableAdditionalFields() { |
| 118 |
const client = APIClient.additional_fields |
| 119 |
await client.additional_fields.getAll("erm_licenses").then( |
| 120 |
searchable_additional_fields => { |
| 121 |
this.searchable_additional_fields = |
| 122 |
searchable_additional_fields.filter( |
| 123 |
field => field.searchable |
| 124 |
) |
| 125 |
}, |
| 126 |
error => {} |
| 127 |
) |
| 128 |
}, |
| 129 |
async getSearchableAVOptions() { |
| 130 |
const client_av = APIClient.authorised_values |
| 131 |
let av_cat_array = this.searchable_additional_fields |
| 132 |
.filter(field => field.authorised_value_category) |
| 133 |
.map(field => field.authorised_value_category) |
| 134 |
|
| 135 |
await client_av.values |
| 136 |
.getCategoriesWithValues([ |
| 137 |
...new Set(av_cat_array.map(av_cat => '"' + av_cat + '"')), |
| 138 |
]) // unique |
| 139 |
.then(av_categories => { |
| 140 |
av_cat_array.forEach(av_cat => { |
| 141 |
let av_match = av_categories.find( |
| 142 |
element => element.category_name == av_cat |
| 143 |
) |
| 144 |
this.searchable_av_options[av_cat] = |
| 145 |
av_match.authorised_values.map(av => ({ |
| 146 |
value: av.value, |
| 147 |
label: av.description, |
| 148 |
})) |
| 149 |
}) |
| 150 |
}) |
| 151 |
}, |
| 105 |
doShow: function ({ license_id }, dt, event) { |
152 |
doShow: function ({ license_id }, dt, event) { |
| 106 |
event.preventDefault() |
153 |
event.preventDefault() |
| 107 |
this.$router.push({ name: "LicensesShow", params: { license_id } }) |
154 |
this.$router.push({ name: "LicensesShow", params: { license_id } }) |