@worksafevictoria/wcl7.5 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,25 +7,25 @@
7
7
  <label class="visually-hidden" for="search-directory">
8
8
  Search by keyword (typed keyword automatically filters below results)
9
9
  </label>
10
- <input type="text" v-model="searchOrg" placeholder="Search organisation" class="search">
10
+ <input type="text" v-model="searchOrg" placeholder="Organisation" class="search">
11
11
  </column>
12
12
  <column xxl="2" xl="3" md="4" sm="6">
13
13
  <label class="visually-hidden" for="search-directory">
14
14
  Search by suburb (typed suburb automatically filters below results)
15
15
  </label>
16
- <input type="text" v-model="searchSub" placeholder="Search suburb" class="search">
16
+ <input type="text" v-model="searchSub" placeholder="Training location" class="search">
17
17
  </column>
18
18
  <!-- Other Filters -->
19
19
  <column xxl="2" xl="3" md="4" sm="6">
20
20
  <select id="filterType" v-model="searchCourse" name="filter" class="selectClass">
21
- <option class="placeholder" value="" disabled hidden selected>Search course type</option>
21
+ <option class="placeholder" value="" disabled hidden selected>Course type</option>
22
22
  <option value="HSR Initial">HSR Initial</option>
23
23
  <option value="HSR Refresher">HSR Refresher</option>
24
24
  </select>
25
25
  </column>
26
26
  <column xxl="2" xl="3" md="4" sm="6">
27
27
  <select id="filterTheme" v-model="searchThemes" name="filter1" class="selectClass">
28
- <option class="placeholder" value="" disabled hidden selected>Search theme</option>
28
+ <option class="placeholder" value="" disabled hidden selected>Theme</option>
29
29
  <option v-for="(opt, i) in themeOptions" :key="i" :value="opt">
30
30
  {{ opt }}
31
31
  </option>
@@ -42,9 +42,9 @@
42
42
  </column>
43
43
  </row>
44
44
  <!-- HSCP Records -->
45
- <div class="hscpRecords">
46
- <template v-for="(item, index) in resultChunks[page]">
47
- <hscp-record v-if="item.type === 'hscp'" :key="index" :item="item" />
45
+ <div class="hscpRecords" >
46
+ <template v-for="(item, index) in resultChunks[page]" >
47
+ <hscp-record v-if="item.type === 'hscp'" :key="index" :item="item"/>
48
48
  </template>
49
49
  </div>
50
50
  <div v-if="filteredRecords.length > 0" align-items="center">
@@ -88,7 +88,7 @@ export default {
88
88
  perPage: 10,
89
89
  page: 0,
90
90
  searchIcon,
91
- hideReset: true,
91
+ hideReset: true
92
92
  }
93
93
  },
