2 <div v-if="!initialized">{{ $__("Loading") }}</div>
3 <div v-else-if="resource" id="eholdings_resources_show">
5 {{ $__("Resource #%s").format(resource.resource_id) }}
6 <span v-if="!updating_is_selected">
8 v-if="!resource.is_selected"
9 class="btn btn-default btn-xs"
11 @click="add_to_holdings"
12 ><font-awesome-icon icon="plus" />
13 {{ $__("Add title to holdings") }}</a
17 class="btn btn-default btn-xs"
19 id="remove-from-holdings"
20 @click="remove_from_holdings"
21 ><font-awesome-icon icon="minus" />
22 {{ $__("Remove title from holdings") }}</a
24 ><span v-else><font-awesome-icon icon="spinner" /></span>
27 <fieldset class="rows">
28 <legend>{{ $__("Resource information") }}</legend>
30 <li v-if="resource.resource_id">
31 <label>{{ $__("Resource identifier") }}:</label>
33 {{ resource.resource_id }}
37 <label>{{ $__("Publication title") }}:</label>
41 name: 'EHoldingsEBSCOTitlesShow',
42 params: { title_id: resource.title_id },
45 resource.title.publication_title
51 <label>{{ $__("Publisher name") }}:</label>
53 {{ resource.title.publisher_name }}
57 <label>{{ $__("Publication type") }}:</label>
59 {{ resource.title.publication_type }}
62 <li v-if="resource.title.print_identifier">
63 <label>{{ $__("Print-format identifier") }}:</label>
65 {{ resource.title.print_identifier }}
68 <li v-if="resource.title.online_identifier">
69 <label>{{ $__("Online-format identifier") }}:</label>
71 {{ resource.title.online_identifier }}
77 <fieldset class="rows">
80 <label>{{ $__("Package") }}:</label>
84 name: 'EHoldingsEBSCOPackagesShow',
85 params: { package_id: resource.package_id },
87 >{{ resource.package.name }}</router-link
93 <label>{{ $__("Vendor") }}:</label>
94 <span v-if="resource.vendor">
95 {{ resource.vendor.name }}
98 <li v-if="resource.package.content_type">
99 <label>{{ $__("Package content type") }}:</label>
100 <span>{{ resource.package.content_type }}</span>
105 <fieldset class="rows">
106 <legend>Resource settings</legend>
109 <label>{{ $__("Coverage dates") }}:</label>
111 >{{ format_date(resource.started_on) }}-{{
112 format_date(resource.ended_on)
123 import { inject } from "vue"
124 import { storeToRefs } from "pinia"
125 import { APIClient } from "../../fetch/api-client.js"
129 const format_date = $date
148 updating_is_selected: false,
152 beforeRouteEnter(to, from, next) {
154 vm.getResource(to.params.resource_id)
157 beforeRouteUpdate(to, from) {
158 this.resource = this.getResource(to.params.resource_id)
161 getResource(resource_id) {
162 const client = APIClient.erm
163 client.EBSCOResources.get(resource_id).then(
165 this.resource = resource
166 this.initialized = true
167 this.updating_is_selected = false
172 edit_selected(is_selected) {
173 this.updating_is_selected = true
174 const client = APIClient.erm
175 client.EBSCOResources.patch(this.resource.resource_id, {
179 // Refresh the page. We should not need that actually.
180 this.getResource(this.resource.resource_id)
186 this.edit_selected(true)
188 remove_from_holdings() {
189 this.edit_selected(false)
192 name: "EHoldingsEBSCOResourcesShow",
196 fieldset.rows label {