3 <div v-if="!initialized">{{ $__("Loading") }}</div>
4 <div v-else id="titles_list">
5 <Toolbar :options="this.toolbar_options" />
19 <div v-else class="dialog message">
20 {{ $__("There are no titles defined") }}
27 import Toolbar from "../Toolbar.vue"
28 import { inject, ref, reactive } from "vue"
29 import { storeToRefs } from "pinia"
30 import { APIClient } from "../../fetch/api-client.js"
31 import KohaTable from "../KohaTable.vue"
35 const AVStore = inject("AVStore")
36 const { av_title_publication_types } = storeToRefs(AVStore)
37 const { get_lib_from_av, map_av_dt_filter } = AVStore
39 const { setConfirmationDialog, setMessage } = inject("mainStore")
42 const filters = reactive({
43 publication_title: "",
48 av_title_publication_types,
54 setConfirmationDialog,
56 eholdings_titles_table_settings,
61 publication_title: this.$route.query.publication_title || "",
62 publication_type: this.$route.query.publication_type || "",
64 let filters = this.filters
70 columns: this.getTableColumns(),
71 url: "/api/v1/erm/eholdings/local/titles",
73 embed: "resources.package",
75 { search: filters.publication_title },
77 { search: filters.publication_type },
81 table_settings: this.eholdings_titles_table_settings,
85 this.map_av_dt_filter("av_title_publication_types"),
89 "-1": ["edit", "delete"],
95 to: "EHoldingsLocalTitlesFormAdd",
96 button_title: this.$__("New title"),
99 to: "EHoldingsLocalTitlesFormImport",
100 button_title: this.$__("Import from list"),
105 beforeRouteEnter(to, from, next) {
107 vm.getTitleCount().then(() => (vm.initialized = true))
111 async getTitleCount() {
112 const client = APIClient.erm
113 await client.localTitles.count().then(
115 this.title_count = count
120 doShow: function ({ title_id }, dt, event) {
121 event.preventDefault()
123 name: "EHoldingsLocalTitlesShow",
124 params: { title_id },
127 doEdit: function ({ title_id }, dt, event) {
129 name: "EHoldingsLocalTitlesFormAddEdit",
130 params: { title_id },
133 doDelete: function (title, dt, event) {
134 this.setConfirmationDialog(
137 "Are you sure you want to remove this title?"
139 message: title.publication_title,
140 accept_label: this.$__("Yes, delete"),
141 cancel_label: this.$__("No, do not delete"),
144 const client = APIClient.erm
145 client.localTitles.delete(title.title_id).then(
148 this.$__("Local title %s deleted").format(
149 title.publication_title
160 getTableColumns: function () {
161 let get_lib_from_av = this.get_lib_from_av
162 let escape_str = this.escape_str
167 data: "me.publication_title:me.title_id",
170 render: function (data, type, row, meta) {
172 '<a href="/cgi-bin/koha/erm/eholdings/local/titles/' +
176 `${row.publication_title} (#${row.title_id})`
183 title: __("Contributors"),
184 data: "first_author:first_editor",
187 render: function (data, type, row, meta) {
189 escape_str(row.first_author) +
190 (row.first_author && row.first_editor
193 escape_str(row.first_editor)
198 title: __("Publication type"),
199 data: "publication_type",
202 render: function (data, type, row, meta) {
205 "av_title_publication_types",
212 title: __("Identifier"),
213 data: "print_identifier:online_identifier",
216 render: function (data, type, row, meta) {
217 let print_identifier = row.print_identifier
218 let online_identifier = row.online_identifier
222 _("ISBN (Print): %s").format(
229 _("ISBN (Online): %s").format(
240 components: { Toolbar, KohaTable },
241 name: "EHoldingsLocalTitlesList",