diff --git a/2wr-app/src/api/hazard-hunt-api.js b/2wr-app/src/api/hazard-hunt-api.js
index 7c661dc..a30e16e 100644
--- a/2wr-app/src/api/hazard-hunt-api.js
+++ b/2wr-app/src/api/hazard-hunt-api.js
@@ -4,4 +4,7 @@ export default {
async getDocuments() {
return (await baseApiInstance.getInstance()).get('hazardhunt-list');
},
+ async get(id) {
+ return (await baseApiInstance.getInstance()).get(`hazardhunt-by-id/${id}`);
+ }
};
\ No newline at end of file
diff --git a/2wr-app/src/api/hazard-info-api.js b/2wr-app/src/api/hazard-info-api.js
index 7317d9d..0f0fe6c 100644
--- a/2wr-app/src/api/hazard-info-api.js
+++ b/2wr-app/src/api/hazard-info-api.js
@@ -7,5 +7,5 @@ export default {
async get(id) {
return (await baseApiInstance.getInstance()).get(`hazardinfo-by-id/${id}`);
- },
+ }
};
\ No newline at end of file
diff --git a/2wr-app/src/components/prepare/hazards/hazard-hunt-list.vue b/2wr-app/src/components/prepare/hazards/hazard-hunt-list.vue
index 081e250..68060ed 100644
--- a/2wr-app/src/components/prepare/hazards/hazard-hunt-list.vue
+++ b/2wr-app/src/components/prepare/hazards/hazard-hunt-list.vue
@@ -2,7 +2,7 @@
mdi-arrow-left
- mdi-shield-search
+ mdi-shield-alert-outline
Hazard Hunt
-
-
-
-
-
-
-
-
-
- {{ item.name }}
-
-
- {{ item.description }}
-
-
-
+
+
+
+
+
+
+
+
+
@@ -45,7 +43,7 @@ export default {
};
},
computed: mapState({
- hunts: state => state.hazardHuntStore.list
+ items: state => state.hazardHuntStore.list
}),
async created() {
await this.$store.dispatch(`hazardHuntStore/getHazardHuntsAsync`);
@@ -53,7 +51,10 @@ export default {
},
methods: {
goBack() {
- window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/');
+ window.history.length > 1 ? this.$router.go(-1) : this.$router.push('/');
+ },
+ viewItem(id){
+ this.$router.push(`/prepare/hazardhunt/${id}`);
}
}
}
diff --git a/2wr-app/src/components/prepare/hazards/hazard-hunt.vue b/2wr-app/src/components/prepare/hazards/hazard-hunt.vue
new file mode 100644
index 0000000..b6ba373
--- /dev/null
+++ b/2wr-app/src/components/prepare/hazards/hazard-hunt.vue
@@ -0,0 +1,164 @@
+
+
+
+ mdi-arrow-left
+
+ {{item ? item.name : 'Hazard Information'}}
+
+
+
+ {{item.description}}
+
+
+
+
+
+
+ {{item.name}} Safety
+
+
+ Before
+
+
+ During
+
+
+ After
+
+
+ {{item.name}} Resources
+
+
+
+
+
+
+
+
+
+ mdi-close
+
+ {{item.name}} Safety: Before
+
+
+
+
+
+
+
+
+
+ mdi-close
+
+ {{item.name}} Safety: During
+
+
+
+
+
+
+
+
+
+ mdi-close
+
+ {{item.name}} Safety: After
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/2wr-app/src/components/prepare/prepare-landing.vue b/2wr-app/src/components/prepare/prepare-landing.vue
index f402b5f..844adff 100644
--- a/2wr-app/src/components/prepare/prepare-landing.vue
+++ b/2wr-app/src/components/prepare/prepare-landing.vue
@@ -57,8 +57,8 @@
-
+
diff --git a/2wr-app/src/router/index.js b/2wr-app/src/router/index.js
index bec426e..0eb5fc0 100644
--- a/2wr-app/src/router/index.js
+++ b/2wr-app/src/router/index.js
@@ -9,6 +9,7 @@ import EmergencyKitEditPage from '../views/prepare/emergency-kits/emergency-kit-
import HazardHuntListing from '../views/prepare/hazards/hazard-hunt-list-view.vue';
import HazardInfoListing from '../views/prepare/hazards/hazard-info-list-view.vue';
import HazardInfo from '../views/prepare/hazards/hazard-info-view.vue';
+import HazardHunt from '../views/prepare/hazards/hazard-hunt-view.vue';
import Recent from '../views/recent/recent.vue';
import Settings from '../views/settings/settings.vue';
@@ -65,7 +66,16 @@ const routes = [{
meta: {
requiresAuth: true
}
- }, {
+ },
+ {
+ path: '/prepare/hazardhunt/:id',
+ name: 'hazardhuntdetails',
+ component: HazardHunt,
+ meta: {
+ requiresAuth: true
+ }
+ },
+ {
path: '/prepare/hazardinfo',
name: 'hazardinfolist',
component: HazardInfoListing,
diff --git a/2wr-app/src/store/modules/prepare/hazards/hazard-hunt-store.js b/2wr-app/src/store/modules/prepare/hazards/hazard-hunt-store.js
index 20fdfd3..456cad6 100644
--- a/2wr-app/src/store/modules/prepare/hazards/hazard-hunt-store.js
+++ b/2wr-app/src/store/modules/prepare/hazards/hazard-hunt-store.js
@@ -3,16 +3,21 @@ import localForage from 'localforage';
const CACHE_KEY = 'HazardHunts';
const SET_LIST = 'SET_LIST';
+const SET_ITEM = 'SET_ITEM';
export default {
namespaced: true,
state: {
- list: []
+ list: [],
+ item: null
},
mutations: {
[SET_LIST](state, payload) {
state.list = payload;
},
+ [SET_ITEM](state, payload) {
+ state.item = payload;
+ }
},
actions: {
async getHazardHuntsAsync({ commit, rootState }) {
@@ -30,6 +35,31 @@ export default {
}
}
+ },
+ async getHazardHuntAsync({ commit, rootState} , id) {
+
+ try {
+ commit("setBusy", null, { root: true });
+ commit("setError", "", { root: true });
+ const itemCacheKey = `${CACHE_KEY}/${id}`
+ if (rootState.globalStore.online) {
+ let response = await api.get(id);
+ commit(SET_ITEM, response.data);
+ await localForage.setItem(itemCacheKey, response.data);
+ } else {
+ var data = await localForage.getItem(itemCacheKey)
+ if (data) {
+ console.log("Serving from cache");
+ commit(SET_ITEM, data);
+ } else {
+ console.log("Offline without data");
+ }
+ }
+ } catch {
+ commit("setError", "Could not load hazard hunt.", { root: true });
+ } finally {
+ commit("clearBusy", null, { root: true });
+ }
}
}
};
\ No newline at end of file
diff --git a/2wr-app/src/views/prepare/hazards/hazard-hunt-view.vue b/2wr-app/src/views/prepare/hazards/hazard-hunt-view.vue
new file mode 100644
index 0000000..a8a9dfb
--- /dev/null
+++ b/2wr-app/src/views/prepare/hazards/hazard-hunt-view.vue
@@ -0,0 +1,14 @@
+
+
+
+
+