@byu-oit/vue-decision-processing-components 9.6.0 → 9.6.2

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.
@@ -50,7 +50,7 @@ export default {
50
50
  },
51
51
  statusClass() {
52
52
  if (this.flag != null) {
53
- switch (this.flag.state.toLowerCase()) {
53
+ switch ((this.flag.state || '').toLowerCase()) {
54
54
  case 'pass':
55
55
  return { 'text-success': true }
56
56
  case 'fail':
@@ -66,7 +66,7 @@ export default {
66
66
  },
67
67
  flagIcon() {
68
68
  if (this.flag != null) {
69
- switch (this.flag.state.toLowerCase()) {
69
+ switch ((this.flag.state || '').toLowerCase()) {
70
70
  case 'pass':
71
71
  return faCheck
72
72
  case 'fail':
@@ -85,17 +85,17 @@ export default {
85
85
  if (this.flag.message != null && this.flag.message.length > 0) {
86
86
  return this.flag.message
87
87
  }
88
- switch (this.flag.state.toLowerCase()) {
88
+ switch ((this.flag.state || '').toLowerCase()) {
89
89
  case 'pass':
90
90
  return 'No geopolitical concerns.'
91
91
  case 'fail':
92
92
  return 'Geopolitical concerns.'
93
93
  case 'error':
94
- return 'An error occurred. Could not find a unique match.'
94
+ return 'An error occurred. Probable geopolitical concerns.'
95
95
  case 'indeterminate':
96
96
  return 'No data available.'
97
97
  default:
98
- return 'An error occurred. Could not find a unique match.'
98
+ return 'An error occurred. Probable geopolitical concerns.'
99
99
  }
100
100
  }
101
101
  },
package/Report.vue CHANGED
@@ -25,11 +25,25 @@
25
25
  <template v-if="!hideDescription">
26
26
  <h1 v-if="metadata.description">{{metadata.description}}</h1>
27
27
  <h4 v-if="metadata.long_description" class="no-uppercase">{{metadata.long_description}}</h4>
28
- <ByuDateSelector
29
- v-if="metadata.parameters.includes('admitPeriod')"
30
- v-model="selectedAdmitPeriod"
31
- @input="val => $emit('update:admitPeriod', val)"
32
- />
28
+
29
+ <!-- Admit Period Selector -->
30
+ <template v-if="metadata.parameters.includes('admitPeriod')">
31
+ <!-- Use custom dropdown if institution is EC -->
32
+ <select v-if="institution === 'EC'"
33
+ v-model="selectedAdmitPeriod"
34
+ @change="$emit('update:admitPeriod', selectedAdmitPeriod)">
35
+ <option disabled value="">Select Admit Period</option>
36
+ <option v-for="period in getEcAdmitPeriods()" :key="period" :value="period">
37
+ {{ getAdmitPeriodTextFilter(period) }}
38
+ </option>
39
+ </select>
40
+ <ByuDateSelector
41
+ v-else
42
+ v-model="selectedAdmitPeriod"
43
+ @input="val => $emit('update:admitPeriod', val)"
44
+ />
45
+ </template>
46
+
33
47
  <date-picker
34
48
  v-if="metadata.parameters.includes('date_start') && metadata.parameters.includes('date_end')"
35
49
  v-model="dateRange"
@@ -83,9 +97,27 @@ import Reports from './vuexModules/reports'
83
97
  import DatePicker from 'vue2-datepicker'
84
98
  import ByuDateSelector from "./ByuDateSelector.vue"
85
99
  import { mapState } from 'vuex'
100
+ import { yearTermLongFormatV2 } from './dateTimeFormat'
86
101
 
87
- let tabHiddenState = document.hidden
102
+ function calculateECAdmitPeriods() { //calculate admit periods to show on EC custom drop down bar
103
+ const currentMonth = new Date().getMonth() + 1 // JavaScript months are 0-indexed
104
+ let currentYear = new Date().getFullYear()
88
105
 
106
+ let periodIndex = Math.floor(currentMonth / 2) // EC has 6 admit periods, each period covers 2 months
107
+ if (periodIndex === 0) periodIndex = 1 // Ensure period index starts at 1
108
+ let admitPeriods = []
109
+
110
+ for (let i = 0; i < 12; i++) { // display 12 admit periods
111
+ if (periodIndex > 6) { // If gone past period 6, reset to period 1 and increment the year
112
+ periodIndex = 1
113
+ currentYear++
114
+ }
115
+ admitPeriods.push(`${currentYear - 1}${periodIndex}`) //push admit periods from last year
116
+ periodIndex++
117
+ }
118
+ return admitPeriods.sort()
119
+ }
120
+ let tabHiddenState = document.hidden
89
121
  export default {
90
122
  name: 'Report',
91
123
  components: { ByuDateSelector, DatePicker, ReportDetail, ReportPhotos, ReportSvg },
@@ -156,6 +188,18 @@ export default {
156
188
  }
157
189
  },
158
190
  methods: {
191
+ getEcAdmitPeriods() {
192
+ if (this.institution === 'EC') {
193
+ return calculateECAdmitPeriods()
194
+ }
195
+ return []
196
+ },
197
+ getAdmitPeriodTextFilter(period) {
198
+ if (this.institution === 'EC') {
199
+ return yearTermLongFormatV2(period)
200
+ }
201
+ return period
202
+ },
159
203
  async loadReports () {
160
204
  if(!this.metadata) {
161
205
  // wait for metadata before trying to load report
@@ -303,7 +347,13 @@ export default {
303
347
  return q
304
348
  },
305
349
  setDefaultAdmitPeriod() {
306
- try {
350
+ try {
351
+ if (this.institution === 'EC') {
352
+ const defaultPeriod = calculateECAdmitPeriods()[0]
353
+ this.selectedAdmitPeriod = defaultPeriod
354
+ this.$emit('update:admitPeriod', defaultPeriod)
355
+ return
356
+ }
307
357
  const today = new Date()
308
358
  const future = this.configs
309
359
  .filter(p => new Date(p.close) >= today)
@@ -362,4 +412,4 @@ export default {
362
412
  color: var(--gray, gray);
363
413
  font-size: 1rem;
364
414
  }
365
- </style>
415
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.6.0",
3
+ "version": "9.6.2",
4
4
  "description": "Vue components shared between decision processing systems for the CES schools.",
5
5
  "dependencies": {
6
6
  "@fortawesome/fontawesome-free": "^5.15.4",