Lines 4-11
Link Here
|
4 |
<div v-else id="titles_list"> |
4 |
<div v-else id="titles_list"> |
5 |
<Toolbar> |
5 |
<Toolbar> |
6 |
<ToolbarButton |
6 |
<ToolbarButton |
7 |
:to="{ name: 'EHoldingsLocalTitlesFormAdd' }" |
7 |
action="add" |
8 |
icon="plus" |
8 |
@go-to-add-resource="goToResourceAdd" |
9 |
:title="$__('New title')" |
9 |
:title="$__('New title')" |
10 |
/> |
10 |
/> |
11 |
<ToolbarButton |
11 |
<ToolbarButton |
Lines 27-35
Link Here
|
27 |
<KohaTable |
27 |
<KohaTable |
28 |
ref="table" |
28 |
ref="table" |
29 |
v-bind="tableOptions" |
29 |
v-bind="tableOptions" |
30 |
@show="doShow" |
30 |
@show="goToResourceShow" |
31 |
@edit="doEdit" |
31 |
@edit="goToResourceEdit" |
32 |
@delete="doDelete" |
32 |
@delete="doResourceDelete" |
33 |
></KohaTable> |
33 |
></KohaTable> |
34 |
</div> |
34 |
</div> |
35 |
<div v-else class="alert alert-info"> |
35 |
<div v-else class="alert alert-info"> |
Lines 46-60
import { inject, ref, reactive } from "vue"
Link Here
|
46 |
import { storeToRefs } from "pinia" |
46 |
import { storeToRefs } from "pinia" |
47 |
import { APIClient } from "../../fetch/api-client.js" |
47 |
import { APIClient } from "../../fetch/api-client.js" |
48 |
import KohaTable from "../KohaTable.vue" |
48 |
import KohaTable from "../KohaTable.vue" |
|
|
49 |
import EHoldingsLocalTitleResource from "./EHoldingsLocalTitleResource.vue" |
49 |
|
50 |
|
50 |
export default { |
51 |
export default { |
|
|
52 |
extends: EHoldingsLocalTitleResource, |
51 |
setup() { |
53 |
setup() { |
52 |
const AVStore = inject("AVStore") |
54 |
const AVStore = inject("AVStore") |
53 |
const { av_title_publication_types } = storeToRefs(AVStore) |
55 |
const { av_title_publication_types } = storeToRefs(AVStore) |
54 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
56 |
const { get_lib_from_av, map_av_dt_filter } = AVStore |
55 |
|
57 |
|
56 |
const { setConfirmationDialog, setMessage } = inject("mainStore") |
|
|
57 |
|
58 |
const table = ref() |
58 |
const table = ref() |
59 |
const filters = reactive({ |
59 |
const filters = reactive({ |
60 |
publication_title: "", |
60 |
publication_title: "", |
Lines 62-75
export default {
Link Here
|
62 |
}) |
62 |
}) |
63 |
|
63 |
|
64 |
return { |
64 |
return { |
|
|
65 |
...EHoldingsLocalTitleResource.setup(), |
65 |
av_title_publication_types, |
66 |
av_title_publication_types, |
66 |
get_lib_from_av, |
67 |
get_lib_from_av, |
67 |
map_av_dt_filter, |
68 |
map_av_dt_filter, |
68 |
escape_str, |
69 |
escape_str, |
69 |
table, |
70 |
table, |
70 |
filters, |
71 |
filters, |
71 |
setConfirmationDialog, |
|
|
72 |
setMessage, |
73 |
eholdings_titles_table_settings, |
72 |
eholdings_titles_table_settings, |
74 |
} |
73 |
} |
75 |
}, |
74 |
}, |
Lines 85-91
export default {
Link Here
|
85 |
initialized: false, |
84 |
initialized: false, |
86 |
tableOptions: { |
85 |
tableOptions: { |
87 |
columns: this.getTableColumns(), |
86 |
columns: this.getTableColumns(), |
88 |
url: "/api/v1/erm/eholdings/local/titles", |
87 |
url: this.getResourceTableUrl(), |
89 |
options: { |
88 |
options: { |
90 |
embed: "resources.package", |
89 |
embed: "resources.package", |
91 |
searchCols: [ |
90 |
searchCols: [ |
Lines 124-169
export default {
Link Here
|
124 |
error => {} |
123 |
error => {} |
125 |
) |
124 |
) |
126 |
}, |
125 |
}, |
127 |
doShow: function ({ title_id }, dt, event) { |
|
|
128 |
event.preventDefault() |
129 |
this.$router.push({ |
130 |
name: "EHoldingsLocalTitlesShow", |
131 |
params: { title_id }, |
132 |
}) |
133 |
}, |
134 |
doEdit: function ({ title_id }, dt, event) { |
135 |
this.$router.push({ |
136 |
name: "EHoldingsLocalTitlesFormAddEdit", |
137 |
params: { title_id }, |
138 |
}) |
139 |
}, |
140 |
doDelete: function (title, dt, event) { |
141 |
this.setConfirmationDialog( |
142 |
{ |
143 |
title: this.$__( |
144 |
"Are you sure you want to remove this title?" |
145 |
), |
146 |
message: title.publication_title, |
147 |
accept_label: this.$__("Yes, delete"), |
148 |
cancel_label: this.$__("No, do not delete"), |
149 |
}, |
150 |
() => { |
151 |
const client = APIClient.erm |
152 |
client.localTitles.delete(title.title_id).then( |
153 |
success => { |
154 |
this.setMessage( |
155 |
this.$__("Local title %s deleted").format( |
156 |
title.publication_title |
157 |
), |
158 |
true |
159 |
) |
160 |
dt.draw() |
161 |
}, |
162 |
error => {} |
163 |
) |
164 |
} |
165 |
) |
166 |
}, |
167 |
getTableColumns: function () { |
126 |
getTableColumns: function () { |
168 |
let get_lib_from_av = this.get_lib_from_av |
127 |
let get_lib_from_av = this.get_lib_from_av |
169 |
let escape_str = this.escape_str |
128 |
let escape_str = this.escape_str |
Lines 176-184
export default {
Link Here
|
176 |
orderable: true, |
135 |
orderable: true, |
177 |
render: function (data, type, row, meta) { |
136 |
render: function (data, type, row, meta) { |
178 |
return ( |
137 |
return ( |
179 |
'<a href="/cgi-bin/koha/erm/eholdings/local/titles/' + |
138 |
'<a role="button" class="show">' + |
180 |
row.title_id + |
|
|
181 |
'" class="show">' + |
182 |
escape_str( |
139 |
escape_str( |
183 |
`${row.publication_title} (#${row.title_id})` |
140 |
`${row.publication_title} (#${row.title_id})` |
184 |
) + |
141 |
) + |