implement filters to the menu
This commit is contained in:
@ -1,96 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import Filters from '@/components/Form/Filters.vue'
|
||||
import Type2 from '@/components/Form/FiltersType/Type2.vue'
|
||||
import Type1 from '@/components/Form/FiltersType/Type1.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="container h-full p-5 mx-auto">
|
||||
<Filters :reportButton="true" >
|
||||
<Type2/>
|
||||
<Type1/>
|
||||
</Filters>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- <template>
|
||||
<div class="fixed top-16 w-72">
|
||||
<Combobox v-model="selected" v-slot="{ open }">
|
||||
<div class="relative mt-1">
|
||||
<div
|
||||
class="relative w-full cursor-default overflow-hidden rounded-lg bg-white text-left shadow-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-teal-300 sm:text-sm">
|
||||
<ComboboxInput class="w-full border-none py-2 pl-3 pr-10 text-sm leading-5 text-gray-900 focus:ring-0"
|
||||
:displayValue="(person: any) => (show || open) ? '' : person.name" @change="query = $event.target.value" @click="show = true" @blur="show = false" defaultValue="sasa" />
|
||||
|
||||
<ComboboxButton id="Test" class="absolute inset-y-0 right-0 flex items-center pr-2">
|
||||
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||
</ComboboxButton>
|
||||
</div>
|
||||
<TransitionRoot :show="show || open" leave="transition ease-in duration-100" leaveFrom="opacity-100" leaveTo="opacity-0"
|
||||
@after-leave="query = ''">
|
||||
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
|
||||
<div v-if="filteredPeople.length === 0 && query !== ''"
|
||||
class="relative cursor-default select-none py-2 px-4 text-gray-700">
|
||||
Nothing found.
|
||||
</div>
|
||||
|
||||
<ComboboxOption v-for="person in filteredPeople" as="template" :key="person.id" :value="person"
|
||||
v-slot="{ selected, active }">
|
||||
<li class="relative cursor-default select-none py-2 pl-10 pr-4" :class="{
|
||||
'bg-teal-600 text-white': active,
|
||||
'text-gray-900': !active,
|
||||
}">
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ person.name }}
|
||||
</span>
|
||||
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3"
|
||||
:class="{ 'text-white': active, 'text-teal-600': !active }">
|
||||
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
</ComboboxOptions>
|
||||
</TransitionRoot>
|
||||
</div>
|
||||
</Combobox>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxInput,
|
||||
ComboboxButton,
|
||||
ComboboxOptions,
|
||||
ComboboxOption,
|
||||
TransitionRoot,
|
||||
} from '@headlessui/vue'
|
||||
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/vue/20/solid'
|
||||
|
||||
const people = [
|
||||
{ id: 1, name: 'Semua Regional' },
|
||||
{ id: 2, name: 'Arlene Mccoy' },
|
||||
{ id: 3, name: 'Devon Webb' },
|
||||
{ id: 4, name: 'Tom Cook' },
|
||||
{ id: 5, name: 'Tanya Fox' },
|
||||
{ id: 6, name: 'Hellen Schmidt' },
|
||||
]
|
||||
|
||||
let selected = ref(people[0])
|
||||
let query = ref('')
|
||||
|
||||
let filteredPeople = computed(() =>
|
||||
query.value === ''
|
||||
? people
|
||||
: people.filter((person) =>
|
||||
person.name
|
||||
.toLowerCase()
|
||||
.replace(/\s+/g, '')
|
||||
.includes(query.value.toLowerCase().replace(/\s+/g, ''))
|
||||
)
|
||||
)
|
||||
|
||||
const show = ref(false)
|
||||
</script> -->
|
||||
|
||||
|
Reference in New Issue
Block a user