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

    <div class="container">
        <asp:Button ID="btnAdd" runat="server" CssClass="btn btn-primary float-right" Text="Add Inspection" />
        <h1>Roadside Inspections</h1>
        
        <div class="table-responsive">
            <asp:GridView ID="gvInspections" runat="server" DataSourceID="dsInspections" AutoGenerateColumns="false" AllowSorting="true"
                CssClass="table clickable-rows table-hover floating-hscroll" CellSpacing="-1" GridLines="None" data-fixed-columns="true" data-fixed-right-number="2" data-fixed-number="3">
                <HeaderStyle CssClass="thead-light" />
                <Columns>
                    <asp:BoundField HeaderText="Date" SortExpression="InspectionDate" DataField="InspectionDate" DataFormatString="{0:d}" />
                    <asp:BoundField HeaderText="Driver" SortExpression="DriverName" DataField="DriverName" />
                    <asp:BoundField HeaderText="Vehicle 1" SortExpression="Vehicle1Desc" DataField="Vehicle1Desc" />
                    <asp:BoundField HeaderText="Vehicle 2" SortExpression="Vehicle2Desc" DataField="Vehicle2Desc" />
                    <asp:BoundField HeaderText="Level of Inspection" SortExpression="LevelOfInspection" DataField="LevelOfInspection" />
                    <asp:BoundField HeaderText="Jurisdiction" SortExpression="Jurisdiction" DataField="Jurisdiction" />
                    <asp:CheckBoxField HeaderText="Have Copy" SortExpression="HaveCopy" DataField="HaveCopy" />
                    <asp:CheckBoxField HeaderText="Violation(s) Discovered" SortExpression="ViolationDiscovered" DataField="ViolationDiscovered" />
                    <asp:CheckBoxField HeaderText="Evidence of Repair" SortExpression="EvidenceOfRepair" DataField="EvidenceOfRepair" />
                    <asp:BoundField HeaderText="Description" SortExpression="InspectionDesc" DataField="InspectionDesc" />
                    <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                            <div class="text-right">
                                <a href="DocumentsNew.aspx?ctx=RoadsideInspection&id=<%# Eval("id") %>&cid=<%# Eval("ContractID") %>" >
                                    <i class="fa fa-fw fa-file"></i>
                                </a>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="">
                        <ItemTemplate>
                            <div class="text-right">
                                <a href="RemoveRoadsideInspection.aspx?id=<%# Eval("id") %>&cid=<%# Eval("ContractID") %>" class="btn btn-outline-danger">
                                    <i class="fa fa-trash-alt fa-fw" title="delete"></i>
                                </a>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <p>There are no inspections.</p>
                </EmptyDataTemplate>
            </asp:GridView>
            <asp:SqlDataSource ID="dsInspections" runat="server" SelectCommand="
                SELECT ID,InspectionDate,DriverName,HaveCopy,InspectionDesc,LevelOfInspection,Jurisdiction,EvidenceOfRepair,ViolationDiscovered,
                    Vehicle1Desc,Vehicle2Desc,Vehicle3Desc, ContractID
                FROM RoadsideInspection WHERE ContractID=@contractId
                ORDER BY InspectionDate DESC, ID">
                <SelectParameters>
                    <asp:Parameter Name="contractId" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </div>

</asp:Content>
