{% macro render_outdated_packages(outdated_packages, current_user, show_config=False) -%}
<ul class="list-group mt-3">
	{% for package in outdated_packages %}
		{% set config = package.update_config %}
		<li class="list-group-item">
			<div class="row">
				<a class="col-sm-auto text-muted" style="min-width: 200px;" href="{{ package.get_url('packages.view') }}">
					<img
						class="img-fluid"
						style="max-height: 22px; max-width: 22px;"
						src="{{ package.get_thumb_or_placeholder() }}" />

					<span class="ps-2">
						{{ package.title }}
					</span>
				</a>

				<div class="col-sm">
					{% if show_config %}
						{% set action = "Make release" if config.make_release else "Notification" %}
						{{ _("On %(trigger)s, do %(action)s", trigger=config.trigger.value, action=action) }}
					{% else %}
						{{ config.get_message() }}<br />
						<span class="text-muted" title="{{ config.outdated_at | full_datetime }}">
							{{ config.outdated_at | datetime }}
						</span>
					{% endif %}
				</div>

				<div class="col-sm-auto">
					{% if not show_config %}
						{% if package.check_perm(current_user, "MAKE_RELEASE") %}
							<a class="btn btn-sm btn-primary me-2" href="{{ config.get_create_release_url() }}">
								<i class="fas fa-plus me-1"></i>
								{{ _("Release") }}
							</a>
						{% endif %}
					{% endif %}

					<a class="btn btn-sm btn-secondary me-2" href="{{ package.repo }}">
						<i class="fas fa-code-branch me-1"></i>
						{{ _("Repo") }}
					</a>

					{% if package.check_perm(current_user, "MAKE_RELEASE") %}
						<a class="btn btn-sm btn-secondary" href="{{ package.get_url('packages.update_config') }}">
							<i class="fas fa-cog me-1"></i>
							{{ _("Update settings") }}
						</a>
					{% endif %}
				</div>
			</div>
		</li>
	{% else %}
		<p class="list-group-item"><i>{{ _("No outdated packages.") }}</i></p>
	{% endfor %}
</ul>
{% endmacro %}

{% macro render_mtsupport_packages(packages, current_user, show_config=False) -%}
<div class="list-group mt-3">
	{% for package in packages %}
		<a class="list-group-item list-group-item-action" href="{{ package.get_url('packages.list_releases') }}">
			<div class="row">
				<div class="col-sm-auto text-muted" style="min-width: 200px;">
					<img
						class="img-fluid"
						style="max-height: 22px; max-width: 22px;"
						src="{{ package.get_thumb_or_placeholder() }}" />

					<span class="ps-2">
						{{ package.title }}
					</span>
				</div>

				<div class="col-sm">
					{% set release = package.get_download_release() %}
					{% if release %}
						{{ release.min_rel.name }} - {{ release.max_rel.name }}
					{% endif %}
				</div>
			</div>
		</a>
	{% else %}
		<p class="list-group-item"><i>{{ _("No outdated packages.") }}</i></p>
	{% endfor %}
</div>
{% endmacro %}
