{% set gpm = admin.gpm() %}
{% set installed = gpm.isPluginInstalled(admin.route) %}

<div class="grav-update plugin" data-gpm-plugin="{{ admin.route }}">
{% if installed and gpm.isPluginUpdatable(admin.route) %}
    {% set remote = gpm.getRepositoryPlugin(admin.route) %}
        <p>
            <i class="fa fa-bullhorn"></i>
            <strong>v{{ remote.available }}</strong> {{ "PLUGIN_ADMIN.OF_THIS_PLUGIN_IS_NOW_AVAILABLE"|tu }}!
            <button class="button button-small secondary" data-download="{{ remote.zipball_url }}">{{ "PLUGIN_ADMIN.UPDATE_PLUGIN"|tu }}</button>
        </p>
{% endif %}
</div>

<h1>
    {{ plugin.name|e }}
    {% if admin.isTeamGrav(plugin) %}
        <small><span class="info-reverse"><i class="fa fa-check-circle" title="{{ "PLUGIN_ADMIN.GRAV_OFFICIAL_PLUGIN"|tu }}"></i></span></small>
    {% endif %}
    {% if plugin.symlink %}
    <small class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.PLUGIN_SYMBOLICALLY_LINKED"|tu }}">
        <i class="fa fa-fw fa-link"></i>
    </small>
    {% endif %}
    <small>{{ plugin.version ? 'v' ~ plugin.version|e }}</small>
</h1>
<div class="gpm-item-info">
    <i class="gpm-item-icon fa fa-fw fa-{{ plugin.icon }}"></i>
    {% include 'partials/plugin-data.html.twig' with { plugin: plugin } %}
</div>

{% if (installed) %}
    {% set data = admin.data('plugins/' ~ admin.route) %}
    {% include 'partials/blueprints.html.twig' with { data: data, blueprints: data.blueprints } %}

    <div class="button-bar danger">
        <span class="danger-zone"></span>
        <a class="button" href="{{ base_url_relative }}/plugins/{{ plugin.slug }}/task{{ config.system.param_sep }}uninstall"><i class="fa fa-fw fa-warning"></i>{{ "PLUGIN_ADMIN.REMOVE_PLUGIN"|tu }}</a>
    </div>
{% else %}
    <div class="button-bar success">
        <a class="button" href="{{ base_url_relative }}/plugins/{{ plugin.slug }}/task{{ config.system.param_sep }}install"><i class="fa fa-fw fa-plus"></i>{{ "PLUGIN_ADMIN.INSTALL_PLUGIN"|tu }}</a>
    </div>
{% endif %}
