diff --git a/frontend/src/views/warranty/WarrantiesList.vue b/frontend/src/views/warranty/WarrantiesList.vue index d26343a..fa30afa 100644 --- a/frontend/src/views/warranty/WarrantiesList.vue +++ b/frontend/src/views/warranty/WarrantiesList.vue @@ -82,16 +82,22 @@
- + + + + Who backs the warranty. Pick a known vendor or type a new one.
- + + Where coverage data comes from. Non-manual sources can be refreshed from the maker's warranty API.
@@ -155,7 +161,7 @@ import { ref, computed, watch, onMounted } from 'vue' import { useRoute } from 'vue-router' import { colorStyle } from '@/utils/colorStyle' -import { warrantyApi, assetsApi } from '../../api' +import { warrantyApi, assetsApi, vendorsApi } from '../../api' import { useToast } from '../../composables/toast' import { apiError } from '../../utils/apiError' @@ -196,6 +202,8 @@ const form = ref(blankForm()) const selectedAssets = ref([]) const assetQuery = ref('') const assetResults = ref([]) +// Suggestions for the Vendor combobox, pulled from the site vendor catalog. +const vendorNames = ref([]) function blankForm() { return { vendor: '', provider: 'manual', servicetag: '', servicelevel: '', startdate: '', enddate: '', notes: '' } @@ -215,6 +223,7 @@ function assetLink(a) { onMounted(async () => { await loadData() + loadVendors() // Deep-link from an asset detail page: open the add modal pre-linked to it. const addfor = route.query.addfor if (addfor) { @@ -229,6 +238,18 @@ onMounted(async () => { } }) +async function loadVendors() { + // Best-effort: the combobox still accepts free text if this fails. + try { + const response = await vendorsApi.list({ per_page: 1000 }) + const rows = response.data.data + const list = Array.isArray(rows) ? rows : (rows.items || []) + vendorNames.value = list.map(v => v.vendor || v.name).filter(Boolean).sort() + } catch (err) { + vendorNames.value = [] + } +} + async function loadData() { loading.value = true try {