{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid"> {% if success %}
    <div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> {{ success }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
    {% endif %}
    {% if error %}
    {% for error_message in error %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_message }}</div>
    {% endfor %}
    {% endif %}
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-puzzle-piece"></i> {{ text_dashboard }}</h3>
      </div>
      <div class="panel-body">
        <div class="row">
          <div class="col-md-6">
            <div class="row">
              <div class="col-md-12">
                <table class="table table-bordered table-hover">
                  <thead>
                    <tr>
                      <td class="text-left" width="60%">{{ column_name }}</td>
                      <td class="text-center" width="20%">{{ column_status }}</td>
                      <td class="text-right" width="20%">{{ column_action }}</td>
                    </tr>
                  </thead>
                  <tbody>
                    {% for extension in extensions %}
                    <tr>
                      <td class="text-left">{{ extension.name }}</td>
                      <td class="text-center">{{ extension.status }}</td>
                      <td class="text-right"> {% if not extension.installed %} <a href="{{ extension.install }}" data-toggle="tooltip" title="{{ button_install }}" class="btn btn-success" id="button-install-{{ extension.code }}"><i class="fa fa-plus-circle"></i></a> {% else %} <a href="{{ extension.edit }}" data-toggle="tooltip" title="{{ button_edit }}" class="btn btn-primary" id="button-edit-{{ extension.code }}"><i class="fa fa-pencil"></i></a> <a onclick="confirm('{{ text_confirm }}') ? location.href='{{ extension.uninstall }}' : false;" data-toggle="tooltip" title="{{ button_uninstall }}" class="btn btn-danger" id="button-uninstall-{{ extension.code }}"><i class="fa fa-minus-circle"></i></a> {% endif %}</td>
                    </tr>
                    {% endfor %}
                  </tbody>
                </table>
              </div>
            </div>
            <div class="row">
              <div class="col-md-12 text-center">
                <div class="row">
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="{{ product_link }}"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-tags fa-stack-1x"></i> </span>
                      <h4>{{ text_products }}</h4>
                      </a>
                    </div>
                  </div>
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="{{ order_link }}"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-shopping-cart fa-stack-1x"></i> </span>
                      <h4>{{ text_orders }}</h4>
                      </a>
                    </div>
                  </div>
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="{{ manage_link }}"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-wrench fa-stack-1x"></i> </span>
                      <h4>{{ text_manage }}</h4>
                      </a>
                    </div>
                  </div>
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="http://www.openbaypro.com/help" target="_BLANK"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-comments-o fa-stack-1x"></i> </span>
                      <h4>{{ text_help }}</h4>
                      </a>
                    </div>
                  </div>
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="http://www.openbaypro.com/tutorials" target="_BLANK"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-youtube-play fa-stack-1x"></i> </span>
                      <h4>{{ text_tutorials }}</h4>
                      </a>
                    </div>
                  </div>
                  <div class="col-md-4 text-center">
                    <div class="well"> <a href="http://www.openbaypro.com/suggestions" target="_BLANK"> <span class="fa-stack fa-2x"> <i class="fa fa-square-o fa-stack-2x"></i> <i class="fa fa-bullhorn fa-stack-1x"></i> </span>
                      <h4>{{ text_suggestions }}</h4>
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="col-md-6" style="padding-left:10px;">
            <div id="openbay-version" class="alert alert-info text-left">
              <div id="openbay-version-loading"> <i class="fa fa-cog fa-lg fa-spin"></i> {{ text_version_check }} </div>
            </div>
            <div id="openbay-notification" class="alert alert-info text-left">
              <div id="openbay-loading"> <i class="fa fa-cog fa-lg fa-spin"></i> {{ text_getting_messages }} </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<script type="text/javascript"><!--
  function version() {
    var version = '{{ feed_openbaypro_version }}';

    $('#openbay-version').empty().html('<div id="openbay-version-loading"><i class="fa fa-cog fa-lg fa-spin"></i> {{ text_version_check }}</div>');

    setTimeout(function () {
      $.ajax({
        type: 'GET',
        url: 'index.php?route=marketplace/openbay/version&user_token={{ user_token }}',
        dataType: 'json',
        success: function (json) {
          $('#openbay-version-loading').hide();

          if (json.error) {
            $('#openbay-version').removeClass('attention').addClass('alert-warning').append(json.msg);
          } else {
            if (version < json.version) {
              $('#openbay-version').removeClass('attention').addClass('alert-warning').append('<i class="fa fa-warning"></i> {{ text_version_current }} v.' + version + ', {{ text_version_available }} v.' + json.version);
            } else {
              $('#openbay-version').removeClass('attention').addClass('alert-success').append('<i class="fa fa-check"></i> {{ text_version_latest }} (v.' + version + ')');
            }
          }
        },
        failure: function () {
          $('#openbay-version').html('{{ error_failed }}<strong><span onclick="version();">{{ button_retry }}</span></strong>');
        },
        error: function (xhr, ajaxOptions, thrownError) {
          if (xhr.status != 0) {
            alert(xhr.status + "\r\n" + thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
          }
        }
      });
    }, 500);
  }

  function getNotifications() {
    $('#openbay-notification').empty().html('<div id="openbay-loading"><i class="fa fa-cog fa-lg fa-spin"></i> {{ text_getting_messages }}</div>');

    setTimeout(function () {
      $.ajax({
        type: 'GET',
        url: 'index.php?route=marketplace/openbay/notifications&user_token={{ user_token }}',
        dataType: 'json',
        success: function (json) {
          html = '<h4><i class="fa fa-info-circle"></i>  {{ text_title_messages }}</h4>';
          html += '<ul>';
          $.each(json, function (key, val) {
            html += '<li>' + val + '</li>';
          });
          html += '</ul>';

          $('#openbay-notification').html(html);
        },
        error: function (xhr, ajaxOptions, thrownError) {
          if (xhr.status != 0) {
            alert(xhr.status + "\r\n" +thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
          }
        }
      });
    }, 500);
  }

  $(document).ready(function () {
    version();
    getNotifications();
  });
//--></script></div>
{{ footer }}