@byu-oit/vue-decision-processing-components 9.2.0 → 9.4.0

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.
@@ -5,7 +5,7 @@ on:
5
5
  branches: [ main, v8 ]
6
6
 
7
7
  env:
8
- node_version: "14"
8
+ node_version: "22"
9
9
 
10
10
  jobs:
11
11
  publish:
@@ -14,45 +14,61 @@
14
14
  limitations under the License.
15
15
  -->
16
16
  <template>
17
- <FilterButton @show="show = true" @hide="show = false" :show="show">
18
- <FontAwesomeIcon slot="icon" :icon="calendarIcon" />
19
- <span slot="label">Admit Period</span>
20
- <button class="dropdown-item" @click="clearFilter">Show All</button>
21
- <div
22
- v-for="(admitPeriod, i) of admitPeriods"
23
- :key="i"
24
- class="dropdown-item"
25
- >
26
- <input
27
- type="checkbox"
28
- :id="`filter-button-admit-period-option-${i}`"
29
- :value="admitPeriod"
30
- :checked="selectedPeriods.includes(admitPeriod)"
31
- @change="toggle(admitPeriod)"
32
- ></input>
33
- <label :for="`filter-button-admit-period-option-${i}`">{{ admitPeriod | yearTerm }}</label>
34
- </div>
35
- </FilterButton>
17
+ <FilterButton @show="show = true" @hide="show = false" :show="show">
18
+ <FontAwesomeIcon slot="icon" :icon="calendarIcon" />
19
+ <span slot="label">Admit Period</span>
20
+ <button class="dropdown-item" @click="clearFilter">Show All</button>
21
+ <div
22
+ v-for="(admitPeriod, i) of getAdmitPeriodList()"
23
+ :key="i"
24
+ class="dropdown-item"
25
+ >
26
+ <input
27
+ type="checkbox"
28
+ :id="`filter-button-admit-period-option-${i}`"
29
+ :value="admitPeriod"
30
+ :checked="selectedPeriods.includes(admitPeriod)"
31
+ @change="toggle(admitPeriod)"
32
+ ></input>
33
+ <label :for="`filter-button-admit-period-option-${i}`">{{getAdmitPeriodTextFilter(admitPeriod) }}</label>
34
+ </div>
35
+ </FilterButton>
36
36
  </template>
37
37
  <script>
38
38
  import FilterButton from './FilterButton'
39
- import { yearTermLongFormat } from './dateTimeFormat'
39
+ import { yearTermLongFormat, yearTermLongFormatV2 } from './dateTimeFormat'
40
40
  import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
41
41
  import { faCalendarAlt } from '@fortawesome/free-solid-svg-icons'
42
- import { mapGetters, mapMutations, mapActions } from 'vuex'
42
+ import { mapGetters, mapMutations, mapActions, mapState } from 'vuex'
43
+
44
+
45
+ function calcAdmitPeriodV2() {
46
+ const currentMonth = new Date().getMonth() + 1 // JavaScript months are 0-indexed
47
+ let currentYear = new Date().getFullYear()
48
+ // EC has 6 admit periods. This feels cleaner than a bunch of if statements.
49
+ let startAdmitPeriod = Math.floor(currentMonth / 2);
50
+ if (startAdmitPeriod === 0) startAdmitPeriod = 1;
51
+ let admitPeriods = []
52
+ for (let i = 0; i < 6; i ++) {
53
+ if (startAdmitPeriod > 6) {
54
+ startAdmitPeriod = 1
55
+ currentYear++
56
+ }
57
+ admitPeriods.push(`${currentYear}${startAdmitPeriod}`)
58
+ startAdmitPeriod++
59
+ }
60
+ return admitPeriods
61
+ }
43
62
 
44
63
  function calcAdmitPeriods () {
45
64
  const currentMonth = new Date().getMonth() + 1 // JavaScript months are 0-indexed
46
65
  const currentYear = new Date().getFullYear()
47
-
48
66
  if (currentMonth >= 1 && currentMonth <= 4) { // Spring Evaluated: January-April
49
67
  return [`${currentYear}1`, `${currentYear}3`, `${currentYear}5`, `${currentYear + 1}1`]
50
- }
51
- else if (currentMonth >= 5 && currentMonth <= 8) { // Fall Evaluated: May - August
68
+ } else if (currentMonth >= 5 && currentMonth <= 8) { // Fall Evaluated: May - August
52
69
  return [`${currentYear}3`, `${currentYear}5`, `${currentYear + 1}1`, `${currentYear + 1}3`]
53
- }
54
- else if (currentMonth >= 9 && currentMonth <= 12) { // Winter Evaluated: September - December
55
- return [`${currentYear}5`, `${currentYear+1}1`, `${currentYear+1}3`, `${currentYear + 1}5`]
70
+ } else if (currentMonth >= 9 && currentMonth <= 12) { // Winter Evaluated: September - December
71
+ return [`${currentYear}5`, `${currentYear + 1}1`, `${currentYear + 1}3`, `${currentYear + 1}5`]
56
72
  }
57
73
  return []
58
74
  }
@@ -60,17 +76,20 @@ function calcAdmitPeriods () {
60
76
  export default {
61
77
  name: 'FilterButtonAdmitPeriod',
62
78
  components: { FilterButton, FontAwesomeIcon },
63
- filters: { yearTerm: yearTermLongFormat },
64
79
  props: {
65
80
  admitPeriods: {
66
81
  type: Array,
67
82
  default() {
68
- return calcAdmitPeriods()
83
+ return []
69
84
  }
70
85
  }
86
+ },
87
+ mounted () {
88
+
71
89
  },
72
90
  computed: {
73
91
  ...mapGetters(['packetListFilters']),
92
+ ...mapState({institution: state => state?.ui?.institution}),
74
93
  calendarIcon: () => faCalendarAlt,
75
94
  activeFilter () {
76
95
  const filters = this.packetListFilters
@@ -110,6 +129,19 @@ export default {
110
129
  this.clearPacketListFilter({type: 'admitPeriod'})
111
130
  this.fetchPacketList({force: true})
112
131
  this.show = false
132
+ },
133
+ getAdmitPeriodList() {
134
+ if (this.institution === 'EC') {
135
+ return calcAdmitPeriodV2()
136
+ }
137
+ return calcAdmitPeriods()
138
+ },
139
+ getAdmitPeriodTextFilter(period) {
140
+ if (this.institution === 'EC') {
141
+ return yearTermLongFormatV2(period)
142
+
143
+ }
144
+ return yearTermLongFormat(period)
113
145
  }
114
146
  }
115
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
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",