| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <template>
- <q-dialog ref="dialogRef" @hide="onDialogHide">
- <q-card style="width: 800px; max-width: 95vw; border-radius: 12px">
- <q-bar class="bg-transparent q-px-md" style="height: 55px">
- <span class="text-h6 text-dark" style="font-weight: 600"
- >Frequência Média</span
- >
- <q-space />
- <q-btn dense flat icon="mdi-close" @click="onDialogCancel" />
- </q-bar>
- <q-card-section class="q-pt-none q-pb-md q-px-md">
- <q-card flat bordered style="border-radius: 8px">
- <q-card-section class="q-pb-sm">
- <q-input
- v-model="search"
- dense
- borderless
- placeholder="Busque por unidade, status"
- >
- <template #prepend>
- <q-icon name="mdi-magnify" color="grey-6" />
- </template>
- </q-input>
- </q-card-section>
- <q-separator />
- <div class="list-header q-px-md q-py-xs">
- <span class="text-caption text-grey-7">Unidade</span>
- <span class="text-caption text-grey-7">Frequência média</span>
- <span class="text-caption text-grey-7">Status</span>
- </div>
- <q-separator />
- <div>
- <template
- v-for="(item, index) in filteredUnidades"
- :key="item.id"
- >
- <div
- class="list-row q-px-md q-py-sm"
- :class="{ 'row-selected': index === selectedIndex }"
- @click="selectedIndex = index"
- >
- <span class="text-body2 text-dark">{{ item.unidade }}</span>
- <span class="text-body2 text-dark">{{ item.frequencia }}</span>
- <q-badge
- :label="item.status"
- :color="item.status === 'Alto' ? 'secondary' : 'orange'"
- style="
- border-radius: 8px;
- font-size: 11px;
- padding: 4px 8px;
- width: max-content;
- "
- />
- </div>
- <q-separator v-if="index < filteredUnidades.length - 1" />
- </template>
- </div>
- </q-card>
- </q-card-section>
- </q-card>
- </q-dialog>
- </template>
- <script setup>
- import { ref, computed } from "vue";
- import { useDialogPluginComponent } from "quasar";
- defineEmits([...useDialogPluginComponent.emits]);
- const { dialogRef, onDialogHide, onDialogCancel } = useDialogPluginComponent();
- const search = ref("");
- const selectedIndex = ref(0);
- const unidades = [
- { id: 1, unidade: "São Paulo", frequencia: "47%", status: "Baixa" },
- { id: 2, unidade: "Maringá", frequencia: "20 %", status: "Baixa" },
- { id: 3, unidade: "Curitiba", frequencia: "79 %", status: "Alto" },
- { id: 4, unidade: "Foz Iguaçu", frequencia: "98%", status: "Alto" },
- ];
- const filteredUnidades = computed(() => {
- if (!search.value) return unidades;
- const q = search.value.toLowerCase();
- return unidades.filter(
- (u) =>
- u.unidade.toLowerCase().includes(q) ||
- u.status.toLowerCase().includes(q),
- );
- });
- </script>
- <style scoped>
- .list-header {
- display: grid;
- grid-template-columns: 1fr 1fr 80px;
- align-items: center;
- }
- .list-row {
- display: grid;
- grid-template-columns: 1fr 1fr 80px;
- align-items: center;
- cursor: pointer;
- transition: background-color 0.15s;
- }
- .list-row:hover {
- background-color: #f5f5f5;
- }
- .row-selected {
- background-color: #b2dfdb !important;
- }
- </style>
|