Skip to content

Commit

Permalink
Ref: WIP #87000, added basics
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoInuits committed Jun 29, 2022
1 parent 3c7c419 commit ee6b14f
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 26 deletions.
73 changes: 73 additions & 0 deletions src/components/cards/leaflet/CampsOverviewMap.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template>
<div class="w-full" style="height: 60vh">
<l-map ref="myMap" :options="options" class="z-0" v-model:zoom="zoom" :center="center">
<l-tile-layer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"></l-tile-layer>
<div v-for="location in locations" :key="location">
</div>
</l-map>
</div>
</template>

<script lang="ts">
import { LMap, LTileLayer, LMarker, LIcon, LPopup, LControl } from '@vue-leaflet/vue-leaflet'
import { CustomInput, CustomButtonSmall, Warning } from 'vue-3-component-library'
import { defineComponent, ref, PropType } from 'vue'
import ICenter from '@/components/icons/ICenter.vue'
import CustomPopup from './CustomPopup.vue'
import { useI18n } from 'vue-i18n'
import { latLng } from 'leaflet'
import 'leaflet/dist/leaflet.css'
export default defineComponent({
components: {
CustomPopup,
LTileLayer,
CustomInput,
LControl,
LMarker,
LPopup,
LIcon,
LMap,
Warning,
CustomButtonSmall,
ICenter
},
props: {
locations: {
type: Object as PropType<Array<any>>,
required: false,
default: () => {
return []
},
},
},
setup(props, { emit }) {
const myMap = ref<any>(null)
const options = ref<any>({scrollWheelZoom: false})
const center = ref<any>(latLng(50.5039,4.4699))
const zoom = ref<Number>(5)
const { t } = useI18n({
inheritLocale: true,
useScope: 'local',
})
return {
t,
myMap,
options,
center,
zoom
}
},
})
</script>

<style>
.leaflet-popup-content-wrapper {
border-radius: 0px !important;
}
.leaflet-container button a {
color: white;
}
</style>
55 changes: 41 additions & 14 deletions src/components/semantics/LocationFilter.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
<template>
<span class="italic font-bold">filters</span>
<div class="border-2 p-2 rounded-md">
<div v-if="isFilterMenuOpen">
<div class="md:hidden float-right">
<cross v-if="filter.gender || filter.ageMin || filter.ageMax" @click="clearFilters()" class="cursor-pointer" />
<cross v-if="filter.year || filter.startDate || filter.endDate || filter.groupNumber" @click="clearFilters()" class="cursor-pointer" />
</div>
<div class="flex xs:flex-col md:gap-4 xs:gap-2">
<div class="flex" style="md:margin-left: 110px">
<div class="flex xs:flex-col pt-3 gap-4 -mt-4">
<!-- <input @input="filtersChanged()" v-model="filter.ageMin" :placeholder="t('location-overview.filters.')" type="number" style="width:115px" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"> -->
<!-- <input @input="filtersChanged()" v-model="filter.ageMax" :placeholder="t('location-overview.participant-sidebar.filter.max-age')" type="number" style="width:120px" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"> -->
<!-- <input @input="filtersChanged()" v-model="filter.ageMax" :placeholder="t('location-overview.participant-sidebar.filter.max-age')" type="number" style="width:120px" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"> -->
<div class="flex xs:flex-col pt-3 gap-4 -mt-4 xs:w-full">
<!-- YEAR -->
<div class="flex flex-col">
<span class="text-base font-bold" >{{t('location-overview.filters.year')}}</span>
<input @input="filtersChanged()" v-model="filter.year" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<!-- STARTDATE -->
<div class="flex flex-col">
<span class="text-base font-bold" >{{t('location-overview.filters.start-date')}}</span>
<input @input="filtersChanged()" v-model="filter.startDate" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>

<div class="flex flex-col">
<span class="text-base font-bold" >{{t('location-overview.filters.end-date')}}</span>
<input @input="filtersChanged()" v-model="filter.endDate" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>

