<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Client/ClientMaster.master" CodeBehind="ViewApplication.aspx.vb" Inherits="Web.ViewApplication" %>
<%@ MasterType VirtualPath="ClientMaster.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phContent" runat="server">

    <div class="container">
        <h1>View Application</h1>

        <div class="mb-3">
            <p>App Id: <asp:Literal ID="litId" runat="server" /></p>
            <p>Name: <asp:Literal ID="litName" runat="server" /></p>
            <p>Submitted: <asp:Literal ID="litSubmitted" runat="server" /></p>
        </div>

        <section>
            <h2>Documents</h2>
            <div class="table-responsive">
                <asp:GridView ID="gvDocs" runat="server" DataSourceID="dsDocs" AutoGenerateColumns="false" AllowSorting="true"
                    CssClass="table clickable-rows table-hover" CellSpacing="-1" GridLines="None">
                    <HeaderStyle CssClass="thead-light table-hover floating-hscroll" />
                    <Columns>
                        <asp:BoundField HeaderText="File Name" SortExpression="pageFileName" DataField="pageFileName" />
                        <asp:BoundField HeaderText="Title" SortExpression="pageTitle" DataField="pageTitle" />
                    </Columns>
                    <EmptyDataTemplate>
                        There are no documents.
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:SqlDataSource ID="dsDocs" runat="server"
                    SelectCommand="
                        SELECT 0 id, 'application/*' pageFileName, 'All application documents' pageTitle, CONCAT('/_assets/Document.aspx?context=FullApplication&id=', @appId) pageUrl
                        UNION
                        SELECT id, pageFileName, pageTitle, CONCAT('/_assets/Document.aspx?context=Application&id=', id) pageUrl
                        FROM web_DriverApplicationPdf WHERE appId=@appId
                        ORDER BY id">
                    <SelectParameters>
                        <asp:Parameter Name="appId" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </div>
        </section>
    </div>

</asp:Content>
