Lines 4-11
Link Here
|
4 |
<div v-else id="packages_list"> |
4 |
<div v-else id="packages_list"> |
5 |
<Toolbar> |
5 |
<Toolbar> |
6 |
<ToolbarButton |
6 |
<ToolbarButton |
7 |
:to="{ name: 'EHoldingsLocalPackagesFormAdd' }" |
7 |
action="add" |
8 |
icon="plus" |
8 |
@go-to-add-resource="goToResourceAdd" |
9 |
:title="$__('New package')" |
9 |
:title="$__('New package')" |
10 |
/> |
10 |
/> |
11 |
</Toolbar> |
11 |
</Toolbar> |
Lines 17-25
Link Here
|
17 |
<KohaTable |
17 |
<KohaTable |
18 |
ref="table" |
18 |
ref="table" |
19 |
v-bind="tableOptions" |
19 |
v-bind="tableOptions" |
20 |
@show="doShow" |
20 |
@show="goToResourceShow" |
21 |
@edit="doEdit" |
21 |
@edit="goToResourceEdit" |
22 |
@delete="doDelete" |
22 |
@delete="doResourceDelete" |
23 |
></KohaTable> |
23 |
></KohaTable> |
24 |
</div> |
24 |
</div> |
25 |
<div v-else class="alert alert-info"> |
25 |
<div v-else class="alert alert-info"> |
Lines 36-43
import { inject, ref, reactive } from "vue"
Link Here
|
36 |
import { storeToRefs } from "pinia" |
36 |
import { storeToRefs } from "pinia" |
37 |
import { APIClient } from "../../fetch/api-client.js" |
37 |
import { APIClient } from "../../fetch/api-client.js" |
38 |
import KohaTable from "../KohaTable.vue" |
38 |
import KohaTable from "../KohaTable.vue" |
|
|
39 |
import EHoldingsLocalPackageResource from "./EHoldingsLocalPackageResource.vue" |
39 |
|
40 |
|
40 |
export default { |
41 |
export default { |
|
|
42 |
extends: EHoldingsLocalPackageResource, |
41 |
setup() { |
43 |
setup() { |
42 |
const vendorStore = inject("vendorStore") |
44 |
const vendorStore = inject("vendorStore") |
43 |
const { vendors } = storeToRefs(vendorStore) |
45 |
const { vendors } = storeToRefs(vendorStore) |
Lines 45-52
export default {
Link Here
|
45 |
const AVStore = inject("AVStore") |
47 |
const AVStore = inject("AVStore") |
46 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
48 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
47 |
|
49 |
|
48 |
const { setConfirmationDialog, setMessage } = inject("mainStore") |
|
|
49 |
|
50 |
const table = ref() |
50 |
const table = ref() |
51 |
const filters = reactive({ |
51 |
const filters = reactive({ |
52 |
package_name: "", |
52 |
package_name: "", |
Lines 54-66
export default {
Link Here
|
54 |
}) |
54 |
}) |
55 |
|
55 |
|
56 |
return { |
56 |
return { |
|
|
57 |
...EHoldingsLocalPackageResource.setup(), |
57 |
vendors, |
58 |
vendors, |
58 |
get_lib_from_av, |
59 |
get_lib_from_av, |
59 |
map_av_dt_filter, |
60 |
map_av_dt_filter, |
60 |
table, |
61 |
table, |
61 |
filters, |
62 |
filters, |
62 |
setConfirmationDialog, |
|
|
63 |
setMessage, |
64 |
escape_str, |
63 |
escape_str, |
65 |
eholdings_packages_table_settings, |
64 |
eholdings_packages_table_settings, |
66 |
} |
65 |
} |
Lines 76-82
export default {
Link Here
|
76 |
initialized: false, |
75 |
initialized: false, |
77 |
tableOptions: { |
76 |
tableOptions: { |
78 |
columns: this.getTableColumns(), |
77 |
columns: this.getTableColumns(), |
79 |
url: "/api/v1/erm/eholdings/local/packages", |
78 |
url: this.getResourceTableUrl(), |
80 |
options: { |
79 |
options: { |
81 |
embed: "resources+count,vendor.name", |
80 |
embed: "resources+count,vendor.name", |
82 |
searchCols: [ |
81 |
searchCols: [ |
Lines 122-167
export default {
Link Here
|
122 |
error => {} |
121 |
error => {} |
123 |
) |
122 |
) |
124 |
}, |
123 |
}, |
125 |
doShow: function ({ package_id }, dt, event) { |
|
|
126 |
event.preventDefault() |
127 |
this.$router.push({ |
128 |
name: "EHoldingsLocalPackagesShow", |
129 |
params: { package_id }, |
130 |
}) |
131 |
}, |
132 |
doEdit: function ({ package_id }, dt, event) { |
133 |
this.$router.push({ |
134 |
name: "EHoldingsLocalPackagesFormAddEdit", |
135 |
params: { package_id }, |
136 |
}) |
137 |
}, |
138 |
doDelete: function (erm_package, dt, event) { |
139 |
this.setConfirmationDialog( |
140 |
{ |
141 |
title: this.$__( |
142 |
"Are you sure you want to remove this package?" |
143 |
), |
144 |
message: erm_package.name, |
145 |
accept_label: this.$__("Yes, delete"), |
146 |
cancel_label: this.$__("No, do not delete"), |
147 |
}, |
148 |
() => { |
149 |
const client = APIClient.erm |
150 |
client.localPackages.delete(erm_package.package_id).then( |
151 |
success => { |
152 |
this.setMessage( |
153 |
this.$__("Local package %s deleted").format( |
154 |
erm_package.name |
155 |
), |
156 |
true |
157 |
) |
158 |
dt.draw() |
159 |
}, |
160 |
error => {} |
161 |
) |
162 |
} |
163 |
) |
164 |
}, |
165 |
getTableColumns: function () { |
124 |
getTableColumns: function () { |
166 |
let get_lib_from_av = this.get_lib_from_av |
125 |
let get_lib_from_av = this.get_lib_from_av |
167 |
let escape_str = this.escape_str |
126 |
let escape_str = this.escape_str |
Lines 173-181
export default {
Link Here
|
173 |
orderable: true, |
132 |
orderable: true, |
174 |
render: function (data, type, row, meta) { |
133 |
render: function (data, type, row, meta) { |
175 |
return ( |
134 |
return ( |
176 |
'<a href="/cgi-bin/koha/erm/eholdings/local/packages/' + |
135 |
'<a role="button" class="show">' + |
177 |
row.package_id + |
|
|
178 |
'" class="show">' + |
179 |
escape_str(`${row.name} (#${row.package_id})`) + |
136 |
escape_str(`${row.name} (#${row.package_id})`) + |
180 |
"</a>" |
137 |
"</a>" |
181 |
) |
138 |
) |