Tally UI

SalesFiltersBar

Choose the Sales room's period, order status, cashier and register.

Import

import { SalesFiltersBar, type SalesFilters, type SalesOption } from '@tallyui/components';

Usage

const [filters, setFilters] = React.useState<SalesFilters>({
  preset: 'today', range: presetRange('today', new Date(), timezone), compare: 'previous',
  status: 'completed', cashierId: null, registerId: null,
});
<SalesFiltersBar filters={filters} onFiltersChange={setFilters} timezone={timezone}
  statusOptions={[{ value: 'completed', label: 'Completed' }]}
  cashierOptions={cashierOptions} registerOptions={registerOptions} />

The bar shows a DateRangeMenu for the period, then a status, a cashier and a register choice. The cashier choice starts with Everyone and the register choice with All registers; choosing Everyone or All registers sets that filter to null. Every change calls onFiltersChange with the whole filter object. SalesRoom renders this bar above its hero.

Props

PropTypeDefaultDescription
filtersSalesFiltersrequiredThe current filters
onFiltersChange(next: SalesFilters) => voidrequiredCalled with the updated filters
timezonestringrequiredIANA zone of the store, or device
now() => DateTime of the pressThe clock presets are worked out from
earliestDayStoreDay—The earliest store day the data covers; the calendar's minimum
statusOptionsSalesOption[]requiredStatus choices
cashierOptionsSalesOption[]requiredCashier choices, after Everyone
registerOptionsSalesOption[]requiredRegister choices, after All registers

SalesFilters

interface SalesFilters {
  preset: DatePreset | 'custom';
  range: DayRange;
  /** A single day's comparison: the day before or the same weekday last week. */
  compare: 'previous' | 'week';
  status: string;
  cashierId: string | null;
  registerId: string | null;
}

SalesOption

interface SalesOption { value: string; label: string }