Lines 3-10
Link Here
|
3 |
<div v-else id="licenses_list"> |
3 |
<div v-else id="licenses_list"> |
4 |
<Toolbar> |
4 |
<Toolbar> |
5 |
<ToolbarButton |
5 |
<ToolbarButton |
6 |
:to="{ name: 'LicensesFormAdd' }" |
6 |
action="add" |
7 |
icon="plus" |
7 |
@go-to-add-resource="goToResourceAdd" |
8 |
:title="$__('New license')" |
8 |
:title="$__('New license')" |
9 |
/> |
9 |
/> |
10 |
</Toolbar> |
10 |
</Toolbar> |
Lines 12-20
Link Here
|
12 |
<KohaTable |
12 |
<KohaTable |
13 |
ref="table" |
13 |
ref="table" |
14 |
v-bind="tableOptions" |
14 |
v-bind="tableOptions" |
15 |
@show="doShow" |
15 |
@show="goToResourceShow" |
16 |
@edit="doEdit" |
16 |
@edit="goToResourceEdit" |
17 |
@delete="doDelete" |
17 |
@delete="doResourceDelete" |
18 |
></KohaTable> |
18 |
></KohaTable> |
19 |
</div> |
19 |
</div> |
20 |
<div v-else class="alert alert-info"> |
20 |
<div v-else class="alert alert-info"> |
Lines 30-37
import { inject, ref } from "vue"
Link Here
|
30 |
import { storeToRefs } from "pinia" |
30 |
import { storeToRefs } from "pinia" |
31 |
import { APIClient } from "../../fetch/api-client.js" |
31 |
import { APIClient } from "../../fetch/api-client.js" |
32 |
import KohaTable from "../KohaTable.vue" |
32 |
import KohaTable from "../KohaTable.vue" |
|
|
33 |
import LicenseResource from "./LicenseResource.vue" |
33 |
|
34 |
|
34 |
export default { |
35 |
export default { |
|
|
36 |
extends: LicenseResource, |
35 |
setup() { |
37 |
setup() { |
36 |
const vendorStore = inject("vendorStore") |
38 |
const vendorStore = inject("vendorStore") |
37 |
const { vendors } = storeToRefs(vendorStore) |
39 |
const { vendors } = storeToRefs(vendorStore) |
Lines 39-55
export default {
Link Here
|
39 |
const AVStore = inject("AVStore") |
41 |
const AVStore = inject("AVStore") |
40 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
42 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
41 |
|
43 |
|
42 |
const { setConfirmationDialog, setMessage } = inject("mainStore") |
|
|
43 |
|
44 |
const table = ref() |
44 |
const table = ref() |
45 |
|
45 |
|
46 |
return { |
46 |
return { |
|
|
47 |
...LicenseResource.setup(), |
47 |
vendors, |
48 |
vendors, |
48 |
get_lib_from_av, |
49 |
get_lib_from_av, |
49 |
map_av_dt_filter, |
50 |
map_av_dt_filter, |
50 |
table, |
51 |
table, |
51 |
setConfirmationDialog, |
|
|
52 |
setMessage, |
53 |
license_table_settings, |
52 |
license_table_settings, |
54 |
} |
53 |
} |
55 |
}, |
54 |
}, |
Lines 66-72
export default {
Link Here
|
66 |
], |
65 |
], |
67 |
tableOptions: { |
66 |
tableOptions: { |
68 |
columns: this.getTableColumns(), |
67 |
columns: this.getTableColumns(), |
69 |
url: "/api/v1/erm/licenses", |
68 |
url: this.getResourceTableUrl(), |
70 |
options: { embed: "vendor" }, |
69 |
options: { embed: "vendor" }, |
71 |
table_settings: this.license_table_settings, |
70 |
table_settings: this.license_table_settings, |
72 |
add_filters: true, |
71 |
add_filters: true, |
Lines 102-144
export default {
Link Here
|
102 |
error => {} |
101 |
error => {} |
103 |
) |
102 |
) |
104 |
}, |
103 |
}, |
105 |
doShow: function ({ license_id }, dt, event) { |
|
|
106 |
event.preventDefault() |
107 |
this.$router.push({ name: "LicensesShow", params: { license_id } }) |
108 |
}, |
109 |
doEdit: function ({ license_id }, dt, event) { |
110 |
this.$router.push({ |
111 |
name: "LicensesFormAddEdit", |
112 |
params: { license_id }, |
113 |
}) |
114 |
}, |
115 |
doDelete: function (license, dt, event) { |
116 |
this.setConfirmationDialog( |
117 |
{ |
118 |
title: this.$__( |
119 |
"Are you sure you want to remove this license?" |
120 |
), |
121 |
message: license.name, |
122 |
accept_label: this.$__("Yes, delete"), |
123 |
cancel_label: this.$__("No, do not delete"), |
124 |
}, |
125 |
() => { |
126 |
const client = APIClient.erm |
127 |
client.licenses.delete(license.license_id).then( |
128 |
success => { |
129 |
this.setMessage( |
130 |
this.$__("License %s deleted").format( |
131 |
license.name |
132 |
), |
133 |
true |
134 |
) |
135 |
dt.draw() |
136 |
}, |
137 |
error => {} |
138 |
) |
139 |
} |
140 |
) |
141 |
}, |
142 |
getTableColumns: function () { |
104 |
getTableColumns: function () { |
143 |
let get_lib_from_av = this.get_lib_from_av |
105 |
let get_lib_from_av = this.get_lib_from_av |
144 |
|
106 |
|
Lines 150-158
export default {
Link Here
|
150 |
orderable: true, |
112 |
orderable: true, |
151 |
render: function (data, type, row, meta) { |
113 |
render: function (data, type, row, meta) { |
152 |
return ( |
114 |
return ( |
153 |
'<a href="/cgi-bin/koha/erm/licenses/' + |
115 |
'<a role="button" class="show">' + |
154 |
row.license_id + |
|
|
155 |
'" class="show">' + |
156 |
escape_str(`${row.name} (#${row.license_id})`) + |
116 |
escape_str(`${row.name} (#${row.license_id})`) + |
157 |
"</a>" |
117 |
"</a>" |
158 |
) |
118 |
) |