New Plugins: - USB plugin: Device checkout/checkin with employee lookup, checkout history - Notifications plugin: Announcements with types, scheduling, shopfloor display - Network plugin: Network device management with subnets and VLANs - Equipment and Computers plugins: Asset type separation Frontend: - EmployeeSearch component: Reusable employee lookup with autocomplete - USB views: List, detail, checkout/checkin modals - Notifications views: List, form with recognition mode - Network views: Device list, detail, form - Calendar view with FullCalendar integration - Shopfloor and TV dashboard views - Reports index page - Map editor for asset positioning - Light/dark mode fixes for map tooltips Backend: - Employee search API with external lookup service - Collector API for PowerShell data collection - Reports API endpoints - Slides API for TV dashboard - Fixed AppVersion model (removed BaseModel inheritance) - Added checkout_name column to usbcheckouts table Styling: - Unified detail page styles - Improved pagination (page numbers instead of prev/next) - Dark/light mode theme improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
137 lines
3.5 KiB
Vue
137 lines
3.5 KiB
Vue
<template>
|
|
<div>
|
|
<div class="page-header">
|
|
<h2>Printers</h2>
|
|
<router-link to="/printers/new" class="btn btn-primary">Add Printer</router-link>
|
|
</div>
|
|
|
|
<!-- Filters -->
|
|
<div class="filters">
|
|
<input
|
|
v-model="search"
|
|
type="text"
|
|
class="form-control"
|
|
placeholder="Search printers..."
|
|
@input="debouncedSearch"
|
|
/>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div v-if="loading" class="loading">Loading...</div>
|
|
|
|
<template v-else>
|
|
<div class="table-container">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Asset #</th>
|
|
<th>Name</th>
|
|
<th>Business Unit</th>
|
|
<th>Model</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="printer in printers" :key="printer.printer?.printerid || printer.assetid">
|
|
<td>{{ printer.assetnumber }}</td>
|
|
<td>{{ printer.name || '-' }}</td>
|
|
<td>{{ printer.businessunit_name || '-' }}</td>
|
|
<td>{{ printer.printer?.model_name || '-' }}</td>
|
|
<td>
|
|
<span class="badge" :class="getStatusClass(printer.status_name)">
|
|
{{ printer.status_name || 'Active' }}
|
|
</span>
|
|
</td>
|
|
<td class="actions">
|
|
<router-link
|
|
:to="`/printers/${printer.printer?.printerid || printer.assetid}`"
|
|
class="btn btn-secondary btn-sm"
|
|
>
|
|
View
|
|
</router-link>
|
|
</td>
|
|
</tr>
|
|
<tr v-if="printers.length === 0">
|
|
<td colspan="6" style="text-align: center; color: var(--text-light);">
|
|
No printers found
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<div class="pagination" v-if="totalPages > 1">
|
|
<button
|
|
v-for="p in totalPages"
|
|
:key="p"
|
|
:class="{ active: p === page }"
|
|
@click="goToPage(p)"
|
|
>
|
|
{{ p }}
|
|
</button>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue'
|
|
import { printersApi } from '../../api'
|
|
|
|
const printers = ref([])
|
|
const loading = ref(true)
|
|
const search = ref('')
|
|
const page = ref(1)
|
|
const totalPages = ref(1)
|
|
|
|
let searchTimeout = null
|
|
|
|
onMounted(() => {
|
|
loadPrinters()
|
|
})
|
|
|
|
async function loadPrinters() {
|
|
loading.value = true
|
|
try {
|
|
const params = {
|
|
page: page.value,
|
|
perpage: 20
|
|
}
|
|
if (search.value) params.search = search.value
|
|
|
|
const response = await printersApi.list(params)
|
|
printers.value = response.data.data || []
|
|
totalPages.value = response.data.meta?.pagination?.total_pages || 1
|
|
} catch (error) {
|
|
console.error('Error loading printers:', error)
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
function debouncedSearch() {
|
|
clearTimeout(searchTimeout)
|
|
searchTimeout = setTimeout(() => {
|
|
page.value = 1
|
|
loadPrinters()
|
|
}, 300)
|
|
}
|
|
|
|
function goToPage(p) {
|
|
page.value = p
|
|
loadPrinters()
|
|
}
|
|
|
|
function getStatusClass(status) {
|
|
if (!status) return 'badge-info'
|
|
const s = status.toLowerCase()
|
|
if (s === 'in use' || s === 'active') return 'badge-success'
|
|
if (s === 'in repair') return 'badge-warning'
|
|
if (s === 'retired') return 'badge-danger'
|
|
return 'badge-info'
|
|
}
|
|
</script>
|