{% extends 'admin/model/list.html' %}
{% import 'admin/model/layout.html' as model_layout with context %}
{% import 'admin/actions.html' as actionlib with context %}

{% block access_control %}
    {{ super() }}
    {#
    <ul class="nav navbar-right">
        <div class="btn-group navbar-btn">
            <button class="btn btn-warning btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bars"></i> Export Table</button>
            <ul class="dropdown-menu " role="menu">
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'json',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/json.png') }}" width="24px"> JSON</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'json',escape:'false',ignoreColumn:'[2,3]'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/json.png') }}" width="24px"> JSON (ignoreColumn)</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'json',escape:'true'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/json.png') }}" width="24px"> JSON (with Escape)</a></li>
              <li class="divider"></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'xml',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/xml.png') }}" width="24px"> XML</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'sql'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/sql.png') }}" width="24px"> SQL</a></li>
              <li class="divider"></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'csv',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/csv.png') }}" width="24px"> CSV</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'txt',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/txt.png') }}" width="24px"> TXT</a></li>
              <li class="divider"></li>               
              
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'excel',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/xls.png') }}" width="24px"> XLS</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'doc',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/word.png') }}" width="24px"> Word</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'powerpoint',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/ppt.png') }}" width="24px"> PowerPoint</a></li>
              <li class="divider"></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'png',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/png.png') }}" width="24px"> PNG</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'pdf',pdfFontSize:'7',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/pdf.png') }}" width="24px"> PDF</a></li>
            </ul>
        </div>    
    </ul>
    #}
{% endblock %}

{#
{% block tail_js %}
    {{ super() }}
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/tableExport.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jquery.base64.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/html2canvas.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/libs/sprintf.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/jspdf.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename='mmw/htmltable_export/jspdf/libs/base64.js') }}"></script>
{% endblock %}
#}

{% block model_menu_bar %}
    <h4><i class="fa fa-arrow-right"></i> {{ admin_view.name }}</h4>
    {{ super() }}
{% endblock %}

{#
{% block model_menu_bar %}
    <h4><i class="fa fa-arrow-right"></i> {{ admin_view.name }}</h4>
        
	<ul class="nav nav-tabs actions-nav">
	    <li class="active">
	        <a href="javascript:void(0)">{{ _gettext('List') }} ({{ count }})</a>
	    </li>
	    {% if admin_view.can_create %}
	    <li>
	        <a href="{{ get_url('.create_view', url=return_url) }}" title="{{ _gettext('Create new record') }}">{{ _gettext('Create') }}</a>
	    </li>
	    {% endif %}
	
	    {% if filters %}
	    <li class="dropdown">
	        {{ model_layout.filter_options() }}
	    </li>
	    {% endif %}
	
	    {% if actions %}
	    <li class="dropdown">
	        {{ actionlib.dropdown(actions) }}
	    </li>
	    {% endif %}
	
	    {% if search_supported %}
	    <li>
	        {{ model_layout.search_form() }}
	    </li>
	    {% endif %}
	    
		<li class="dropdown">
		    <a aria-expanded="true" class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">
		        Export<b class="caret"></b>
		    </a>
		    <ul class="dropdown-menu">
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'sql'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/sql.png') }}" width="24px"> SQL</a></li>
              <li class="divider"></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'csv',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/csv.png') }}" width="24px"> CSV</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'txt',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/txt.png') }}" width="24px"> TXT</a></li>
              <li class="divider"></li>               
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'excel',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/xls.png') }}" width="24px"> XLS</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'doc',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/word.png') }}" width="24px"> Word</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'powerpoint',escape:'false'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/ppt.png') }}" width="24px"> PowerPoint</a></li>
              <li class="divider"></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'png',escape:'false',ignoreColumn:'[1,2]'});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/png.png') }}" width="24px"> PNG</a></li>
              <li><a href="#" onclick="$('.model-list:first').tableExport({type:'pdf',pdfFontSize:'7',escape:'false',ignoreColumn:[0,1]});"> <img src="{{ url_for('static', filename='mmw/htmltable_export/icons/pdf.png') }}" width="24px"> PDF</a></li>
		    </ul>
		</li>	    
	    
	    
	</ul>
{% endblock %}
#}


{% block list_row_actions scoped %}
    {{ super() }}
    <a class="icon" href="{{ get_url('.show_view', id=get_pk_value(row), url=return_url) }}" title="{{ _('Show record') }}">
        <span class="glyphicon glyphicon-eye-open"></span>
    </a>
{% endblock %}
{% block Xlist_row_actions scoped %}
    {%- if admin_view.can_delete -%}
    <form class="icon" method="POST" action="{{ get_url('.delete_view') }}">
        {{ delete_form.id(value=get_pk_value(row)) }}
        {{ delete_form.url(value=return_url) }}
        {{ delete_form.csrf_token }}
        <button onclick="return confirm('{{ _('Are you sure you want to delete this record?') }}');" title="Delete record">
            <span class="glyphicon glyphicon-trash"></span>
        </button>
    </form>
    {%- if admin_view.can_edit -%}
    <a class="icon" href="{{ get_url('.edit_view', id=get_pk_value(row), url=return_url) }}" title="{{ _('Edit record') }}">
        <span class="glyphicon glyphicon-pencil"></span>
    </a>
    {%- endif -%}    
    {%- endif -%}
    <a class="icon" href="{{ get_url('.show_view', id=get_pk_value(row), url=return_url) }}" title="{{ _('Show record') }}">
        <span class="glyphicon glyphicon-eye-open"></span>
    </a>
{% endblock %}

    