Kiosk entry input, gage lab tag column, model image subpath fix
This commit is contained in:
@@ -131,6 +131,7 @@ import { useRoute } from 'vue-router'
|
|||||||
import JsBarcode from 'jsbarcode'
|
import JsBarcode from 'jsbarcode'
|
||||||
import { renderQrDataUrl } from './qrLogo'
|
import { renderQrDataUrl } from './qrLogo'
|
||||||
import { getSetting } from '@/utils/siteSettings'
|
import { getSetting } from '@/utils/siteSettings'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import {
|
import {
|
||||||
TYPE_CONFIG, hasLocationType, resolveDefaultEncodes,
|
TYPE_CONFIG, hasLocationType, resolveDefaultEncodes,
|
||||||
effectiveEncodes as effEncodes, resolveCodeText as resolveText, captionFor,
|
effectiveEncodes as effEncodes, resolveCodeText as resolveText, captionFor,
|
||||||
@@ -171,7 +172,7 @@ const cardTitle = computed(() => {
|
|||||||
|
|
||||||
const imageUrl = computed(() => {
|
const imageUrl = computed(() => {
|
||||||
const ext = extension.value
|
const ext = extension.value
|
||||||
return (ext && ext.imageurl) ? ext.imageurl : null
|
return (ext && ext.imageurl) ? withBase(ext.imageurl) : null
|
||||||
})
|
})
|
||||||
|
|
||||||
// Small identity table shown on the card.
|
// Small identity table shown on the card.
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const modelName = computed(() => {
|
|||||||
const imageUrl = computed(() => {
|
const imageUrl = computed(() => {
|
||||||
if (!machine.value) return null
|
if (!machine.value) return null
|
||||||
const img = machine.value.machine?.imageurl
|
const img = machine.value.machine?.imageurl
|
||||||
if (img) return img.startsWith('/') ? img : `/images/models/machines/${img}`
|
if (img) return withBase(img.startsWith('/') ? img : `/images/models/machines/${img}`)
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Image</label>
|
<label>Image</label>
|
||||||
<div class="image-manage">
|
<div class="image-manage">
|
||||||
<img v-if="form.imageurl" :src="form.imageurl" alt="Model image" class="image-thumb" />
|
<img v-if="form.imageurl" :src="withBase(form.imageurl)" alt="Model image" class="image-thumb" />
|
||||||
<div class="image-actions">
|
<div class="image-actions">
|
||||||
<template v-if="editingModel">
|
<template v-if="editingModel">
|
||||||
<input
|
<input
|
||||||
@@ -209,6 +209,7 @@ import { modelsApi, vendorsApi, modeltypesApi } from '../../api'
|
|||||||
import PaginationBar from '../../components/PaginationBar.vue'
|
import PaginationBar from '../../components/PaginationBar.vue'
|
||||||
import { useToast } from '../../composables/toast'
|
import { useToast } from '../../composables/toast'
|
||||||
import { apiError } from '../../utils/apiError'
|
import { apiError } from '../../utils/apiError'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import { useListQuery } from '@/composables/listQuery'
|
import { useListQuery } from '@/composables/listQuery'
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<!-- Hero Section -->
|
<!-- Hero Section -->
|
||||||
<div class="hero-card">
|
<div class="hero-card">
|
||||||
<div class="hero-image" v-if="computer.computer?.imageurl">
|
<div class="hero-image" v-if="computer.computer?.imageurl">
|
||||||
<img :src="computer.computer.imageurl" :alt="computer.computer.modelname || 'Model photo'" />
|
<img :src="withBase(computer.computer.imageurl)" :alt="computer.computer.modelname || 'Model photo'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="hero-content">
|
<div class="hero-content">
|
||||||
<div class="hero-title">
|
<div class="hero-title">
|
||||||
@@ -241,6 +241,7 @@ import { ref, onMounted } from 'vue'
|
|||||||
import { colorStyle } from "@/utils/colorStyle"
|
import { colorStyle } from "@/utils/colorStyle"
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { computersApi, applicationsApi } from '@/api'
|
import { computersApi, applicationsApi } from '@/api'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import { useWarrantyBadge } from '@/composables/warrantyBadge'
|
import { useWarrantyBadge } from '@/composables/warrantyBadge'
|
||||||
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
||||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<!-- Hero Section -->
|
<!-- Hero Section -->
|
||||||
<div class="hero-card">
|
<div class="hero-card">
|
||||||
<div class="hero-image" v-if="machine.machine?.imageurl">
|
<div class="hero-image" v-if="machine.machine?.imageurl">
|
||||||
<img :src="machine.machine.imageurl" :alt="machine.machine.modelname || 'Model photo'" />
|
<img :src="withBase(machine.machine.imageurl)" :alt="machine.machine.modelname || 'Model photo'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="hero-content">
|
<div class="hero-content">
|
||||||
<div class="hero-title">
|
<div class="hero-title">
|
||||||
@@ -235,6 +235,7 @@
|
|||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { machinesApi } from '@/api'
|
import { machinesApi } from '@/api'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
||||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
||||||
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="detail-page" v-if="device">
|
<div class="detail-page" v-if="device">
|
||||||
<div class="hero-card">
|
<div class="hero-card">
|
||||||
<div class="hero-image">
|
<div class="hero-image">
|
||||||
<img v-if="device.networkdevice?.imageurl" :src="device.networkdevice.imageurl" alt="Model photo" />
|
<img v-if="device.networkdevice?.imageurl" :src="withBase(device.networkdevice.imageurl)" alt="Model photo" />
|
||||||
<div class="device-icon" v-else>
|
<div class="device-icon" v-else>
|
||||||
<span class="icon"><component :is="getDeviceIcon()" :size="24" /></span>
|
<span class="icon"><component :is="getDeviceIcon()" :size="24" /></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -202,6 +202,7 @@ import { useRoute, useRouter } from 'vue-router'
|
|||||||
import { Network, Router, Shield, Wifi, Camera, Server, Server as Rack, Globe } from 'lucide-vue-next'
|
import { Network, Router, Shield, Wifi, Camera, Server, Server as Rack, Globe } from 'lucide-vue-next'
|
||||||
import { useAuthStore } from '@/stores/auth'
|
import { useAuthStore } from '@/stores/auth'
|
||||||
import { networkApi } from '@/api'
|
import { networkApi } from '@/api'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import AssetRelationships from '@/components/AssetRelationships.vue'
|
import AssetRelationships from '@/components/AssetRelationships.vue'
|
||||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
||||||
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="parts-kiosk" @click="focusWedge">
|
<div class="parts-kiosk" @click="focusEntry">
|
||||||
<!-- keyboard-wedge scanners type the code + Enter into this hidden,
|
|
||||||
always-focused input; whichever step is active consumes the scan -->
|
|
||||||
<input ref="wedgeInput" v-model="wedgeBuffer" class="wedge-input"
|
|
||||||
autocomplete="off" @keydown.enter.prevent="onWedgeEnter" />
|
|
||||||
|
|
||||||
<header class="kiosk-header">
|
<header class="kiosk-header">
|
||||||
<h1>3D Printed Parts</h1>
|
<h1>3D Printed Parts</h1>
|
||||||
<button v-if="step !== 'item'" class="btn btn-secondary" @click="reset">
|
<button v-if="step !== 'item'" class="btn btn-secondary" @click="reset">
|
||||||
@@ -14,24 +9,22 @@
|
|||||||
|
|
||||||
<div v-if="error" class="kiosk-error">{{ error }}</div>
|
<div v-if="error" class="kiosk-error">{{ error }}</div>
|
||||||
|
|
||||||
<!-- step 1: scan the bin -->
|
<!-- step 1: the bin label -->
|
||||||
<section v-if="step === 'item'" class="kiosk-step">
|
<section v-if="step === 'item'" class="kiosk-step">
|
||||||
<p class="kiosk-prompt">Scan the barcode on the bin</p>
|
<p class="kiosk-prompt">Scan the barcode on the bin</p>
|
||||||
<p class="kiosk-hint">
|
<!-- one visible field: keyboard-wedge scanners, a plugged-in keyboard or
|
||||||
No scanner?
|
numpad, and the on-screen keypad all type into it. -->
|
||||||
<a href="#" @click.prevent="manualEntry = !manualEntry">Type the number</a>
|
<div class="entry-panel">
|
||||||
</p>
|
<input ref="entryInput" v-model="manualCode" class="entry-input"
|
||||||
<div v-if="manualEntry" class="entry-panel">
|
inputmode="none" autocomplete="off" placeholder="label number"
|
||||||
<div class="entry-display" :class="{ empty: !manualCode }">
|
@keydown.enter.prevent="lookupItem(manualCode)" />
|
||||||
{{ manualCode || 'label number' }}
|
|
||||||
</div>
|
|
||||||
<TouchKeypad @digit="manualCode += $event"
|
<TouchKeypad @digit="manualCode += $event"
|
||||||
@clear="manualCode = ''"
|
@clear="manualCode = ''"
|
||||||
@backspace="manualCode = manualCode.slice(0, -1)" />
|
@backspace="manualCode = manualCode.slice(0, -1)" />
|
||||||
<button class="btn btn-primary take-button" :disabled="!manualCode"
|
<button class="btn btn-primary take-button" :disabled="!manualCode"
|
||||||
@click="lookupItem(manualCode)">Look up</button>
|
@click="lookupItem(manualCode)">Look up</button>
|
||||||
<p class="kiosk-hint">Just the number from the label; letters are
|
<p class="kiosk-hint">Scan the label, type on a keyboard, or tap it in;
|
||||||
added automatically.</p>
|
letters are added automatically.</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -46,9 +39,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<p class="kiosk-prompt">Scan your badge or tap in your SSO</p>
|
<p class="kiosk-prompt">Scan your badge or tap in your SSO</p>
|
||||||
<div class="entry-panel">
|
<div class="entry-panel">
|
||||||
<div class="entry-display" :class="{ empty: !manualBadge }">
|
<input ref="entryInput" v-model="manualBadge" class="entry-input"
|
||||||
{{ manualBadge || 'SSO' }}
|
inputmode="none" autocomplete="off" placeholder="SSO"
|
||||||
</div>
|
@keydown.enter.prevent="acceptBadge(manualBadge)" />
|
||||||
<TouchKeypad @digit="manualBadge += $event"
|
<TouchKeypad @digit="manualBadge += $event"
|
||||||
@clear="manualBadge = ''"
|
@clear="manualBadge = ''"
|
||||||
@backspace="manualBadge = manualBadge.slice(0, -1)" />
|
@backspace="manualBadge = manualBadge.slice(0, -1)" />
|
||||||
@@ -68,9 +61,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<p class="kiosk-prompt">How many are you taking?</p>
|
<p class="kiosk-prompt">How many are you taking?</p>
|
||||||
<div class="entry-panel">
|
<div class="entry-panel">
|
||||||
<div class="entry-display" :class="{ empty: !quantity }">
|
<input ref="entryInput" v-model="quantity" class="entry-input"
|
||||||
{{ quantity || '0' }}
|
inputmode="none" autocomplete="off" placeholder="0"
|
||||||
</div>
|
@keydown.enter.prevent="submitTake" />
|
||||||
<TouchKeypad @digit="quantity += $event"
|
<TouchKeypad @digit="quantity += $event"
|
||||||
@clear="quantity = ''"
|
@clear="quantity = ''"
|
||||||
@backspace="quantity = quantity.slice(0, -1)" />
|
@backspace="quantity = quantity.slice(0, -1)" />
|
||||||
@@ -90,7 +83,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
import { ref, onMounted, onBeforeUnmount, nextTick } from 'vue'
|
||||||
import { printedpartsApi } from '@/api'
|
import { printedpartsApi } from '@/api'
|
||||||
import { withBase } from '@/utils/basePath'
|
import { withBase } from '@/utils/basePath'
|
||||||
import TouchKeypad from '@/components/TouchKeypad.vue'
|
import TouchKeypad from '@/components/TouchKeypad.vue'
|
||||||
@@ -102,47 +95,38 @@ const quantity = ref('')
|
|||||||
const error = ref('')
|
const error = ref('')
|
||||||
const doneMessage = ref('')
|
const doneMessage = ref('')
|
||||||
const submitting = ref(false)
|
const submitting = ref(false)
|
||||||
const manualEntry = ref(false)
|
|
||||||
const manualCode = ref('')
|
const manualCode = ref('')
|
||||||
const manualBadge = ref('')
|
const manualBadge = ref('')
|
||||||
const wedgeInput = ref(null)
|
const entryInput = ref(null)
|
||||||
const wedgeBuffer = ref('')
|
|
||||||
let resetTimer = null
|
let resetTimer = null
|
||||||
|
|
||||||
onMounted(focusWedge)
|
onMounted(focusEntry)
|
||||||
onBeforeUnmount(() => clearTimeout(resetTimer))
|
onBeforeUnmount(() => clearTimeout(resetTimer))
|
||||||
|
|
||||||
function focusWedge(event) {
|
function focusEntry(event) {
|
||||||
// Tapping a visible input/button must keep it - only reclaim focus for
|
// Keep focus on the entry input so a wedge scanner or plugged-in keyboard
|
||||||
// the wedge scanner from dead space.
|
// always types into it. Only reclaim focus from dead space - never steal it
|
||||||
|
// mid-tap from a button or another control.
|
||||||
const tag = event?.target?.tagName
|
const tag = event?.target?.tagName
|
||||||
if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA'
|
if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA'
|
||||||
|| tag === 'BUTTON' || tag === 'A') return
|
|| tag === 'BUTTON' || tag === 'A') return
|
||||||
wedgeInput.value?.focus()
|
nextTick(() => entryInput.value?.focus())
|
||||||
}
|
|
||||||
|
|
||||||
function onWedgeEnter() {
|
|
||||||
const scanned = wedgeBuffer.value.trim()
|
|
||||||
wedgeBuffer.value = ''
|
|
||||||
if (!scanned) return
|
|
||||||
if (step.value === 'item') lookupItem(scanned)
|
|
||||||
else if (step.value === 'badge') acceptBadge(scanned)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function lookupItem(itemcode) {
|
async function lookupItem(itemcode) {
|
||||||
error.value = ''
|
error.value = ''
|
||||||
if (!itemcode) return
|
const code = (itemcode || '').trim()
|
||||||
|
if (!code) return
|
||||||
try {
|
try {
|
||||||
const response = await printedpartsApi.kioskItem(itemcode.trim())
|
const response = await printedpartsApi.kioskItem(code)
|
||||||
item.value = response.data.data
|
item.value = response.data.data
|
||||||
step.value = 'badge'
|
step.value = 'badge'
|
||||||
manualEntry.value = false
|
|
||||||
manualCode.value = ''
|
manualCode.value = ''
|
||||||
} catch (lookupError) {
|
} catch (lookupError) {
|
||||||
error.value = lookupError.response?.data?.data?.error?.message ||
|
error.value = lookupError.response?.data?.data?.error?.message ||
|
||||||
'No part matches that barcode'
|
'No part matches that barcode'
|
||||||
}
|
}
|
||||||
focusWedge()
|
focusEntry()
|
||||||
}
|
}
|
||||||
|
|
||||||
function acceptBadge(value) {
|
function acceptBadge(value) {
|
||||||
@@ -152,10 +136,11 @@ function acceptBadge(value) {
|
|||||||
badge.value = scanned
|
badge.value = scanned
|
||||||
manualBadge.value = ''
|
manualBadge.value = ''
|
||||||
step.value = 'quantity'
|
step.value = 'quantity'
|
||||||
focusWedge()
|
focusEntry()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitTake() {
|
async function submitTake() {
|
||||||
|
if (!quantity.value || submitting.value) return
|
||||||
submitting.value = true
|
submitting.value = true
|
||||||
error.value = ''
|
error.value = ''
|
||||||
try {
|
try {
|
||||||
@@ -173,6 +158,7 @@ async function submitTake() {
|
|||||||
if (takeError.response?.status === 422) {
|
if (takeError.response?.status === 422) {
|
||||||
// badge problem: go back a step so the next scan retries cleanly
|
// badge problem: go back a step so the next scan retries cleanly
|
||||||
step.value = 'badge'
|
step.value = 'badge'
|
||||||
|
focusEntry()
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
@@ -185,9 +171,11 @@ function reset() {
|
|||||||
item.value = null
|
item.value = null
|
||||||
badge.value = ''
|
badge.value = ''
|
||||||
quantity.value = ''
|
quantity.value = ''
|
||||||
|
manualCode.value = ''
|
||||||
|
manualBadge.value = ''
|
||||||
error.value = ''
|
error.value = ''
|
||||||
doneMessage.value = ''
|
doneMessage.value = ''
|
||||||
focusWedge()
|
focusEntry()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -209,12 +197,6 @@ function reset() {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.wedge-input {
|
|
||||||
position: absolute;
|
|
||||||
opacity: 0;
|
|
||||||
height: 1px;
|
|
||||||
width: 1px;
|
|
||||||
}
|
|
||||||
.kiosk-step {
|
.kiosk-step {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -258,7 +240,7 @@ function reset() {
|
|||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
padding: 1.5rem 2rem;
|
padding: 1.5rem 2rem;
|
||||||
}
|
}
|
||||||
.entry-display {
|
.entry-input {
|
||||||
width: 16.9rem;
|
width: 16.9rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
font-size: 2.4rem;
|
font-size: 2.4rem;
|
||||||
@@ -269,15 +251,14 @@ function reset() {
|
|||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
overflow: hidden;
|
color: var(--text);
|
||||||
text-overflow: ellipsis;
|
outline: none;
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
.entry-display.empty {
|
.entry-input:focus { border-color: var(--primary); }
|
||||||
|
.entry-input::placeholder {
|
||||||
color: var(--text-light);
|
color: var(--text-light);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
line-height: 2.4rem;
|
|
||||||
}
|
}
|
||||||
.take-button {
|
.take-button {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
@@ -285,11 +266,4 @@ function reset() {
|
|||||||
width: 16.9rem;
|
width: 16.9rem;
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
}
|
}
|
||||||
.manual-row { display: flex; gap: 0.6rem; }
|
|
||||||
.manual-block {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<!-- Hero Section -->
|
<!-- Hero Section -->
|
||||||
<div class="hero-card">
|
<div class="hero-card">
|
||||||
<div class="hero-image" v-if="printer.printer?.imageurl">
|
<div class="hero-image" v-if="printer.printer?.imageurl">
|
||||||
<img :src="printer.printer.imageurl" :alt="printer.printer.modelname || 'Model photo'" />
|
<img :src="withBase(printer.printer.imageurl)" :alt="printer.printer.modelname || 'Model photo'" />
|
||||||
</div>
|
</div>
|
||||||
<div class="hero-content">
|
<div class="hero-content">
|
||||||
<div class="hero-title">
|
<div class="hero-title">
|
||||||
@@ -280,6 +280,7 @@
|
|||||||
import { ref, onMounted, computed } from 'vue'
|
import { ref, onMounted, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { printersApi } from '@/api'
|
import { printersApi } from '@/api'
|
||||||
|
import { withBase } from '@/utils/basePath'
|
||||||
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
import LocationMapTooltip from '@/components/LocationMapTooltip.vue'
|
||||||
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
import CustomFieldsSection from '@/components/CustomFieldsSection.vue'
|
||||||
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
import PluginAssetPanels from '@/components/PluginAssetPanels.vue'
|
||||||
|
|||||||
Reference in New Issue
Block a user