4 {{ $__("Package name") }}:
7 id="package_name_filter"
8 v-model="filters.package_name"
9 @keyup.enter="filter_table"
11 {{ $__("Content type") }}:
12 <select id="content_type_filter" v-model="filters.content_type">
13 <option value="">{{ $__("All") }}</option>
15 v-for="type in av_package_content_types"
16 :key="type.authorised_values"
19 {{ type.description }}
22 {{ $__("Selection status") }}:
23 <select id="selection_type_filter" v-model="filters.selection_type">
24 <option value="0">{{ $__("All") }}</option>
25 <option value="1">{{ $__("Selected") }}</option>
26 <option value="2">{{ $__("Not selected") }}</option>
32 :value="$__('Submit')"
36 <!-- We need to display the table element to initiate DataTable -->
38 id="package_list_result"
39 :style="show_table ? 'display: block' : 'display: none'"
43 local_count_packages !== undefined &&
44 local_count_packages !== null
47 <router-link :to="local_packages_url">
49 $__("%s packages found locally").format(
55 <div id="package_list_result" class="page-section">
68 import { inject, ref, reactive } from "vue"
69 import { storeToRefs } from "pinia"
70 import { APIClient } from "../../fetch/api-client.js"
71 import { build_url_params, build_url } from "../../composables/datatables"
72 import KohaTable from "../KohaTable.vue"
76 const AVStore = inject("AVStore")
77 const { av_package_types, av_package_content_types } =
79 const { get_lib_from_av, map_av_dt_filter } = AVStore
81 const ERMStore = inject("ERMStore")
82 const { config } = ERMStore
85 const filters = reactive({
93 av_package_content_types,
103 package_name: this.$route.query.package_name || "",
104 content_type: this.$route.query.content_type || "",
105 selection_type: this.$route.query.selection_type || "",
107 let filters = this.filters
113 columns: this.getTableColumns(),
114 url: "/api/v1/erm/eholdings/ebsco/packages",
116 embed: "resources+count,vendor.name",
118 dom: '<"top pager"<"table_entries"ilp>>tr<"bottom pager"ip>',
124 table_settings: this.eholdings_titles_table_settings,
125 actions: { 0: ["show"] },
128 return filters.package_name || ""
130 content_type: function () {
131 return filters.content_type || ""
133 selection_type: function () {
134 return filters.selection_type || ""
138 show_table: build_url_params(filters).length ? true : false,
139 local_count_packages: null,
143 local_packages_url() {
144 let { href } = this.$router.resolve({
145 name: "EHoldingsLocalPackagesList",
147 return build_url(href, this.filters)
151 doShow: function ({ package_id }, dt, event) {
152 event.preventDefault()
154 name: "EHoldingsEBSCOPackagesShow",
155 params: { package_id },
158 filter_table: async function () {
159 let { href } = this.$router.resolve({
160 name: "EHoldingsEBSCOPackagesList",
162 let new_route = build_url(href, this.filters)
163 this.$router.push(new_route)
164 this.show_table = true
165 this.local_count_packages = null
167 if (this.config.settings.ERMProviders.includes("local")) {
168 const client = APIClient.erm
169 const query = this.filters
172 like: "%" + this.filters.package_name + "%",
174 ...(this.filters.content_type
175 ? { "me.content_type": this.filters.content_type }
179 client.localPackages.count(query).then(
180 count => (this.local_count_packages = count),
185 if (this.$refs.table) {
186 this.$refs.table.redraw("/api/v1/erm/eholdings/ebsco/packages")
189 getTableColumns: function () {
190 let get_lib_from_av = this.get_lib_from_av
191 let escape_str = this.escape_str
196 data: "me.package_id:me.name",
199 render: function (data, type, row, meta) {
201 '<a href="/cgi-bin/koha/erm/eholdings/ebsco/packages/' +
204 escape_str(`${row.name} (#${row.package_id})`) +
206 if (row.is_selected) {
209 '<i class="fa fa-check-square" style="color: green; float: right;" title="' +
221 render: function (data, type, row, meta) {
222 return row.vendor ? escape_str(row.vendor.name) : ""
227 data: "package_type",
230 render: function (data, type, row, meta) {
240 title: __("Content type"),
243 render: function (data, type, row, meta) {
246 "av_package_content_types",
255 components: { KohaTable },
256 name: "EHoldingsEBSCOPackagesList",