Skip to content

Commit

Permalink
Sprint 42
Browse files Browse the repository at this point in the history
  • Loading branch information
john-labbate committed Oct 30, 2024
1 parent 0c44904 commit e4378fd
Show file tree
Hide file tree
Showing 54 changed files with 1,641 additions and 281 deletions.
9 changes: 5 additions & 4 deletions training-front-end/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion training-front-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@uswds/compile": "^1.1.0",
"@uswds/uswds": "^3.8.2",
"@uswds/uswds": "^3.9.0",
"@vitejs/plugin-vue": "^4.6.2",
"@vitest/coverage-v8": "^2.1.2",
"@vue/cli-plugin-eslint": "^5.0.8",
Expand Down
4 changes: 2 additions & 2 deletions training-front-end/public/styles/styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion training-front-end/public/styles/styles.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion training-front-end/src/components/AdminEditReporting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {computed, reactive, ref, watch} from "vue"
import AdminAgencySelect from "./AdminAgencySelect.vue";
import DeleteIcon from "./icons/DeleteIcon.vue";
import USWDSComboBox from "./USWDSComboBox.vue";
import USWDSComboBox from "./form-components/USWDSComboBox.vue";
import {agencyList, bureauList, selectedAgencyId, setSelectedAgencyId} from '../stores/agencies'
import {useStore} from '@nanostores/vue'
import AdminEditUserDetails from "./AdminEditUserDetails.vue";
Expand Down Expand Up @@ -263,6 +263,7 @@ function formatDate(dateStr) {
:items="agency_options"
label="Select agency or organization user should receive reports for?"
name="agency"
:required="true"
/>

<div
Expand Down
26 changes: 16 additions & 10 deletions training-front-end/src/components/AdminEditUserDetails.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup>
import ValidatedInput from "./ValidatedInput.vue";
import ValidatedInput from "./form-components/ValidatedInput.vue";
import {onBeforeMount, reactive, ref, watch} from "vue";
import {helpers, required, requiredIf} from "@vuelidate/validators";
import {useVuelidate} from "@vuelidate/core";
import ValidatedSelect from "./ValidatedSelect.vue";
import {useStore} from "@nanostores/vue";
import {agencyList, bureauList, setSelectedAgencyId} from "../stores/agencies.js";
import USWDSAlert from "./USWDSAlert.vue";
import SpinnerGraphic from "./SpinnerGraphic.vue";
import { RepositoryFactory } from "./RepositoryFactory.vue";
import USWDSComboBox from "./form-components/USWDSComboBox.vue";
const adminRepository = RepositoryFactory.get('admin')
const props = defineProps({
Expand Down Expand Up @@ -48,10 +48,10 @@ const validations_all_info = {
required: withMessage('Please enter your full name', required)
},
agency_id: {
required: withMessage('Please enter your agency', required),
required: withMessage('Please select your agency', required),
},
bureau_id: {
requiredIf: withMessage('Please enter your Sub-Agency, Organization, or Bureau', requiredIf(() => bureaus.value.length)),
requiredIf: withMessage('Please select your Sub-Agency, Organization, or Bureau', requiredIf(() => bureaus.value.length)),
}
}
const v_all_info$ = useVuelidate(validations_all_info, user_input)
Expand Down Expand Up @@ -79,8 +79,6 @@ async function update_user_info() {
try{
let updatedUser = await adminRepository.updateUser(props.userToEdit.id, user_data)
is_saving.value = false
show_spinner.value = false
let successMessage = `Successfully updated ${updatedUser.email}`
emit('completeUserUpdate', successMessage)
} catch(err){
Expand All @@ -89,6 +87,9 @@ async function update_user_info() {
message: err
})
}
is_saving.value = false
show_spinner.value = false
}
function clearErrors(){
Expand Down Expand Up @@ -127,6 +128,7 @@ function setError(event) {
:validator="v_all_info$.name"
label="Full Name"
name="name"
:required="true"
/>
</div>
<div class="tablet:grid-col">
Expand All @@ -147,24 +149,28 @@ function setError(event) {
</div>
<div class="grid-row grid-gap">
<div class="tablet:grid-col">
<ValidatedSelect
<USWDSComboBox
v-model="user_input.agency_id"
client:load
:validator="v_all_info$.agency_id"
:options="agency_options"
:items="agency_options"
label="Agency / organization"
name="agency"
:required="true"
:model-value="user_input.agency_id"
/>
</div>
<div class="tablet:grid-col">
<ValidatedSelect
<USWDSComboBox
v-if="bureaus.length"
v-model="user_input.bureau_id"
client:load
:validator="v_all_info$.bureau_id"
:options="bureaus"
:items="bureaus"
label="Sub-Agency, Organization, or Bureau"
name="bureau"
:required="true"
:model-value="user_input.bureau_id"
/>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions training-front-end/src/components/AdminGSPC.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup>
import { ref, reactive } from 'vue';
import USWDSAlert from './USWDSAlert.vue'
import ValidatedTextArea from './ValidatedTextArea.vue';
import ValidatedDatePicker from './ValidatedDatepicker.vue';
import ValidatedTextArea from './form-components/ValidatedTextArea.vue';
import ValidatedMemorableDatepicker from './form-components/ValidatedMemorableDatepicker.vue';
import { useVuelidate } from '@vuelidate/core';
import { required, helpers } from '@vuelidate/validators';
import SpinnerGraphic from './SpinnerGraphic.vue'
Expand Down Expand Up @@ -147,14 +147,16 @@
:validator="v_all_info$.emailAddresses"
label="Email Addresses of GSA SmartPay Forum Attendees"
name="email-list"
:required="true"
/>
<ValidatedDatePicker
<ValidatedMemorableDatepicker
v-model="user_input.certificationExpirationDate"
client:load
:validator="v_all_info$.certificationExpirationDate"
label="Certification Expiration Date"
name="certification-expiration-date"
hint-text="For example: January 19 2000"
:required="true"
/>
<div>
<USWDSAlert
Expand Down
73 changes: 0 additions & 73 deletions training-front-end/src/components/AdminReportDownload.vue

This file was deleted.

36 changes: 36 additions & 0 deletions training-front-end/src/components/AdminReportGSPC.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script setup>
import AdminRepository from './AdminRepository.vue';
import ReportUtilities from './ReportUtilities.vue';
async function downloadGspcReport() {
let response = await AdminRepository.downloadGspcReport()
let blob = await response.blob();
ReportUtilities.downloadBlobAsFile(blob, 'GspcCompletionReport.csv')
}
</script>
<template>
<li class="usa-card tablet:grid-col-12">
<div class="usa-card__container">
<div class="usa-card__header">
<h4 class="usa-card__heading">
Download GSPC Report
</h4>
</div>
<div class="usa-card__body">
<p>
We’ve created a report for you in CSV format. You can open it in the spreadsheet
application of your choice (e.g. Microsoft Excel, Google Sheets, Apple Numbers).
</p>
</div>
<div class="usa-card__footer">
<button
class="usa-button"
@click="downloadGspcReport"
>
Download Report
</button>
</div>
</div>
</li>
</template>
80 changes: 65 additions & 15 deletions training-front-end/src/components/AdminReportIndex.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<script setup>
import { ref, onErrorCaptured } from "vue"
import AdminReportDownload from "./AdminReportDownload.vue";
import { useStore } from '@nanostores/vue'
import { profile} from '../stores/user'
import { computed } from "vue"
import AdminReportDownload from "./AdminReportGSPC.vue";
import USWDSAlert from './USWDSAlert.vue'
const error = ref()
const user = useStore(profile)
const isAdminUser = computed(() => user.value.roles.includes('Admin'))
function setError(event){
Expand All @@ -23,20 +28,65 @@
</script>

<template>
<div class="padding-top-4 padding-bottom-4 grid-container">
<div class="grid-row">
<div class="tablet:grid-col-12">
<USWDSAlert
v-if="error"
class="tablet:grid-col-12 margin-bottom-4"
status="error"
:heading="error.name"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="error.message" />
</USWDSAlert>
<AdminReportDownload />
<section
v-if="isAdminUser"
class="usa-prose"
>
<div class="padding-top-4 padding-bottom-4 grid-container">
<div class="grid-row">
<div class="tablet:grid-col-12">
<USWDSAlert
v-if="error"
class="tablet:grid-col-12 margin-bottom-4"
status="error"
:heading="error.name"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="error.message" />
</USWDSAlert>
<ul class="usa-card-group">
<AdminReportDownload />
<li class="usa-card tablet:grid-col-12">
<div class="usa-card__container">
<div class="usa-card__header">
<h4 class="usa-card__heading">
GSA SmartPay® Training Report
</h4>
</div>
<div class="usa-card__body">
<p>
This report will enable users to customize a report for individuals who have finished GSA SmartPay training.
The report will be in CSV format, which can be opened in spreadsheet applications like Microsoft Excel, Google Sheets, or Apple Numbers.
</p>
</div>
<div class="usa-card__footer">
<a
href="./training-report/"
class="card_link usa-button"
>
Access Report
</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<section v-else>
<USWDSAlert
status="error"
class="usa-alert"
heading="You are not authorized to receive reports."
>
Your email account is not authorized to access admin reports. If you should be authorized, you can
<a
class="usa-link"
href="mailto:[email protected]"
>
contact the GSA SmartPay team
</a> to gain access.
</USWDSAlert>
</section>
</template>
Loading

0 comments on commit e4378fd

Please sign in to comment.