Bug 32030: Add title.external_id
[srvgit] / koha-tmpl / intranet-tmpl / prog / js / vue / components / ERM / EHoldingsTitlesShow.vue
1 <template>
2     <div v-if="!initialized">{{ $t("Loading") }}</div>
3     <div v-else id="eholdings_title_show">
4         <h2>
5             {{ $t("Title .id", { id: title.title_id }) }}
6             <span class="action_links">
7                 <router-link
8                     :to="`/cgi-bin/koha/erm/eholdings/titles/edit/${title.title_id}`"
9                     :title="$t('Edit')"
10                     ><i class="fa fa-pencil"></i
11                 ></router-link>
12
13                 <router-link
14                     :to="`/cgi-bin/koha/erm/eholdings/titles/delete/${title.title_id}`"
15                     :title="$t('Delete')"
16                     ><i class="fa fa-trash"></i
17                 ></router-link>
18             </span>
19         </h2>
20         <div>
21             <fieldset class="rows">
22                 <ol>
23                     <li v-if="title.title_id">
24                         <label
25                             >{{ $t("Title identifier") }}:</label
26                         >
27                         <span>
28                             {{ title.title_id}}
29                         </span>
30                     </li>
31                     <li>
32                         <label>{{ $t("Publication title") }}:</label>
33                         <span>
34                             {{ title.publication_title }}
35                         </span>
36                     </li>
37                     <li v-if="title.external_id">
38                         <label>{{ $t("External ID") }}:</label>
39                         <span>
40                             {{ title.external_id }}
41                         </span>
42                     </li>
43                     <li>
44                         <label>{{ $t("Vendor") }}:</label>
45                         <span v-if="title.vendor_id">
46                             {{
47                                 vendors.find((e) => e.id == title.vendor_id)
48                                     .name
49                             }}
50                         </span>
51                     </li>
52                     <li>
53                         <label>{{ $t("Print-format identifier") }}:</label>
54                         <span>
55                             {{ title.print_identifier }}
56                         </span>
57                     </li>
58                     <li>
59                         <label>{{ $t("Online-format identifier") }}:</label>
60                         <span>
61                             {{ title.online_identifier }}
62                         </span>
63                     </li>
64                     <li>
65                         <label
66                             >{{
67                                 $t(
68                                     "Date of first serial issue available online"
69                                 )
70                             }}:</label
71                         >
72                         <span>
73                             {{ title.date_first_issue_online }}
74                         </span>
75                     </li>
76                     <li>
77                         <label
78                             >{{
79                                 $t("Number of first volume available online")
80                             }}:</label
81                         >
82                         <span>
83                             {{ title.num_first_vol_online }}
84                         </span>
85                     </li>
86                     <li>
87                         <label
88                             >{{
89                                 $t("Number of first issue available online")
90                             }}:</label
91                         >
92                         <span>
93                             {{ title.num_first_issue_online }}
94                         </span>
95                     </li>
96                     <li>
97                         <label
98                             >{{
99                                 $t("Date of last issue available online")
100                             }}:</label
101                         >
102                         <span>
103                             {{ title.date_last_issue_online }}
104                         </span>
105                     </li>
106                     <li>
107                         <label
108                             >{{
109                                 $t("Number of last volume available online")
110                             }}:</label
111                         >
112                         <span>
113                             {{ title.num_last_vol_online }}
114                         </span>
115                     </li>
116                     <li>
117                         <label
118                             >{{
119                                 $t("Number of last issue available online")
120                             }}:</label
121                         >
122                         <span>
123                             {{ title.num_last_issue_online }}
124                         </span>
125                     </li>
126                     <li>
127                         <label>{{ $t("Title-level URL") }}:</label>
128                         <span>
129                             {{ title.title_url }}
130                         </span>
131                     </li>
132                     <li>
133                         <label>{{ $t("First author") }}:</label>
134                         <span>
135                             {{ title.first_author }}
136                         </span>
137                     </li>
138                     <li>
139                         <label>{{ $t("Embargo information") }}:</label>
140                         <span>
141                             {{ title.embargo_info }}
142                         </span>
143                     </li>
144                     <li>
145                         <label>{{ $t("Coverage depth") }}:</label>
146                         <span>
147                             {{ title.coverage_depth }}
148                         </span>
149                     </li>
150                     <li>
151                         <label>{{ $t("Notes") }}:</label>
152                         <span>
153                             {{ title.notes }}
154                         </span>
155                     </li>
156                     <li>
157                         <label>{{ $t("Publisher name") }}:</label>
158                         <span>
159                             {{ title.publisher_name }}
160                         </span>
161                     </li>
162                     <li>
163                         <label>{{ $t("Publication type") }}:</label>
164                         <span>
165                             {{ title.publication_type }}
166                         </span>
167                     </li>
168                     <li>
169                         <label
170                             >{{
171                                 $t(
172                                     "Date the monograph is first published in print"
173                                 )
174                             }}:</label
175                         >
176                         <span>
177                             {{ title.date_monograph_published_print }}
178                         </span>
179                     </li>
180                     <li>
181                         <label
182                             >{{
183                                 $t(
184                                     "Date the monograph is first published online"
185                                 )
186                             }}:</label
187                         >
188                         <span>
189                             {{ title.date_monograph_published_online }}
190                         </span>
191                     </li>
192                     <li>
193                         <label
194                             >{{ $t("Number of volume for monograph") }}:</label
195                         >
196                         <span>
197                             {{ title.monograph_volume }}
198                         </span>
199                     </li>
200                     <li>
201                         <label>{{ $t("Edition of the monograph") }}:</label>
202                         <span>
203                             {{ title.monograph_edition }}
204                         </span>
205                     </li>
206                     <li>
207                         <label>{{ $t("First editor") }}:</label>
208                         <span>
209                             {{ title.first_editor }}
210                         </span>
211                     </li>
212                     <li>
213                         <label
214                             >{{
215                                 $t(
216                                     "Title identifier of the parent publication"
217                                 )
218                             }}:</label
219                         >
220                         <span>
221                             {{ title.parent_publication_title_id }}
222                         </span>
223                     </li>
224                     <li>
225                         <label
226                             >{{
227                                 $t(
228                                     "Title identifier of any preceding publication title"
229                                 )
230                             }}:</label
231                         >
232                         <span>
233                             {{ title.preceeding_publication_title_id }}
234                         </span>
235                     </li>
236                     <li>
237                         <label>{{ $t("Acces type") }}:</label>
238                         <span>
239                             {{ title.access_type }}
240                         </span>
241                     </li>
242
243                     <li v-if="title.resources.length">
244                         <label>{{ $t("Packages") }}</label>
245                         <table>
246                             <thead>
247                                 <tr>
248                                     <th>Name</th>
249                                 </tr>
250                             </thead>
251                             <tbody>
252                                 <tr
253                                     v-for="(
254                                         r, counter
255                                     ) in title.resources"
256                                     v-bind:key="counter"
257                                 >
258                                     <td>
259                                         <router-link
260                                             :to="`/cgi-bin/koha/erm/eholdings/resources/${r.resource_id}`"
261                                             :title="$t('Show resource')"
262                                         >
263                                             {{ r.package.name }}
264                                         </router-link>
265                                     </td>
266                                 </tr>
267                             </tbody>
268                         </table>
269                     </li>
270                 </ol>
271             </fieldset>
272             <fieldset class="action">
273                 <router-link
274                     to="/cgi-bin/koha/erm/eholdings/titles"
275                     role="button"
276                     class="cancel"
277                     >{{ $t("Close") }}</router-link
278                 >
279             </fieldset>
280         </div>
281     </div>
282 </template>
283
284 <script>
285 import { fetchTitle } from "../../fetch"
286 import { useVendorStore } from "../../stores/vendors"
287 import { storeToRefs } from "pinia"
288 export default {
289     setup() {
290         const vendorStore = useVendorStore()
291         const { vendors } = storeToRefs(vendorStore)
292
293         return {
294             vendors,
295         }
296     },
297     data() {
298         return {
299             title: {
300                 title_id: null,
301                 vendor_id: null,
302                 publication_title: '',
303                 external_id: '',
304                 print_identifier: '',
305                 online_identifier: '',
306                 date_first_issue_online: '',
307                 num_first_vol_online: '',
308                 num_first_issue_online: '',
309                 date_last_issue_online: '',
310                 num_last_vol_online: '',
311                 num_last_issue_online: '',
312                 title_url: '',
313                 first_author: '',
314                 embargo_info: '',
315                 coverage_depth: '',
316                 notes: '',
317                 publisher_name: '',
318                 publication_type: '',
319                 date_monograph_published_print: '',
320                 date_monograph_published_online: '',
321                 monograph_volume: '',
322                 monograph_edition: '',
323                 first_editor: '',
324                 parent_publication_title_id: '',
325                 preceeding_publication_title_id: '',
326                 access_type: '',
327                 resources: [],
328             },
329             initialized: false,
330         }
331     },
332
333     beforeRouteEnter(to, from, next) {
334         next(vm => {
335             vm.getTitle(to.params.title_id)
336         })
337     },
338     beforeRouteUpdate(to, from) {
339         this.title = this.getTitle(to.params.title_id)
340     },
341     methods: {
342         async getTitle(title_id) {
343             const title= await fetchTitle(title_id)
344             this.title = title
345             this.initialized = true
346         },
347     },
348     name: "EHoldingsTitlesShow",
349 }
350 </script>
351 <style scoped>
352 .action_links a {
353     padding-left: 0.2em;
354     font-size: 11px;
355 }
356 fieldset.rows label {
357     width: 25rem;
358 }
359 </style>