{% ckan_extends %}

{% block package_additional_info %}
  {% if h.is_enabled_downloads() %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Downloads') }}</th>
      <td class="dataset-details">{{ h.get_package_downloads(pkg_dict.id) }}</td>
    </tr>
  {% endif %}
  {% if h.is_enabled_utilizations() %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Utilizations') }}</th>
      <td class="dataset-details"><a href="{{ h.url_for('utilization.search', id=pkg_dict.id, disable_keyword=true) }}">{{ h.get_package_utilizations(pkg_dict.id) }}</a></td>
    </tr>
  {% endif %}
  {% if h.is_enabled_resources() %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Comments') }}</th>
      <td class="dataset-details">{{ h.get_package_comments(pkg_dict.id) }}</a></td>
    </tr>
    <tr>
      <th scope="row" class="dataset-label">{{ _('Rating') }}</th>
      <td class="dataset-details">{{ h.get_package_rating(pkg_dict.id)|round(1) }}</a></td>
    </tr>
  {% endif %}
  {% if h.is_enabled_utilizations() %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Issue Resolutions') }}</th>
      <td class="dataset-details">{{ h.get_package_issue_resolutions(pkg_dict.id) }}</td>
    </tr>
  {% endif %}
  
  {% if pkg_dict.url %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Source') }}</th>
      {% if h.is_url(pkg_dict.url) %}
        <td class="dataset-details" property="foaf:homepage">{{ h.link_to(pkg_dict.url, pkg_dict.url, rel='foaf:homepage', target='_blank') }}</td>
      {% else %}
        <td class="dataset-details" property="foaf:homepage">{{ pkg_dict.url }}</td>
      {% endif %}
    </tr>
  {% endif %}
  {% if pkg_dict.author_email %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("Author") }}</th>
      <td class="dataset-details" property="dc:creator">{{ h.mail_to(email_address=pkg_dict.author_email, name=pkg_dict.author) }}</td>
    </tr>
  {% elif pkg_dict.author %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("Author") }}</th>
      <td class="dataset-details" property="dc:creator">{{ pkg_dict.author }}</td>
    </tr>
  {% endif %}
  {% if pkg_dict.maintainer_email %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
      <td class="dataset-details" property="dc:contributor">{{ h.mail_to(email_address=pkg_dict.maintainer_email, name=pkg_dict.maintainer) }}</td>
    </tr>
  {% elif pkg_dict.maintainer %}
    <tr>
      <th scope="row" class="dataset-label">{{ _('Maintainer') }}</th>
      <td class="dataset-details" property="dc:contributor">{{ pkg_dict.maintainer }}</td>
    </tr>
  {% endif %}
  {% if pkg_dict.version %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("Version") }}</th>
      <td class="dataset-details">{{ pkg_dict.version }}</td>
    </tr>
  {% endif %}
  {% if h.check_access('package_update',{'id':pkg_dict.id}) %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("State") }}</th>
      <td class="dataset-details">{{ _(pkg_dict.state) }}</td>
    </tr>
  {% endif %}
  {% if pkg_dict.metadata_modified %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("Last Updated") }}</th>
      <td class="dataset-details">
          {% snippet 'snippets/local_friendly_datetime.html', datetime_obj=pkg_dict.metadata_modified %}
      </td>
    </tr>
  {% endif %}
  {% if pkg_dict.metadata_created %}
    <tr>
      <th scope="row" class="dataset-label">{{ _("Created") }}</th>
      <td class="dataset-details">
          {% snippet 'snippets/local_friendly_datetime.html', datetime_obj=pkg_dict.metadata_created %}
      </td>
    </tr>
  {% endif %}
  {% block extras scoped %}
    {% for extra in h.sorted_extras(pkg_dict.extras) %}
      {% set key, value = extra %}
      <tr rel="dc:relation" resource="_:extra{{ i }}">
        <th scope="row" class="dataset-label" property="rdfs:label">{{ _(key|e) }}</th>
        <td class="dataset-details" property="rdf:value">{{ value }}</td>
      </tr>
    {% endfor %}
  {% endblock %}

{% endblock %}