#49 fix: labels en nodos de gráficos y municipio con departamento en proveedores

This commit is contained in:
2026-08-15 18:33:30 -05:00
parent 79100ef40e
commit 58b42d956b
6 changed files with 52 additions and 7 deletions

View File

@@ -60,6 +60,7 @@
color: '#263238',
'font-size': 12,
'font-family': 'sans-serif',
content: 'data(label)',
'text-valign': 'bottom',
'text-halign': 'center',
'text-wrap': 'wrap',
@@ -73,7 +74,7 @@
{ selector: 'node.product', style: { 'background-color': '#26a69a', 'border-color': '#00796b' } },
{ selector: 'node.supplier', style: { 'background-color': '#42a5f5', 'border-color': '#1565c0' } },
{ selector: 'node.organization', style: { 'background-color': '#ffb74d', 'border-color': '#e65100' } },
{ selector: 'node.has-image', style: { 'background-image': 'data(image)', 'background-fit': 'cover', 'background-clip': 'none' } },
{ selector: 'node.has-image', style: { 'background-image': 'data(image)', 'background-fit': 'cover', 'background-clip': 'none', 'text-background-color': '#ffffff', 'text-background-opacity': 0.85, 'text-background-padding': 2 } },
{
selector: 'edge',
style: {

View File

@@ -60,6 +60,7 @@
color: '#263238',
'font-size': 12,
'font-family': 'sans-serif',
content: 'data(label)',
'text-valign': 'bottom',
'text-halign': 'center',
'text-wrap': 'wrap',
@@ -75,7 +76,7 @@
{ selector: 'node.municipality', style: { 'background-color': '#66bb6a', 'border-color': '#2e7d32' } },
{ selector: 'node.department', style: { 'background-color': '#5c6bc0', 'border-color': '#283593' } },
{ selector: 'node.country', style: { 'background-color': '#ab47bc', 'border-color': '#6a1b9a' } },
{ selector: 'node.has-image', style: { 'background-image': 'data(image)', 'background-fit': 'cover', 'background-clip': 'none' } },
{ selector: 'node.has-image', style: { 'background-image': 'data(image)', 'background-fit': 'cover', 'background-clip': 'none', 'text-background-color': '#ffffff', 'text-background-opacity': 0.85, 'text-background-padding': 2 } },
{
selector: 'edge',
style: {

View File

@@ -111,7 +111,7 @@
v-model="formData.municipality"
clearable
data-testid="supplier-form-municipality"
item-title="name"
:item-title="municipalityItemTitle"
item-value="id"
:items="municipalityItems"
label="Municipio"
@@ -189,6 +189,7 @@
const suppliers = ref([])
const organizations = ref([])
const municipalities = ref([])
const departments = ref([])
const loading = ref(false)
const saving = ref(false)
const searchQuery = ref('')
@@ -226,12 +227,18 @@
})
})
function municipalityItemTitle (item) {
const department = departments.value.find(department => department.id === item.department)
if (!department) return item.name || ''
return `${item.name} (${department.name})`
}
const municipalityItems = computed(() => {
const query = municipalitySearch.value.trim().toLowerCase()
let filtered = municipalities.value
if (query) {
filtered = municipalities.value.filter(municipality => {
return (municipality.name || '').toLowerCase().includes(query)
return municipalityItemTitle(municipality).toLowerCase().includes(query)
})
}
const selectedId = Number(formData.value.municipality)
@@ -246,14 +253,16 @@
async function load () {
loading.value = true
try {
const [suppliersData, organizationsData, municipalitiesData] = await Promise.all([
const [suppliersData, organizationsData, municipalitiesData, departmentsData] = await Promise.all([
api.getSuppliers(),
api.getOrganizations(),
api.getMunicipalities(),
api.getDepartments(),
])
suppliers.value = suppliersData
organizations.value = organizationsData
municipalities.value = municipalitiesData
departments.value = departmentsData
} catch (error) {
console.error('Error al cargar proveedores:', error)
showSnackbar('Error al cargar proveedores', 'error')