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

    <div class="container">
        <h1><asp:Literal ID="litContext" runat="server" /> Docs</h1>
        <p>Name: <asp:Literal ID="litItemName" runat="server" /></p>
        <asp:Button ID="btnCancel" runat="server" CausesValidation="false" Text="Cancel" CssClass="btn btn-secondary mb-3" />
        
        <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 where @appID<>0
                        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>
    </div>

</asp:Content>
