Frontend: asset identifiers, statuses, printer types, UI fixes
- Wire gauge/maintenance refs + identifier toggles into equipment pages. - Repoint status dropdowns and Settings>Statuses to asset statuses. - Printer type column/filter; require vendor before model; printer-model picker. - Per-type identifier labels; printer detail title fallback. - Fixes: truncate long description cells, opaque supply modal, readable dark-mode autofill, drum/waste default colorless. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -264,9 +264,26 @@ export const printersApi = {
|
||||
get(id) {
|
||||
return api.get(`/printers/${id}`)
|
||||
},
|
||||
// create/update write asset core + printer extension in one call (the
|
||||
// printers plugin owns both). Use these instead of the legacy machinesApi.
|
||||
create(data) {
|
||||
return api.post('/printers', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/printers/${id}`, data)
|
||||
},
|
||||
updateExtension(id, data) {
|
||||
return api.put(`/printers/${id}/printerdata`, data)
|
||||
},
|
||||
// printer sub-types (Laser, Inkjet, Label, Card, Wide Format, ...)
|
||||
types: {
|
||||
list(params = {}) {
|
||||
return api.get('/printers/types', { params })
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/printers/types', data)
|
||||
}
|
||||
},
|
||||
updateCommunication(id, data) {
|
||||
return api.put(`/printers/${id}/communication`, data)
|
||||
},
|
||||
@@ -279,6 +296,12 @@ export const printersApi = {
|
||||
lowSupplies() {
|
||||
return api.get('/printers/lowsupplies')
|
||||
},
|
||||
refreshSupplies() {
|
||||
return api.post('/printers/supplies/refresh')
|
||||
},
|
||||
lookup({ ip, fqdn } = {}) {
|
||||
return api.get('/printers/lookup', { params: { ip, fqdn } })
|
||||
},
|
||||
dashboardSummary() {
|
||||
return api.get('/printers/dashboard/summary')
|
||||
},
|
||||
@@ -303,6 +326,27 @@ export const printersApi = {
|
||||
create(data) {
|
||||
return api.post('/printers/supplytypes', data)
|
||||
}
|
||||
},
|
||||
// model -> toner/drum/waste part-number management
|
||||
modelSupplies: {
|
||||
meta() {
|
||||
return api.get('/printers/supplies/meta')
|
||||
},
|
||||
listModels(params = {}) {
|
||||
return api.get('/printers/models', { params })
|
||||
},
|
||||
list(modelnumberid) {
|
||||
return api.get(`/printers/models/${modelnumberid}/supplies`)
|
||||
},
|
||||
create(modelnumberid, data) {
|
||||
return api.post(`/printers/models/${modelnumberid}/supplies`, data)
|
||||
},
|
||||
update(modelsupplyid, data) {
|
||||
return api.put(`/printers/supplies/${modelsupplyid}`, data)
|
||||
},
|
||||
delete(modelsupplyid) {
|
||||
return api.delete(`/printers/supplies/${modelsupplyid}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +365,23 @@ export const modelsApi = {
|
||||
list(params = {}) {
|
||||
return api.get('/models', { params })
|
||||
},
|
||||
// Backend caps perpage at 100, so page through every model. Returns the
|
||||
// full array directly (not an axios response). Use in forms whose model
|
||||
// dropdown must include the editing record's model regardless of page.
|
||||
async listAll() {
|
||||
const first = await api.get('/models', { params: { perpage: 100, page: 1 } })
|
||||
let items = first.data.data || []
|
||||
const totalpages = first.data.meta?.pagination?.totalpages || 1
|
||||
if (totalpages > 1) {
|
||||
const rest = await Promise.all(
|
||||
Array.from({ length: totalpages - 1 }, (_, i) =>
|
||||
api.get('/models', { params: { perpage: 100, page: i + 2 } })
|
||||
)
|
||||
)
|
||||
rest.forEach(r => { items = items.concat(r.data.data || []) })
|
||||
}
|
||||
return items
|
||||
},
|
||||
get(id) {
|
||||
return api.get(`/models/${id}`)
|
||||
},
|
||||
@@ -528,8 +589,17 @@ export const assetsApi = {
|
||||
}
|
||||
},
|
||||
statuses: {
|
||||
list() {
|
||||
return api.get('/assets/statuses')
|
||||
list(params = {}) {
|
||||
return api.get('/assets/statuses', { params })
|
||||
},
|
||||
create(data) {
|
||||
return api.post('/assets/statuses', data)
|
||||
},
|
||||
update(id, data) {
|
||||
return api.put(`/assets/statuses/${id}`, data)
|
||||
},
|
||||
delete(id) {
|
||||
return api.delete(`/assets/statuses/${id}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user