@byu-oit/vue-decision-processing-components 8.35.11 → 8.35.13

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.
@@ -63,15 +63,48 @@
63
63
  computed: {
64
64
  ...mapState({
65
65
  env: 'environment',
66
- applicantId: state => state.application.applicantId
66
+ applicantId: state => state.application.applicantId,
67
+ applicantFirstName: state => state.application.preferredFirstName,
68
+ applicantSurname: state => state.application.surname,
69
+ applicantDob: state => state.application.personalRecords.dateOfBirth
67
70
  }),
68
71
  spinner () { return faSpinner },
69
72
  holdIcon () {
70
73
  return this.holdSet ? faExclamationTriangle : this.error ? faQuestionCircle : faCheck
71
74
  }
72
75
  },
76
+ methods: {
77
+ getByuId: async function () {
78
+ try {
79
+ const surname = this.applicantSurname
80
+ const preferredFirstName = this.applicantFirstName
81
+ const applicantDob = new Date(this.applicantDob).toISOString().split('T')[0].trim()
82
+ const url = this.env === 'production'
83
+ ? `https://api.byu.edu/byuapi/persons/v4/?preferred_first_name=${preferredFirstName.trim()}&surname=${surname.trim()}&vital_record.date_of_birth=${applicantDob.trim()}`
84
+ : `https://api-sandbox.byu.edu/byuapi/persons/v4/?preferred_first_name=${preferredFirstName.trim()}&surname=${surname.trim()}&vital_record.date_of_birth=${applicantDob.trim()}`
85
+
86
+ const { body, status } = await window.byu.auth.request({ url })
87
+ if (status >= 400) {
88
+ this.error = true
89
+ return null
90
+ }
91
+
92
+ const data = JSON.parse(body)
93
+ const recordCount = data.values.length
94
+
95
+ if (recordCount !== 1) {
96
+ return null
97
+ }
98
+
99
+ return data.values[0].byu_id.value
100
+ } catch (err) {
101
+ console.error(err)
102
+ this.error = true
103
+ }
104
+ }
105
+ },
73
106
  async mounted () {
74
- const applicantId = this.applicantId
107
+ const applicantId = this.applicantId ? this.applicantId : await this.getByuId()
75
108
  if (!applicantId) {
76
109
  this.error = true
77
110
  return
@@ -14,7 +14,7 @@
14
14
  limitations under the License.
15
15
  -->
16
16
  <template>
17
- <div v-if="mission">
17
+ <div v-if="mission.name">
18
18
  <div v-if="condensed">
19
19
  <template v-if="mission.name">
20
20
  <div>{{ mission.name }} - {{ mission.type }}</div>
@@ -31,22 +31,22 @@
31
31
  </div>
32
32
  <table v-else class="table table-borderless table-sm">
33
33
  <thead>
34
- <tr>
35
- <th>Mission Name</th>
36
- <th>Mission Type</th>
37
- <th>Mission Language</th>
38
- <th>Mission Dates</th>
39
- <th>Months of Service</th>
40
- </tr>
34
+ <tr>
35
+ <th>Mission Name</th>
36
+ <th>Mission Type</th>
37
+ <th>Mission Language</th>
38
+ <th>Mission Dates</th>
39
+ <th>Months of Service</th>
40
+ </tr>
41
41
  </thead>
42
42
  <tbody>
43
- <tr>
44
- <td>{{mission.name}}</td>
45
- <td>{{mission.type}}</td>
46
- <td>{{mission.language}}</td>
47
- <td>{{mission.startMonth}} - {{mission.endMonth}}</td>
48
- <td>{{monthsOfService}}</td>
49
- </tr>
43
+ <tr>
44
+ <td>{{mission.name}}</td>
45
+ <td>{{mission.type}}</td>
46
+ <td>{{mission.language}}</td>
47
+ <td>{{formatStartDate}} - {{formatEndDate}}</td>
48
+ <td>{{monthsOfService}}</td>
49
+ </tr>
50
50
  </tbody>
51
51
  </table>
52
52
  </div>
@@ -55,34 +55,50 @@
55
55
  </div>
56
56
  </template>
57
57
  <script>
58
- import { mapState } from 'vuex'
59
- import dayjs from 'dayjs';
58
+ import { mapState } from 'vuex'
59
+ import dayjs from 'dayjs';
60
60
 
61
61
 
62
- export default {
63
- name: 'DetailsMission',
64
- props: {
65
- condensed: {
66
- type: Boolean
67
- }
62
+ export default {
63
+ name: 'DetailsMission',
64
+ props: {
65
+ condensed: {
66
+ type: Boolean
67
+ }
68
+ },
69
+ computed: {
70
+ ...mapState({
71
+ mission: state => state.application.mission
72
+ }),
73
+ formatStartDate () {
74
+ if (!this.mission) return ''
75
+ const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
76
+ const startMonth = this.mission.startMonth
77
+ if (!startMonth || !yyyyMm.test(startMonth)) return ''
78
+ return dayjs(startMonth).format('YYYY/MM')
79
+ },
80
+ formatEndDate () {
81
+ if (!this.mission) return ''
82
+ const yyyyMmDd = /^[0-9]{4}-([0][1-9]||[1][0-2])-([0][1-9]||[1-2][0-9]||[3][0-1])$/
83
+ if (this.mission.endMonth === 'Ongoing') return 'Ongoing'
84
+ const endDate = this.mission.endMonth
85
+ if (!endDate || !yyyyMmDd.test(endDate)) return ''
86
+ console.log(`END_DATE: ${dayjs(endDate).format('YYYY/MM/DD')}`)
87
+ return dayjs(endDate).format('YYYY/MM/DD')
68
88
  },
69
- computed: {
70
- ...mapState({
71
- mission: state => state.application.mission
72
- }),
73
- monthsOfService () {
74
- if (!this.mission) return ''
75
- const yyyyMm = /^[0-9]{4}-[0-9]{1,2}$/
76
- const startMonth = this.mission.startMonth
77
- if (!startMonth || !yyyyMm.test(startMonth)) return ''
78
- const endMonth = (this.mission.endMonth === 'Ongoing') ? dayjs().format('YYYY-MM') : dayjs(this.mission.startMonth).format('YYYY-MM')
79
- if (!endMonth || !yyyyMm.test(endMonth)) return ''
80
- const [endY, endM] = endMonth.split('-')
81
- const [startY, startM] = startMonth.split('-')
82
- const mAdjust = Number(endM) - Number(startM)
83
- const yDiff = Number(endY) - Number(startY)
84
- return 12 * yDiff + mAdjust
85
- }
89
+ monthsOfService () {
90
+ if (!this.mission) return ''
91
+ const yyyyMm = /^[0-9]{4}-([0][1-9]||[1][0-2])$/
92
+ const startMonth = this.mission.startMonth
93
+ if (!startMonth || !yyyyMm.test(startMonth)) return ''
94
+ const endMonth = (this.mission.endMonth === 'Ongoing') ? dayjs().format('YYYY-MM') : dayjs(this.mission.endMonth).format('YYYY-MM')
95
+ if (!endMonth || !yyyyMm.test(endMonth)) return ''
96
+ const [endY, endM] = endMonth.split('-')
97
+ const [startY, startM] = startMonth.split('-')
98
+ const mAdjust = Number(endM) - Number(startM)
99
+ const yDiff = Number(endY) - Number(startY)
100
+ return 12 * yDiff + mAdjust
86
101
  }
87
102
  }
103
+ }
88
104
  </script>
package/hsSummary.json CHANGED
@@ -17,7 +17,6 @@
17
17
  },
18
18
  "high_school_codes__info": {
19
19
  "rel": "high_school_codes__info",
20
- "href": "https://api.byu.edu/byuapi/meta/high_school_codes/v1/130535",
21
20
  "method": "GET"
22
21
  }
23
22
  },
@@ -36,7 +35,6 @@
36
35
  "high_school_type": {
37
36
  "value": "USAC",
38
37
  "description": "US-Accredited",
39
- "domain": "https://api.byu.edu/byuapi/meta/high_school_types/v1",
40
38
  "api_type": "modifiable",
41
39
  "key": true,
42
40
  "display_label": "High School Type"
@@ -44,7 +42,6 @@
44
42
  "high_school": {
45
43
  "value": "130535",
46
44
  "description": "MADISON HIGH SCHOOL",
47
- "domain": "https://api.byu.edu/byuapi/meta/high_schools/v1",
48
45
  "api_type": "related",
49
46
  "key": true,
50
47
  "related_resource": "persons",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byu-oit/vue-decision-processing-components",
3
- "version": "8.35.11",
3
+ "version": "8.35.13",
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",
@@ -62,6 +62,7 @@ export const parseBasic = b => {
62
62
  sortName,
63
63
  state,
64
64
  submittedOn,
65
+ surname,
65
66
  zipCode
66
67
  }
67
68
  }