94
94
  props: {
@@ -137,7 +137,7 @@ export default {
137
137
 
138
138
  filteredRecords() {
139
139
  let results = this.flatRecords
140
-
140
+
141
141
  if (this.searchOrg.length) {
142
142
  this.hideReset = false
143
143
  results = results.filter(item => item.title.toLowerCase().includes(this.searchOrg.toLowerCase()))
@@ -155,6 +155,11 @@ export default {
155
155
  results = results.filter(item => item.courses.toLowerCase().includes(this.searchThemes.toLowerCase()))
156
156
  }
157
157
  this.filteredItems = results
158
+
159
+ if (this.searchOrg.length || this.searchSub.length || this.searchCourse.length || this.searchThemes.length) {
160
+ this.pageChanged(1)
161
+ }
162
+
158
163
  return results
159
164
  },
160
165
 
@@ -244,30 +249,23 @@ export default {
244
249
 
245
250
  pageChanged(ev) {
246
251
  this.page = ev - 1
247
- if (this.pageResultCount < this.perPage) {
248
- console.log('scroll to records')
249
- this.scrollToRecords()
250
- }
251
- },
252
- scrollToRecords() {
253
- if (this.$refs.records) {
254
- const element = this.$refs.records
255
- const top = element.offsetTop
256
-
257
- const buttons = [...element.querySelectorAll('button')]
258
- if (Array.isArray(buttons) && buttons.length > 0) {
259
- buttons
260
- .filter((button) => button.getAttribute('aria-expanded') === 'true')
261
- .forEach((button) => button.click())
252
+
253
+ const aLinks = document.getElementsByName('titleLink')
254
+ // Convert nodelist to array
255
+ let linksArr = Array.from(aLinks)
256
+ if (Array.isArray(linksArr) && linksArr.length > 0) {
257
+ linksArr
258
+ .filter((link) => link.getAttribute('aria-expanded') === 'true')
259
+ .forEach((link) => link.click())
262
260
 
263
- buttons[0].focus()
261
+ if (this.searchOrg.length || this.searchSub.length || this.searchCourse.length || this.searchThemes.length) {
262
+ // don't set focus
263
+ } else {
264
+ linksArr[0].focus()
264
265
  }
265
-
266
- window.scrollTo({
267
- top,
268
- behavior: 'smooth',
269
- })
266
+
270
267
  }
268
+
271
269
  },
272
270
  }
273
271
  }
@@ -22,62 +22,50 @@
22
22
  </row>
23
23
  <row>
24
24
  <column>
25
- <div>
26
- <GoogleMap
27
- api-key="AIzaSyD76GAmQQ6DuxKWf-aLXPZ9pwdz4nOvs2c"
28
- :style="`width: 100%; height: ${mapHeight}`"
29
- :center="center"
30
- :zoom="zoom"
31
- :zoom-control="true"
32
- :mapTypeControl="false"
33
- :streetViewControl="false"
34
- :fullscreenControl="true"
35
- >
36
- <!-- <CustomControl
37
- position="TOP_CENTER"
38
- class="mt-4"
39
- style="background-color: rgba(0, 0, 0, 0.2); border-radius: 5px"
40
- ><row>
41
- <column class="py-2 px-3">
42
- <single-taxonomy
43
- v-for="(t, i) in computedPropFilters"
44
- :key="i"
45
- :ref="`${t.record_id}`"
46
- :data="t"
47
- :results="filteredList.length"
48
- :loading="isFiltering"
49
- class="wcl-directory-filters__filterButton"
50
- @onFilter="onFilter"
51
- />
52
- <filter-button
53
- v-if="!hideReset"
54
- :is-reset="true"
55
- class="wcl-directory-filters__filterButton"
56
- @clicked="reset"
57
- />
58
- </column>
59
- </row>
60
- </CustomControl> -->
61
- <!-- <MarkerCluster> -->
62
- <Marker
63
- v-for="(location, i) in postcodes"
64
- :options="{
65
- position: location.center,
66
- label: `${location.deaths}`,
67
- title: `${location.deaths} ${location.deaths > 1 ? 'deaths' : 'death'}`,
68
- }"
69
- :key="i"
70
- />
71
- <!-- </MarkerCluster> -->
72
- </GoogleMap>
73
- </div>
25
+ <GoogleMap
26
+ api-key="AIzaSyD76GAmQQ6DuxKWf-aLXPZ9pwdz4nOvs2c"
27
+ map-id="18650d0e6b0daeb1"
28
+ :style="`width: 100%; height: ${mapHeight}`"
29
+ :center="center"
30
+ :zoom="zoom"
31
+ :zoom-control="true"
32
+ :mapTypeControl="false"
33
+ :streetViewControl="false"
34
+ :fullscreenControl="true"
35
+ >
36
+ <Polygon
37
+ v-for="(location, i) in lgaBoundaries"
38
+ :options="location"
39
+ :key="i + polygonKey"
40
+ />
41
+ <CustomControl position="BOTTOM_CENTER">
42
+ <h4 v-if="unknownLGA">
43
+ <BBadge variant="light"> Unknown LGA {{ unknownLGA }} </BBadge>
44
+ </h4>
45
+ </CustomControl>
46
+ <AdvancedMarker
47
+ v-for="(location, i) in centerLGA"
48
+ :options="{
49
+ position: location.center,
50
+ title: `${location.lga} (${location.deaths} ${location.deaths > 1 ? 'fatalities' : 'fatality'})`,
51
+ }"
52
+ :key="i"
53
+ :pin-options="{
54
+ background: '#fdcd59',
55
+ glyph: `${location.deaths}`,
56
+ glyphColor: 'black',
57
+ borderColor: '#000000',
58
+ scale: 1,
59
+ }"
60
+ />
61
+ </GoogleMap>
74
62
  </column>
75
63
  </row>
76
64
  </container>
77
65
  </template>
78
66
 
79
67
  <script>
80
- import postcode from './postcode_location.json'
68
+ import lga from './lga-map.json'
81
69
  import {
82
70
  GoogleMap,
83
71
  Marker,
@@ -85,13 +73,15 @@ import {
85
73
  Circle,
86
74
  CustomControl,
87
75
  InfoWindow,
76
+ Polygon,
77
+ AdvancedMarker,
88
78
  } from 'vue3-google-map'
89
79
  import Container from '../../Containers/Container/index.vue'
90
80
  import Column from '../../Containers/Column/index.vue'
91
81
  import Row from '../../Containers/Row/index.vue'
92
82
  import FilterButton from '../../Common/FilterButton/index.vue' // Reset
93
83
  import SingleTaxonomy from '../../Global/DirectoryFilters/SingleTaxonomy/index.vue'
94
- import { BFormGroup, BFormSelect, BButton } from 'bootstrap-vue-next'
84
+ import { BFormGroup, BFormSelect, BButton, BBadge } from 'bootstrap-vue-next'
95
85
 
96
86
  export default {
97
87
  name: 'GeoChart',
@@ -110,6 +100,9 @@ export default {
110
100
  CustomControl,
111
101
  InfoWindow,
112
102
  BButton,
103
+ Polygon,
104
+ AdvancedMarker,
105
+ BBadge,
113
106
  },
114
107
  props: {
115
108
  statsData: { type: Array, default: () => [] },
@@ -118,7 +111,7 @@ export default {
118
111
  },
119
112
  data() {
120
113
  return {
121
- postcode,
114
+ lga,
122
115
  zoom: 7,
123
116
  mapHeight: '700px',
124
117
  center: { lat: -36.5, lng: 145.3 },
@@ -129,6 +122,8 @@ export default {
129
122
  selected: {},
130
123
  availableBundles: [],
131
124
  },
125
+ unknownLGA: 0,
126
+ polygonKey: 1,
132
127
  }
133
128
  },
134
129
  mounted() {
@@ -209,27 +204,50 @@ export default {
209
204
  })
210
205
  return list
211
206
  },
212
- postcodes: function () {
207
+ centerLGA: function () {
213
208
  if (this.filteredList.length > 1) {
214
209
  let location = {}
210
+ this.unknownLGA = 0
215
211
  this.filteredList.forEach((item) => {
216
- if (location[item.POSTCODE]) {
217
- location[item.POSTCODE].deaths++
212
+ if (location[item.LGA]) {
213
+ location[item.LGA].deaths++
218
214
  } else {
219
- let pc = this.postcode.find((obj) => obj.postcode == item.POSTCODE)
215
+ let pc = this.lga.find(
216
+ (obj) =>
217
+ obj.name ==
218
+ item.LGA.replace('-', ' ')
219
+ .toUpperCase()
220
+ .substring(0, obj.name.length),
221
+ )
220
222
  if (pc) {
221
- location[item.POSTCODE] = {
222
- center: { lat: pc.lat, lng: pc.long },
223
+ location[item.LGA] = {
224
+ center: { lat: pc.labelpoint[0], lng: pc.labelpoint[1] },
223
225
  deaths: 1,
226
+ lga: pc.name,
224
227
  }
225
228
  } else {
226
- console.log('🚀 ~ item.POSTCODE:', item.POSTCODE)
229
+ this.unknownLGA++
227
230
  }
228
231
  }
229
232
  })
230
233
  return location
231
234
  }
232
235
  },
236
+ lgaBoundaries: function () {
237
+ let lgaData = lga.map((item) => {
238
+ return {
239
+ strokeColor: '#000000',
240
+ strokeOpacity: 0.8,
241
+ strokeWeight: 1,
242
+ fillColor: '#bababa',
243
+ fillOpacity: 0.5,
244
+ paths: item.boundaries.map((item) => {
245
+ return { lng: item[0], lat: item[1] }
246
+ }),
247
+ }
248
+ })
249
+ return lgaData
250
+ },
233
251
  },
234
252
  methods: {
235
253
  resize() {