<div class="flex flex-col">
<span class="text-base font-bold" >{{t('location-overview.filters.group-number')}}</span>
<input @input="filtersChanged()" v-model="filter.groupNumber" class="appearance-none border rounded py-2 pl-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>

</div>
<div class="ml-3 xs:hidden">
<cross v-if="filter.gender || filter.ageMin || filter.ageMax" @click="clearFilters()" class="cursor-pointer" />
</div>
</div>
</div>
</div>
<div v-if="checkIfIsMobileSize()" @click="toggleFilterMenu()" class="my-1 flex justify-center">
<i-chevon-down v-if="!isFilterMenuOpen" />
<i-chevon-up v-if="isFilterMenuOpen" />
</div>
</div>
</template>

<script lang="ts">
import IChevonDown from '../icons/IChevonDown.vue'
import { defineComponent, ref, watch } from 'vue'
import { Filter } from '../../serializer/Filter'
import { Filter, LocationFilter } from '../../serializer/Filter'
import Cross from '../icons/Cross.vue'
import { useI18n } from 'vue-i18n'
import IChevonUp from '../icons/IChevonUp.vue'
Expand All @@ -34,32 +58,35 @@ export default defineComponent({
props: {
},
setup (props, { emit }) {
const { checkIfIsMobileSize } = usePhoneHelper()
const { checkIfIsMobileSize } = usePhoneHelper()
const { t } = useI18n({
inheritLocale: true,
useScope: 'local',
})
const filter = ref<any>({ year: '', ageMin: '', ageMax: '', type: '' })
const isFilterMenuOpen = ref<boolean>(true)
watch(() => filter.value.gender, () => {
emit('changedFilters', filter.value)
})
const filter = ref<LocationFilter>({ year: '', startDate: '', endDate: '', groupName: '', groupNumber: '', country: '' })
const filtersChanged = () => {
emit('changedFilters', filter.value)
}
const clearFilters = () => {
filter.value.gender = ''
filter.value.ageMin = ''
filter.value.ageMax = ''
filter.value = { year: '', startDate: '', endDate: '', groupName: '', groupNumber: '', country: '' }
emit('changedFilters', filter.value)
}
const toggleFilterMenu = () => {
isFilterMenuOpen.value = !isFilterMenuOpen.value
}
return {
checkIfIsMobileSize,
filtersChanged,
toggleFilterMenu,
isFilterMenuOpen,
clearFilters,
filter,
t
Expand Down
12 changes: 6 additions & 6 deletions src/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@
},
"location-overview": {
"filters": {
"year": "Jaar:",
"start-date": "Van:",
"end-date": "Tot:",
"group-name": "Groepsnaam: (bevat)",
"group-number": "Groepsnummer: (is of begint met)",
"country": "Land:"
"year": "Jaar",
"start-date": "Van",
"end-date": "Tot",
"group-name": "Groepsnaam (bevat)",
"group-number": "Groepsnummer (is of begint met)",
"country": "Land"
}
}
}
30 changes: 24 additions & 6 deletions src/views/LocationsOverview.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
<template>
<div>
<!-- LOCATIONS PAGE -->
<location-filter />
<div class="p-3">
<location-filter-component @changedFilters="changedFilters($event)" />
</div>

<div class="p-3">
<camps-overview-map :locations="[]" />
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import LocationFilter from '../components/semantics/LocationFilter.vue'
import CampsOverviewMap from '@/components/cards/leaflet/CampsOverviewMap.vue'
import { LocationFilter } from '@/serializer/Filter'
import { defineComponent, ref } from 'vue'
import LocationFilterComponent from '../components/semantics/LocationFilter.vue'
export default defineComponent({
name: 'LocationsOverview',
components: {
LocationFilter
LocationFilterComponent,
CampsOverviewMap
},
setup () {
window.scrollTo({ top: 0, behavior: 'auto' })
const filters = ref<LocationFilter>({ year: '', startDate: '', endDate: '', groupName: '', groupNumber: '', country: '' })
const changedFilters = (f: LocationFilter) => {
filters.value = f
}
return {
changedFilters,
filters
}
}
})
</script>

0 comments on commit ee6b14f

Please sign in to comment.