Skip to content

Commit f41d600

Browse files
Added support for toggling alerts on family plans
1 parent 8f85eeb commit f41d600

8 files changed

Lines changed: 6667 additions & 6072 deletions

File tree

2wr-app/package-lock.json

Lines changed: 6621 additions & 6055 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2wr-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"eslint": "^6.7.2",
4242
"eslint-plugin-vue": "^6.2.2",
4343
"npm-run-all": "^4.1.5",
44-
"sass": "^1.32.4",
44+
"sass": "~1.32.4",
4545
"sass-loader": "^8.0.2",
4646
"vue-cli-plugin-vuetify": "^2.0.9",
4747
"vue-template-compiler": "^2.6.11",

2wr-app/src/assets/app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
position: absolute;
44
background-color: #fff;
55
margin-top: -9px;
6-
font-size: 12px;
76
padding: 1px;
87
}
98

2wr-app/src/components/common/EditableTextBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div>
33
<v-card v-if="!isEditing">
4-
<div class="pseudo-text-block-label">{{ label }}</div>
4+
<div class="pseudo-text-block-label text-caption">{{ label }}</div>
55
<v-flex class="d-flex justify-space-between px-2 py-2">
66
<v-card-title v-if="isTitle">{{ theText }}</v-card-title>
77
<v-card-text v-if="!isTitle">{{ theText }}</v-card-text>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div>
33
<v-card v-if="address">
4-
<div class="pseudo-text-block-label">{{ title }}</div>
4+
<div class="pseudo-text-block-label text-caption">{{ title }}</div>
55
<v-card-text>
66
<v-row class="pl-3 justify-end">
77
<v-icon class="pr-2" @click="dialogOpen = true">mdi-pencil</v-icon>
88
</v-row>
9-
<v-row class="pl-4">
9+
<v-row class="pl-4 black--text">
1010
<div v-if="!formattedAddress"
1111
><em>No Address: Click pencil to specify address.</em></div
1212
>

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@
4242
:to="`/prepare/familyplan/${item.id}`"
4343
>
4444
<v-card-title class="d-flex justify-space-between px-2 py-2">
45-
<div>
46-
{{ item.title }}
47-
</div>
48-
<div>
49-
<v-icon class="mr-2">mdi-chevron-right</v-icon>
50-
</div>
45+
<div>
46+
<v-icon v-if="item.allowAlerts">mdi-alarm-light</v-icon>
47+
<v-icon v-if="!item.allowAlerts">mdi-alarm-light-off</v-icon>
48+
49+
{{ item.title }}
50+
</div>
51+
<v-icon class="mr-2">mdi-chevron-right</v-icon>
5152
</v-card-title>
5253
</v-card>
5354
</div>
@@ -66,7 +67,7 @@ import {
6667
computed,
6768
defineComponent,
6869
onMounted,
69-
ref,
70+
ref
7071
} from "@vue/composition-api";
7172
import store from "@/store";
7273
@@ -86,8 +87,8 @@ export default defineComponent({
8687
return {
8788
currentTab,
8889
familyPlans,
89-
sharedPlans,
90+
sharedPlans
9091
};
91-
},
92+
}
9293
});
93-
</script>
94+
</script>

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
<template>
22
<v-container class="py-0" v-if="plan">
33
<InfoBar title="Family Plan"></InfoBar>
4+
<v-flex>
5+
<v-row justify="end" class="py-6" @click="toggleAlerts">
6+
<div class="text-button px-6">{{ plan.allowAlerts ? 'Alerts Enabled' : 'Alerts Disabled'}}</div>
7+
<v-icon
8+
plain
9+
large
10+
class="mr-6"
11+
>{{ plan.allowAlerts ? 'mdi-alarm-light' : 'mdi-alarm-light-off'}}</v-icon
12+
>
13+
</v-row>
14+
</v-flex>
415
<EditableTextBlock
516
label="Plan Name"
617
v-model="plan.title"
@@ -117,7 +128,6 @@ export default defineComponent({
117128
if (props.planId === "new") {
118129
plan.value = reactive(new FamilyPlan());
119130
} else {
120-
console.log(props.planId);
121131
let found = store.getters["familyPlansStore/findFamilyPlan"](
122132
props.planId
123133
);
@@ -150,14 +160,25 @@ export default defineComponent({
150160
151161
function ensureNamed(intent, subcomponent) {
152162
if (store.state.error) store.commit("clearError");
153-
if (!plan.value || !plan.value.id || !plan.value.title) {
163+
if (!isPlanSaved()) {
154164
store.commit("setError", `Must name a plan before setting ${intent}`);
155165
} else {
156166
router.push(`/prepare/familyplan/${plan.value.id}/${subcomponent}/`);
157167
}
158168
}
159169
170+
function isPlanSaved() {
171+
return plan.value && plan.value.id;
172+
}
173+
174+
async function toggleAlerts() {
175+
plan.value.allowAlerts = plan.value.allowAlerts ? false : true;
176+
if (isPlanSaved()) {
177+
await updatePlan();
178+
}
179+
}
160180
return {
181+
toggleAlerts,
161182
ensureNamed,
162183
plan,
163184
updatePlan,
@@ -167,3 +188,9 @@ export default defineComponent({
167188
}
168189
});
169190
</script>
191+
192+
<style scoped>
193+
.v-icon {
194+
transition: none !important;
195+
}
196+
</style>

2wr-app/src/models/family-plans/FamilyPlan.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ export default class FamilyPlan {
1010
routes = [];
1111
children = [];
1212
pets = [];
13+
allowAlerts = false;
14+
1315
}

0 commit comments

Comments
 (0)