|
1 | 1 | <script setup> |
2 | | - import { ref, reactive } from 'vue'; |
| 2 | + import {ref, reactive, computed} from 'vue'; |
3 | 3 | import USWDSAlert from './USWDSAlert.vue' |
4 | 4 | import ValidatedTextArea from './form-components/ValidatedTextArea.vue'; |
5 | 5 | import ValidatedMemorableDatepicker from './form-components/ValidatedMemorableDatepicker.vue'; |
6 | 6 | import { useVuelidate } from '@vuelidate/core'; |
7 | 7 | import { required, helpers } from '@vuelidate/validators'; |
8 | 8 | import SpinnerGraphic from './SpinnerGraphic.vue' |
9 | 9 | import { RepositoryFactory } from "./RepositoryFactory.vue"; |
| 10 | + import { useStore } from "@nanostores/vue"; |
| 11 | + import { profile } from "../stores/user.js"; |
10 | 12 | |
11 | 13 | const adminRepository = RepositoryFactory.get('admin') |
12 | 14 | const { withMessage } = helpers |
13 | | - |
| 15 | +
|
| 16 | + const user = useStore(profile) |
| 17 | + const isAdminUser = computed(() => user.value.roles.includes('Admin')) |
14 | 18 | const showSuccessMessage = ref(false) |
15 | 19 | const showFailedMessage = ref(false) |
16 | 20 | const showFollowUpSuccessMessage = ref(false) |
|
145 | 149 | } |
146 | 150 | </script> |
147 | 151 | <template> |
148 | | - <div class="padding-top-4 padding-bottom-4 grid-container"> |
149 | | - <ul class="usa-card-group"> |
150 | | - <li class="usa-card tablet:grid-col-12"> |
151 | | - <div class="usa-card__container"> |
152 | | - <div class="usa-card__header"> |
153 | | - <h2 class="usa-card__heading"> |
154 | | - Send Invitations for GSA SmartPay Program Certification |
155 | | - </h2> |
| 152 | + <section |
| 153 | + v-if="isAdminUser" |
| 154 | + class="usa-prose" |
| 155 | + > |
| 156 | + <div class="padding-top-4 padding-bottom-4 grid-container"> |
| 157 | + <ul class="usa-card-group"> |
| 158 | + <li class="usa-card tablet:grid-col-12"> |
| 159 | + <div class="usa-card__container"> |
| 160 | + <div class="usa-card__header"> |
| 161 | + <h2 class="usa-card__heading"> |
| 162 | + Send Invitations for GSA SmartPay Program Certification |
| 163 | + </h2> |
| 164 | + </div> |
| 165 | + <div class="usa-card__body"> |
| 166 | + <p> |
| 167 | + After the attendees finish the necessary coursework for the GSA SmartPay Program Certification (GSPC), as |
| 168 | + stated in Smart Bulletin 22 during the GSA SmartPay Training Forum, you can use the form below to send |
| 169 | + each attendee an email containing a link. This link will enable them to certify their hands-on experience |
| 170 | + and obtain a PDF copy of their GSPC. |
| 171 | + </p> |
| 172 | + <p> |
| 173 | + Please fill out the form below by entering the attendees' email addresses as a comma-separated list and |
| 174 | + selecting an expiration date for their certificate. The expiration date should be three years from the |
| 175 | + date of the GSA SmartPay Training Forum. This form will verify the entered email addresses and notify you |
| 176 | + if any are invalid. |
| 177 | + </p> |
| 178 | + <form |
| 179 | + ref="form" |
| 180 | + class="usa-form usa-form--large margin-bottom-3" |
| 181 | + data-test="gspc-form" |
| 182 | + @submit.prevent="submitGspcInvites" |
| 183 | + > |
| 184 | + <ValidatedTextArea |
| 185 | + v-model="user_input.emailAddresses" |
| 186 | + client:load |
| 187 | + :validator="v_all_info$.emailAddresses" |
| 188 | + label="Email Addresses of GSA SmartPay Forum Attendees" |
| 189 | + name="email-list" |
| 190 | + :required="true" |
| 191 | + @update:paste="handlePaste" |
| 192 | + /> |
| 193 | + <ValidatedMemorableDatepicker |
| 194 | + v-model="user_input.certificationExpirationDate" |
| 195 | + client:load |
| 196 | + :validator="v_all_info$.certificationExpirationDate" |
| 197 | + label="Certification Expiration Date" |
| 198 | + name="certification-expiration-date" |
| 199 | + hint-text="For example: January 19 2000" |
| 200 | + :required="true" |
| 201 | + /> |
| 202 | + <div> |
| 203 | + <USWDSAlert |
| 204 | + v-if="showFailedMessage" |
| 205 | + status="error" |
| 206 | + class="usa-alert--slim" |
| 207 | + :has-heading="false" |
| 208 | + > |
| 209 | + Emails failed to send to: {{ failedEmailList }} |
| 210 | + </USWDSAlert> |
| 211 | + <USWDSAlert |
| 212 | + v-if="showSuccessMessage" |
| 213 | + status="success" |
| 214 | + class="usa-alert--slim" |
| 215 | + :has-heading="false" |
| 216 | + > |
| 217 | + Emails sending to {{ successCount }} people. |
| 218 | + </USWDSAlert> |
| 219 | + </div> |
| 220 | + <div class="grid-row grid-gap margin-top-3"> |
| 221 | + <div class="grid-col"> |
| 222 | + <input |
| 223 | + class="usa-button" |
| 224 | + type="submit" |
| 225 | + value="Send Invitations" |
| 226 | + :disabled="isLoading" |
| 227 | + data-test="submit" |
| 228 | + > |
| 229 | + <button |
| 230 | + id="cancel" |
| 231 | + type="button" |
| 232 | + class="usa-button usa-button--outline" |
| 233 | + :disabled="isLoading" |
| 234 | + @click="cancel" |
| 235 | + > |
| 236 | + Cancel |
| 237 | + </button> |
| 238 | + </div> |
| 239 | + <!--display spinner along with submit button in one row for desktop--> |
| 240 | + <div |
| 241 | + v-if="showSpinner" |
| 242 | + class="display-none tablet:display-block tablet:grid-col-1 tablet:padding-top-3 tablet:margin-left-neg-1" |
| 243 | + > |
| 244 | + <SpinnerGraphic /> |
| 245 | + </div> |
| 246 | + </div> |
| 247 | + <!--display spinner under submit button for mobile view--> |
| 248 | + <div |
| 249 | + v-if="showSpinner" |
| 250 | + class="tablet:display-none margin-top-1 text-center" |
| 251 | + > |
| 252 | + <SpinnerGraphic /> |
| 253 | + </div> |
| 254 | + </form> |
| 255 | + </div> |
156 | 256 | </div> |
157 | | - <div class="usa-card__body"> |
158 | | - <p> |
159 | | - After the attendees finish the necessary coursework for the GSA SmartPay Program Certification (GSPC), as |
160 | | - stated in Smart Bulletin 22 during the GSA SmartPay Training Forum, you can use the form below to send |
161 | | - each attendee an email containing a link. This link will enable them to certify their hands-on experience |
162 | | - and obtain a PDF copy of their GSPC. |
163 | | - </p> |
164 | | - <p> |
165 | | - Please fill out the form below by entering the attendees' email addresses as a comma-separated list and |
166 | | - selecting an expiration date for their certificate. The expiration date should be three years from the |
167 | | - date of the GSA SmartPay Training Forum. This form will verify the entered email addresses and notify you |
168 | | - if any are invalid. |
169 | | - </p> |
170 | | - <form |
171 | | - ref="form" |
172 | | - class="usa-form usa-form--large margin-bottom-3" |
173 | | - data-test="gspc-form" |
174 | | - @submit.prevent="submitGspcInvites" |
175 | | - > |
176 | | - <ValidatedTextArea |
177 | | - v-model="user_input.emailAddresses" |
178 | | - client:load |
179 | | - :validator="v_all_info$.emailAddresses" |
180 | | - label="Email Addresses of GSA SmartPay Forum Attendees" |
181 | | - name="email-list" |
182 | | - :required="true" |
183 | | - @update:paste="handlePaste" |
184 | | - /> |
185 | | - <ValidatedMemorableDatepicker |
186 | | - v-model="user_input.certificationExpirationDate" |
187 | | - client:load |
188 | | - :validator="v_all_info$.certificationExpirationDate" |
189 | | - label="Certification Expiration Date" |
190 | | - name="certification-expiration-date" |
191 | | - hint-text="For example: January 19 2000" |
192 | | - :required="true" |
193 | | - /> |
| 257 | + </li> |
| 258 | + <li class="usa-card tablet:grid-col-12"> |
| 259 | + <div class="usa-card__container"> |
| 260 | + <div class="usa-card__header"> |
| 261 | + <h2 class="usa-card__heading"> |
| 262 | + Send Follow Ups for GSA SmartPay Program Certification |
| 263 | + </h2> |
| 264 | + </div> |
| 265 | + <div class="usa-card__body"> |
| 266 | + <p> |
| 267 | + Sends out follow up GSPC invite emails to users who have |
| 268 | + <ul> |
| 269 | + <li>Received the original GSPC invite within the last 6 months</li> |
| 270 | + <li>Hasn't already completed the GSPC survey</li> |
| 271 | + <li>Hasn't already received both follow up notifications</li> |
| 272 | + <li>Hasn't received the last GSPC email within 12 hours</li> |
| 273 | + </ul> |
| 274 | + </p> |
| 275 | + <p> |
| 276 | + The system will send the subsequent needed notification based on the last one received by the user. |
| 277 | + </p> |
194 | 278 | <div> |
195 | 279 | <USWDSAlert |
196 | | - v-if="showFailedMessage" |
197 | | - status="error" |
198 | | - class="usa-alert--slim" |
199 | | - :has-heading="false" |
200 | | - > |
201 | | - Emails failed to send to: {{ failedEmailList }} |
202 | | - </USWDSAlert> |
203 | | - <USWDSAlert |
204 | | - v-if="showSuccessMessage" |
| 280 | + v-if="showFollowUpSuccessMessage" |
205 | 281 | status="success" |
206 | 282 | class="usa-alert--slim" |
207 | 283 | :has-heading="false" |
208 | 284 | > |
209 | | - Emails sending to {{ successCount }} people. |
| 285 | + Sending out GSPC follow up emails. |
210 | 286 | </USWDSAlert> |
211 | 287 | </div> |
212 | 288 | <div class="grid-row grid-gap margin-top-3"> |
213 | 289 | <div class="grid-col"> |
214 | | - <input |
215 | | - class="usa-button" |
216 | | - type="submit" |
217 | | - value="Send Invitations" |
218 | | - :disabled="isLoading" |
219 | | - data-test="submit" |
220 | | - > |
221 | 290 | <button |
222 | | - id="cancel" |
| 291 | + id="send-out-follow-ups" |
223 | 292 | type="button" |
224 | | - class="usa-button usa-button--outline" |
| 293 | + class="usa-button" |
225 | 294 | :disabled="isLoading" |
226 | | - @click="cancel" |
| 295 | + @click="sendGspcFollowUps" |
227 | 296 | > |
228 | | - Cancel |
| 297 | + Send Out Follow Ups |
229 | 298 | </button> |
230 | 299 | </div> |
231 | 300 | <!--display spinner along with submit button in one row for desktop--> |
|
236 | 305 | <SpinnerGraphic /> |
237 | 306 | </div> |
238 | 307 | </div> |
239 | | - <!--display spinner under submit button for mobile view--> |
240 | 308 | <div |
241 | 309 | v-if="showSpinner" |
242 | 310 | class="tablet:display-none margin-top-1 text-center" |
243 | 311 | > |
244 | 312 | <SpinnerGraphic /> |
245 | 313 | </div> |
246 | | - </form> |
247 | | - </div> |
248 | | - </div> |
249 | | - </li> |
250 | | - <li class="usa-card tablet:grid-col-12"> |
251 | | - <div class="usa-card__container"> |
252 | | - <div class="usa-card__header"> |
253 | | - <h2 class="usa-card__heading"> |
254 | | - Send Follow Ups for GSA SmartPay Program Certification |
255 | | - </h2> |
256 | | - </div> |
257 | | - <div class="usa-card__body"> |
258 | | - <p> |
259 | | - Sends out follow up GSPC invite emails to users who have |
260 | | - <ul> |
261 | | - <li>Received the original GSPC invite within the last 6 months</li> |
262 | | - <li>Hasn't already completed the GSPC survey</li> |
263 | | - <li>Hasn't already received both follow up notifications</li> |
264 | | - <li>Hasn't received the last GSPC email within 12 hours</li> |
265 | | - </ul> |
266 | | - </p> |
267 | | - <p> |
268 | | - The system will send the subsequent needed notification based on the last one received by the user. |
269 | | - </p> |
270 | | - <div> |
271 | | - <USWDSAlert |
272 | | - v-if="showFollowUpSuccessMessage" |
273 | | - status="success" |
274 | | - class="usa-alert--slim" |
275 | | - :has-heading="false" |
276 | | - > |
277 | | - Sending out GSPC follow up emails. |
278 | | - </USWDSAlert> |
279 | | - </div> |
280 | | - <div class="grid-row grid-gap margin-top-3"> |
281 | | - <div class="grid-col"> |
282 | | - <button |
283 | | - id="send-out-follow-ups" |
284 | | - type="button" |
285 | | - class="usa-button" |
286 | | - :disabled="isLoading" |
287 | | - @click="sendGspcFollowUps" |
288 | | - > |
289 | | - Send Out Follow Ups |
290 | | - </button> |
291 | | - </div> |
292 | | - <!--display spinner along with submit button in one row for desktop--> |
293 | | - <div |
294 | | - v-if="showSpinner" |
295 | | - class="display-none tablet:display-block tablet:grid-col-1 tablet:padding-top-3 tablet:margin-left-neg-1" |
296 | | - > |
297 | | - <SpinnerGraphic /> |
298 | | - </div> |
299 | | - </div> |
300 | | - <div |
301 | | - v-if="showSpinner" |
302 | | - class="tablet:display-none margin-top-1 text-center" |
303 | | - > |
304 | | - <SpinnerGraphic /> |
305 | 314 | </div> |
306 | 315 | </div> |
307 | | - </div> |
308 | | - </li> |
309 | | - </ul> |
310 | | - </div> |
| 316 | + </li> |
| 317 | + </ul> |
| 318 | + </div> |
| 319 | + </section> |
| 320 | + <section v-else> |
| 321 | + <USWDSAlert |
| 322 | + status="error" |
| 323 | + class="usa-alert" |
| 324 | + heading="You are not authorized to access." |
| 325 | + > |
| 326 | + Your email account is not authorized to access. If you should be authorized, you can contact the |
| 327 | + <a |
| 328 | + class="usa-link" |
| 329 | + href="mailto:gsa_smartpay@gsa.gov" |
| 330 | + > |
| 331 | + GSA SmartPay team |
| 332 | + </a> to gain access. |
| 333 | + </USWDSAlert> |
| 334 | + </section> |
311 | 335 | </template> |
312 | 336 | <style> |
313 | 337 | .usa-textarea { |
|
0 commit comments