Initial single printer page

This commit is contained in:
Douglas Barone 2023-07-05 09:18:01 -04:00
parent 132878556c
commit 9918c39260
5 changed files with 35 additions and 12 deletions

View File

@ -69,7 +69,8 @@ class PrinterController {
orderBy: {
timestamp: 'desc'
}
}
},
network: true
}
})

View File

@ -3,7 +3,11 @@
variant="outlined"
class="printer-card"
:class="{ 'printer-alert': printerAlert }"
:to="{ name: 'Printer', params: { serialNumber: printer.serialNumber } }"
:to="
nav
? { name: 'Printer', params: { serialNumber: printer.serialNumber } }
: undefined
"
>
<v-row no-gutters wrap>
<v-col cols="4" sm="2" align-self="center">
@ -93,6 +97,7 @@ import { computed } from 'vue'
const props = defineProps<{
printer: any
nav?: boolean
}>()
const printerAlert = computed(() => {

View File

@ -8,13 +8,6 @@
/>
<v-app-bar :elevation="0">
<v-btn icon="mdi-arrow-left" @click="router.back" />
<v-btn
icon="mdi-refresh"
class="ml-1"
title="Atualizar"
@click="appStore.fetchPrinters"
:disabled="appStore.loadingPrinters"
/>
<v-spacer />
<user-chip />

View File

@ -16,7 +16,7 @@
v-for="printer in appStore.filteredPrinters"
:key="printer.id"
>
<printer-card :printer="printer" />
<printer-card :printer="printer" nav />
</v-col>
</v-row>
</v-container>

View File

@ -1,4 +1,28 @@
<template>
<div>Nada aqui.... Ainda ;)</div>
<v-container>
<printer-card class="mb-2" v-if="printer" :printer="printer" />
{{ printer }}
</v-container>
</template>
<script lang="ts" setup></script>
<script lang="ts" setup>
import { api } from '@/api'
import { Printer } from '@prisma/client'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
import PrinterCard from '@/components/PrinterCard.vue'
const route = useRoute()
const printer = ref<Printer>()
const serialNumber = route.params.serialNumber as string
async function getPrinter() {
printer.value = await api<Printer>(`printer/${serialNumber}`, {
method: 'GET'
})
}
getPrinter()
</script>