Skip to content

Commit 6206c62

Browse files
dpaquetteDavid Paquette
and
David Paquette
authored
Build Emergency Kits Feature (#157)
* Ability to add and edit base kits from admin app * Solution architecture diagram from diagrams.net * Admin App: Add new base kits and refactored Base Kit properties * Client App: Build A Kit page * Added ability to fetch emergency kits by baseKitId * Add description to BaseKit * Client App: Build a kit for each base kit type * Client App: Create New Kit * Client App: Edit Emergency Kits * Rename EmergencyKitCreate to EmergencyKitDetails * Fix undefined error Co-authored-by: David Paquette <[email protected]>
1 parent 2080c0f commit 6206c62

28 files changed

+688
-907
lines changed

Diff for: 2wr-app/public/images/kits/build-a-kit.png

46 KB
Loading

Diff for: 2wr-app/public/images/kits/go-kit.png

5.93 KB
Loading

Diff for: 2wr-app/public/images/kits/work-kit.png

5.43 KB
Loading

Diff for: 2wr-app/src/api/emergency-kit-api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import baseApiInstance from './base-api-instance';
22

33
const emergencyKitApi = {
4-
async getAll() {
5-
return (await baseApiInstance.getInstance()).get('emergencykits');
4+
async getAllByBaseKitId(baseKitId) {
5+
return (await baseApiInstance.getInstance()).get(`emergencykits/${baseKitId}`);
66
},
77
async getById(id) {
88
return (await baseApiInstance.getInstance()).get(`emergencykit-by-id/${id}`);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<template>
2+
<v-container class="py-0">
3+
<v-app-bar app flat dense fixed color="background">
4+
<v-icon class="mr-2" v-on:click="goBack()">mdi-arrow-left</v-icon>
5+
<v-icon class="mr-2">mdi-medical-bag</v-icon>
6+
<v-toolbar-title>Build your Emergency Kits</v-toolbar-title>
7+
</v-app-bar>
8+
<v-progress-linear
9+
v-if="loading"
10+
indeterminate
11+
color="green"
12+
></v-progress-linear>
13+
<v-row>
14+
<v-img src="/images/kits/build-a-kit.png"
15+
max-height="20vh"
16+
contain></v-img>
17+
18+
</v-row>
19+
<v-row>
20+
<p>After a disaster, you may be on your own for at least 2 weeks. After you fill out your family plan, this section will help you determine what you need to build your kits for you and your family, one step at a time.</p>
21+
</v-row>
22+
<v-row>
23+
<v-col
24+
v-for="baseKit in baseKits"
25+
:key="baseKit.id"
26+
cols="6"
27+
>
28+
<v-card @click="goToKitListing(baseKit.id)">
29+
<v-img
30+
contain
31+
:src="baseKit.iconUrl"
32+
class="white--text align-end"
33+
gradient="to bottom, rgba(0,0,0,.1), rgba(0,0,0,.5)"
34+
height="200px"
35+
>
36+
<v-card-title v-text="baseKit.name"></v-card-title>
37+
</v-img>
38+
</v-card>
39+
</v-col>
40+
</v-row>
41+
<br/>
42+
<br/>
43+
<br/>
44+
</v-container>
45+
</template>
46+
47+
<script>
48+
import { mapState } from "vuex";
49+
50+
export default {
51+
name: "EmergencyKitBuild",
52+
data: () => ({
53+
loading: true,
54+
}),
55+
computed: mapState({
56+
baseKits: (state) => state.baseKitStore.list,
57+
}),
58+
async created() {
59+
await this.$store.dispatch(`baseKitStore/getBaseKitListAsync`);
60+
this.loading = false;
61+
},
62+
methods: {
63+
goBack() {
64+
window.history.length > 1 ? this.$router.go(-1) : this.$router.push("/");
65+
},
66+
goToKitListing(baseKitId){
67+
this.$router.push(`/prepare/emergencykits/${baseKitId}`);
68+
}
69+
},
70+
};
71+
</script>

0 commit comments

Comments
 (0)