@byu-oit/vue-decision-processing-components 8.34.1 → 8.35.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +51 -0
- package/.repo-meta.yml +55 -55
- package/AdmitPeriodConfig.vue +115 -115
- package/ApiCallButton.vue +91 -91
- package/ApplicantInfo.vue +100 -100
- package/AssignmentBulkDialog.vue +153 -153
- package/AssignmentDialog.vue +117 -117
- package/AssignmentSummary.vue +75 -75
- package/BackgroundBadge.vue +83 -83
- package/BackgroundDetailCrime.vue +78 -78
- package/BackgroundDetailPluralMarriage.vue +43 -43
- package/BackgroundDetailSexRegistry.vue +43 -43
- package/BackgroundDetailUniversity.vue +37 -37
- package/CHANGELOG.md +676 -665
- package/Dashboard.vue +201 -201
- package/DashboardApplicationList.vue +50 -50
- package/DecisionDialog.vue +178 -178
- package/Details.vue +124 -124
- package/DetailsActivity.vue +59 -59
- package/DetailsBackground.vue +143 -143
- package/DetailsBackgroundDetail.vue +47 -47
- package/DetailsBackgroundSummary.vue +66 -66
- package/DetailsCesHold.vue +107 -107
- package/DetailsCollege.vue +93 -93
- package/DetailsContact.vue +65 -65
- package/DetailsDecision.vue +183 -183
- package/DetailsDecisionHistory.vue +56 -56
- package/DetailsEndorsement.vue +74 -74
- package/DetailsEssay.vue +59 -59
- package/DetailsFilenote.vue +62 -62
- package/DetailsFilenoteList.vue +109 -109
- package/DetailsFlagSection.vue +176 -176
- package/DetailsHeader.vue +263 -263
- package/DetailsHighSchool.vue +99 -99
- package/DetailsHsTranscript.vue +100 -100
- package/DetailsInstitute.vue +90 -90
- package/DetailsMission.vue +88 -88
- package/DetailsNewAppHistory.vue +50 -50
- package/DetailsNotes.vue +83 -83
- package/DetailsPathway.vue +45 -45
- package/DetailsScoringSection.vue +128 -128
- package/DetailsSection.vue +116 -116
- package/DetailsSeminary.vue +184 -184
- package/DetailsSrs.vue +52 -52
- package/DetailsSubnav.vue +54 -54
- package/DetailsTestScores.vue +131 -131
- package/ExpandIndicator.vue +75 -75
- package/ExternalLink.vue +34 -34
- package/FilterBreadcrumb.vue +85 -85
- package/FilterButton.vue +86 -86
- package/FilterButtonAdmitPeriod.vue +104 -109
- package/FilterButtonAppType.vue +103 -103
- package/FilterButtonAssignedTo.vue +96 -96
- package/FilterButtonClearFilters.vue +65 -65
- package/FilterButtonSex.vue +105 -105
- package/FlagButton.vue +59 -59
- package/FlagDialog.vue +129 -129
- package/Footer.vue +432 -432
- package/Header.vue +132 -132
- package/HighSchoolSummary.vue +60 -60
- package/InternationalIndicator.vue +44 -44
- package/InternationalStatus.vue +48 -48
- package/LICENSE +201 -201
- package/LoadingBadge.vue +58 -58
- package/ManageAssignments.vue +123 -123
- package/NoAuth.vue +14 -14
- package/NoteDialog.vue +106 -106
- package/ObjectViewer.vue +49 -49
- package/Queues.vue +268 -268
- package/QuickLinks.vue +25 -25
- package/README.md +2 -2
- package/RecentApplications.vue +53 -53
- package/Report.vue +340 -340
- package/ReportDetail.vue +279 -279
- package/ReportList.vue +87 -87
- package/ReportPhotos.vue +65 -65
- package/ReportSvg.vue +78 -78
- package/ReportViewer.vue +165 -165
- package/RequestAccess.vue +14 -14
- package/RequestAccessList.vue +45 -45
- package/RoleSelector.vue +29 -29
- package/Search.vue +22 -22
- package/ShowApplicantIds.vue +100 -0
- package/SortableHeader.vue +53 -53
- package/Spinner.vue +34 -34
- package/StarredIndicator.vue +36 -36
- package/StatBox.vue +73 -73
- package/StatCharts.vue +196 -196
- package/SupportDialog.vue +172 -172
- package/UserInfo.vue +52 -52
- package/YesNoIndicator.vue +48 -48
- package/dateTimeFormat.js +67 -67
- package/gpaCalculation.js +162 -162
- package/gpaFilter.js +5 -5
- package/hsSummary.json +2019 -2019
- package/package.json +36 -36
- package/parsers/application.js +396 -396
- package/parsers/decisionHistory.js +27 -27
- package/parsers/filenotes.js +27 -27
- package/parsers/notes.js +49 -49
- package/parsers/packet.js +88 -88
- package/parsers/packetList.js +57 -57
- package/parsers/reports.js +13 -13
- package/sat2Act.js +46 -46
- package/test.js +48 -48
- package/themes/ByuiFooter.vue +38 -38
- package/themes/ByuiHeader.vue +96 -96
- package/themes/LdsbcFooter.vue +38 -38
- package/themes/LdsbcHeader.vue +100 -100
- package/vuexModules/application/activity.js +32 -32
- package/vuexModules/application/applicationList.js +71 -71
- package/vuexModules/application/background.js +47 -47
- package/vuexModules/application/bio.js +38 -38
- package/vuexModules/application/citizenship.js +30 -30
- package/vuexModules/application/collegeSummaries.js +32 -32
- package/vuexModules/application/essay.js +26 -26
- package/vuexModules/application/highSchoolSummaries.js +40 -40
- package/vuexModules/application/index.js +157 -157
- package/vuexModules/application/institute.js +30 -30
- package/vuexModules/application/mission.js +48 -48
- package/vuexModules/application/personalRecords.js +24 -24
- package/vuexModules/application/questions.js +23 -23
- package/vuexModules/application/seminary.js +39 -39
- package/vuexModules/application/testScores.js +26 -26
- package/vuexModules/notes/index.js +22 -22
- package/vuexModules/packet/decision.js +43 -43
- package/vuexModules/packet/decisionHistory.js +28 -28
- package/vuexModules/packet/flags.js +174 -174
- package/vuexModules/packet/index.js +52 -52
- package/vuexModules/packet/packetList.js +127 -127
- package/vuexModules/packet/processes.js +28 -28
- package/vuexModules/reports/index.js +32 -32
- package/vuexModules/ui/index.js +56 -56
- package/vuexModules/users/index.js +46 -46
- package/yyyyMmFilter.js +7 -7
package/ReportDetail.vue
CHANGED
|
@@ -1,279 +1,279 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Copyright 2018 Brigham Young University
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License")
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
-->
|
|
16
|
-
<template>
|
|
17
|
-
<div class="overflow-scroll">
|
|
18
|
-
<div v-if="loading">
|
|
19
|
-
<Spinner text="Loading Report..." />
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<template v-else-if="error">
|
|
23
|
-
<p>Error loading report.</p>
|
|
24
|
-
</template>
|
|
25
|
-
<template v-else-if="rows.length === 0">
|
|
26
|
-
<p>No results returned.</p>
|
|
27
|
-
</template>
|
|
28
|
-
<template v-else>
|
|
29
|
-
<div class="left-align-fullwidth">
|
|
30
|
-
<FilterButton
|
|
31
|
-
v-for="{ values, label, column } of uniqueValues"
|
|
32
|
-
:key="label"
|
|
33
|
-
@show="setFilterOpen(column)"
|
|
34
|
-
@hide="setFilterClosed(column)"
|
|
35
|
-
:show="filterOpen[column]"
|
|
36
|
-
>
|
|
37
|
-
<span slot="label">{{ label }}</span>
|
|
38
|
-
<div @click="filterBy(null, column)" class="dropdown-item">All</div>
|
|
39
|
-
<div
|
|
40
|
-
v-for="val of values"
|
|
41
|
-
:key="val"
|
|
42
|
-
class="dropdown-item"
|
|
43
|
-
@click="filterBy(val, column)"
|
|
44
|
-
>
|
|
45
|
-
{{val | yearTermLongFormat}}
|
|
46
|
-
</div>
|
|
47
|
-
</FilterButton>
|
|
48
|
-
<span>
|
|
49
|
-
<input type="checkbox" v-model="showHidden" id="showHiddenCheckbox">
|
|
50
|
-
<label for="showHiddenCheckbox">Show sensitive columns</label>
|
|
51
|
-
</span>
|
|
52
|
-
</div>
|
|
53
|
-
<div class="lr-fullwidth">
|
|
54
|
-
<a :href="csvDataEncoded"
|
|
55
|
-
:download="title ? `${title}.csv` : 'report.csv'"
|
|
56
|
-
><FontAwesomeIcon :icon="csvIcon" />Download as .csv</a>
|
|
57
|
-
<span>
|
|
58
|
-
{{ rowCount }} rows
|
|
59
|
-
</span>
|
|
60
|
-
</div>
|
|
61
|
-
<table class="table table-hover table-bordered table-sm">
|
|
62
|
-
<thead v-if="columnMetadata.length > 0">
|
|
63
|
-
<tr>
|
|
64
|
-
<template v-for="({meta}, i) of filterColumns(columnMetadata, showHidden)">
|
|
65
|
-
<SortableHeader
|
|
66
|
-
v-if="meta.qualifier.includes('sort')"
|
|
67
|
-
:sort="sortColumnIndex"
|
|
68
|
-
:field="i"
|
|
69
|
-
:order="sortOrder"
|
|
70
|
-
@click="sortBy(i)"
|
|
71
|
-
>
|
|
72
|
-
{{ meta.name }}
|
|
73
|
-
</SortableHeader>
|
|
74
|
-
<th v-else>
|
|
75
|
-
{{ meta.name }}
|
|
76
|
-
</th>
|
|
77
|
-
</template>
|
|
78
|
-
</tr>
|
|
79
|
-
</thead>
|
|
80
|
-
<tbody>
|
|
81
|
-
<tr v-for="r of filteredRows">
|
|
82
|
-
<td v-for="({meta, value}, i) of filterColumns(r, showHidden)">
|
|
83
|
-
<!-- TODO: these apply to the wrong column if some columns are hidden! -->
|
|
84
|
-
<template v-if="meta.qualifier.includes('link_app')">
|
|
85
|
-
<router-link v-if="newTab" :to="replaceLinkValue(meta.link, value)" target="_blank" data-disable-navigate="true"> Application Details </router-link>
|
|
86
|
-
<router-link v-else :to="replaceLinkValue(meta.link, value)"> Application Details </router-link>
|
|
87
|
-
</template>
|
|
88
|
-
<template v-else-if="meta.qualifier.includes('link_report')">
|
|
89
|
-
<router-link v-if="newTab" :to="replaceLinkValue(meta.link, value)" target="_blank" data-disable-navigate="true">{{value}}</router-link>
|
|
90
|
-
<router-link v-else :to="replaceLinkValue(meta.link, value)">{{value}}</router-link>
|
|
91
|
-
</template>
|
|
92
|
-
<template v-else-if="meta.qualifier.includes('date')">{{value | dateFormat}}</template>
|
|
93
|
-
<template v-else-if="meta.qualifier.includes('timestamp')">{{value | dateTimeFormat}}</template>
|
|
94
|
-
<template v-else-if="meta.qualifier.includes('admitPeriod')">{{value | yearTermLongFormat}}</template>
|
|
95
|
-
<template v-else>{{value}}</template>
|
|
96
|
-
</td>
|
|
97
|
-
</tr>
|
|
98
|
-
</tbody>
|
|
99
|
-
</table>
|
|
100
|
-
</template>
|
|
101
|
-
</div>
|
|
102
|
-
</template>
|
|
103
|
-
<script>
|
|
104
|
-
import isIsoDate from 'is-iso-date'
|
|
105
|
-
import { dateFormat, dateTimeFormat, yearTermLongFormat } from './dateTimeFormat'
|
|
106
|
-
import FilterButton from './FilterButton'
|
|
107
|
-
import SortableHeader from './SortableHeader'
|
|
108
|
-
import Spinner from './Spinner'
|
|
109
|
-
|
|
110
|
-
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
|
111
|
-
import { faFileCsv } from '@fortawesome/free-solid-svg-icons'
|
|
112
|
-
|
|
113
|
-
export default {
|
|
114
|
-
name: 'ReportDetail',
|
|
115
|
-
components: {
|
|
116
|
-
FilterButton,
|
|
117
|
-
FontAwesomeIcon,
|
|
118
|
-
SortableHeader,
|
|
119
|
-
Spinner
|
|
120
|
-
},
|
|
121
|
-
filters: { dateTimeFormat, dateFormat, yearTermLongFormat },
|
|
122
|
-
props: {
|
|
123
|
-
columnMetadata: {
|
|
124
|
-
type: Array,
|
|
125
|
-
default: () => []
|
|
126
|
-
},
|
|
127
|
-
rows: {
|
|
128
|
-
type: Array,
|
|
129
|
-
default: () => []
|
|
130
|
-
},
|
|
131
|
-
csv: String,
|
|
132
|
-
title: String,
|
|
133
|
-
loading: Boolean,
|
|
134
|
-
detailPath: {
|
|
135
|
-
type: String,
|
|
136
|
-
default: '/detail'
|
|
137
|
-
},
|
|
138
|
-
error: Boolean,
|
|
139
|
-
newTab: Boolean
|
|
140
|
-
},
|
|
141
|
-
data () {
|
|
142
|
-
return {
|
|
143
|
-
appIdIndex: null,
|
|
144
|
-
sortColumnIndex: null,
|
|
145
|
-
sortOrder: 'desc',
|
|
146
|
-
filteredRows: null,
|
|
147
|
-
filterOpen: [],
|
|
148
|
-
uniqueValues: null,
|
|
149
|
-
showHidden: false
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
watch: {
|
|
153
|
-
rows: {
|
|
154
|
-
handler: 'copyForFiltering',
|
|
155
|
-
immediate: true
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
computed: {
|
|
159
|
-
csvDataEncoded () {
|
|
160
|
-
const encoded = window.encodeURIComponent(this.csv)
|
|
161
|
-
return `data:text/csv;charset=utf-8,${encoded}`
|
|
162
|
-
},
|
|
163
|
-
rowCount () {
|
|
164
|
-
return this.rows.length
|
|
165
|
-
},
|
|
166
|
-
csvIcon () {
|
|
167
|
-
return faFileCsv
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
methods: {
|
|
171
|
-
isIsoDate,
|
|
172
|
-
isUuid (val) {
|
|
173
|
-
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
|
174
|
-
return uuidPattern.test(val)
|
|
175
|
-
},
|
|
176
|
-
sortBy (i) {
|
|
177
|
-
if (i === this.sortColumnIndex) {
|
|
178
|
-
const order = this.sortOrder
|
|
179
|
-
this.sortOrder = (order === 'desc') ? 'asc' : 'desc'
|
|
180
|
-
} else {
|
|
181
|
-
this.sortColumnIndex = i
|
|
182
|
-
this.sortOrder = 'desc'
|
|
183
|
-
}
|
|
184
|
-
const sortDesc = (a, b) => {
|
|
185
|
-
const valA = a[i]
|
|
186
|
-
const valB = b[i]
|
|
187
|
-
return valA > valB ? 1 : -1
|
|
188
|
-
}
|
|
189
|
-
const sortAsc = (a, b) => {
|
|
190
|
-
const valA = a[i]
|
|
191
|
-
const valB = b[i]
|
|
192
|
-
return valA > valB ? -1 : 1
|
|
193
|
-
}
|
|
194
|
-
this.filteredRows.sort((this.sortOrder === 'desc') ? sortDesc : sortAsc)
|
|
195
|
-
},
|
|
196
|
-
copyForFiltering (rows) {
|
|
197
|
-
if (Array.isArray(rows) && rows.length > 0) {
|
|
198
|
-
this.filteredRows = rows.slice(0)
|
|
199
|
-
this.uniqueValues = this.columnMetadata
|
|
200
|
-
.map((meta, i) => {
|
|
201
|
-
return {
|
|
202
|
-
column: i,
|
|
203
|
-
label: meta.name,
|
|
204
|
-
values: this.unique(rows, i),
|
|
205
|
-
columnCanBeFiltered: Array.isArray(meta.qualifier) ? meta.qualifier.includes('filter') : false
|
|
206
|
-
}
|
|
207
|
-
})
|
|
208
|
-
.filter(o => o.columnCanBeFiltered)
|
|
209
|
-
.filter(u => u.values.length < rows.length && u.values.length > 1)
|
|
210
|
-
} else {
|
|
211
|
-
this.filteredRows = null
|
|
212
|
-
this.uniqueValues = null
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
unique (rows, column) {
|
|
216
|
-
const values = Array.from(rows.reduce((a, c) => {
|
|
217
|
-
a.add(c[column])
|
|
218
|
-
return a
|
|
219
|
-
}, new Set())).sort()
|
|
220
|
-
return values
|
|
221
|
-
},
|
|
222
|
-
filterBy (val, column) {
|
|
223
|
-
this.filterOpen[column] = false
|
|
224
|
-
if (val === null) {
|
|
225
|
-
this.filteredRows = this.rows.slice(0)
|
|
226
|
-
} else {
|
|
227
|
-
this.filteredRows = this.rows.filter(r => r[column] === val)
|
|
228
|
-
}
|
|
229
|
-
this.sortOrder = 'desc'
|
|
230
|
-
this.sortColumnIndex = null
|
|
231
|
-
},
|
|
232
|
-
setFilterOpen (col) {
|
|
233
|
-
this.$set(this.filterOpen, col, true)
|
|
234
|
-
},
|
|
235
|
-
setFilterClosed (col) {
|
|
236
|
-
this.$set(this.filterOpen, col, false)
|
|
237
|
-
},
|
|
238
|
-
filterColumns(data, showHidden) {
|
|
239
|
-
const emptyMetadata = {
|
|
240
|
-
ordinal: 999,
|
|
241
|
-
name: '',
|
|
242
|
-
qualifier: [],
|
|
243
|
-
link: ''
|
|
244
|
-
}
|
|
245
|
-
const withMetadata = data.map((v, i) => ({ meta: this.columnMetadata[i] || emptyMetadata, value: v }))
|
|
246
|
-
if(showHidden) {
|
|
247
|
-
return withMetadata
|
|
248
|
-
}
|
|
249
|
-
const columnQualifierHidden = this.columnMetadata.map(m => {
|
|
250
|
-
if(m.qualifier && Array.isArray(m.qualifier)) {
|
|
251
|
-
return m.qualifier.includes('hidden')
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
})
|
|
255
|
-
return withMetadata.filter((val, i) => !columnQualifierHidden[i])
|
|
256
|
-
},
|
|
257
|
-
replaceLinkValue(link, value) {
|
|
258
|
-
return link.replace(/:value/, value)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
</script>
|
|
263
|
-
|
|
264
|
-
<style scoped>
|
|
265
|
-
.left-align-fullwidth {
|
|
266
|
-
display: flex;
|
|
267
|
-
}
|
|
268
|
-
.left-align-fullwidth > * {
|
|
269
|
-
padding: 0.1rem 0.5rem;
|
|
270
|
-
}
|
|
271
|
-
.lr-fullwidth {
|
|
272
|
-
display: flex;
|
|
273
|
-
justify-content: space-between;
|
|
274
|
-
}
|
|
275
|
-
.overflow-scroll {
|
|
276
|
-
max-height: 80vh;
|
|
277
|
-
overflow: scroll;
|
|
278
|
-
}
|
|
279
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2018 Brigham Young University
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License")
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
-->
|
|
16
|
+
<template>
|
|
17
|
+
<div class="overflow-scroll">
|
|
18
|
+
<div v-if="loading">
|
|
19
|
+
<Spinner text="Loading Report..." />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<template v-else-if="error">
|
|
23
|
+
<p>Error loading report.</p>
|
|
24
|
+
</template>
|
|
25
|
+
<template v-else-if="rows.length === 0">
|
|
26
|
+
<p>No results returned.</p>
|
|
27
|
+
</template>
|
|
28
|
+
<template v-else>
|
|
29
|
+
<div class="left-align-fullwidth">
|
|
30
|
+
<FilterButton
|
|
31
|
+
v-for="{ values, label, column } of uniqueValues"
|
|
32
|
+
:key="label"
|
|
33
|
+
@show="setFilterOpen(column)"
|
|
34
|
+
@hide="setFilterClosed(column)"
|
|
35
|
+
:show="filterOpen[column]"
|
|
36
|
+
>
|
|
37
|
+
<span slot="label">{{ label }}</span>
|
|
38
|
+
<div @click="filterBy(null, column)" class="dropdown-item">All</div>
|
|
39
|
+
<div
|
|
40
|
+
v-for="val of values"
|
|
41
|
+
:key="val"
|
|
42
|
+
class="dropdown-item"
|
|
43
|
+
@click="filterBy(val, column)"
|
|
44
|
+
>
|
|
45
|
+
{{val | yearTermLongFormat}}
|
|
46
|
+
</div>
|
|
47
|
+
</FilterButton>
|
|
48
|
+
<span>
|
|
49
|
+
<input type="checkbox" v-model="showHidden" id="showHiddenCheckbox">
|
|
50
|
+
<label for="showHiddenCheckbox">Show sensitive columns</label>
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="lr-fullwidth">
|
|
54
|
+
<a :href="csvDataEncoded"
|
|
55
|
+
:download="title ? `${title}.csv` : 'report.csv'"
|
|
56
|
+
><FontAwesomeIcon :icon="csvIcon" />Download as .csv</a>
|
|
57
|
+
<span>
|
|
58
|
+
{{ rowCount }} rows
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
<table class="table table-hover table-bordered table-sm">
|
|
62
|
+
<thead v-if="columnMetadata.length > 0">
|
|
63
|
+
<tr>
|
|
64
|
+
<template v-for="({meta}, i) of filterColumns(columnMetadata, showHidden)">
|
|
65
|
+
<SortableHeader
|
|
66
|
+
v-if="meta.qualifier.includes('sort')"
|
|
67
|
+
:sort="sortColumnIndex"
|
|
68
|
+
:field="i"
|
|
69
|
+
:order="sortOrder"
|
|
70
|
+
@click="sortBy(i)"
|
|
71
|
+
>
|
|
72
|
+
{{ meta.name }}
|
|
73
|
+
</SortableHeader>
|
|
74
|
+
<th v-else>
|
|
75
|
+
{{ meta.name }}
|
|
76
|
+
</th>
|
|
77
|
+
</template>
|
|
78
|
+
</tr>
|
|
79
|
+
</thead>
|
|
80
|
+
<tbody>
|
|
81
|
+
<tr v-for="r of filteredRows">
|
|
82
|
+
<td v-for="({meta, value}, i) of filterColumns(r, showHidden)">
|
|
83
|
+
<!-- TODO: these apply to the wrong column if some columns are hidden! -->
|
|
84
|
+
<template v-if="meta.qualifier.includes('link_app')">
|
|
85
|
+
<router-link v-if="newTab" :to="replaceLinkValue(meta.link, value)" target="_blank" data-disable-navigate="true"> Application Details </router-link>
|
|
86
|
+
<router-link v-else :to="replaceLinkValue(meta.link, value)"> Application Details </router-link>
|
|
87
|
+
</template>
|
|
88
|
+
<template v-else-if="meta.qualifier.includes('link_report')">
|
|
89
|
+
<router-link v-if="newTab" :to="replaceLinkValue(meta.link, value)" target="_blank" data-disable-navigate="true">{{value}}</router-link>
|
|
90
|
+
<router-link v-else :to="replaceLinkValue(meta.link, value)">{{value}}</router-link>
|
|
91
|
+
</template>
|
|
92
|
+
<template v-else-if="meta.qualifier.includes('date')">{{value | dateFormat}}</template>
|
|
93
|
+
<template v-else-if="meta.qualifier.includes('timestamp')">{{value | dateTimeFormat}}</template>
|
|
94
|
+
<template v-else-if="meta.qualifier.includes('admitPeriod')">{{value | yearTermLongFormat}}</template>
|
|
95
|
+
<template v-else>{{value}}</template>
|
|
96
|
+
</td>
|
|
97
|
+
</tr>
|
|
98
|
+
</tbody>
|
|
99
|
+
</table>
|
|
100
|
+
</template>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
<script>
|
|
104
|
+
import isIsoDate from 'is-iso-date'
|
|
105
|
+
import { dateFormat, dateTimeFormat, yearTermLongFormat } from './dateTimeFormat'
|
|
106
|
+
import FilterButton from './FilterButton'
|
|
107
|
+
import SortableHeader from './SortableHeader'
|
|
108
|
+
import Spinner from './Spinner'
|
|
109
|
+
|
|
110
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
|
|
111
|
+
import { faFileCsv } from '@fortawesome/free-solid-svg-icons'
|
|
112
|
+
|
|
113
|
+
export default {
|
|
114
|
+
name: 'ReportDetail',
|
|
115
|
+
components: {
|
|
116
|
+
FilterButton,
|
|
117
|
+
FontAwesomeIcon,
|
|
118
|
+
SortableHeader,
|
|
119
|
+
Spinner
|
|
120
|
+
},
|
|
121
|
+
filters: { dateTimeFormat, dateFormat, yearTermLongFormat },
|
|
122
|
+
props: {
|
|
123
|
+
columnMetadata: {
|
|
124
|
+
type: Array,
|
|
125
|
+
default: () => []
|
|
126
|
+
},
|
|
127
|
+
rows: {
|
|
128
|
+
type: Array,
|
|
129
|
+
default: () => []
|
|
130
|
+
},
|
|
131
|
+
csv: String,
|
|
132
|
+
title: String,
|
|
133
|
+
loading: Boolean,
|
|
134
|
+
detailPath: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: '/detail'
|
|
137
|
+
},
|
|
138
|
+
error: Boolean,
|
|
139
|
+
newTab: Boolean
|
|
140
|
+
},
|
|
141
|
+
data () {
|
|
142
|
+
return {
|
|
143
|
+
appIdIndex: null,
|
|
144
|
+
sortColumnIndex: null,
|
|
145
|
+
sortOrder: 'desc',
|
|
146
|
+
filteredRows: null,
|
|
147
|
+
filterOpen: [],
|
|
148
|
+
uniqueValues: null,
|
|
149
|
+
showHidden: false
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
watch: {
|
|
153
|
+
rows: {
|
|
154
|
+
handler: 'copyForFiltering',
|
|
155
|
+
immediate: true
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
computed: {
|
|
159
|
+
csvDataEncoded () {
|
|
160
|
+
const encoded = window.encodeURIComponent(this.csv)
|
|
161
|
+
return `data:text/csv;charset=utf-8,${encoded}`
|
|
162
|
+
},
|
|
163
|
+
rowCount () {
|
|
164
|
+
return this.rows.length
|
|
165
|
+
},
|
|
166
|
+
csvIcon () {
|
|
167
|
+
return faFileCsv
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
methods: {
|
|
171
|
+
isIsoDate,
|
|
172
|
+
isUuid (val) {
|
|
173
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
|
174
|
+
return uuidPattern.test(val)
|
|
175
|
+
},
|
|
176
|
+
sortBy (i) {
|
|
177
|
+
if (i === this.sortColumnIndex) {
|
|
178
|
+
const order = this.sortOrder
|
|
179
|
+
this.sortOrder = (order === 'desc') ? 'asc' : 'desc'
|
|
180
|
+
} else {
|
|
181
|
+
this.sortColumnIndex = i
|
|
182
|
+
this.sortOrder = 'desc'
|
|
183
|
+
}
|
|
184
|
+
const sortDesc = (a, b) => {
|
|
185
|
+
const valA = a[i]
|
|
186
|
+
const valB = b[i]
|
|
187
|
+
return valA > valB ? 1 : -1
|
|
188
|
+
}
|
|
189
|
+
const sortAsc = (a, b) => {
|
|
190
|
+
const valA = a[i]
|
|
191
|
+
const valB = b[i]
|
|
192
|
+
return valA > valB ? -1 : 1
|
|
193
|
+
}
|
|
194
|
+
this.filteredRows.sort((this.sortOrder === 'desc') ? sortDesc : sortAsc)
|
|
195
|
+
},
|
|
196
|
+
copyForFiltering (rows) {
|
|
197
|
+
if (Array.isArray(rows) && rows.length > 0) {
|
|
198
|
+
this.filteredRows = rows.slice(0)
|
|
199
|
+
this.uniqueValues = this.columnMetadata
|
|
200
|
+
.map((meta, i) => {
|
|
201
|
+
return {
|
|
202
|
+
column: i,
|
|
203
|
+
label: meta.name,
|
|
204
|
+
values: this.unique(rows, i),
|
|
205
|
+
columnCanBeFiltered: Array.isArray(meta.qualifier) ? meta.qualifier.includes('filter') : false
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
.filter(o => o.columnCanBeFiltered)
|
|
209
|
+
.filter(u => u.values.length < rows.length && u.values.length > 1)
|
|
210
|
+
} else {
|
|
211
|
+
this.filteredRows = null
|
|
212
|
+
this.uniqueValues = null
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
unique (rows, column) {
|
|
216
|
+
const values = Array.from(rows.reduce((a, c) => {
|
|
217
|
+
a.add(c[column])
|
|
218
|
+
return a
|
|
219
|
+
}, new Set())).sort()
|
|
220
|
+
return values
|
|
221
|
+
},
|
|
222
|
+
filterBy (val, column) {
|
|
223
|
+
this.filterOpen[column] = false
|
|
224
|
+
if (val === null) {
|
|
225
|
+
this.filteredRows = this.rows.slice(0)
|
|
226
|
+
} else {
|
|
227
|
+
this.filteredRows = this.rows.filter(r => r[column] === val)
|
|
228
|
+
}
|
|
229
|
+
this.sortOrder = 'desc'
|
|
230
|
+
this.sortColumnIndex = null
|
|
231
|
+
},
|
|
232
|
+
setFilterOpen (col) {
|
|
233
|
+
this.$set(this.filterOpen, col, true)
|
|
234
|
+
},
|
|
235
|
+
setFilterClosed (col) {
|
|
236
|
+
this.$set(this.filterOpen, col, false)
|
|
237
|
+
},
|
|
238
|
+
filterColumns(data, showHidden) {
|
|
239
|
+
const emptyMetadata = {
|
|
240
|
+
ordinal: 999,
|
|
241
|
+
name: '',
|
|
242
|
+
qualifier: [],
|
|
243
|
+
link: ''
|
|
244
|
+
}
|
|
245
|
+
const withMetadata = data.map((v, i) => ({ meta: this.columnMetadata[i] || emptyMetadata, value: v }))
|
|
246
|
+
if(showHidden) {
|
|
247
|
+
return withMetadata
|
|
248
|
+
}
|
|
249
|
+
const columnQualifierHidden = this.columnMetadata.map(m => {
|
|
250
|
+
if(m.qualifier && Array.isArray(m.qualifier)) {
|
|
251
|
+
return m.qualifier.includes('hidden')
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
254
|
+
})
|
|
255
|
+
return withMetadata.filter((val, i) => !columnQualifierHidden[i])
|
|
256
|
+
},
|
|
257
|
+
replaceLinkValue(link, value) {
|
|
258
|
+
return link.replace(/:value/, value)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
</script>
|
|
263
|
+
|
|
264
|
+
<style scoped>
|
|
265
|
+
.left-align-fullwidth {
|
|
266
|
+
display: flex;
|
|
267
|
+
}
|
|
268
|
+
.left-align-fullwidth > * {
|
|
269
|
+
padding: 0.1rem 0.5rem;
|
|
270
|
+
}
|
|
271
|
+
.lr-fullwidth {
|
|
272
|
+
display: flex;
|
|
273
|
+
justify-content: space-between;
|
|
274
|
+
}
|
|
275
|
+
.overflow-scroll {
|
|
276
|
+
max-height: 80vh;
|
|
277
|
+
overflow: scroll;
|
|
278
|
+
}
|
|
279
|
+
</style>
|