<%@ Page Language="c#" CodeBehind="List.aspx.cs" AutoEventWireup="True" Inherits="eDocument.Server.Administrator.Process.List" MasterPageFile="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">

    <h1 class="skjema-admin__page-title">
        Oversikt over prosesser
    </h1>

    <p class="mb-5">
        Denne siden gir en oversikt over de prosessene du har opprettet. Du kan se detaljer for, redigere og 
		slette eksisterende prosesser.
    </p>

    <asp:Button 
        ID="btnCreate" 
        CssClass="skjema-admin__button skjema-admin__button--primary mb-4"
        runat="server" 
        Text="OPPRETT"
        OnClick="btnCreate_OnClick" />

    <asp:GridView 
        ID="gridProcesses" 
        runat="server" 
        AutoGenerateColumns="False" 
        Width="100%" 
        CssClass="skjema-admin__table mb-4"
        Border="0"
        HeaderStyle-CssClass="HeaderStyle"
        ItemStyle-CssClass="ItemStyle" 
        AllowSorting="False" 
        OnRowDataBound="gridProcesses_OnDataBound" >
        <Columns>
            <asp:BoundField Visible="False" DataField="ProcessID" />
            <asp:HyperLinkField HeaderText="Navn" DataTextField="Name" DataNavigateUrlFields="ProcessID" DataNavigateUrlFormatString="Details.aspx?ProcessID={0}" />
            <asp:BoundField HeaderText="Kommentar" DataField="Comment" />
            <asp:BoundField HeaderText="Opprettet" DataField="CreatedOn" />
            <asp:BoundField Visible="False" HeaderText="Antall handlinger" DataField="ActionCount" />
            <asp:BoundField HeaderText="Antall bruksområder" DataField="TotalUsageCount" />
            <asp:HyperLinkField Visible="False" Text="Detaljer" DataNavigateUrlFields="ProcessID" DataNavigateUrlFormatString="Details.aspx?ProcessID={0}" />
            <asp:HyperLinkField Visible="False" Text="Rediger" DataNavigateUrlFields="ProcessID" DataNavigateUrlFormatString="Edit.aspx?ProcessID={0}" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton runat="server" CommandName="Delete" ID="btnRemove" Text="Fjern" OnClientClick="return confirm('Er du sikker på at du ønsker å slette prosessen?');" OnCommand="btnRemove_OnCommand" CommandArgument='<%#Bind("ProcessID") %>'>Fjern</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <%--<asp:ButtonField Text="Slett" CommandName="Delete"  />--%>
        </Columns>
    </asp:GridView>

    <div class="mb-2">
        <span style="background: red; width: 30px;">
            &nbsp;&nbsp;&nbsp;&nbsp;
        </span>
        &nbsp; = Prosessen mangler handlinger
    </div>

    <div class="mb-4">
        <span style="background: yellow; width: 30px;">
            &nbsp;&nbsp;&nbsp;&nbsp;
        </span>

        &nbsp; = Prosessen er ikke knyttet mot noen skjemaer/abonnementer/flytregler eller systemer.
    </div>

    <asp:Label ID="lblMessage" runat="server" ForeColor="Red"></asp:Label>
</asp:Content>
