{% macro badge(check=none, url=none, solo=false, last=false, header=false, color='primary', rgb=none, blank=none, icon=none, alt=none, collapsible=none, text=none, tooltip=none) %} {% if check or url %} {% if url %} {% if icon %}{% endif %} {% if rgb %}{% endif %} {% if collapsible and not last %} {{ collapsible }} {% endif %} {% if text %}{{ text }}{% endif %} {% if url %} {% else %} {% endif %} {% endif %} {% endmacro %} {% macro bricklink(item, solo=false, last=false) %} {{ badge(url=item.url_for_bricklink(), solo=solo, last=last, blank=true, color='light border', icon='external-link-line', collapsible='Bricklink', alt='Bricklink') }} {% endmacro %} {% macro color(item, icon=none, solo=false, last=false, header=false) %} {% if item.fields.color == 9999 %} {% set rgb = 'any' %} {% else %} {% set rgb = item.fields.color_rgb %} {% endif %} {{ badge(check=item.fields.color_name, solo=solo, last=last, header=header, color=' bg-white text-black border', rgb=rgb, icon='palette-line', collapsible=item.fields.color_name) }} {{ badge(check=item.fields.color_transparent, solo=solo, last=last, header=header, color='light border', icon='blur-off-line', collapsible='Transparent') }} {% endmacro %} {% macro identifier(id, icon=none, solo=false, last=false, header=false) %} {{ badge(check=id, solo=solo, last=last, header=header, color='secondary', icon=icon, text=id) }} {% endmacro %} {% macro instructions(item, solo=false, last=false) %} {{ badge(url=item.url_for_instructions(), solo=solo, last=last, blank=true, color='light border', icon='file-line', collapsible='Instructions:', text=item.instructions | length, alt='Instructions') }} {% endmacro %} {% macro parts(parts, solo=false, last=false) %} {{ badge(check=parts, solo=solo, last=last, color='success', icon='shapes-line', collapsible='Parts:', text=parts, alt='Parts') }} {% endmacro %} {% macro quantity(quantity, solo=false, last=false) %} {{ badge(check=quantity, solo=solo, last=last, color='success', icon='close-line', collapsible='Quantity:', text=quantity, alt='Quantity') }} {% endmacro %} {% macro owner(item, owner, solo=false, last=false) %} {% if last %} {% set tooltip=owner.fields.name %} {% else %} {% set text=owner.fields.name %} {% endif %} {{ badge(check=item.fields[owner.as_column()], solo=solo, last=last, color='light text-success-emphasis bg-success-subtle border border-success-subtle', icon='user-line', text=text, alt='Owner', tooltip=tooltip) }} {% endmacro %} {% macro print(item, solo=false, last=false, header=false) %} {% if item.fields.print %} {{ badge(url=item.url_for_print(), solo=solo, last=last, color='light border', icon='paint-brush-line', collapsible='Print') }} {% endif %} {% endmacro %} {% macro set(set, solo=false, last=false, url=None, id=None) %} {% if id %} {% set url=url_for('set.details', id=id) %} {% endif %} {{ badge(check=set, url=url, solo=solo, last=last, color='secondary', icon='hashtag', collapsible='Set:', text=set, alt='Set') }} {% endmacro %} {% macro storage(item, storages, solo=false, last=false) %} {% if storages and item.fields.storage in storages.mapping %} {% set storage = storages.mapping[item.fields.storage] %} {% if last %} {% set tooltip=storage.fields.name %} {% else %} {% set text=storage.fields.name %} {% endif %} {{ badge(check=storage, solo=solo, last=last, color='light text-warning-emphasis bg-warning-subtle border border-warning-subtle', icon='archive-2-line', text=text, alt='Storage', tooltip=tooltip) }} {% endif %} {% endmacro %} {% macro tag(item, tag, solo=false, last=false) %} {% if last %} {% set tooltip=tag.fields.name %} {% else %} {% set text=tag.fields.name %} {% endif %} {{ badge(check=item.fields[tag.as_column()], solo=solo, last=last, color='light text-primary-emphasis bg-primary-subtle border border-primary-subtle', icon='price-tag-2-line', text=text, alt='Tag', tooltip=tooltip) }} {% endmacro %} {% macro theme(theme, solo=false, last=false) %} {% if last %} {% set tooltip=theme %} {% else %} {% set text=theme %} {% endif %} {{ badge(check=theme, solo=solo, last=last, color='primary', icon='price-tag-3-line', text=text, alt='Theme', tooltip=tooltip) }} {% endmacro %} {% macro total_damaged(damaged, solo=false, last=false) %} {{ badge(check=damaged, solo=solo, last=last, color='danger', icon='error-warning-line', collapsible='Damaged:', text=damaged, alt='Damaged') }} {% endmacro %} {% macro total_quantity(quantity, solo=false, last=false) %} {{ badge(check=quantity, solo=solo, last=last, color='success', icon='functions', collapsible='Quantity:', text=quantity, alt='Quantity') }} {% endmacro %} {% macro total_minifigures(minifigures, solo=false, last=false) %} {{ badge(check=minifigures, solo=solo, last=last, color='info', icon='group-line', collapsible='Minifigures:', text=minifigures, alt='Minifigures') }} {% endmacro %} {% macro total_missing(missing, solo=false, last=false) %} {{ badge(check=missing, solo=solo, last=last, color='light text-danger-emphasis bg-danger-subtle border border-danger-subtle', icon='question-line', collapsible='Missing:', text=missing, alt='Missing') }} {% endmacro %} {% macro total_sets(sets, solo=false, last=false) %} {{ badge(check=sets, solo=solo, last=last, color='secondary', icon='hashtag', collapsible='Sets:', text=sets, alt='Sets') }} {% endmacro %} {% macro total_spare(spare, solo=false, last=false) %} {{ badge(check=spare, solo=solo, last=last, color='warning', icon='loop-left-line', collapsible='Spare:', text=spare, alt='Spare') }} {% endmacro %} {% macro rebrickable(item, solo=false, last=false) %} {{ badge(url=item.url_for_rebrickable(), solo=solo, last=last, blank=true, color='light border', icon='external-link-line', collapsible='Rebrickable', alt='Rebrickable') }} {% endmacro %} {% macro year(year, solo=false, last=false) %} {{ badge(check=year, solo=solo, last=last, color='secondary', icon='calendar-line', collapsible='Year:', text=year, alt='Year') }} {% endmacro %}