2 <div v-if="!initialized">{{ $t("Loading") }}</div>
3 <div v-else-if="resource" id="eholdings_resources_show">
5 {{ $t("Resource .id", { id: 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" /> Add to holdings</a
16 class="btn btn-default btn-xs"
18 id="remove-from-holdings"
19 @click="remove_from_holdings"
20 ><font-awesome-icon icon="minus" /> Remove from holdings</a
22 ><span v-else><font-awesome-icon icon="spinner" /></span>
25 <fieldset class="rows">
26 <legend>{{ $t("Resource information") }}</legend>
28 <li v-if="resource.resource_id">
29 <label>{{ $t("Resource identifier") }}:</label>
31 {{ resource.resource_id }}
35 <label>{{ $t("Publication title") }}:</label>
38 :to="`/cgi-bin/koha/erm/eholdings/ebsco/titles/${resource.title_id}`"
40 resource.title.publication_title
46 <label>{{ $t("Publisher name") }}:</label>
48 {{ resource.title.publisher_name }}
52 <label>{{ $t("Publication type") }}:</label>
54 {{ resource.title.publication_type }}
57 <li v-if="resource.title.print_identifier">
58 <label>{{ $t("Print-format identifier") }}:</label>
60 {{ resource.title.print_identifier }}
63 <li v-if="resource.title.online_identifier">
64 <label>{{ $t("Online-format identifier") }}:</label>
66 {{ resource.title.online_identifier }}
72 <fieldset class="rows">
75 <label>{{ $t("Package") }}:</label>
78 :to="`/cgi-bin/koha/erm/eholdings/ebsco/packages/${resource.package_id}`"
79 >{{ resource.package.name }}</router-link
85 <label>{{ $t("Vendor") }}:</label>
86 <span v-if="resource.vendor">
87 {{ resource.vendor.name }}
90 <li v-if="resource.package.content_type">
91 <label>{{ $t("Package content type") }}:</label>
92 <span>{{ resource.package.content_type }}</span>
97 <fieldset class="rows">
98 <legend>Resource settings</legend>
101 <label>{{ $t("Coverage dates") }}:</label>
103 >{{ format_date(resource.started_on) }}-{{
104 format_date(resource.ended_on)
115 import { fetchEBSCOResource } from "../../fetch"
116 import { useVendorStore } from "../../stores/vendors"
117 import { storeToRefs } from "pinia"
118 import { checkError } from '../../fetch.js'
122 const format_date = $date
124 const vendorStore = useVendorStore()
125 const { vendors } = storeToRefs(vendorStore)
144 updating_is_selected: false,
148 beforeRouteEnter(to, from, next) {
150 vm.getResource(to.params.resource_id)
153 beforeRouteUpdate(to, from) {
154 this.resource = this.getResource(to.params.resource_id)
157 async getResource(resource_id) {
158 const resource = await fetchEBSCOResource(resource_id)
159 this.resource = resource
160 this.initialized = true
161 this.updating_is_selected = false
163 edit_selected(is_selected) {
164 this.updating_is_selected = true
165 fetch('/api/v1/erm/eholdings/ebsco/resources/' + this.resource.resource_id, {
167 body: JSON.stringify({ is_selected }),
169 'Accept': 'application/json',
170 'Content-Type': 'application/json'
176 // Refresh the page. We should not need that actually.
177 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 {