Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/military affiliation #426

Merged
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion webroot/src/components/Forms/InputFile/InputFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
// Created by InspiringApps on 7/8/2020.
//

import { Component, mixins, toNative } from 'vue-facing-decorator';
import {
Component,
mixins,
toNative
} from 'vue-facing-decorator';
import { reactive } from 'vue';
import MixinInput from '@components/Forms/_mixins/input.mixin';
import UploadFileIcon from '@components/Icons/UploadFile/UploadFile.vue';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
label {
display: flex;
align-items: center;
margin-left: 3rem;
font-weight: @fontWeightLight;
cursor: pointer;

&::before {
display: inline-block;
position: absolute;
top: 0;
left: -3rem;
width: 2.0rem;
height: 2.0rem;
margin: 0 0.3rem 0 0;
Expand All @@ -60,7 +63,7 @@
input[type='radio']:checked + label::after {
position: absolute;
top: 0.4rem;
left: 0.4rem;
left: -2.6rem;
display: block;
width: 1.4rem;
height: 1.4rem;
Expand Down
5 changes: 4 additions & 1 deletion webroot/src/components/Forms/_mixins/form.mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MixinForm extends Vue {
get joiMessages(): any {
const messages = {
string: {
'string.empty': this.$t('inputErrors.required'),

'string.min': this.$t('inputErrors.minLength', { min: '{#limit}' }),
'string.email': this.$t('inputErrors.email'),
'string.max': this.$t('inputErrors.maxLength', { max: '{#limit}' }),
Expand All @@ -80,6 +80,9 @@ class MixinForm extends Vue {
'array.min': this.$t('inputErrors.required'),
'array.max': this.$t('inputErrors.maxFiles', { max: '{#limit}' }),
'array.length': this.$t('inputErrors.lengthFiles', { length: '{#limit}' }),
},
radio: {
'string.empty': this.$t('inputErrors.required'),
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// MilitaryDocumentRow.less
// InspiringApps modules
//
// Created by InspiringApps on 4/30/2021.
//

.example-row {
display: flex;
flex-direction: column;
padding: 0.8rem 0;
border-bottom: 0.1rem solid @midGrey;

@media @tabletWidth {
flex-direction: row;
}

.cell {
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
color: @veryDarkGrey;

&.is-header {
display: none;
font-weight: @fontWeightBold;

@media @tabletWidth {
display: flex;
}
}

.cell-title {
font-weight: @fontWeightBold;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// MilitaryDocumentRow.spec.ts
// InspiringApps modules
//
// Created by InspiringApps on 4/30/2021.
//

import { expect } from 'chai';
import { mountShallow } from '@tests/helpers/setup';
import MilitaryDocumentRow from '@components/MilitaryDocumentRow/MilitaryDocumentRow.vue';

describe('MilitaryDocumentRow component', async () => {
it('should mount the component', async () => {
const wrapper = await mountShallow(MilitaryDocumentRow, {
props: {
item: {},
}
});

expect(wrapper.exists()).to.equal(true);
expect(wrapper.findComponent(MilitaryDocumentRow).exists()).to.equal(true);
});
});
14 changes: 14 additions & 0 deletions webroot/src/components/MilitaryDocumentRow/MilitaryDocumentRow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// MilitaryDocumentRow.ts
// InspiringApps modules
//
// Created by InspiringApps on 4/30/2021.
//

import { Component, Prop, Vue } from 'vue-facing-decorator';

@Component
export default class MilitaryDocumentRow extends Vue {
@Prop({ required: true }) item!: any;
@Prop({ default: false }) isHeaderRow?: boolean;
}
22 changes: 22 additions & 0 deletions webroot/src/components/MilitaryDocumentRow/MilitaryDocumentRow.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
MilitaryDocumentRow.vue
InspiringApps modules

Created by InspiringApps on 4/30/2021.
-->

<template>
<li class="example-row">
<div class="cell name" :class="{ 'is-header': isHeaderRow }">
<span v-if="$matches.phone.only" class="cell-title">{{ $t('military.fileName') }}:</span>
{{ item.name }}
</div>
<div class="cell size" :class="{ 'is-header': isHeaderRow }">
<span v-if="$matches.phone.only" class="cell-title">{{ $t('military.dateUploaded') }}:</span>
{{ item.date }}
</div>
</li>
</template>

<script lang="ts" src="./MilitaryDocumentRow.ts"></script>
<style scoped lang="less" src="./MilitaryDocumentRow.less"></style>
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class SelectedStatePurchaseInformation extends mixins(MixinForm) {
}

get militaryDiscountText(): string {
return this.$t('licensing.militaryDiscountText');
return this.$t('military.militaryDiscountText');
}

get jurisprudenceModalTitle(): string {
Expand Down Expand Up @@ -149,8 +149,18 @@ class SelectedStatePurchaseInformation extends mixins(MixinForm) {
return this.selectedStatePurchaseData?.isMilitaryDiscountActive || false;
}

get shouldApplyMilitaryDiscount(): boolean {
let shouldApply = false;

if (this.licensee) {
shouldApply = this.isMilitaryDiscountActive && this.licensee.isMilitary();
}

return shouldApply;
}

get subTotal(): string {
const militaryDiscount = this.isMilitaryDiscountActive
const militaryDiscount = this.shouldApplyMilitaryDiscount
&& this.selectedStatePurchaseData?.militaryDiscountAmount
? this.selectedStatePurchaseData?.militaryDiscountAmount : 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="info-row-label">{{commissionFeeText}}</div>
<div class="expire-date-value">${{currentCompactCommissionFeeDisplay}}</div>
</div>
<div v-if="selectedStatePurchaseData.isMilitaryDiscountActive" class="info-row sub-row">
<div v-if="shouldApplyMilitaryDiscount" class="info-row sub-row">
<div class="info-row-label">{{militaryDiscountText}}</div>
<div class="expire-date-value">-${{militaryDiscountAmountDisplay}}</div>
</div>
Expand Down
38 changes: 37 additions & 1 deletion webroot/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@
"licensing": {
"license": "License",
"licensingListTitle": "Licensing Data",
"attestation": "Attestation",
"searchTitle": "Begin a search",
"searchSubtext": "Enter at least one field to search for licensing data.",
"licenseExpiredMessage": "Your license has expired.",
Expand All @@ -498,7 +499,6 @@
"state": "State",
"issued": "Issued",
"expirationDate": "Expiration date",
"militaryDiscountText": "Military Discount",
"expireDate": "Expire Date",
"expires": "Expires",
"selectPrivileges": "Select privileges",
Expand Down Expand Up @@ -553,6 +553,42 @@
}
]
},
"military": {
"militaryStatusTitle": "Military status",
"updateMilitaryStatusTitle": "Update military status",
"viewMilitaryStatus": "View military status",
"militaryDiscountText": "Military Discount",
"affiliationType": "Affiliation Type",
"previouslyUploadedDocuments": "Previously Uploaded Documents",
"endMilitaryAffiliation": "End military affiliation",
"editInfo": "Edit info",
"noUploadedDocuments": "No uploaded documents",
"endAffiliationModalTitle": "Are you sure you want to end your military affiliation?",
"endAffiliationModalContent" : "This action cannot be undone, but if needed, you can go through the confirmation process again.",
"noGoBack": "No, go back",
"yesEnd": "Yes, end my affiliation",
"affiliationAttestationOptions": [
{
"name": "I hereby attest and affirm that I am an active-duty military member, defined as a person with a full-time duty status in the active uniformed service of the United States, including members of the National Guard and Reserve on active duty orders.",
"value": "militaryMember"
},
{
"name": "I hereby attest and affirm that I am the legal spouse of an active-duty military member, defined as a person with a full-time duty status in the active uniformed service of the United States, including members of the National Guard and Reserve on active duty orders.",
"value": "militaryMemberSpouse"
}
],
"affiliationTypes": {
"militaryMember": "Active-duty military member",
"militaryMemberSpouse": "Active-duty military spouse",
"none": "N/A"
},
"documentProofLabel": "Upload proof of military affiliation*",
"successLongProcess": "Submit successful, your status may take a minute to process",
"submitFail": "Error uploading document",
"fileInstructions": "Only 1 file (PDF, docx, png, jpeg only)",
"fileName": "File name",
"dateUploaded": "Date uploaded"
},
"account": {
"accountTitle": "Account",
"usersListTitle": "Users",
Expand Down
38 changes: 37 additions & 1 deletion webroot/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@
"licensing": {
"licensingListTitle": "Datos de licencia",
"searchTitle": "Iniciar una búsqueda",
"attestation": "Atestación",
"searchSubtext": "Introduzca al menos un campo para buscar datos de licencia.",
"searchLabel": "Buscar",
"searchPlaceholderName": "Introducir nombre",
Expand All @@ -491,7 +492,6 @@
"issueDate": "Fecha de asunto",
"expireDate": "Fecha de caducidad",
"expirationDate": "Fecha de caducidad",
"militaryDiscountText": "Descuento Militar",
"lastUpdate": "Última carga",
"license": "Licencia",
"licenseExpiredMessage": "Su licencia ha caducado.",
Expand Down Expand Up @@ -553,6 +553,42 @@
}
]
},
"military": {
"militaryStatusTitle": "Estado militar",
"updateMilitaryStatusTitle": "Actualizar el estado militar",
"militaryDiscountText": "Descuento Militar",
"viewMilitaryStatus": "Ver estado militar",
"affiliationType": "Tipo de afiliación",
"previouslyUploadedDocuments": "Previously Uploaded Documents",
"endMilitaryAffiliation": "Parar afiliación militar",
"editInfo": "Editar información",
"noUploadedDocuments": "No documentos cargados",
"endAffiliationModalTitle": "¿Está seguro de que desea poner fin a su afiliación militar?",
"endAffiliationModalContent" : "Esta acción no se puede deshacer, pero si es necesario, puedes volver a realizar el proceso de confirmación.",
"noGoBack": "No, regresa",
"yesEnd": "Sí, terminar mi afiliación",
"affiliationAttestationOptions": [
{
"name": "Por la presente doy fe y afirmo que soy un miembro militar en servicio activo, definido como una persona con un estado de servicio de tiempo completo en el servicio uniformado activo de los Estados Unidos, incluidos los miembros de la Guardia Nacional y la Reserva en servicio activo.",
"value": "militaryMember"
},
{
"name": "Por la presente doy fe y afirmo que soy el cónyuge legal de un miembro militar en servicio activo, definido como una persona con estatus de servicio de tiempo completo en el servicio uniformado activo de los Estados Unidos, incluidos los miembros de la Guardia Nacional y la Reserva en activo. órdenes de servicio.",
"value": "militaryMemberSpouse"
}
],
"affiliationTypes": {
"militaryMember": "Miembro militar en servicio activo",
"militaryMemberSpouse": "Esposo militar en servicio activo",
"none": "N/A"
},
"documentProofLabel": "Cargar prueba de afiliación militar",
"successLongProcess": "Enviado correctamente, su estado puede tardar un minuto en procesarse",
"submitFail": "Error al cargar el documento",
"fileInstructions": "Sólo 1 archivo (sólo PDF, docx, png, jpeg)",
"fileName": "Nombre del archivo",
"dateUploaded": "Fecha de carga"
},
"account": {
"accountTitle": "Cuenta",
"usersListTitle": "Usuarios",
Expand Down
Loading
Loading