6060
6161 <template v-if =" applicationsInitialized " >
6262 <TransitionGroup >
63+ <sba-panel
64+ v-if =" hasActiveFilter && statusGroups.length === 0"
65+ class =" text-center"
66+ >
67+ {{ t('filter.no_results') }}
68+ </sba-panel >
6369 <sba-panel
6470 v-for =" group in statusGroups"
71+ v-else
6572 :key =" group.status"
6673 :seamless =" true"
6774 :title =" t('term.applications_tc', group.applications.length)"
112119
113120<script >
114121import { groupBy , sortBy , transform } from ' lodash-es' ;
115- import { ref } from ' vue' ;
122+ import { computed , ref , watch } from ' vue' ;
116123import { useI18n } from ' vue-i18n' ;
124+ import { useRoute , useRouter } from ' vue-router' ;
117125
118126import SbaStickySubnav from ' @/components/sba-sticky-subnav' ;
119127import SbaWave from ' @/components/sba-wave' ;
@@ -164,15 +172,40 @@ export default {
164172 default: null ,
165173 },
166174 },
167- setup : function () {
175+ setup : function (props ) {
168176 const { t } = useI18n ();
177+ const router = useRouter ();
178+ const route = useRoute ();
169179 const { applications , applicationsInitialized } = useApplicationStore ();
180+ const filter = ref (route .query .q );
181+
182+ watch (filter, (q ) => {
183+ let to = {
184+ name: ' applications' ,
185+ params: { selected: props .selected },
186+ };
187+
188+ if (q? .length > 0 ) {
189+ to = {
190+ ... to,
191+ query: { q },
192+ };
193+ }
194+
195+ router .replace (to);
196+ });
197+
198+ const hasActiveFilter = computed (() => {
199+ return filter .value ? .length > 0 ;
200+ });
170201
171202 return {
172203 applications,
173204 applicationsInitialized,
174205 t,
175- filter: ref (null ),
206+ filter,
207+ router,
208+ hasActiveFilter,
176209 hasNotificationFiltersSupport: ref (false ),
177210 showNotificationFilterSettingsObject: ref (null ),
178211 notificationFilters: ref ([]),
@@ -205,12 +238,6 @@ export default {
205238 },
206239 },
207240 watch: {
208- ' $route.query' : {
209- immediate: true ,
210- handler () {
211- this .filter = this .$route .query .q || ' ' ;
212- },
213- },
214241 selected: {
215242 immediate: true ,
216243 handler (newVal ) {
@@ -223,7 +250,7 @@ export default {
223250 },
224251 methods: {
225252 select (name ) {
226- this .$ router .replace ({
253+ this .router .replace ({
227254 name: ' applications' ,
228255 params: { selected: name },
229256 });
@@ -234,7 +261,7 @@ export default {
234261 }
235262 this .toggleNotificationFilterSettings (null );
236263 if (this .selected === expectedSelected || ! expectedSelected) {
237- this .$ router .replace ({ name: ' applications' });
264+ this .router .replace ({ name: ' applications' });
238265 }
239266 },
240267 async scrollIntoView (id , behavior ) {
0 commit comments