|
|
@@ -3,6 +3,7 @@
|
|
|
export let ordensCompra = [];
|
|
|
export let ordensVenda = [];
|
|
|
export let ultimaVenda = { valor: 0, quantidade: 0 };
|
|
|
+ export let emptyMessage = '';
|
|
|
const dispatch = createEventDispatcher();
|
|
|
function formatBRL(n) { return new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(Number(n || 0)); }
|
|
|
function formatQty(n) { return new Intl.NumberFormat('pt-BR', { minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(Number(n || 0)); }
|
|
|
@@ -84,16 +85,22 @@
|
|
|
<div class="text-xs text-gray-500">VALOR · QUANTIDADE</div>
|
|
|
</div>
|
|
|
<div class="space-y-1">
|
|
|
- {#each listaCompraView as o}
|
|
|
- <div
|
|
|
- class={`flex items-center justify-between text-sm rounded px-1 py-0.5 transition-colors duration-700 ${flashCompra.has(o.__idx) ? 'bg-green-100 dark:bg-green-900/30' : ''}`}
|
|
|
- on:mouseenter={(event) => scheduleTooltip(event, o)}
|
|
|
- on:mouseleave={hideTooltip}
|
|
|
- >
|
|
|
- <span class="text-green-600">{formatBRL(o.valor)}</span>
|
|
|
- <span class="text-gray-700 dark:text-gray-200">{formatQty(o.quantidade)}</span>
|
|
|
- </div>
|
|
|
- {/each}
|
|
|
+ {#if listaCompraView.length === 0}
|
|
|
+ <div class="text-xs text-gray-500 dark:text-gray-400 text-center py-4 border border-dashed border-gray-200 dark:border-gray-700 rounded">
|
|
|
+ {emptyMessage || 'Nenhuma ordem de compra disponível.'}
|
|
|
+ </div>
|
|
|
+ {:else}
|
|
|
+ {#each listaCompraView as o}
|
|
|
+ <div
|
|
|
+ class={`flex items-center justify-between text-sm rounded px-1 py-0.5 transition-colors duration-700 ${flashCompra.has(o.__idx) ? 'bg-green-100 dark:bg-green-900/30' : ''}`}
|
|
|
+ on:mouseenter={(event) => scheduleTooltip(event, o)}
|
|
|
+ on:mouseleave={hideTooltip}
|
|
|
+ >
|
|
|
+ <span class="text-green-600">{formatBRL(o.valor)}</span>
|
|
|
+ <span class="text-gray-700 dark:text-gray-200">{formatQty(o.quantidade)}</span>
|
|
|
+ </div>
|
|
|
+ {/each}
|
|
|
+ {/if}
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="p-4">
|
|
|
@@ -102,17 +109,23 @@
|
|
|
<div class="text-xs text-gray-500">VALOR · QUANTIDADE</div>
|
|
|
</div>
|
|
|
<div class="space-y-1">
|
|
|
- {#each listaVendaView as o}
|
|
|
- <div
|
|
|
- class={`flex items-center justify-between text-sm rounded px-1 py-0.5 transition-colors duration-700 cursor-pointer hover:bg-red-50 dark:hover:bg-red-900/40 ${flashVenda.has(o.__idx) ? 'bg-red-100 dark:bg-red-900/30' : ''}`}
|
|
|
- on:mouseenter={(event) => scheduleTooltip(event, o)}
|
|
|
- on:mouseleave={hideTooltip}
|
|
|
- on:click={() => dispatch('selectSellOrder', { valor: o.valor, quantidade: o.quantidade })}
|
|
|
- >
|
|
|
- <span class="text-red-600">{formatBRL(o.valor)}</span>
|
|
|
- <span class="text-gray-700 dark:text-gray-200">{formatQty(o.quantidade)}</span>
|
|
|
- </div>
|
|
|
- {/each}
|
|
|
+ {#if listaVendaView.length === 0}
|
|
|
+ <div class="text-xs text-gray-500 dark:text-gray-400 text-center py-4 border border-dashed border-gray-200 dark:border-gray-700 rounded">
|
|
|
+ {emptyMessage || 'Nenhuma ordem de venda disponível.'}
|
|
|
+ </div>
|
|
|
+ {:else}
|
|
|
+ {#each listaVendaView as o}
|
|
|
+ <div
|
|
|
+ class={`flex items-center justify-between text-sm rounded px-1 py-0.5 transition-colors duration-700 cursor-pointer hover:bg-red-50 dark:hover:bg-red-900/40 ${flashVenda.has(o.__idx) ? 'bg-red-100 dark:bg-red-900/30' : ''}`}
|
|
|
+ on:mouseenter={(event) => scheduleTooltip(event, o)}
|
|
|
+ on:mouseleave={hideTooltip}
|
|
|
+ on:click={() => dispatch('selectSellOrder', { valor: o.valor, quantidade: o.quantidade })}
|
|
|
+ >
|
|
|
+ <span class="text-red-600">{formatBRL(o.valor)}</span>
|
|
|
+ <span class="text-gray-700 dark:text-gray-200">{formatQty(o.quantidade)}</span>
|
|
|
+ </div>
|
|
|
+ {/each}
|
|
|
+ {/if}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|