View | Details | Raw Unified | Return to bug 32468
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesList.vue (-9 / +7 lines)
Lines 46-60 Link Here
46
        >
46
        >
47
            <div
47
            <div
48
                v-if="
48
                v-if="
49
                    local_count_titles !== undefined &&
49
                    local_title_count !== undefined &&
50
                    local_count_titles !== null
50
                    local_title_count !== null
51
                "
51
                "
52
            >
52
            >
53
                <router-link :to="local_titles_url">
53
                <router-link :to="local_titles_url">
54
                    {{
54
                    {{
55
                        $__("%s titles found locally").format(
55
                        $__("%s titles found locally").format(local_title_count)
56
                            local_count_titles
57
                        )
58
                    }}</router-link
56
                    }}</router-link
59
                >
57
                >
60
            </div>
58
            </div>
Lines 68-74 Link Here
68
<script>
66
<script>
69
import { inject, createVNode, render } from "vue"
67
import { inject, createVNode, render } from "vue"
70
import { storeToRefs } from "pinia"
68
import { storeToRefs } from "pinia"
71
import { fetchCountLocalTitles } from "./../../fetch"
69
import { fetchLocalTitleCount } from "./../../fetch"
72
import {
70
import {
73
    useDataTable,
71
    useDataTable,
74
    build_url_params,
72
    build_url_params,
Lines 106-112 export default { Link Here
106
            },
104
            },
107
            cannot_search: false,
105
            cannot_search: false,
108
            show_table: false,
106
            show_table: false,
109
            local_count_titles: null,
107
            local_title_count: null,
110
        }
108
        }
111
    },
109
    },
112
    computed: {
110
    computed: {
Lines 137-148 export default { Link Here
137
                )
135
                )
138
                this.$router.push(new_route)
136
                this.$router.push(new_route)
139
                this.show_table = true
137
                this.show_table = true
140
                this.local_count_titles = null
138
                this.local_title_count = null
141
                $("#" + this.table_id)
139
                $("#" + this.table_id)
142
                    .DataTable()
140
                    .DataTable()
143
                    .draw()
141
                    .draw()
144
                if (this.erm_providers.includes("local")) {
142
                if (this.erm_providers.includes("local")) {
145
                    this.local_count_titles = await fetchCountLocalTitles(
143
                    this.local_title_count = await fetchLocalTitleCount(
146
                        this.filters
144
                        this.filters
147
                    )
145
                    )
148
                }
146
                }
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsLocalTitlesList.vue (-13 / +8 lines)
Lines 1-14 Link Here
1
<template>
1
<template>
2
    <div>
2
    <div>
3
        <div v-if="!initialized">{{ $__("Loading") }}</div>
3
        <div v-if="!initialized">{{ $__("Loading") }}</div>
4
        <div v-else-if="titles" id="titles_list">
4
        <div v-else-if="title_count" id="titles_list">
5
            <Toolbar />
5
            <Toolbar />
6
            <div
6
            <div v-if="title_count" id="title_list_result" class="page-section">
7
                v-if="titles.length"
7
                <table v-if="title_count" :id="table_id"></table>
8
                id="title_list_result"
9
                class="page-section"
10
            >
11
                <table v-if="titles.length" :id="table_id"></table>
12
            </div>
8
            </div>
13
            <div v-else-if="initialized" class="dialog message">
9
            <div v-else-if="initialized" class="dialog message">
14
                {{ $__("There are no titles defined") }}
10
                {{ $__("There are no titles defined") }}
Lines 21-27 Link Here
21
import Toolbar from "./EHoldingsLocalTitlesToolbar.vue"
17
import Toolbar from "./EHoldingsLocalTitlesToolbar.vue"
22
import { inject, createVNode, render } from "vue"
18
import { inject, createVNode, render } from "vue"
23
import { storeToRefs } from "pinia"
19
import { storeToRefs } from "pinia"
24
import { fetchLocalTitles } from "../../fetch"
20
import { fetchLocalTitleCount } from "../../fetch"
25
import { useDataTable } from "../../composables/datatables"
21
import { useDataTable } from "../../composables/datatables"
26
22
27
export default {
23
export default {
Lines 42-48 export default { Link Here
42
    },
38
    },
43
    data: function () {
39
    data: function () {
44
        return {
40
        return {
45
            titles: [],
41
            title_count: undefined,
46
            initialized: false,
42
            initialized: false,
47
            filters: {
43
            filters: {
48
                publication_title: this.$route.query.publication_title || "",
44
                publication_title: this.$route.query.publication_title || "",
Lines 53-65 export default { Link Here
53
    },
49
    },
54
    beforeRouteEnter(to, from, next) {
50
    beforeRouteEnter(to, from, next) {
55
        next(vm => {
51
        next(vm => {
56
            vm.getTitles().then(() => vm.build_datatable())
52
            vm.getTitleCount().then(() => vm.build_datatable())
57
        })
53
        })
58
    },
54
    },
59
    methods: {
55
    methods: {
60
        async getTitles() {
56
        async getTitleCount() {
61
            const titles = await fetchLocalTitles()
57
            this.title_count = await fetchLocalTitleCount()
62
            this.titles = titles
63
            this.initialized = true
58
            this.initialized = true
64
        },
59
        },
65
        show_title: function (title_id) {
60
        show_title: function (title_id) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch.js (-12 / +17 lines)
Lines 290-308 export const fetchEBSCOTitles = function () { Link Here
290
    return _fetchTitles(apiUrl);
290
    return _fetchTitles(apiUrl);
291
};
291
};
292
292
293
export const fetchCountLocalTitles = async function (filters) {
293
export const fetchLocalTitleCount = async function (filters) {
294
    const q = {
294
    const q = filters
295
        "me.publication_title": {
295
        ? {
296
            like: "%" + filters.publication_title + "%",
296
              ...(filters.publication_title
297
        },
297
                  ? {
298
        ...(filters.publication_type
298
                        "me.publication_title": {
299
            ? { "me.publication_type": filters.publication_type }
299
                            like: "%" + filters.publication_title + "%",
300
            : {}),
300
                        },
301
    };
301
                    }
302
                  : {}),
303
              ...(filters.publication_type
304
                  ? { "me.publication_type": filters.publication_type }
305
                  : {}),
306
          }
307
        : undefined;
302
    const params = {
308
    const params = {
303
        _page: 1,
309
        _page: 1,
304
        _per_page: 1,
310
        _per_page: 1,
305
        q: JSON.stringify(q),
311
        ...(q ? { q: JSON.stringify(q) } : {}),
306
    };
312
    };
307
    let count_local_titles;
313
    let count_local_titles;
308
    var apiUrl = "/api/v1/erm/eholdings/local/titles";
314
    var apiUrl = "/api/v1/erm/eholdings/local/titles";
Lines 367-373 export const fetchEBSCOResources = function () { Link Here
367
    return _fetchResources(apiUrl);
373
    return _fetchResources(apiUrl);
368
};
374
};
369
375
370
export const checkError = function(response) {
376
export const checkError = function (response) {
371
    if (response.status >= 200 && response.status <= 299) {
377
    if (response.status >= 200 && response.status <= 299) {
372
        return response.json();
378
        return response.json();
373
    } else {
379
    } else {
374
- 

Return to bug 32468