{% extends 'base.html' %}{% block content %}
<div class="toolbar"><h1>{{ t('software.asset_title', 'Software: {name}').replace('{name}', asset.name) }}</h1><div class="toolbar-actions">{% if is_admin and asset.mesh_node_id %}<form method="post" action="/assets/{{ asset.id }}/software-inventory" class="inline-form"><button type="submit">{% if software %}{{ t('software.update_inventory') }}{% else %}{{ t('software.initialize_inventory') }}{% endif %}</button></form>{% endif %}<a class="button button-secondary" href="/assets/{{ asset.id }}">{{ t('software.back_to_asset') }}</a></div></div>
<section class="panel">
<div class="software-inventory-heading">
  <div>
    <h2>{{ t('software.installed') }}</h2>
    <p class="muted">{% if software %}{{ t('software.inventory_count', '{count} software entries stored.', count=software|length) }}{% else %}{{ t('software.inventory_not_initialized') }}{% endif %}</p>
  </div>
  <span class="software-inventory-count">{{ software|length }}</span>
</div><div class="table-scroll"><table class="data-table" data-storage-key="asset-installed-software-{{ asset.id }}"><thead><tr><th>{{ t('common.name') }}</th><th>{{ t('about.version') }}</th><th>{{ t('software.publisher') }}</th><th>{{ t('software.architecture') }}</th><th>{{ t('software.install_date') }}</th><th>{{ t('software.last_seen') }}</th></tr></thead><tbody>{% for s in software %}<tr><td>{{ s.name }}</td><td>{{ s.version }}</td><td>{{ s.publisher }}</td><td>{{ s.architecture }}</td><td>{{ s.install_date or '' }}</td><td>{% if s.last_seen_at %}<time class="local-time" datetime="{{ utc_iso(s.last_seen_at) }}" data-utc="{{ utc_iso(s.last_seen_at) }}">{{ s.last_seen_at }}</time>{% else %}{{ '' }}{% endif %}</td></tr>{% else %}<tr><td colspan="6"><div class="software-empty-inventory"><strong>{{ t('software.inventory_not_initialized') }}</strong><span>{{ t('software.inventory_initialize_help') }}</span></div></td></tr>{% endfor %}</tbody></table></div></section>
<section class="panel"><h2>{{ t('software.jobs') }}</h2><div class="table-scroll"><table class="data-table" data-storage-key="asset-software-jobs-{{ asset.id }}"><thead><tr><th>{{ t('software.time') }}</th><th>{{ t('jobs.type') }}</th><th>{{ t('jobs.action') }}</th><th>{{ t('jobs.priority') }}</th><th>{{ t('software.status') }}</th><th>{{ t('software.message') }}</th><th>{{ t('software.log') }}</th><th>{{ t('jobs.actions') }}</th></tr></thead><tbody>{% for j in jobs %}<tr><td>{% if j.created_at %}<time class="local-time" datetime="{{ utc_iso(j.created_at) }}" data-utc="{{ utc_iso(j.created_at) }}">{{ j.created_at }}</time>{% else %}{{ '' }}{% endif %}</td><td>{{ t(j.display_job_type_key, j.display_job_type_fallback) }}</td><td>{{ t('jobs.action.' ~ j.action, j.action) }}</td><td>{{ j.priority }}</td><td><span class="job-status job-status-{{ j.status }}">{{ t('software.status.' ~ j.status, j.status) }}</span></td><td>{{ j.message or '' }}</td><td><a href="/jobs/{{ j.id }}">{{ t('software.show') }}</a></td><td>{% if is_admin and j.status not in ['sending', 'running'] %}<form method="post" action="/jobs/{{ j.id }}/restart" class="inline-form" onsubmit="return confirm({{ t('jobs.restart.confirm')|tojson }});"><button type="submit" class="button button-secondary button-small">↻ {{ t('jobs.restart') }}</button></form>{% else %}<span class="muted">—</span>{% endif %}</td></tr>{% else %}<tr><td colspan="8">{{ t('software.no_jobs') }}</td></tr>{% endfor %}</tbody></table></div></section>
{% endblock %}