<!DOCTYPE html>
<html>
    <head>
        {% for src in js %}
            <script type="text/javascript" src="{{ src }}"></script>
        {% endfor %}
        {% for src in css %}
            <link type="text/css" rel="stylesheet" href="{{ src }}">
        {% endfor %}
        
        <script type="text/javascript" src="{{ url_for( 'files.send_app_files', subpath = 'functions.js' ) }}"></script>
        <link type="text/css" rel="stylesheet" href="{{ url_for( 'files.send_app_files', subpath = 'app.css' ) }}">
        
        <script type="text/javascript">
            baseurl = "{{ baseurl }}";
            var password_local = decrypt( sessionStorage.getItem( "session_key" ), "{{ session_security_key }}" );
            var nickname = decrypt( "{{ nickname }}", password_local );
        </script>
        
        <style type="text/css">
            :root {
                --imgsize: 300px;
            }
            .icnml_list_of_boxes {
                grid-template-columns: repeat( auto-fill, calc( var( --imgsize ) + 2 * var( --imgmargin ) ) );
            }
        </style>
    </head>
    <body class="icnml_main_layout">
        {% include "header.html" %}
        {% include navigation %}
        
        <div class="icnml_content">
            <div class="icnml_list_of_boxes">
                {% macro tp_box( tenprint ) %}
                    <div>
                        <div class="ui-widget-header ui-corner-top icnml_box_top" id="tenprint_{{ tenprint[ 'uuid' ] }}_filename">-</div>
                        <div class="ui-widget-content ui-corner-bottom icnml_box_content">
                            <div
                                id="edit_{{ tenprint[ 'uuid' ] }}"
                                class="icnml_pointer"
                                style="background-image: url( {{ url_for( 'image.image_file_serve', file_id = tenprint[ 'uuid' ] ) }} )">
                            </div>
                        </div>
                    </div>
                {% endmacro %}
                
                <div id="front">
                    {% for tenprint in tenprint_cards_front %}
                        {{ tp_box( tenprint ) }}
                    {% endfor %}
                </div>
                <div id="back">
                    {% for tenprint in tenprint_cards_back %}
                        {{ tp_box( tenprint ) }}
                    {% endfor %}
                </div>
                <div id="nist">
                    {% for tenprint in tenprint_cards_nist %}
                        {{ tp_box( tenprint ) }}
                    {% endfor %}
                </div>
            </div>
            <div id="zoom_slider"></div>
        </div>
        
        <script type="text/javascript">
            {% for tenprint in tenprint_cards_front %}
                $( "#tenprint_{{ tenprint[ 'uuid' ] }}_filename" )
                    .text( decrypt( "{{ tenprint[ 'filename' ] }}", password_local ) );
                $( "#edit_{{ tenprint[ 'uuid' ] }}" ).on( "click", function()
                {
                    window.location.href = "{{ url_for( 'submission.submission_tenprint', submission_id = submission_id, tenprint_id = tenprint[ 'uuid' ] ) }}";
                } );
            {% endfor %}
            {% for tenprint in tenprint_cards_back %}
                $( "#tenprint_{{ tenprint[ 'uuid' ] }}_filename" )
                    .text( decrypt( "{{ tenprint[ 'filename' ] }}", password_local ) );
                $( "#edit_{{ tenprint[ 'uuid' ] }}" ).on( "click", function()
                {
                    window.location.href = "{{ url_for( 'submission.submission_tenprint', submission_id = submission_id, tenprint_id = tenprint[ 'uuid' ] ) }}";
                } );
            {% endfor %}
            
            {% for tenprint in tenprint_cards_nist %}
                $( "#tenprint_{{ tenprint[ 'uuid' ] }}_filename" )
                    .text( decrypt( "{{ tenprint[ 'filename' ] }}", password_local ) );
                $( "#edit_{{ tenprint[ 'uuid' ] }}" ).on( "click", function()
                {
                    window.location.href = "{{ url_for( 'submission.submission_tenprint', submission_id = submission_id, tenprint_id = tenprint[ 'uuid' ] ) }}";
                } );
            {% endfor %}
            
            $( "#icnml_navigation_submissions" )
                .addClass( "activated" );
            
            $( "#navloc" ).append(
                $( "<a />" )
                    .attr( "href", "{{ url_for( 'submission.submission_list' ) }}" )
                    .text( "Submissions" )
            )
            .append(
                $( "<span />" ).text( ">" )
            )
            .append(
                $( "<a />" )
                    .attr( "href", "{{ url_for( 'submission.submission_upload_tenprintmark', submission_id = submission_id ) }}" )
                    .text( nickname )
            )
            .append(
                $( "<span />" ).text( ">" )
            )
            .append(
                $( "<span />" ).text( "Tenprints" )
            );
        </script>
    </body>
</html>
        
