Bug 34789: Update usage throughout Koha modules and Vue components
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / vue / components / ERM / EHoldingsEBSCOTitlesShow.vue
1 <template>
2     <div v-if="!initialized">{{ $__("Loading") }}</div>
3     <div v-else-if="title" id="eholdings_title_show">
4         <h2>
5             {{ $__("Title #%s").format(title.title_id) }}
6         </h2>
7         <div>
8             <fieldset class="rows">
9                 <ol>
10                     <li v-if="title.title_id">
11                         <label>{{ $__("Title identifier") }}:</label>
12                         <span>
13                             {{ title.title_id }}
14                         </span>
15                     </li>
16                     <li>
17                         <label>{{ $__("Publication title") }}:</label>
18                         <span>
19                             {{ title.publication_title }}
20                             <a
21                                 v-if="title.biblio_id"
22                                 :href="`/cgi-bin/koha/catalogue/detail.pl?biblionumber=${title.biblio_id}`"
23                             >
24                                 {{ $__("Local bibliographic record") }}
25                             </a>
26                         </span>
27                     </li>
28                     <li v-if="title.print_identifier">
29                         <label>{{ $__("Print-format identifier") }}:</label>
30                         <span>
31                             {{ title.print_identifier }}
32                         </span>
33                     </li>
34                     <li v-if="title.online_identifier">
35                         <label>{{ $__("Online-format identifier") }}:</label>
36                         <span>
37                             {{ title.online_identifier }}
38                         </span>
39                     </li>
40                     <li v-if="title.date_first_issue_online">
41                         <label
42                             >{{
43                                 $__(
44                                     "Date of first serial issue available online"
45                                 )
46                             }}:</label
47                         >
48                         <span>
49                             {{ title.date_first_issue_online }}
50                         </span>
51                     </li>
52                     <li v-if="title.num_first_vol_online">
53                         <label
54                             >{{
55                                 $__("Number of first volume available online")
56                             }}:</label
57                         >
58                         <span>
59                             {{ title.num_first_vol_online }}
60                         </span>
61                     </li>
62                     <li v-if="title.num_first_issue_online">
63                         <label
64                             >{{
65                                 $__("Number of first issue available online")
66                             }}:</label
67                         >
68                         <span>
69                             {{ title.num_first_issue_online }}
70                         </span>
71                     </li>
72                     <li v-if="title.date_last_issue_online">
73                         <label
74                             >{{
75                                 $__("Date of last issue available online")
76                             }}:</label
77                         >
78                         <span>
79                             {{ title.date_last_issue_online }}
80                         </span>
81                     </li>
82                     <li v-if="title.num_last_vol_online">
83                         <label
84                             >{{
85                                 $__("Number of last volume available online")
86                             }}:</label
87                         >
88                         <span>
89                             {{ title.num_last_vol_online }}
90                         </span>
91                     </li>
92                     <li v-if="title.num_last_issue_online">
93                         <label
94                             >{{
95                                 $__("Number of last issue available online")
96                             }}:</label
97                         >
98                         <span>
99                             {{ title.num_last_issue_online }}
100                         </span>
101                     </li>
102                     <li v-if="title.title_url">
103                         <label>{{ $__("Title-level URL") }}:</label>
104                         <span>
105                             {{ title.title_url }}
106                         </span>
107                     </li>
108                     <li v-if="title.first_author">
109                         <label>{{ $__("First author") }}:</label>
110                         <span>
111                             {{ title.first_author }}
112                         </span>
113                     </li>
114                     <li v-if="title.embargo_info">
115                         <label>{{ $__("Embargo information") }}:</label>
116                         <span>
117                             {{ title.embargo_info }}
118                         </span>
119                     </li>
120                     <li v-if="title.coverage_depth">
121                         <label>{{ $__("Coverage depth") }}:</label>
122                         <span>
123                             {{ title.coverage_depth }}
124                         </span>
125                     </li>
126                     <li v-if="title.notes">
127                         <label>{{ $__("Notes") }}:</label>
128                         <span>
129                             {{ title.notes }}
130                         </span>
131                     </li>
132                     <li v-if="title.publisher_name">
133                         <label>{{ $__("Publisher name") }}:</label>
134                         <span>
135                             {{ title.publisher_name }}
136                         </span>
137                     </li>
138                     <li v-if="title.publication_type">
139                         <label>{{ $__("Publication type") }}:</label>
140                         <span
141                             >{{
142                                 get_lib_from_av(
143                                     "av_title_publication_types",
144                                     title.publication_type
145                                 )
146                             }}
147                         </span>
148                     </li>
149                     <li v-if="title.date_monograph_published_print">
150                         <label
151                             >{{
152                                 $__(
153                                     "Date the monograph is first published in print"
154                                 )
155                             }}:</label
156                         >
157                         <span>
158                             {{ title.date_monograph_published_print }}
159                         </span>
160                     </li>
161                     <li v-if="title.date_monograph_published_online">
162                         <label
163                             >{{
164                                 $__(
165                                     "Date the monograph is first published online"
166                                 )
167                             }}:</label
168                         >
169                         <span>
170                             {{ title.date_monograph_published_online }}
171                         </span>
172                     </li>
173                     <li v-if="title.monograph_volume">
174                         <label
175                             >{{ $__("Number of volume for monograph") }}:</label
176                         >
177                         <span>
178                             {{ title.monograph_volume }}
179                         </span>
180                     </li>
181                     <li v-if="title.monograph_edition">
182                         <label>{{ $__("Edition of the monograph") }}:</label>
183                         <span>
184                             {{ title.monograph_edition }}
185                         </span>
186                     </li>
187                     <li v-if="title.first_editor">
188                         <label>{{ $__("First editor") }}:</label>
189                         <span>
190                             {{ title.first_editor }}
191                         </span>
192                     </li>
193                     <li v-if="title.parent_publication_title_id">
194                         <label
195                             >{{
196                                 $__(
197                                     "Title identifier of the parent publication"
198                                 )
199                             }}:</label
200                         >
201                         <span>
202                             {{ title.parent_publication_title_id }}
203                         </span>
204                     </li>
205                     <li v-if="title.preceding_publication_title_id">
206                         <label
207                             >{{
208                                 $__(
209                                     "Title identifier of any preceding publication title"
210                                 )
211                             }}:</label
212                         >
213                         <span>
214                             {{ title.preceding_publication_title_id }}
215                         </span>
216                     </li>
217                     <li v-if="title.access_type">
218                         <label>{{ $__("Access type") }}:</label>
219                         <span>
220                             {{ title.access_type }}
221                         </span>
222                     </li>
223                     <li>
224                         <label>Packages ({{ title.resources.length }})</label>
225                         <div v-if="title.resources.length">
226                             <EHoldingsTitlePackagesList
227                                 :resources="title.resources"
228                             />
229                         </div>
230                     </li>
231                 </ol>
232             </fieldset>
233             <fieldset class="action">
234                 <router-link
235                     :to="{ name: 'EHoldingsEBSCOTitlesList' }"
236                     role="button"
237                     class="cancel"
238                     >{{ $__("Close") }}</router-link
239                 >
240             </fieldset>
241         </div>
242     </div>
243 </template>
244
245 <script>
246 import { inject } from "vue"
247 import EHoldingsTitlePackagesList from "./EHoldingsEBSCOTitlePackagesList.vue"
248 import { APIClient } from "../../fetch/api-client.js"
249
250 export default {
251     setup() {
252         const AVStore = inject("AVStore")
253         const { get_lib_from_av } = AVStore
254
255         return {
256             get_lib_from_av,
257         }
258     },
259     data() {
260         return {
261             title: {
262                 title_id: null,
263                 publication_title: "",
264                 external_id: "",
265                 print_identifier: "",
266                 online_identifier: "",
267                 date_first_issue_online: "",
268                 num_first_vol_online: "",
269                 num_first_issue_online: "",
270                 date_last_issue_online: "",
271                 num_last_vol_online: "",
272                 num_last_issue_online: "",
273                 title_url: "",
274                 first_author: "",
275                 embargo_info: "",
276                 coverage_depth: "",
277                 notes: "",
278                 publisher_name: "",
279                 publication_type: "",
280                 date_monograph_published_print: "",
281                 date_monograph_published_online: "",
282                 monograph_volume: "",
283                 monograph_edition: "",
284                 first_editor: "",
285                 parent_publication_title_id: "",
286                 preceding_publication_title_id: "",
287                 access_type: "",
288                 resources: [],
289             },
290             initialized: false,
291         }
292     },
293     beforeRouteEnter(to, from, next) {
294         next(vm => {
295             vm.getTitle(to.params.title_id)
296         })
297     },
298     beforeRouteUpdate(to, from) {
299         this.title = this.getTitle(to.params.title_id)
300     },
301     methods: {
302         getTitle(title_id) {
303             const client = APIClient.erm
304             client.EBSCOTitles.get(title_id).then(
305                 title => {
306                     this.title = title
307                     this.initialized = true
308                 },
309                 error => {}
310             )
311         },
312     },
313     components: {
314         EHoldingsTitlePackagesList,
315     },
316     name: "EHoldingsEBSCOTitlesShow",
317 }
318 </script>
319 <style scoped>
320 fieldset.rows label {
321     width: 25rem;
322 }
323 </style>