2022-07-12 10:55:28 +02:00
|
|
|
<template>
|
|
|
|
<form
|
|
|
|
id="search-anchor"
|
|
|
|
class="container mx-auto my-3 px-2 flex flex-wrap flex-col sm:flex-row items-stretch gap-2 text-center items-center justify-center dark:text-slate-100"
|
|
|
|
role="search"
|
|
|
|
@submit.prevent="emit('submit')"
|
|
|
|
>
|
|
|
|
<o-input
|
|
|
|
class="flex-1"
|
|
|
|
v-model="search"
|
|
|
|
:placeholder="t('Keyword, event title, group name, etc.')"
|
|
|
|
autofocus
|
|
|
|
autocapitalize="off"
|
|
|
|
autocomplete="off"
|
|
|
|
autocorrect="off"
|
|
|
|
maxlength="1024"
|
|
|
|
/>
|
|
|
|
<full-address-auto-complete
|
|
|
|
:type="AddressSearchType.ADMINISTRATIVE"
|
|
|
|
:doGeoLocation="false"
|
|
|
|
v-model="location"
|
2022-08-19 15:07:58 +02:00
|
|
|
:hide-map="true"
|
|
|
|
:hide-selected="true"
|
2022-07-12 10:55:28 +02:00
|
|
|
/>
|
|
|
|
<o-button type="submit" icon-left="magnify">
|
|
|
|
<template v-if="search">{{ t("Go!") }}</template>
|
|
|
|
<template v-else>{{ t("Explore!") }}</template>
|
|
|
|
</o-button>
|
|
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { IAddress } from "@/types/address.model";
|
|
|
|
import { AddressSearchType } from "@/types/enums";
|
|
|
|
import { computed } from "vue";
|
|
|
|
import { useI18n } from "vue-i18n";
|
2022-08-12 16:46:44 +02:00
|
|
|
import FullAddressAutoComplete from "@/components/Event/FullAddressAutoComplete.vue";
|
2022-07-12 10:55:28 +02:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
location: IAddress;
|
|
|
|
search: string;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(event: "update:location", location: IAddress): void;
|
|
|
|
(event: "update:search", newSearch: string): void;
|
|
|
|
(event: "submit"): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const location = computed({
|
|
|
|
get(): IAddress {
|
|
|
|
return props.location;
|
|
|
|
},
|
|
|
|
set(newLocation: IAddress) {
|
|
|
|
emit("update:location", newLocation);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const search = computed({
|
|
|
|
get(): string {
|
|
|
|
return props.search;
|
|
|
|
},
|
|
|
|
set(newSearch: string) {
|
|
|
|
emit("update:search", newSearch);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const { t } = useI18n({ useScope: "global" });
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
#search-anchor :deep(.o-ctrl-input) {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
</style>
|