Added selector
This commit is contained in:
parent
34668e7c17
commit
41e347d668
|
@ -4,19 +4,27 @@
|
|||
Em desenvolvimento! Versão 0.0.0.½ Alpha Gambiarra
|
||||
</div>
|
||||
<v-app>
|
||||
<v-main><RouterView /></v-main>
|
||||
<v-main>
|
||||
<keep-alive>
|
||||
<RouterView />
|
||||
</keep-alive>
|
||||
</v-main>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAppStore } from './store/appStore'
|
||||
import { onMounted } from 'vue'
|
||||
import { onMounted, onBeforeMount } from 'vue'
|
||||
|
||||
const appStore = useAppStore()
|
||||
|
||||
onMounted(async () => {
|
||||
await appStore.fetchMe()
|
||||
})
|
||||
|
||||
onBeforeMount(() => {
|
||||
appStore.selectedCampus = appStore.me?.campus || ''
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
.alpha-banner {
|
||||
|
|
|
@ -20,13 +20,18 @@
|
|||
v-model.lazy="appStore.printerFilter"
|
||||
/>
|
||||
|
||||
<v-checkbox
|
||||
class="ml-2"
|
||||
v-model="appStore.onlyMyCampus"
|
||||
<v-select
|
||||
class="ml-3"
|
||||
:items="campiSelectItems"
|
||||
v-model="appStore.selectedCampus"
|
||||
@update:model-value="appStore.fetchPrinters"
|
||||
color="primary"
|
||||
:label="`Apenas ${appStore.me?.campus}`"
|
||||
hide-details
|
||||
variant="solo"
|
||||
density="compact"
|
||||
style="max-width: 200px"
|
||||
prepend-inner-icon="mdi-domain"
|
||||
label="Campus"
|
||||
rounded
|
||||
/>
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
|
@ -59,6 +64,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { useAppStore } from '@/store/appStore'
|
||||
|
||||
import { removeJwtToken } from '@/auth'
|
||||
|
||||
import { useRouter } from 'vue-router'
|
||||
|
@ -67,6 +73,57 @@ const appStore = useAppStore()
|
|||
|
||||
const router = useRouter()
|
||||
|
||||
const campiSelectItems = [
|
||||
{
|
||||
title: 'Todos',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
title: 'Reitoria',
|
||||
value: 'RT'
|
||||
},
|
||||
{
|
||||
title: 'Aquidauana',
|
||||
value: 'AQ'
|
||||
},
|
||||
{
|
||||
title: 'Campo Grande',
|
||||
value: 'CG'
|
||||
},
|
||||
{
|
||||
title: 'Corumbá',
|
||||
value: 'CB'
|
||||
},
|
||||
{
|
||||
title: 'Coxim',
|
||||
value: 'CX'
|
||||
},
|
||||
{
|
||||
title: 'Nova Andradina',
|
||||
value: 'NA'
|
||||
},
|
||||
{
|
||||
title: 'Ponta Porã',
|
||||
value: 'PP'
|
||||
},
|
||||
{
|
||||
title: 'Três Lagoas',
|
||||
value: 'TL'
|
||||
},
|
||||
{
|
||||
title: 'Jardim',
|
||||
value: 'JD'
|
||||
},
|
||||
{
|
||||
title: 'Naviraí',
|
||||
value: 'NV'
|
||||
},
|
||||
{
|
||||
title: 'Dourados',
|
||||
value: 'DR'
|
||||
}
|
||||
]
|
||||
|
||||
function logout() {
|
||||
removeJwtToken()
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export const useAppStore = defineStore('app', {
|
|||
me: null as User | null,
|
||||
printers: [] as any[],
|
||||
printerFilter: '',
|
||||
onlyMyCampus: true,
|
||||
selectedCampus: '',
|
||||
loadingPrinters: false
|
||||
}),
|
||||
|
||||
|
@ -19,7 +19,7 @@ export const useAppStore = defineStore('app', {
|
|||
try {
|
||||
this.printers = await api<any[]>(
|
||||
`printer?${new URLSearchParams({
|
||||
campus: this.onlyMyCampus ? this.me?.campus || '' : ''
|
||||
campus: this.selectedCampus
|
||||
})}`,
|
||||
{ method: 'GET' }
|
||||
)
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<template>
|
||||
<v-container fluid>
|
||||
<v-alert
|
||||
type="info"
|
||||
v-if="appStore.filteredPrinters.length == 0 && appStore.printerFilter"
|
||||
closable
|
||||
variant="outlined"
|
||||
>
|
||||
Nenhuma impressora encontrada com este filtro
|
||||
</v-alert>
|
||||
<v-row>
|
||||
<v-col
|
||||
cols="12"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<template>
|
||||
<div>Hello</div>
|
||||
<div>Nada aqui.... Ainda ;)</div>
|
||||
</template>
|
||||
<script lang="ts" setup></script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user