LedgerUI.Components.CashTimer (LedgerUI v0.2.0)

Copy Markdown View Source

Status card of a cash register shift: an icon in the colour of the state, a title and a line, the time the register has been open (ticking in the browser) and a balance, a difference or an action.

<.cash_timer id="register-2" state="open" title="Caixa 2 aberto" subtitle="desde 08:00 · Marina"
  elapsed={24_130} amount="R$ 6.412,30" />

<.cash_timer id="register-2" state="closed" title="Caixa 2 fechado" subtitle="ontem às 18:04">
  <:action><button class="lu-b c-mono v-solid s-sm">Abrir caixa</button></:action>
</.cash_timer>

<.cash_timer id="check-2" state="alert" title="Conferência do caixa 2" difference="− R$ 12,50">
  <:stat label="Esperado">R$ 6.412,30</:stat>
  <:stat label="Contado">R$ 6.399,80</:stat>
</.cash_timer>

state styles the card (closed dimmed, alert ringed in amber; the difference takes the amber); the icon tile is always the accent colour. elapsed (seconds) shows the clock, which counts up in the browser with the LedgerUI.Timer hook while the state is open and running; a new elapsed from the server resets it. amount_label (default "Em caixa") names the balance.

Summary

Functions

cash_timer(assigns)

Attributes

  • id (:string) (required)
  • state (:string) - Defaults to "open". Must be one of "open", "closed", or "alert".
  • title (:string) (required)
  • subtitle (:string) - Defaults to nil.
  • elapsed (:integer) - Seconds the register has been open: shows the clock. Defaults to nil.
  • running (:boolean) - Defaults to true.
  • amount (:string) - Defaults to nil.
  • amount_label (:string) - Defaults to "Em caixa".
  • difference (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • action - A button at the right.
  • stat - A figure in the row under the head. Accepts attributes:
    • label (:string)