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

(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackageAgreements.vue (-1 / +10 lines)
Lines 58-63 export default { Link Here
58
            erm_package.provider = "ebsco"
58
            erm_package.provider = "ebsco"
59
            erm_package.package_id = erm_package.koha_internal_id
59
            erm_package.package_id = erm_package.koha_internal_id
60
            delete erm_package.koha_internal_id
60
            delete erm_package.koha_internal_id
61
            delete erm_package.resources
62
            delete erm_package.vendor
63
            delete erm_package.resources_count
64
            delete erm_package.is_selected
61
            return erm_package
65
            return erm_package
62
        },
66
        },
63
        addAgreement(agreement_id) {
67
        addAgreement(agreement_id) {
Lines 72-78 export default { Link Here
72
            ) {
76
            ) {
73
                erm_package.package_agreements.push({ agreement_id })
77
                erm_package.package_agreements.push({ agreement_id })
74
                const client = APIClient.erm
78
                const client = APIClient.erm
79
75
                if (this.erm_package.koha_internal_id) {
80
                if (this.erm_package.koha_internal_id) {
81
                    let package_id = erm_package.package_id
82
                    delete erm_package.package_id
76
                    client.localPackages.update(erm_package, package_id).then(
83
                    client.localPackages.update(erm_package, package_id).then(
77
                        success => {
84
                        success => {
78
                            this.$emit("refresh-agreements")
85
                            this.$emit("refresh-agreements")
Lines 97-104 export default { Link Here
97
        },
104
        },
98
        deleteAgreement(counter) {
105
        deleteAgreement(counter) {
99
            let erm_package = this.serializeAgreement()
106
            let erm_package = this.serializeAgreement()
100
            const client = APIClient.erm
101
            erm_package.package_agreements.splice(counter, 1)
107
            erm_package.package_agreements.splice(counter, 1)
108
            let package_id = erm_package.package_id
109
            delete erm_package.package_id
110
            const client = APIClient.erm
102
            client.localPackages.update(erm_package, package_id).then(
111
            client.localPackages.update(erm_package, package_id).then(
103
                success => {
112
                success => {
104
                    this.$emit("refresh-agreements")
113
                    this.$emit("refresh-agreements")
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesList.vue (-4 / +6 lines)
Lines 137-147 export default { Link Here
137
                .draw()
137
                .draw()
138
            if (this.erm_providers.includes("local")) {
138
            if (this.erm_providers.includes("local")) {
139
                const client = APIClient.erm
139
                const client = APIClient.erm
140
                const query = filters
140
                const query = this.filters
141
                    ? {
141
                    ? {
142
                          "me.name": { like: "%" + filters.package_name + "%" },
142
                          "me.name": {
143
                          ...(filters.content_type
143
                              like: "%" + this.filters.package_name + "%",
144
                              ? { "me.content_type": filters.content_type }
144
                          },
145
                          ...(this.filters.content_type
146
                              ? { "me.content_type": this.filters.content_type }
145
                              : {}),
147
                              : {}),
146
                      }
148
                      }
147
                    : {}
149
                    : {}
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOPackagesShow.vue (-6 / +11 lines)
Lines 116-122 Link Here
116
import { inject } from "vue"
116
import { inject } from "vue"
117
import EHoldingsPackageAgreements from "./EHoldingsEBSCOPackageAgreements.vue"
117
import EHoldingsPackageAgreements from "./EHoldingsEBSCOPackageAgreements.vue"
118
import EHoldingsPackageTitlesList from "./EHoldingsEBSCOPackageTitlesList.vue"
118
import EHoldingsPackageTitlesList from "./EHoldingsEBSCOPackageTitlesList.vue"
119
import { fetchEBSCOPackage, checkError } from "../../fetch/erm.js"
119
import { APIClient } from "../../fetch/api-client.js"
120
120
121
export default {
121
export default {
122
    setup() {
122
    setup() {
Lines 157-167 export default { Link Here
157
        this.erm_package = this.getPackage(to.params.package_id)
157
        this.erm_package = this.getPackage(to.params.package_id)
158
    },
158
    },
159
    methods: {
159
    methods: {
160
        async getPackage(package_id) {
160
        getPackage(package_id) {
161
            const erm_package = await fetchEBSCOPackage(package_id)
161
            const client = APIClient.erm
162
            this.erm_package = erm_package
162
            client.EBSCOPackages.get(package_id).then(
163
            this.initialized = true
163
                erm_package => {
164
            this.updating_is_selected = false
164
                    this.erm_package = erm_package
165
                    this.initialized = true
166
                    this.updating_is_selected = false
167
                },
168
                error => {}
169
            )
165
        },
170
        },
166
        edit_selected(is_selected) {
171
        edit_selected(is_selected) {
167
            this.updating_is_selected = true
172
            this.updating_is_selected = true
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOResourcesShow.vue (-6 / +11 lines)
Lines 115-123 Link Here
115
115
116
<script>
116
<script>
117
import { inject } from "vue"
117
import { inject } from "vue"
118
import { fetchEBSCOResource } from "../../fetch/erm.js"
119
import { storeToRefs } from "pinia"
118
import { storeToRefs } from "pinia"
120
import { checkError } from "../../fetch/erm.js"
119
import { checkError } from "../../fetch/erm.js"
120
import { APIClient } from "../../fetch/api-client.js"
121
121
122
export default {
122
export default {
123
    setup() {
123
    setup() {
Lines 156-166 export default { Link Here
156
        this.resource = this.getResource(to.params.resource_id)
156
        this.resource = this.getResource(to.params.resource_id)
157
    },
157
    },
158
    methods: {
158
    methods: {
159
        async getResource(resource_id) {
159
        getResource(resource_id) {
160
            const resource = await fetchEBSCOResource(resource_id)
160
            const client = APIClient.erm
161
            this.resource = resource
161
            client.EBSCOResources.get(resource_id).then(
162
            this.initialized = true
162
                resource => {
163
            this.updating_is_selected = false
163
                    this.resource = resource
164
                    this.initialized = true
165
                    this.updating_is_selected = false
166
                },
167
                error => {}
168
            )
164
        },
169
        },
165
        edit_selected(is_selected) {
170
        edit_selected(is_selected) {
166
            this.updating_is_selected = true
171
            this.updating_is_selected = true
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/EHoldingsEBSCOTitlesShow.vue (-5 / +11 lines)
Lines 245-251 Link Here
245
<script>
245
<script>
246
import { inject } from "vue"
246
import { inject } from "vue"
247
import EHoldingsTitlePackagesList from "./EHoldingsEBSCOTitlePackagesList.vue"
247
import EHoldingsTitlePackagesList from "./EHoldingsEBSCOTitlePackagesList.vue"
248
import { fetchEBSCOTitle } from "../../fetch/erm.js"
248
import { APIClient } from "../../fetch/api-client.js"
249
249
export default {
250
export default {
250
    setup() {
251
    setup() {
251
        const AVStore = inject("AVStore")
252
        const AVStore = inject("AVStore")
Lines 298-307 export default { Link Here
298
        this.title = this.getTitle(to.params.title_id)
299
        this.title = this.getTitle(to.params.title_id)
299
    },
300
    },
300
    methods: {
301
    methods: {
301
        async getTitle(title_id) {
302
        getTitle(title_id) {
302
            const title = await fetchEBSCOTitle(title_id)
303
            const client = APIClient.erm
303
            this.title = title
304
            client.EBSCOTitles.get(title_id).then(
304
            this.initialized = true
305
                title => {
306
                    this.title = title
307
                    this.initialized = true
308
                },
309
                error => {}
310
            )
305
        },
311
        },
306
    },
312
    },
307
    components: {
313
    components: {
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js (-1 / +53 lines)
Lines 169-174 export class ERMAPIClient extends HttpClient { Link Here
169
                }),
169
                }),
170
        };
170
        };
171
    }
171
    }
172
173
174
    get EBSCOPackages() {
175
        return {
176
            get: (id) =>
177
                this.get({
178
                    endpoint: "eholdings/ebsco/packages/" + id,
179
                    headers: {
180
                        "x-koha-embed":
181
                            "package_agreements,package_agreements.agreement,resources+count,vendor",
182
                    },
183
                }),
184
            getAll: (query) =>
185
                this.get({
186
                    endpoint:
187
                        "eholdings/ebsco/packages/" +
188
                        id +
189
                        (query || "_per_page=-1"),
190
                    headers: {
191
                        "x-koha-embed": "resources+count,vendor.name",
192
                    },
193
                }),
194
        };
195
    }
196
197
    get EBSCOTitles() {
198
        return {
199
            get: (id) =>
200
                this.get({
201
                    endpoint: "eholdings/ebsco/titles/" + id,
202
                    headers: {
203
                        "x-koha-embed": "resources,resources.package",
204
                    },
205
                }),
206
            getAll: (query) =>
207
                this.get({
208
                    endpoint:
209
                        "eholdings/local/ebsco/titles" + (query || "_per_page=-1"),
210
                }),
211
        };
212
    }
213
214
    get EBSCOResources() {
215
        return {
216
            get: (id) =>
217
                this.get({
218
                    endpoint: "eholdings/ebsco/resources/" + id,
219
                    headers: {
220
                        "x-koha-embed": "title,package,vendor",
221
                    },
222
                }),
223
        };
224
    }
172
}
225
}
173
226
174
export default ERMAPIClient;
227
export default ERMAPIClient;
175
- 

Return to bug 32939