Skip to content

Commit dbb4cec

Browse files
authored
Added support for out of area contacts. (#105)
* Added Distant property. * Added support for out of area contacts. * Added support for out of area contacts. * Added support for out of area contacts. * Added support for out of area contacts. * Added support for out of area contacts. * Added support for out of area contacts. * Added support for out of area contacts.
1 parent 0d799be commit dbb4cec

8 files changed

Lines changed: 66 additions & 10 deletions

File tree

2wr-app/src/components/prepare/family-plans/editors/emergency-contact-editor.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
v-model="theContact.sharePlanWith"
5151
label="Share Plan with this Person?"
5252
/>
53+
<v-checkbox
54+
v-model="theContact.distant"
55+
v-if="distant"
56+
label="Out of area?"
57+
disabled=true
58+
/>
5359
<v-divider></v-divider>
5460
<v-card-actions class="">
5561
<v-btn text @click="$emit(`cancel`)">Cancel</v-btn>
@@ -67,6 +73,7 @@ import _ from "lodash";
6773
export default defineComponent({
6874
props: {
6975
contact: { required: true },
76+
distant: { required: true }
7077
},
7178
setup(props, { emit, refs }) {
7279
const theContact = reactive(_.cloneDeep(props.contact));

2wr-app/src/components/prepare/family-plans/emergency-contact-view.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
<IconTextBlock :icon="contact.sharePlanWith ? 'mdi-check-box-outline' : 'mdi-checkbox-blank-outline'">
6262
<div>Share Plan?</div>
6363
</IconTextBlock>
64+
<IconTextBlock v-if="distant" :icon="distant ? 'mdi-check-box-outline' : 'mdi-checkbox-blank-outline'">
65+
<div>Out of area?</div>
66+
</IconTextBlock>
6467
</div>
6568
</div>
6669
</template>
@@ -71,6 +74,7 @@ import { defineComponent, ref } from "@vue/composition-api";
7174
export default defineComponent({
7275
props: {
7376
contact: { required: true },
77+
distant: { required: true }
7478
},
7579
setup() {
7680
const showSchoolInfo = ref(false);

2wr-app/src/components/prepare/family-plans/family-plan-contacts-view.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<v-container class="py-0" v-if="plan">
33
<v-fab-transition>
44
<v-btn
5+
v-if="contacts.length == 0 || !distant"
56
color="green"
67
dark
78
absolute
@@ -14,15 +15,17 @@
1415
<v-icon>mdi-plus</v-icon>
1516
</v-btn>
1617
</v-fab-transition>
17-
<InfoBar :title="`${plan.title} - Emergency Contacts`"></InfoBar>
18-
<v-card class="pa-2" v-if="contacts.length == 0"><em>Press <strong>'+'</strong> to add new contacts.</em></v-card>
18+
<InfoBar v-if="distant" :title="`${plan.title} - Distant Contact`"></InfoBar>
19+
<InfoBar v-if="!distant" :title="`${plan.title} - Emergency Contacts`"></InfoBar>
20+
<v-card class="pa-2" v-if="contacts.length == 0"><em>Press <strong>'+'</strong> to add a new contact.</em></v-card>
1921
<v-card v-for="contact in contacts" :key="contact.fullName">
20-
<EmergencyContactView :contact="contact" @launchEditor="launchEditor"></EmergencyContactView>
22+
<EmergencyContactView v-if="contact.distant === distant" :contact="contact" :distant="distant" @launchEditor="launchEditor"></EmergencyContactView>
2123
</v-card>
2224
<v-dialog v-model="showEditor" persistent>
2325
<EmergencyContactEditor
2426
v-if="showEditor"
2527
:contact="editorContact"
28+
:distant="distant"
2629
@cancel="showEditor = false"
2730
@save="save"
2831
></EmergencyContactEditor>
@@ -49,15 +52,16 @@ export default defineComponent({
4952
EmergencyContactView,
5053
EmergencyContactEditor
5154
},
52-
props: { planId: { required: true } },
55+
props: { planId: { required: true }, distant: { required: true } },
5356
setup(props) {
5457
const contacts = ref(null);
5558
const plan = ref(null);
56-
5759
const editorContact = ref(null);
5860
const showEditor = ref(false);
61+
const distant = ref(false);
5962
6063
onMounted(() => {
64+
distant.value = props.distant;
6165
let found = store.getters["familyPlansStore/findFamilyPlan"](
6266
props.planId
6367
);
@@ -80,10 +84,13 @@ export default defineComponent({
8084
}
8185
8286
function addNew() {
83-
launchEditor(new EmergencyContact());
87+
let contact = new EmergencyContact();
88+
contact.distant = distant.value;
89+
launchEditor(contact);
8490
}
8591
8692
return {
93+
distant,
8794
contacts,
8895
goBack,
8996
plan,

2wr-app/src/components/prepare/family-plans/family-plans-view.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@
7272
</div>
7373
</v-flex>
7474
</v-card>
75+
<v-card
76+
class="mx-2 my-2"
77+
color="primary"
78+
ripple
79+
@click="ensureNamed('Out of Area Contact', 'distantcontacts')"
80+
>
81+
<v-flex class="d-flex justify-space-between px-2 py-2">
82+
<div>Out of Area Contacts</div>
83+
<div>
84+
<v-icon class="mr-2">mdi-chevron-right</v-icon>
85+
</div>
86+
</v-flex>
87+
</v-card>
7588
<v-card
7689
class="mx-2 my-2"
7790
color="primary"

2wr-app/src/router/familyPlanRoutes.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import FamilyPlanLanding from '../views/prepare/family-plans/landing.vue';
22
import FamilyPlanView from '../views/prepare/family-plans/view.vue';
33
import FamilyPlanContacts from "../views/prepare/family-plans/contacts.vue"
4+
import FamilyPlanDistantContacts from "../views/prepare/family-plans/distant-contacts.vue"
45
import FamilyPlanRoutes from "../views/prepare/family-plans/routes.vue";
56
import FamilyPlanChildren from '@/views/prepare/family-plans/children.vue';
67
import FamilyPlanPets from '@/views/prepare/family-plans/pets.vue';
@@ -23,6 +24,15 @@ export default [
2324
requiresAuth: true
2425
}
2526
},
27+
{
28+
path: '/prepare/familyplan/:planId/distantcontacts',
29+
name: "familyplan-distantcontacts",
30+
component: FamilyPlanDistantContacts,
31+
props: true,
32+
meta: {
33+
requiresAuth: true
34+
}
35+
},
2636
{
2737
path: '/prepare/familyplan/:planId/emergencycontacts',
2838
name: "familyplay-contacts",
@@ -59,4 +69,4 @@ export default [
5969
requiresAuth: true
6070
}
6171
}
62-
];
72+
];

2wr-app/src/views/prepare/family-plans/contacts.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<FamilyPlansContacts :planId="planId"></FamilyPlansContacts>
2+
<FamilyPlansContacts :planId="planId" :distant=false></FamilyPlansContacts>
33
</template>
44

55
<script>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<FamilyPlansContacts :planId="planId" :distant=true></FamilyPlansContacts>
3+
</template>
4+
5+
<script>
6+
import FamilyPlansContacts from "@/components/prepare/family-plans/family-plan-contacts-view.vue";
7+
import { defineComponent } from "@vue/composition-api";
8+
9+
export default defineComponent({
10+
components: { FamilyPlansContacts },
11+
props: [ "planId" ]
12+
});
13+
</script>

TwoWeeksReady.Common/FamilyPlans/Contact.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Newtonsoft.Json;
1+
using Newtonsoft.Json;
22

33
namespace TwoWeeksReady.Common.FamilyPlans
44
{
@@ -22,5 +22,7 @@ public class Contact
2222
public bool NotifyLastLocation { get; set; }
2323
[JsonProperty("sharePlanWith")]
2424
public bool SharePlanWith { get; set; }
25+
[JsonProperty("distant")]
26+
public bool Distant { get; set; }
2527
}
26-
}
28+
}

0 commit comments

Comments
 (0)