2 <div v-if="!initialized">{{ $__("Loading") }}</div>
3 <div v-else id="titles_add">
4 <h2 v-if="title.title_id">
5 {{ $__("Edit title #%s").format(title.title_id) }}
7 <h2 v-else>{{ $__("New title") }}</h2>
9 <form @submit="onSubmit($event)">
10 <fieldset class="rows">
12 <li v-if="title.title_id">
13 <label for="title_title_id"
14 >{{ $__("Title identifier") }}:</label
22 <label class="required" for="title_name"
23 >{{ $__("Publication title") }}:</label
26 id="title_publication_title"
27 v-model="title.publication_title"
28 :placeholder="$__('Publication title')"
31 <span class="required">{{ $__("Required") }}</span>
35 <label for="title_print_identifier"
36 >{{ $__("Print-format identifier") }}:</label
39 id="title_print_identifier"
40 v-model="title.print_identifier"
41 :placeholder="$__('Print-format identifier')"
46 <label for="title_online_identifier"
47 >{{ $__("Online-format identifier") }}:</label
50 id="title_online_identifier"
51 v-model="title.online_identifier"
52 :placeholder="$__('Online-format identifier')"
57 <label for="title_date_first_issue_online"
60 "Date of first serial issue available online"
65 id="title_date_first_issue_online"
66 v-model="title.date_first_issue_online"
69 'Date of first serial issue available online'
76 <label for="title_num_first_vol_online"
79 "Number of first volume available online"
84 id="title_num_first_vol_online"
85 v-model="title.num_first_vol_online"
88 'Number of first volume available online'
95 <label for="title_num_first_issue_online"
98 "Number of first issue available online"
103 id="title_num_first_issue_online"
104 v-model="title.num_first_issue_online"
107 'Number of first issue available online'
114 <label for="title_date_last_issue_online"
116 $__("Date of last issue available online")
120 id="title_date_last_issue_online"
121 v-model="title.date_last_issue_online"
123 $__('Date of last issue available online')
129 <label for="title_num_last_vol_online"
132 "Number of last volume available online"
137 id="title_num_last_vol_online"
138 v-model="title.num_last_vol_online"
141 'Number of last volume available online'
148 <label for="title_num_last_issue_online"
151 "Number of last issue available online"
156 id="title_num_last_issue_online"
157 v-model="title.num_last_issue_online"
159 $__('Number of last issue available online')
165 <label for="title_title_url"
166 >{{ $__("Title-level URL") }}:</label
170 v-model="title.title_url"
171 :placeholder="$__('Title-level URL')"
176 <label for="title_first_author"
177 >{{ $__("First author") }}:</label
180 id="title_first_author"
181 v-model="title.first_author"
182 :placeholder="$__('First author')"
187 <label for="title_embargo_info"
188 >{{ $__("Embargo information") }}:</label
191 id="title_embargo_info"
192 v-model="title.embargo_info"
193 :placeholder="$__('Embargo information')"
198 <label for="title_coverage_depth"
199 >{{ $__("Coverage depth") }}:</label
202 id="title_coverage_depth"
203 v-model="title.coverage_depth"
204 :placeholder="$__('Coverage depth')"
209 <label for="title_notes">{{ $__("Notes") }}:</label>
212 v-model="title.notes"
213 :placeholder="$__('Notes')"
218 <label for="title_publisher_name"
219 >{{ $__("Publisher name") }}:</label
222 id="title_publisher_name"
223 v-model="title.publisher_name"
224 :placeholder="$__('Publisher name')"
229 <label for="title_publication_type"
230 >{{ $__("Publication type") }}:</label
233 id="title_publication_type"
234 v-model="title.publication_type"
236 :reduce="av => av.value"
237 :options="av_title_publication_types"
242 <label for="title_date_monograph_published_print"
245 "Date the monograph is first published in print"
250 id="title_date_monograph_published_print"
251 v-model="title.date_monograph_published_print"
254 'Date the monograph is first published in print'
261 <label for="title_date_monograph_published_online"
264 "Date the monograph is first published online"
269 id="title_date_monograph_published_online"
270 v-model="title.date_monograph_published_online"
273 'Date the monograph is first published online'
280 <label for="title_monograph_volume"
282 $__("Number of volume for monograph")
286 id="title_monograph_volume"
287 v-model="title.monograph_volume"
289 $__('Number of volume for monograph')
295 <label for="title_monograph_edition"
296 >{{ $__("Edition of the monograph") }}:</label
299 id="title_monograph_edition"
300 v-model="title.monograph_edition"
301 :placeholder="$__('Edition of the monograph')"
306 <label for="title_first_editor"
307 >{{ $__("First editor") }}:</label
310 id="title_first_editor"
311 v-model="title.first_editor"
312 :placeholder="$__('First editor')"
317 <label for="title_parent_publication_title_id"
320 "Title identifier of the parent publication"
325 id="title_parent_publication_title_id"
326 v-model="title.parent_publication_title_id"
329 'Title identifier of the parent publication'
336 <label for="title_preceding_publication_title_id"
339 "Title identifier of any preceding publication title"
344 id="title_preceding_publication_title_id"
345 v-model="title.preceding_publication_title_id"
348 'Title identifier of any preceding publication title'
355 <label for="title_access_type"
357 // FIXME May be fee-based (P) or Open Access (F).
362 id="title_access_type"
363 v-model="title.access_type"
364 :placeholder="$__('Access type')"
369 <EHoldingsTitlesFormAddResources :resources="title.resources" />
370 <fieldset class="action">
371 <input type="submit" value="Submit" />
373 :to="{ name: 'EHoldingsLocalTitlesList' }"
376 >{{ $__("Cancel") }}</router-link
385 import { inject } from "vue"
386 import EHoldingsTitlesFormAddResources from "./EHoldingsLocalTitlesFormAddResources.vue"
387 import { setMessage, setError, setWarning } from "../../messages"
388 import { APIClient } from "../../fetch/api-client.js"
389 import { storeToRefs } from "pinia"
393 const vendorStore = inject("vendorStore")
394 const { vendors } = storeToRefs(vendorStore)
396 const AVStore = inject("AVStore")
397 const { av_title_publication_types } = storeToRefs(AVStore)
398 const { get_lib_from_av } = AVStore
402 av_title_publication_types,
410 publication_title: "",
412 print_identifier: "",
413 online_identifier: "",
414 date_first_issue_online: "",
415 num_first_vol_online: "",
416 num_first_issue_online: "",
417 date_last_issue_online: "",
418 num_last_vol_online: "",
419 num_last_issue_online: "",
426 publication_type: "",
427 date_monograph_published_print: "",
428 date_monograph_published_online: "",
429 monograph_volume: "",
430 monograph_edition: "",
432 parent_publication_title_id: "",
433 preceding_publication_title_id: "",
440 beforeRouteEnter(to, from, next) {
442 if (to.params.title_id) {
443 vm.title = vm.getTitle(to.params.title_id)
445 vm.initialized = true
451 const client = APIClient.erm
452 client.localTitles.get(title_id).then(
455 this.initialized = true
463 let resources = title.resources
464 const package_ids = resources.map(al => al.package_id)
465 const duplicate_package_ids = package_ids.filter(
466 (id, i) => package_ids.indexOf(id) !== i
469 if (duplicate_package_ids.length) {
470 errors.push(this.$__("A package is used several times"))
473 errors.forEach(function (e) {
476 return !errors.length
481 let title = JSON.parse(JSON.stringify(this.title)) // copy
483 if (!this.checkForm(title)) {
487 let title_id = title.title_id
488 delete title.title_id
489 delete title.biblio_id
491 // Cannot use the map/keepAttrs because of the reserved keywork 'package'
492 title.resources.forEach(function (e) {
497 const client = APIClient.erm
499 client.localTitles.update(title, title_id).then(
501 setMessage(this.$__("Title updated"))
503 name: "EHoldingsLocalTitlesList",
509 client.localTitles.create(title).then(
511 setMessage(this.$__("Title created"))
513 name: "EHoldingsLocalTitlesList",
521 components: { EHoldingsTitlesFormAddResources },
522 name: "EHoldingsLocalTitlesFormAdd",
526 fieldset.rows label {