feat(F-161): completed feature

This commit is contained in:
chattie
2026-08-22 18:13:37 +02:00
parent 83a44980c6
commit 9152b3a65e
15 changed files with 164 additions and 63 deletions

View File

@@ -526,46 +526,55 @@ export default function OrderDetailPage() {
{/* Sidebar */}
<div className="space-y-6">
{/* F-140: Customer + Addresses + Payment */}
{(order.email || order.customerName) && (
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Cliente</h2>
<div className="space-y-1 text-sm">
{order.customerName && <p className="font-medium text-gray-900">{order.customerName}</p>}
{order.email && <p className="text-gray-600">{order.email}</p>}
{(order.phone || order.customerPhone) && (
<p className="text-gray-600">{order.customerPhone || order.phone}</p>
)}
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Cliente</h2>
<dl className="space-y-2 text-sm">
<div>
<dt className="text-xs font-semibold uppercase tracking-wide text-gray-400">Nombre</dt>
<dd className="font-medium text-gray-900">{order.customerName || order.shippingAddress?.recipientName || 'No registrado'}</dd>
</div>
</div>
)}
<div>
<dt className="text-xs font-semibold uppercase tracking-wide text-gray-400">Email</dt>
<dd className={order.email ? 'text-gray-700' : 'text-amber-700'}>{order.email || 'No registrado'}</dd>
</div>
<div>
<dt className="text-xs font-semibold uppercase tracking-wide text-gray-400">Teléfono</dt>
<dd className="text-gray-700">{order.customerPhone || order.phone || 'No registrado'}</dd>
</div>
</dl>
</div>
{order.shippingAddress && (
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Dirección de envío</h2>
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Dirección de envío</h2>
{order.shippingAddress ? (
<div className="space-y-1 text-sm text-gray-700">
<p className="font-medium">{order.shippingAddress.recipientName}</p>
<p>{order.shippingAddress.street}</p>
<p>{order.shippingAddress.postalCode} {order.shippingAddress.city}</p>
<p>{order.shippingAddress.country}</p>
</div>
</div>
)}
) : (
<p className="text-sm text-amber-700">No registrada para este pedido.</p>
)}
</div>
{order.billingAddress && (
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Dirección de facturación</h2>
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Dirección de facturación</h2>
{order.billingAddress ? (
<div className="space-y-1 text-sm text-gray-700">
<p className="font-medium">{order.billingAddress.recipientName}</p>
<p>{order.billingAddress.street}</p>
<p>{order.billingAddress.postalCode} {order.billingAddress.city}</p>
<p>{order.billingAddress.country}</p>
</div>
</div>
)}
) : (
<p className="text-sm text-gray-500">No registrada; consultar la dirección de envío.</p>
)}
</div>
{order.payment && (
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Pago</h2>
<div className="bg-white border border-gray-200 rounded-xl p-6">
<h2 className="font-bold text-gray-900 mb-4">Pago</h2>
{order.payment ? (
<div className="space-y-1 text-sm">
<div className="flex justify-between">
<span className="text-gray-600">Método</span>
@@ -593,8 +602,10 @@ export default function OrderDetailPage() {
</span>
</div>
</div>
</div>
)}
) : (
<p className="text-sm text-gray-500">No hay una transacción de pago registrada para este pedido.</p>
)}
</div>
{/* F-140 already shown above — keep existing Envío section */}
{/* Envío */}
<div className="bg-white border border-gray-200 rounded-xl p-6">

View File

@@ -105,7 +105,7 @@ export const ordersApi = {
`/api/orders${qs ? `?${qs}` : ''}`,
).then((data) => (Array.isArray(data) ? { items: data, total: data.length } : data));
},
get: (id: string) => api.get<import('@/types').Order>(`/api/orders/${id}`),
get: (id: string) => api.get<import('@/types').Order>(`/api/orders/${id}/admin`),
transition: (id: string, state: string, trackingNumber?: string, courier?: string) =>
api.post<import('@/types').Order & { notified?: boolean; notificationError?: string }>(
`/api/orders/${id}/transitions/admin`,