Skip to content

Commit

Permalink
Various updates per review/feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle1morel committed May 14, 2024
1 parent 58babb3 commit 6d286aa
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 50 deletions.
6 changes: 6 additions & 0 deletions app/src/components/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export const PERMIT_NEEDED = Object.freeze({
NO: 'No'
});

export const PERMIT_STATUS = Object.freeze({
NEW: 'New',
APPLIED: 'Applied',
COMPLETED: 'Completed'
});

/** Types of notes */
export const NOTE_TYPE_LIST = Object.freeze({
GENERAL: 'General',
Expand Down
4 changes: 3 additions & 1 deletion app/src/controllers/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
APPLICATION_STATUS_LIST,
INTAKE_STATUS_LIST,
PERMIT_NEEDED,
PERMIT_STATUS,
YesNo,
YesNoUnsure
} from '../components/constants';
Expand Down Expand Up @@ -221,6 +222,7 @@ const controller = {

if (data.location) {
location = {
naturalDisaster: data.location.naturalDisaster,
projectLocation: data.location.projectLocation,
locationPIDs: data.location.ltsaPIDLookup,
latitude: data.location.latitude,
Expand All @@ -244,7 +246,7 @@ const controller = {
permitTypeId: x.permitTypeId,
activityId: newActivityId,
trackingId: x.trackingId,
status: x.status,
status: PERMIT_STATUS.APPLIED,
statusLastVerified: x.statusLastVerified
}));
}
Expand Down
8 changes: 4 additions & 4 deletions app/tests/unit/controllers/submission.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,13 @@ describe('createSubmission', () => {
{
permitTypeId: 1,
trackingId: '123',
status: 'New',
status: 'Applied',
statusLastVerified: now
},
{
permitTypeId: 3,
trackingId: '456',
status: 'New',
status: 'Applied',
statusLastVerified: now
}
],
Expand Down Expand Up @@ -533,7 +533,7 @@ describe('createSubmission', () => {
permitTypeId: 1,
activityId: expect.any(String),
trackingId: '123',
status: 'New',
status: 'Applied',
statusLastVerified: now
})
);
Expand All @@ -543,7 +543,7 @@ describe('createSubmission', () => {
permitTypeId: 3,
activityId: expect.any(String),
trackingId: '456',
status: 'New',
status: 'Applied',
statusLastVerified: now
})
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ label {
}

.p-checkbox.p-highlight .p-checkbox-box,
.p-radiobutton-checked .p-radiobutton-box,
.p-radiobutton.p-highlight .p-radiobutton-box,
.p-inputswitch-checked .p-inputswitch-slider:not(.p-disabled) {
background: $app-primary;
border-color: $app-primary;
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/components/form/InputText.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<script setup lang="ts">
import { ErrorMessage } from 'vee-validate';
import { ref } from 'vue';
import InputTextInternal from './internal/InputTextInternal.vue';
import { FloatLabel } from '@/lib/primevue';
import type { Ref } from 'vue';
// Props
type Props = {
helpText?: string;
Expand All @@ -24,6 +27,9 @@ const props = withDefaults(defineProps<Props>(), {
floatLabel: false,
bold: true
});
// State
const fieldActive: Ref<boolean> = ref(false);
</script>

<template>
Expand All @@ -36,10 +42,16 @@ const props = withDefaults(defineProps<Props>(), {
</FloatLabel>
<InputTextInternal
v-else
v-model:fieldActive="fieldActive"
v-bind="props"
/>

<small :id="`${name}-help`">{{ helpText }}</small>
<small
v-if="fieldActive"
:id="`${name}-help`"
>
{{ helpText }}
</small>
<div>
<ErrorMessage :name="name" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/form/RadioList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ watch(value, () => {
:class="{ 'p-invalid': errorMessage }"
:disabled="disabled"
/>
<label
<span
:for="option"
class="ml-2 mb-0"
>
{{ option }}
</label>
</span>
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/form/internal/InputTextInternal.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
import { toRef } from 'vue';
import { toRef, ref } from 'vue';

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

'ref' is defined but never used

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

'ref' is defined but never used

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

'ref' is defined but never used

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

'ref' is defined but never used

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

'ref' is defined but never used

Check warning on line 2 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

'ref' is defined but never used
import { useField } from 'vee-validate';
import { InputText } from '@/lib/primevue';
import type { Ref } from 'vue';

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

'Ref' is defined but never used

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

'Ref' is defined but never used

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

'Ref' is defined but never used

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (16.x)

'Ref' is defined but never used

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (18.x)

'Ref' is defined but never used

Check warning on line 7 in frontend/src/components/form/internal/InputTextInternal.vue

View workflow job for this annotation

GitHub Actions / Unit Tests (Frontend) (20.x)

'Ref' is defined but never used
// Props
type Props = {
helpText: string;
Expand All @@ -17,7 +19,9 @@ type Props = {
const props = withDefaults(defineProps<Props>(), {});
// State
const { errorMessage, value } = useField<string>(toRef(props, 'name'));
const fieldActive = defineModel<boolean>('fieldActive');
</script>

<template>
Expand All @@ -35,5 +39,7 @@ const { errorMessage, value } = useField<string>(toRef(props, 'name'));
class="w-full"
:class="{ 'p-invalid': errorMessage }"
:disabled="disabled"
@focus="fieldActive = true"
@blur="fieldActive = false"
/>
</template>
Loading

0 comments on commit 6d286aa

Please sign in to comment.