|
67 | 67 | @update:modelValue="applyFilters" |
68 | 68 | /> |
69 | 69 |
|
| 70 | + <Select |
| 71 | + class="relative md:col-span-6 lg:col-span-3" |
| 72 | + :label="$t('is_national')" |
| 73 | + v-model="filter.is_national" |
| 74 | + :options="{ |
| 75 | + true: $t('yes'), |
| 76 | + false: $t('no'), |
| 77 | + }" |
| 78 | + @update:modelValue="applyFilters" |
| 79 | + /> |
| 80 | + |
70 | 81 | <Select |
71 | 82 | class="relative md:col-span-6 lg:col-span-3" |
72 | 83 | :label="$t('county')" |
|
114 | 125 | </template> |
115 | 126 |
|
116 | 127 | <script setup> |
117 | | - import { ref } from 'vue'; |
118 | | - import { ViewBoardsIcon, ViewGridIcon, LocationMarkerIcon, XIcon } from '@heroicons/vue/solid'; |
119 | | - import route from '@/Helpers/useRoute'; |
120 | | - import PageLayout from '@/Layouts/PageLayout.vue'; |
121 | | - import Sort from '@/Components/filters/Sort.vue'; |
122 | | - import SearchFilter from '@/Components/filters/SearchFilter.vue'; |
123 | | - import PaginatedGrid from '@/Components/templates/PaginatedGrid.vue'; |
124 | | - import SecondaryButton from '@/Components/buttons/SecondaryButton.vue'; |
125 | | - import Map from '@/Components/maps/Map.vue'; |
126 | | - import DatePicker from '@/Components/form/DatePicker.vue'; |
127 | | - import Select from '@/Components/form/Select.vue'; |
128 | | - import useFilters from '@/Helpers/useFilters.js'; |
129 | | -
|
130 | | - const props = defineProps({ |
131 | | - collection: { |
132 | | - type: Object, |
133 | | - }, |
134 | | - counties: { |
135 | | - type: Array, |
136 | | - }, |
137 | | - categories: { |
138 | | - type: Array, |
139 | | - }, |
140 | | - pins: { |
141 | | - type: Array, |
142 | | - }, |
143 | | - view: { |
144 | | - type: String, |
145 | | - default: 'list', |
146 | | - validator: (view) => ['list', 'map'].includes(view), |
147 | | - }, |
148 | | - }); |
149 | | -
|
150 | | - const filter = ref({ |
151 | | - county: props.collection.filter?.county || [], |
152 | | - status: props.collection.filter?.status || null, |
153 | | - category: props.collection.filter?.category || [], |
154 | | - date: props.collection.filter?.date || [], |
155 | | - search: props.collection.filter?.search || null, |
156 | | - }); |
157 | | -
|
158 | | - let url = route(props.view === 'map' ? 'projects.map' : 'projects.index'); |
159 | | - const scrollTarget = ref(null); |
160 | | -
|
161 | | - function applySelectedCountyFromMap(id) { |
162 | | - filter.value.county = [id]; |
163 | | - applyFilters(); |
164 | | -
|
165 | | - scrollTarget.value.scrollIntoView(); |
166 | | - } |
167 | | -
|
168 | | - const { applyFilters, clearFilters } = useFilters(filter, props.collection.sort, url); |
| 128 | +import { ref } from 'vue'; |
| 129 | +import { ViewBoardsIcon, ViewGridIcon, LocationMarkerIcon, XIcon } from '@heroicons/vue/solid'; |
| 130 | +import route from '@/Helpers/useRoute'; |
| 131 | +import PageLayout from '@/Layouts/PageLayout.vue'; |
| 132 | +import Sort from '@/Components/filters/Sort.vue'; |
| 133 | +import SearchFilter from '@/Components/filters/SearchFilter.vue'; |
| 134 | +import PaginatedGrid from '@/Components/templates/PaginatedGrid.vue'; |
| 135 | +import SecondaryButton from '@/Components/buttons/SecondaryButton.vue'; |
| 136 | +import Map from '@/Components/maps/Map.vue'; |
| 137 | +import DatePicker from '@/Components/form/DatePicker.vue'; |
| 138 | +import Select from '@/Components/form/Select.vue'; |
| 139 | +import useFilters from '@/Helpers/useFilters.js'; |
| 140 | +
|
| 141 | +const props = defineProps({ |
| 142 | + collection: { |
| 143 | + type: Object, |
| 144 | + }, |
| 145 | + counties: { |
| 146 | + type: Array, |
| 147 | + }, |
| 148 | + categories: { |
| 149 | + type: Array, |
| 150 | + }, |
| 151 | + pins: { |
| 152 | + type: Array, |
| 153 | + }, |
| 154 | + view: { |
| 155 | + type: String, |
| 156 | + default: 'list', |
| 157 | + validator: (view) => ['list', 'map'].includes(view), |
| 158 | + }, |
| 159 | +}); |
| 160 | +
|
| 161 | +const filter = ref({ |
| 162 | + county: props.collection.filter?.county || [], |
| 163 | + status: props.collection.filter?.status || null, |
| 164 | + category: props.collection.filter?.category || [], |
| 165 | + is_national: props.collection.filter?.is_national || null, |
| 166 | + date: props.collection.filter?.date || [], |
| 167 | + search: props.collection.filter?.search || null, |
| 168 | +}); |
| 169 | +
|
| 170 | +let url = route(props.view === 'map' ? 'projects.map' : 'projects.index'); |
| 171 | +const scrollTarget = ref(null); |
| 172 | +
|
| 173 | +function applySelectedCountyFromMap(id) { |
| 174 | + filter.value.county = [id]; |
| 175 | + applyFilters(); |
| 176 | +
|
| 177 | + scrollTarget.value.scrollIntoView(); |
| 178 | +} |
| 179 | +
|
| 180 | +const { applyFilters, clearFilters } = useFilters(filter, props.collection.sort, url); |
169 | 181 | </script> |
0 commit comments