Skip to content

Commit

Permalink
Updates to survior tool
Browse files Browse the repository at this point in the history
  • Loading branch information
tabiodun committed Nov 29, 2021
1 parent 7d21f28 commit 517872f
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/models/Worksite.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class Worksite extends CCUModel {
email: this.attr(null),
updated_at: this.attr(null),
favorite: this.attr(null),
auto_contact_frequency_t: this.attr(null),
};
}

Expand Down
39 changes: 39 additions & 0 deletions src/pages/CaseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,31 @@
"
/>
</div>
<div class="form-field">
<span slot="label" class="flex items-center">
<span>{{ $t('casesVue.auto_contact_frequency') }}</span>
<ccu-icon
v-tooltip="{
content: $t('casesVue.auto_contact_frequency_help'),
trigger: 'hover',
classes: 'interactive-tooltip w-72',
}"
:alt="$t('casesVue.auto_contact_frequency_help')"
type="help"
size="large"
/>
</span>
<form-select
:value="worksite.auto_contact_frequency_t"
:options="contactFrequencyOptions"
class="bg-white"
@input="(value) => (worksite.auto_contact_frequency_t = value)"
select-classes="h-12 border"
item-key="value"
label="name_t"
:placeholder="$t('casesVue.auto_contact_frequency')"
/>
</div>
<div
class="
text-base
Expand Down Expand Up @@ -392,6 +417,12 @@ import WorksiteNotes from './WorksiteNotes';
const messageBox = create(MessageBox);
const AUTO_CONTACT_FREQUENCY_OPTIONS = [
'formOptions.often',
'formOptions.not_often',
'formOptions.never',
];
export default {
name: 'CaseForm',
components: {
Expand Down Expand Up @@ -480,6 +511,14 @@ export default {
};
},
computed: {
contactFrequencyOptions() {
return AUTO_CONTACT_FREQUENCY_OPTIONS.map((key) => {
return {
value: key,
name_t: this.$t(key),
};
});
},
fields() {
if (this.currentIncident && this.currentIncident.form_fields) {
const formFields = this.currentIncident.form_fields;
Expand Down
56 changes: 42 additions & 14 deletions src/pages/unauthenticated/Survivors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<div class="text-2xl text-center mb-3 font-bold">
Case Number: {{ survivorToken.worksite.case_number }}
</div>

<div class="text-lg">Hi {{ survivorToken.worksite.name }}</div>
<div class="text-lg mb-1">Hi {{ survivorToken.worksite.name }},</div>
<div class="text-lg">{{ $t(survivorToken.survivor_message) }}</div>
<div>
<div class="text-lg font-bold my-2">
{{ $t('~~Let us know if you still need help') }}
Expand Down Expand Up @@ -70,9 +70,11 @@
<div
v-if="
survivorToken.work_types &&
survivorToken.work_types.length > 0 &&
survivorToken.status_t ===
'survivorContact.already_helped_help_needed'
closedWorkTypes.length === survivorToken.work_types.length &&
[
'survivorContact.already_helped_help_needed',
'survivorContact.help_needed',
].includes(survivorToken.status_t)
"
>
<div class="p-3">
Expand Down Expand Up @@ -238,35 +240,47 @@
<div
class="w-1/3 border-t border-b border-r rounded-l-xl p-3"
:class="
survivorToken.update_frequency === 'often'
survivorToken.worksite.auto_contact_frequency_t ===
'formOptions.often'
? 'bg-primary-light'
: ''
"
@click="survivorToken.update_frequency = 'often'"
@click="
survivorToken.worksite.auto_contact_frequency_t =
'formOptions.often'
"
>
{{ $t('~~Often') }}
{{ $t('~~formOptions.often') }}
</div>
<div
class="w-1/3 border-t border-b border-r p-3"
:class="
survivorToken.update_frequency === 'not_often'
survivorToken.worksite.auto_contact_frequency_t ===
'formOptions.not_often'
? 'bg-primary-light'
: ''
"
@click="survivorToken.update_frequency = 'not_often'"
@click="
survivorToken.worksite.auto_contact_frequency_t =
'formOptions.not_often'
"
>
{{ $t('~~Not Often') }}
{{ $t('formOptions.not_often') }}
</div>
<div
class="w-1/3 border rounded-r-xl p-3"
:class="
survivorToken.update_frequency === 'never'
survivorToken.worksite.auto_contact_frequency_t ===
'formOptions.never'
? 'bg-primary-light'
: ''
"
@click="survivorToken.update_frequency = 'never'"
@click="
survivorToken.worksite.auto_contact_frequency_t =
'formOptions.never'
"
>
{{ $t('~~Never') }}
{{ $t('formOptions.never') }}
</div>
</div>
<div class="text-lg mt-2">
Expand Down Expand Up @@ -383,6 +397,20 @@ export default {
}
return '';
},
closedWorkTypes() {
return (
this.survivorToken &&
this.survivorToken.work_types.filter((wt) =>
wt.status.includes('closed'),
)
);
},
openWorkTypes() {
return (
this.survivorToken &&
this.survivorToken.work_types.filter((wt) => wt.status.includes('open'))
);
},
},
methods: {
updateWorkTypesHelpNeeded(value, workTypeToClaim) {
Expand Down

0 comments on commit 517872f

Please sign in to comment.