Lines 1-138
Link Here
|
1 |
import { defineStore } from "pinia"; |
|
|
2 |
|
3 |
export const useReportsStore = defineStore("reports", { |
4 |
state: () => ({ |
5 |
months_data: [ |
6 |
{ short: "Jan", description: "January", value: 1, active: true }, |
7 |
{ short: "Feb", description: "February", value: 2, active: true }, |
8 |
{ short: "Mar", description: "March", value: 3, active: true }, |
9 |
{ short: "Apr", description: "April", value: 4, active: true }, |
10 |
{ short: "May", description: "May", value: 5, active: true }, |
11 |
{ short: "Jun", description: "June", value: 6, active: true }, |
12 |
{ short: "Jul", description: "July", value: 7, active: true }, |
13 |
{ short: "Aug", description: "August", value: 8, active: true }, |
14 |
{ short: "Sep", description: "September", value: 9, active: true }, |
15 |
{ short: "Oct", description: "October", value: 10, active: true }, |
16 |
{ short: "Nov", description: "November", value: 11, active: true }, |
17 |
{ short: "Dec", description: "December", value: 12, active: true }, |
18 |
], |
19 |
query: null, |
20 |
title_property_column_options: { |
21 |
1: { |
22 |
id: 1, |
23 |
name: "Provider name", |
24 |
active: true, |
25 |
used_by: ["title", "item", "database", "platform"], |
26 |
column: { |
27 |
title: __("Data provider"), |
28 |
data: "provider_name", |
29 |
searchable: true, |
30 |
orderable: true, |
31 |
}, |
32 |
}, |
33 |
2: { |
34 |
id: 2, |
35 |
name: "Publisher", |
36 |
active: false, |
37 |
used_by: ["title", "item", "database"], |
38 |
column: { |
39 |
title: __("Publisher"), |
40 |
data: "publisher", |
41 |
searchable: true, |
42 |
orderable: true, |
43 |
}, |
44 |
}, |
45 |
3: { |
46 |
id: 3, |
47 |
name: "Platform", |
48 |
active: false, |
49 |
used_by: ["item", "database", "platform"], |
50 |
column: { |
51 |
title: __("Platform"), |
52 |
data: "platform", |
53 |
searchable: true, |
54 |
orderable: true, |
55 |
}, |
56 |
}, |
57 |
4: { |
58 |
id: 4, |
59 |
name: "Publisher ID", |
60 |
active: false, |
61 |
used_by: ["title", "database"], |
62 |
column: { |
63 |
title: __("Publisher ID"), |
64 |
data: "publisher_id", |
65 |
searchable: true, |
66 |
orderable: true, |
67 |
}, |
68 |
}, |
69 |
5: { |
70 |
id: 5, |
71 |
name: "Online ISSN", |
72 |
active: false, |
73 |
used_by: ["title"], |
74 |
column: { |
75 |
title: __("Online ISSN"), |
76 |
data: "online_issn", |
77 |
searchable: true, |
78 |
orderable: true, |
79 |
}, |
80 |
}, |
81 |
6: { |
82 |
id: 6, |
83 |
name: "Print ISSN", |
84 |
active: false, |
85 |
used_by: ["title"], |
86 |
column: { |
87 |
title: __("Print ISSN"), |
88 |
data: "print_issn", |
89 |
searchable: true, |
90 |
orderable: true, |
91 |
}, |
92 |
}, |
93 |
7: { |
94 |
id: 7, |
95 |
name: "DOI", |
96 |
active: false, |
97 |
used_by: ["title"], |
98 |
column: { |
99 |
title: __("DOI"), |
100 |
data: "title_doi", |
101 |
searchable: true, |
102 |
orderable: true, |
103 |
}, |
104 |
}, |
105 |
8: { |
106 |
id: 8, |
107 |
name: "URI", |
108 |
active: false, |
109 |
used_by: ["title"], |
110 |
column: { |
111 |
title: __("URI"), |
112 |
data: "title_uri", |
113 |
searchable: true, |
114 |
orderable: true, |
115 |
}, |
116 |
}, |
117 |
}, |
118 |
report_type_map: { |
119 |
TR_B1: ["YOP", "ISBN"], |
120 |
TR_B2: ["YOP", "ISBN"], |
121 |
TR_B3: ["YOP", "Access_Type", "ISBN"], |
122 |
TR_J3: ["Access_Type"], |
123 |
TR_J4: ["YOP"], |
124 |
}, |
125 |
}), |
126 |
actions: { |
127 |
getMonthsData() { |
128 |
return this.months_data; |
129 |
}, |
130 |
getColumnOptions() { |
131 |
return this.title_property_column_options; |
132 |
}, |
133 |
checkReportColumns(report_type, column) { |
134 |
if (!this.report_type_map.hasOwnProperty(report_type)) return false; |
135 |
return this.report_type_map[report_type].includes(column); |
136 |
}, |
137 |
}, |
138 |
}); |
139 |
- |