style(workshop): alinea UI del taller con el resto del POS
- Usa app-shell/main, page-header con eyebrow, summary-strip y cards con iconos. - Reemplaza badges personalizados por .badge del design system. - Unifica tablas con .data-table y .table-wrapper. - Estandariza modales con .modal-overlay/.modal y formularios con .form-grid. - Actualiza workshop.js para usar clases del sistema y toggle is-open en modales. - Corrige tokens rotos (--text-sm, --color-warn, etc.) y usa variables del tema.
This commit is contained in:
@@ -96,7 +96,7 @@ var Workshop = (function() {
|
||||
})
|
||||
.catch(function(e) {
|
||||
console.error(e);
|
||||
document.getElementById('kanbanBoard').innerHTML = '<div class="empty-state"><div class="empty-state__text">Error cargando órdenes</div></div>';
|
||||
document.getElementById('kanbanBoard').innerHTML = '<div class="empty-state"><div class="empty-state__title">Error cargando órdenes</div><div class="empty-state__subtitle">No se pudieron cargar las órdenes de servicio.</div></div>';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ var Workshop = (function() {
|
||||
|
||||
var body = colEl.querySelector('.kanban-column__body');
|
||||
if (!colOrders.length) {
|
||||
body.innerHTML = '<div class="empty-state__text" style="text-align:center;padding:var(--space-4);color:var(--color-text-muted);">Sin órdenes</div>';
|
||||
body.innerHTML = '<div class="empty-state" style="padding:var(--space-4);"><div class="empty-state__subtitle">Sin órdenes</div></div>';
|
||||
} else {
|
||||
colOrders.forEach(function(o) {
|
||||
body.appendChild(renderCard(o));
|
||||
@@ -126,6 +126,33 @@ var Workshop = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
function priorityLabel(p) {
|
||||
var map = {normal: 'Normal', high: 'Alta', urgent: 'Urgente'};
|
||||
return map[p] || p;
|
||||
}
|
||||
|
||||
function statusBadgeClass(status) {
|
||||
var map = {
|
||||
pending: 'badge--pending',
|
||||
reserved: 'badge--reserved',
|
||||
installed: 'badge--installed',
|
||||
cancelled: 'badge--cancelled',
|
||||
complete: 'badge--complete'
|
||||
};
|
||||
return map[status] || 'badge--pending';
|
||||
}
|
||||
|
||||
function statusLabel(status) {
|
||||
var map = {
|
||||
pending: 'Pendiente',
|
||||
reserved: 'Reservado',
|
||||
installed: 'Instalado',
|
||||
cancelled: 'Cancelado',
|
||||
complete: 'Completado'
|
||||
};
|
||||
return map[status] || status;
|
||||
}
|
||||
|
||||
function renderCard(o) {
|
||||
var card = document.createElement('div');
|
||||
card.className = 'kanban-card';
|
||||
@@ -133,7 +160,7 @@ var Workshop = (function() {
|
||||
card.innerHTML =
|
||||
'<div class="kanban-card__header">' +
|
||||
' <span class="kanban-card__id">' + esc(o.order_number) + '</span>' +
|
||||
' <span class="kanban-card__priority kanban-card__priority--' + esc(o.priority) + '">' + esc(o.priority) + '</span>' +
|
||||
' <span class="kanban-card__priority badge badge--' + esc(o.priority) + '">' + esc(priorityLabel(o.priority)) + '</span>' +
|
||||
'</div>' +
|
||||
'<div class="kanban-card__customer">' + esc(o.customer_name || 'Cliente general') + '</div>' +
|
||||
'<div class="kanban-card__vehicle">' + esc(o.vehicle_plate || 'Sin vehículo') + '</div>' +
|
||||
@@ -153,7 +180,7 @@ var Workshop = (function() {
|
||||
.then(function(o) {
|
||||
document.getElementById('detailTitle').textContent = 'Orden ' + esc(o.order_number);
|
||||
renderDetailBody(o);
|
||||
document.getElementById('detailModal').style.display = 'flex';
|
||||
document.getElementById('detailModal').classList.add('is-open');
|
||||
})
|
||||
.catch(function(e) { alert('Error: ' + e.message); });
|
||||
}
|
||||
@@ -176,13 +203,14 @@ var Workshop = (function() {
|
||||
|
||||
' <div class="so-detail__section">' +
|
||||
' <h3>Refacciones</h3>' +
|
||||
' <table class="data-table--compact"><thead><tr><th>Concepto</th><th>Cant.</th><th>Precio</th><th>Estado</th><th></th></tr></thead><tbody>' +
|
||||
' <table class="data-table"><thead><tr><th>Concepto</th><th>Cant.</th><th>Precio</th><th>Estado</th><th></th></tr></thead><tbody>' +
|
||||
(o.items || []).map(function(it) {
|
||||
var itemStatus = it.reserved_quantity >= it.quantity ? 'reserved' : it.status;
|
||||
return '<tr>' +
|
||||
'<td>' + esc(it.name) + '<br><small>' + esc(it.part_number || '') + '</small></td>' +
|
||||
'<td>' + fmt(it.quantity) + '</td>' +
|
||||
'<td>' + fmtMoney(it.unit_price) + '</td>' +
|
||||
'<td><span class="status-badge status-badge--' + (it.reserved_quantity >= it.quantity ? 'reserved' : it.status) + '">' + (it.reserved_quantity >= it.quantity ? 'Reservado' : esc(it.status)) + '</span></td>' +
|
||||
'<td><span class="badge ' + statusBadgeClass(itemStatus) + '">' + statusLabel(itemStatus) + '</span></td>' +
|
||||
'<td>' + (it.reserved_quantity < it.quantity && it.status !== 'cancelled' ? '<button class="btn btn--sm btn--secondary" onclick="event.stopPropagation();Workshop.reserveItem(' + it.id + ')">Reservar</button>' : '') + '</td>' +
|
||||
'</tr>';
|
||||
}).join('') +
|
||||
@@ -195,14 +223,14 @@ var Workshop = (function() {
|
||||
|
||||
' <div class="so-detail__section">' +
|
||||
' <h3>Mano de obra</h3>' +
|
||||
' <table class="data-table--compact"><thead><tr><th>Concepto</th><th>Horas</th><th>Precio/hr</th><th>Total</th><th>Estado</th></tr></thead><tbody>' +
|
||||
' <table class="data-table"><thead><tr><th>Concepto</th><th>Horas</th><th>Precio/hr</th><th>Total</th><th>Estado</th></tr></thead><tbody>' +
|
||||
(o.labor || []).map(function(l) {
|
||||
return '<tr>' +
|
||||
'<td>' + esc(l.description) + '</td>' +
|
||||
'<td>' + fmt(l.hours) + '</td>' +
|
||||
'<td>' + fmtMoney(l.hourly_rate) + '</td>' +
|
||||
'<td>' + fmtMoney(l.total_cost) + '</td>' +
|
||||
'<td><span class="status-badge status-badge--' + l.status + '">' + esc(l.status) + '</span></td>' +
|
||||
'<td><span class="badge ' + statusBadgeClass(l.status) + '">' + statusLabel(l.status) + '</span></td>' +
|
||||
'</tr>';
|
||||
}).join('') +
|
||||
'</tbody></table>' +
|
||||
@@ -250,13 +278,15 @@ var Workshop = (function() {
|
||||
var footer = document.getElementById('detailFooter');
|
||||
footer.innerHTML =
|
||||
'<button class="btn btn--ghost" onclick="Workshop.closeDetailModal()">Cerrar</button>' +
|
||||
'<button class="btn btn--secondary" onclick="Workshop.printOrder()">🖨️ Imprimir orden</button>' +
|
||||
'<button class="btn btn--secondary" onclick="Workshop.printOrder()">' +
|
||||
'<svg viewBox="0 0 24 24"><polyline points="6 9 6 2 18 2 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>' +
|
||||
'Imprimir orden</button>' +
|
||||
(o.status === 'ready' && !o.sale_id ? '<button class="btn btn--primary" onclick="Workshop.convertToSale()">Convertir a venta</button>' : '') +
|
||||
(o.sale_id ? '<a class="btn btn--secondary" href="/pos/invoicing?sale_id=' + o.sale_id + '">Ver venta #' + o.sale_id + '</a>' : '');
|
||||
}
|
||||
|
||||
function closeDetailModal() {
|
||||
document.getElementById('detailModal').style.display = 'none';
|
||||
document.getElementById('detailModal').classList.remove('is-open');
|
||||
currentOrderId = null;
|
||||
}
|
||||
|
||||
@@ -358,11 +388,11 @@ var Workshop = (function() {
|
||||
populateSelect('noCustomer', customers, function(c) { return {value: c.id, text: c.name + ' (' + (c.phone || '') + ')'}; });
|
||||
populateSelect('noVehicle', vehicles, function(v) { return {value: v.id, text: v.plate + ' ' + v.make + ' ' + v.model}; });
|
||||
populateSelect('noMechanic', employees, function(e) { return {value: e.id, text: e.name}; });
|
||||
document.getElementById('newOrderModal').style.display = 'flex';
|
||||
document.getElementById('newOrderModal').classList.add('is-open');
|
||||
}
|
||||
|
||||
function closeNewOrderModal() {
|
||||
document.getElementById('newOrderModal').style.display = 'none';
|
||||
document.getElementById('newOrderModal').classList.remove('is-open');
|
||||
document.getElementById('newOrderForm').reset();
|
||||
}
|
||||
|
||||
@@ -387,12 +417,12 @@ var Workshop = (function() {
|
||||
// ─── Catalog ───
|
||||
|
||||
function openCatalogModal() {
|
||||
document.getElementById('catalogModal').style.display = 'flex';
|
||||
document.getElementById('catalogModal').classList.add('is-open');
|
||||
renderCatalog();
|
||||
}
|
||||
|
||||
function closeCatalogModal() {
|
||||
document.getElementById('catalogModal').style.display = 'none';
|
||||
document.getElementById('catalogModal').classList.remove('is-open');
|
||||
}
|
||||
|
||||
function loadCatalog() {
|
||||
|
||||
Reference in New Issue
Block a user