Lines 1-67
Link Here
|
1 |
import { defineStore } from "pinia"; |
|
|
2 |
|
3 |
export const useAVStore = defineStore("authorised_values", { |
4 |
state: () => ({ |
5 |
av_agreement_statuses: [], |
6 |
av_agreement_closure_reasons: [], |
7 |
av_agreement_renewal_priorities: [], |
8 |
av_user_roles: [], |
9 |
av_license_types: [], |
10 |
av_license_statuses: [], |
11 |
av_agreement_license_statuses: [], |
12 |
av_agreement_license_location: [], |
13 |
av_agreement_relationships: [ |
14 |
{ value: "supersedes", description: __("supersedes") }, |
15 |
{ value: "is-superseded-by", description: __("is superseded by") }, |
16 |
{ |
17 |
value: "provides_post-cancellation_access_for", |
18 |
description: __("provides post-cancellation access for"), |
19 |
}, |
20 |
{ |
21 |
value: "has-post-cancellation-access-in", |
22 |
description: __("has post-cancellation access in"), |
23 |
}, |
24 |
{ |
25 |
value: "tracks_demand-driven_acquisitions_for", |
26 |
description: __("tracks demand-driven acquisitions for"), |
27 |
}, |
28 |
{ |
29 |
value: "has-demand-driven-acquisitions-in", |
30 |
description: __("has demand-driven acquisitions in"), |
31 |
}, |
32 |
{ value: "has_backfile_in", description: __("has backfile in") }, |
33 |
{ value: "has_frontfile_in", description: __("has frontfile in") }, |
34 |
{ value: "related_to", description: __("related to") }, |
35 |
], |
36 |
av_package_types: [], |
37 |
av_package_content_types: [], |
38 |
av_title_publication_types: [], |
39 |
av_notforloan: [], |
40 |
av_report_types: [], |
41 |
av_platform_reports_metrics: [], |
42 |
av_database_reports_metrics: [], |
43 |
av_title_reports_metrics: [], |
44 |
av_item_reports_metrics: [], |
45 |
}), |
46 |
actions: { |
47 |
get_lib_from_av(arr_name, av) { |
48 |
if (this[arr_name] === undefined) { |
49 |
console.warn( |
50 |
"The authorised value category for '%s' is not defined.".format( |
51 |
arr_name |
52 |
) |
53 |
); |
54 |
return; |
55 |
} |
56 |
let o = this[arr_name].find(e => e.value == av); |
57 |
return o ? o.description : av; |
58 |
}, |
59 |
map_av_dt_filter(arr_name) { |
60 |
return this[arr_name].map(e => { |
61 |
e["_id"] = e["value"]; |
62 |
e["_str"] = e["description"]; |
63 |
return e; |
64 |
}); |
65 |
}, |
66 |
}, |
67 |
}); |