4 {{ $__("Publication title") }}:
7 id="publication_title_filter"
8 v-model="filters.publication_title"
9 @keyup.enter="filter_table"
11 {{ $__("Publication type") }}:
13 id="publication_type_filter"
14 v-model="filters.publication_type"
16 <option value="">{{ $__("All") }}</option>
18 v-for="type in av_title_publication_types"
19 :key="type.authorised_values"
20 :value="type.authorised_value"
25 {{ $__("Selection status") }}:
26 <select id="selection_type_filter" v-model="filters.selection_type">
27 <option value="0">{{ $__("All") }}</option>
28 <option value="1">{{ $__("Selected") }}</option>
29 <option value="2">{{ $__("Not selected") }}</option>
35 :value="$__('Submit')"
37 <span v-if="cannot_search">{{
38 $__("Please enter a search term")
42 <!-- We need to display the table element to initiate DataTable -->
44 id="title_list_result"
45 :style="show_table ? 'display: block' : 'display: none'"
49 local_count_titles !== undefined &&
50 local_count_titles !== null
53 <router-link :to="local_titles_url">
55 $__("%s titles found locally").format(
61 <div id="title_list_result" class="page-section">
62 <table :id="table_id"></table>
69 import { inject, createVNode, render } from "vue"
70 import { storeToRefs } from "pinia"
71 import { fetchCountLocalTitles } from "./../../fetch"
76 } from "../../composables/datatables"
80 const vendorStore = inject("vendorStore")
81 const { vendors } = storeToRefs(vendorStore)
83 const AVStore = inject("AVStore")
84 const { av_title_publication_types } = storeToRefs(AVStore)
85 const { get_lib_from_av } = AVStore
87 const table_id = "title_list"
88 useDataTable(table_id)
92 av_title_publication_types,
103 publication_title: this.$route.query.publication_title || "",
104 publication_type: this.$route.query.publication_type || "",
105 selection_type: this.$route.query.selection_type || "",
107 cannot_search: false,
109 local_count_titles: null,
115 "/cgi-bin/koha/erm/eholdings/local/titles",
120 beforeRouteEnter(to, from, next) {
126 show_title: function (title_id) {
128 "/cgi-bin/koha/erm/eholdings/ebsco/titles/" + title_id
131 filter_table: async function () {
132 if (this.filters.publication_title.length) {
133 this.cannot_search = false
134 let new_route = build_url(
135 "/cgi-bin/koha/erm/eholdings/ebsco/titles",
138 this.$router.push(new_route)
139 this.show_table = true
140 this.local_count_titles = null
141 $("#" + this.table_id)
144 if (this.erm_providers.includes("local")) {
145 this.local_count_titles = await fetchCountLocalTitles(
150 this.cannot_search = true
153 build_datatable: function () {
154 let show_title = this.show_title
155 let get_lib_from_av = this.get_lib_from_av
156 if (!this.show_table) {
157 this.show_table = build_url_params(this.filters).length
161 let filters = this.filters
162 let table_id = this.table_id
164 window["vendors"] = this.vendors.map(e => {
166 e["_str"] = e["name"]
169 let vendors_map = this.vendors.reduce((map, e) => {
173 window["av_title_publication_types"] =
174 this.av_title_publication_types.map(e => {
175 e["_id"] = e["authorised_value"]
180 let additional_filters = {
181 publication_title: function () {
182 return filters.publication_title || ""
184 publication_type: function () {
185 return filters.publication_type || ""
187 selection_type: function () {
188 return filters.selection_type || ""
191 $("#" + table_id).kohaTable(
194 url: "/api/v1/erm/eholdings/ebsco/titles",
197 dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>',
207 data: "me.publication_title",
210 render: function (data, type, row, meta) {
211 // Rendering done in drawCallback
216 title: __("Publisher name"),
217 data: "me.publisher_name",
220 render: function (data, type, row, meta) {
221 return escape_str(row.publisher_name)
225 title: __("Publication type"),
226 data: "publication_type",
229 render: function (data, type, row, meta) {
232 "av_title_publication_types",
239 title: __("Identifier"),
240 data: "print_identifier:online_identifier",
243 render: function (data, type, row, meta) {
244 let print_identifier = row.print_identifier
245 let online_identifier = row.online_identifier
249 _("ISBN (Print): %s").format(
256 _("ISBN (Online): %s").format(
265 drawCallback: function (settings) {
266 var api = new $.fn.dataTable.Api(settings)
268 if (!api.rows({ search: "applied" }).count()) return
271 $(this).find("tbody tr td:first-child"),
272 function (index, e) {
273 let tr = $(this).parent()
274 let row = api.row(tr).data()
275 if (!row) return // Happen if the table is empty
282 show_title(row.title_id)
285 `${row.publication_title} (#${row.title_id})`
288 if (row.is_selected) {
289 n = createVNode("span", {}, [
293 class: "fa fa-check-square-o",
298 title: __("Is selected"),
312 if (filters.publication_title.length) {
317 name: "EHoldingsEBSCOTitlesList",