OrderCard.svelte 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <script>
  2. export let pedido;
  3. import { createEventDispatcher } from 'svelte';
  4. const dispatch = createEventDispatcher();
  5. function marcarItemComoPronto(id) {
  6. dispatch('marcarPronto', [id]);
  7. }
  8. function marcarTodosComoProntos() {
  9. const ids = pedido.items.map((item) => item.id);
  10. dispatch('marcarPronto', ids);
  11. }
  12. </script>
  13. <div class="flex flex-col rounded-md bg-gray-700 p-4 text-white shadow-md">
  14. <div class="flex justify-between">
  15. <div>
  16. <div class="mb-2 font-semibold flex"> Mesa <p class="ml-2 text-yellow-400 font-bold">{pedido.mesa}</p></div>
  17. <div class="mb-2 font-semibold flex"> Comanda <p class="ml-2 text-yellow-400 font-bold">{pedido.comanda_nome}</p></div>
  18. <div class="mb-2 font-semibold flex"> Garçom <p class="ml-2 text-yellow-400 font-bold">{pedido.user_name}</p></div>
  19. <strong>Itens:</strong>
  20. <ul class="list-inside list-disc text-lg">
  21. {#each pedido.items as item}
  22. <li class="mb-1 flex items-center justify-between">
  23. <div>
  24. {item.nome}
  25. {#if item.observacao}
  26. <span class="italic text-yellow-300"> — {item.observacao}</span>
  27. {/if}
  28. </div>
  29. <button
  30. class="ml-4 mt-2 h-10 rounded-md bg-blue-600 px-4 py-1 text-sm font-bold hover:bg-blue-500"
  31. on:click={() => marcarItemComoPronto(item.id)}
  32. >
  33. Item pronto
  34. </button>
  35. </li>
  36. {/each}
  37. </ul>
  38. </div>
  39. <div class="flex items-center">
  40. </div>
  41. </div>
  42. </div>