{# ============================================ MULTI-SELECT COMPONENT Reusable multi-select dropdown with checkboxes ============================================ #} {% macro multi_select( field_name, label, items, selected_ids=[], item_id_attr='id', item_label_attr='name', placeholder='All', show_search=True, form_id=None ) %} {# Parameters: - field_name: Name of the hidden input field (e.g., 'project_ids') - label: Label text for the dropdown - items: List of items to display (e.g., projects, users) - selected_ids: List of currently selected IDs - item_id_attr: Attribute name for item ID (default: 'id') - item_label_attr: Attribute name for item label (default: 'name') - placeholder: Text to show when nothing is selected (default: 'All') - show_search: Whether to show search box (default: True) - form_id: Optional form ID for auto-submit #}
{# Hidden input to store selected IDs as comma-separated values #} {# Dropdown button #} {# Dropdown menu #}
{# JavaScript for multi-select functionality #} {% endmacro %}