{# Buyer/Employee Grid Component Displays a responsive grid of buyer buttons for queue actions. Used by start-buy, process-buy, start-sort, and end-sort modals. Variables: - buyers: Array of buyer objects with employeeID, employeeFirstName, employeeLastName (default display) - allBuyers: Array of all active employees (for toggle) - clockedInBuyers: Array of clocked-in employees only - wiwEnabled: Boolean indicating if WhenIWork is enabled - item: Queue item object with buyID - action: The action to perform (e.g., 'startBuy', 'processBuy') #} {# Set defaults for optional variables #} {% set wiwEnabled = wiwEnabled|default(false) %} {% set wiwTokenExpired = wiwTokenExpired|default(false) %} {% set allBuyers = allBuyers|default([]) %} {% set clockedInBuyers = clockedInBuyers|default([]) %} {% if wiwTokenExpired %} {% endif %}
Select Your Buyer ID:
{% if wiwEnabled and allBuyers|length > clockedInBuyers|length %}
{% endif %}
{# Clocked-in count indicator when WIW is enabled #} {% if wiwEnabled and clockedInBuyers|length > 0 %}
{{ clockedInBuyers|length }} working now {{ allBuyers|length }} total
{% endif %} {% if buyers is empty %}
No buyers available. Please ensure employees are clocked in or buyers are configured.
{% else %} {# When WIW is enabled and clockedInBuyers has items, the initial 'buyers' list IS the clocked-in list. So all buttons should be primary (clocked-in style) on initial load. #} {% set initialListIsClockedIn = wiwEnabled and clockedInBuyers|length > 0 %}
{# Initially show clocked-in employees (or all if WIW disabled) #} {% for buyer in buyers %} {% set isClockedIn = initialListIsClockedIn or (buyer.isClockedIn is defined and buyer.isClockedIn) %}
{% endfor %}
{# Hidden container with ALL employees for JS toggle #} {% if wiwEnabled and allBuyers|length > 0 %} {# Hidden container with CLOCKED-IN employees only for JS toggle #} {% endif %} {% endif %}