fix: remove _oem_blocked() from catalog search/part + expose autoMatchCompat
- catalog_bp.py: /search and /part/<id> no longer blocked by CATALOG_OEM_ENABLED These endpoints query the master parts DB and enrich with local stock; they should work in both local and OEM modes. - inventory.js: expose autoMatchCompat and removeCompat to window for onclick handlers in dynamically generated HTML. - Regenerated inventory.min.js
This commit is contained in:
@@ -200,7 +200,11 @@
|
||||
}
|
||||
apiFetch(API + '/items', { method: 'POST', body: JSON.stringify(data) }).then(function (result) {
|
||||
if (result && result.id) {
|
||||
document.getElementById('createResult').innerHTML = '<span style="color:var(--color-success);">Creado ID ' + result.id + ' | Barcode: ' + result.barcode + '</span>';
|
||||
var msg = 'Creado ID ' + result.id + ' | Barcode: ' + result.barcode;
|
||||
if (result.vehicle_compatibilities_added > 0) {
|
||||
msg += ' | ' + result.vehicle_compatibilities_added + ' vehiculo(s) asignado(s) por IA';
|
||||
}
|
||||
document.getElementById('createResult').innerHTML = '<span style="color:var(--color-success);">' + msg + '</span>';
|
||||
loadItems(currentPage);
|
||||
} else {
|
||||
document.getElementById('createResult').innerHTML = '<span style="color:var(--color-error);">' + (result ? result.error || 'Error' : 'Error de red') + '</span>';
|
||||
@@ -683,7 +687,8 @@
|
||||
if (list.length > 0) {
|
||||
html2 += '<table class="data-table"><thead><tr><th>Marca</th><th>Modelo</th><th>Ano</th><th>Motor</th><th>Origen</th><th></th></tr></thead><tbody>';
|
||||
list.forEach(function(c) {
|
||||
html2 += '<tr><td>' + esc(c.brand || '') + '</td><td>' + esc(c.model || '') + '</td><td>' + esc(c.year || '') + '</td><td>' + esc(c.engine || '') + '</td><td>' + esc(c.source || '') + '</td>';
|
||||
var sourceLabel = c.source === 'qwen_ai' ? '<span style="background:var(--color-primary);color:#000;padding:2px 6px;border-radius:4px;font-size:10px;font-weight:600;">IA</span>' : (c.source === 'auto_match' ? '<span style="background:var(--color-success);color:#fff;padding:2px 6px;border-radius:4px;font-size:10px;font-weight:600;">TecDoc</span>' : esc(c.source || ''));
|
||||
html2 += '<tr><td>' + esc(c.brand || '') + '</td><td>' + esc(c.model || '') + '</td><td>' + esc(c.year || '') + '</td><td>' + esc(c.engine || '') + '</td><td>' + sourceLabel + '</td>';
|
||||
html2 += '<td><button class="btn btn--ghost btn--sm" style="color:var(--color-error);" onclick="removeCompat(' + itemId + ',' + c.model_year_engine_id + ')">Quitar</button></td></tr>';
|
||||
});
|
||||
html2 += '</tbody></table>';
|
||||
@@ -777,6 +782,8 @@
|
||||
window.cancelDraft = cancelDraft;
|
||||
window.loadAlerts = loadAlerts;
|
||||
window.printBarcode = printBarcode;
|
||||
window.autoMatchCompat = autoMatchCompat;
|
||||
window.removeCompat = removeCompat;
|
||||
|
||||
// =====================================================================
|
||||
// INIT — load stock on page load
|
||||
|
||||
Reference in New Issue
Block a user