|
|
@@ -8,7 +8,7 @@
|
|
|
<h2 class="flex">
|
|
|
{{ $t("member_companies") }}
|
|
|
</h2>
|
|
|
- <v-btn-toggle mandatory dense @change="viewChanged">
|
|
|
+ <v-btn-toggle mandatory dense :value="mapview ? 0 : 1" @change="viewChanged">
|
|
|
<v-btn>
|
|
|
{{ $t("map") }}
|
|
|
</v-btn>
|
|
|
@@ -151,22 +151,12 @@
|
|
|
</v-form>
|
|
|
</v-row>
|
|
|
|
|
|
- <!-- loading skeleton -->
|
|
|
<div class="pt-4 mt-6">
|
|
|
+ <!-- loading skeleton -->
|
|
|
<v-container v-if="$fetchState.pending">
|
|
|
<v-row v-for="i in 3" :key="i" justify="space-between" class="mt-1 mb-3">
|
|
|
- <v-col
|
|
|
- v-for="j in 2"
|
|
|
- :key="j"
|
|
|
- cols="12"
|
|
|
- sm="12"
|
|
|
- :md="mapview ? 6 : 12"
|
|
|
- class="py-2 px-1"
|
|
|
- >
|
|
|
- <v-skeleton-loader
|
|
|
- type="card"
|
|
|
- :loading="true"
|
|
|
- />
|
|
|
+ <v-col v-for="j in 2" :key="j" cols="12" :md="mapview ? 6 : 12" class="py-2 px-1">
|
|
|
+ <v-skeleton-loader type="card" :loading="true" />
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
</v-container>
|
|
|
@@ -249,7 +239,11 @@
|
|
|
<span class="flex-fill" />
|
|
|
|
|
|
<v-card-actions :class="listview ? 'align-self-end' : ''">
|
|
|
- <v-btn class="see" :to="'/structures/' + structure.id" nuxt>
|
|
|
+ <v-btn
|
|
|
+ class="see"
|
|
|
+ :to="{path: '/structures/' + structure.id, query: { parent: parent, view: view, theme: theme }}"
|
|
|
+ nuxt
|
|
|
+ >
|
|
|
<span style="margin-right: 6px;">{{ $t("see_more") }}</span>
|
|
|
<font-awesome-icon :icon="['fa', 'caret-right']" />
|
|
|
</v-btn>
|
|
|
@@ -283,15 +277,30 @@ import sphericDistance from '@/services/utils/geo'
|
|
|
import StructuresProvider from '~/services/data/StructuresProvider'
|
|
|
|
|
|
export default Vue.extend({
|
|
|
+ validate ({ query }) {
|
|
|
+ if (!/^\d+$/.test(query.parent as string ?? '')) {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.error('Missing parameter: parent')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (query.view && !['map', 'list'].includes(query.view as string)) {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.error('Invalid parameter: view')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
+ parent: parseInt(this.$route.query.parent as string),
|
|
|
+ view: this.$route.query.view ?? 'map',
|
|
|
+ theme: this.$route.query.theme ?? 'orange',
|
|
|
structures: [] as Array<Structure>,
|
|
|
filteredStructures: [] as Array<Structure>,
|
|
|
federations: [] as Array<{ id: number | null, name: string | null }>,
|
|
|
loading: true,
|
|
|
page: 1,
|
|
|
itemsPerPage: 8,
|
|
|
- mapview: true,
|
|
|
departments: departments as {code: string, label: string}[],
|
|
|
practices: practices as {id: string}[],
|
|
|
textFilter: null as string | null,
|
|
|
@@ -305,7 +314,7 @@ export default Vue.extend({
|
|
|
}
|
|
|
},
|
|
|
async fetch () {
|
|
|
- await new StructuresProvider(this.$axios).getAll(12097).then(
|
|
|
+ await new StructuresProvider(this.$axios).getAll(this.parent).then(
|
|
|
(res) => {
|
|
|
this.structures = res
|
|
|
this.filteredStructures = res
|
|
|
@@ -338,8 +347,11 @@ export default Vue.extend({
|
|
|
pageCount (): number {
|
|
|
return Math.floor(this.totalRecords / this.itemsPerPage) + 1
|
|
|
},
|
|
|
+ mapview (): boolean {
|
|
|
+ return this.view === 'map'
|
|
|
+ },
|
|
|
listview (): boolean {
|
|
|
- return !this.mapview
|
|
|
+ return this.view === 'list'
|
|
|
},
|
|
|
translatedPractices (): Array<{ id: string, label: string }> {
|
|
|
const tPractices = []
|
|
|
@@ -351,7 +363,7 @@ export default Vue.extend({
|
|
|
},
|
|
|
methods: {
|
|
|
viewChanged (e: number) {
|
|
|
- this.mapview = (e === 0)
|
|
|
+ this.view = (e === 0) ? 'map' : 'list'
|
|
|
},
|
|
|
textFilterChanged (newVal: string) {
|
|
|
this.textFilter = newVal
|