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

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

    <h1 class="skjema-admin__page-title">
        Detaljer for prosess
    </h1>

    <p class="mb-5">
        Denne siden viser detaljer for en prosess. Klikk på "Rediger" knappen dersom du ønsker å redigere prosessen. Klikk på "Legg til handling" knappen dersom du ønsker å legge en handling til denne prosessen.
    </p>

    <h2 class="skjema-admin__section-title">
        Detaljer
    </h2>

    <div class="skjema-admin__page__field">
        <div class="mb-4">
            <asp:Label 
                ID="Label5" 
                CssClass="skjema-admin__page__label"
                runat="server">
                Navn
            </asp:Label>

            <asp:Label ID="lblName" runat="server"></asp:Label>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label2" 
                CssClass="skjema-admin__page__label"
                runat="server">
                Kommentar
            </asp:Label>
            <asp:Label ID="lblComment" runat="server"></asp:Label>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label4" 
                CssClass="skjema-admin__page__label"
                runat="server">
                Restart prosess-intervall (timer)
            </asp:Label>
            <asp:Label ID="lblRestartAbortedProcessInterval" runat="server"></asp:Label>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label1" 
                CssClass="skjema-admin__page__label"
                runat="server">
                Opprettet
            </asp:Label>
            <asp:Label ID="lblCreated" runat="server"></asp:Label>
        </div>

        <div class="mb-4">
            <asp:HyperLink ID="Hyperlink8" runat="server" NavigateUrl="~/Help/Created.aspx" Target="_blank"
                Visible="False">Help</asp:HyperLink>

            <asp:Button 
                ID="btnEdit" 
                runat="server" 
                Text="Rediger" 
                CssClass="skjema-admin__button skjema-admin__button--primary mb-5"
                OnClick="btnEdit_Click">
            </asp:Button>
        </div>
    </div>

    <h2 class="skjema-admin__section-title">
        Handlinger
    </h2>

    <asp:GridView 
        ID="dgActions" 
        runat="server" 
        AutoGenerateColumns="False" 
        Width="100%" 
        CssClass="skjema-admin__table"
        Border="0"
        HeaderStyle-CssClass="HeaderStyle"
        ItemStyle-CssClass="ItemStyle" OnRowDataBound="dgActions_ItemDataBound"
        AlternatingItemStyle-CssClass="AlternatingItemStyle">
        <Columns>
            <asp:BoundField DataField="ProcessActionID" Visible="False"></asp:BoundField>
            <asp:BoundField DataField="ActionID" Visible="False"></asp:BoundField>
            <asp:BoundField HeaderText="Navn" />
            <asp:BoundField DataField="Sequence" HeaderText="Rekkefølge"></asp:BoundField>
            <asp:BoundField HeaderText="Type"></asp:BoundField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton runat="server" CommandName="Action" ID="btnMoveUp" Text="Flytt opp" OnCommand="btnMoveUp_OnCommand" CommandArgument='<%#Bind("ProcessActionID") %>'>Flytt opp</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton runat="server" CommandName="Action" ID="btnMoveDown" Text="Flytt ned" OnCommand="btnMoveDown_OnCommand" CommandArgument='<%#Bind("ProcessActionID") %>'>Flytt ned</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
<%--            <asp:ButtonColumn Text="Flytt opp" CommandName="MoveUp"></asp:ButtonColumn>
            <asp:ButtonColumn Text="Flytt ned" CommandName="MoveDown"></asp:ButtonColumn>--%>
            <asp:HyperLinkField Text="Detaljer" HeaderText="Detaljer" DataNavigateUrlFields="ActionID,ProcessID" DataNavigateUrlFormatString="~/Action/Edit.aspx?ActionID={0}&ProcessID={1}" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton runat="server" CommandName="Delete" ID="btnRemove" Text="Fjern" OnCommand="btnRemove_OnCommand" CommandArgument='<%#Bind("ProcessActionID") %>'>Fjern</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <%--<asp:ButtonColumn Text="Fjern" CommandName="Delete"></asp:ButtonColumn>--%>
        </Columns>
    </asp:GridView>

    <asp:Label ID="lblNoActionsMessage" runat="server">Ingen handlinger</asp:Label>

    <asp:Button 
        ID="btnAttach" 
        runat="server" 
        CssClass="skjema-admin__button skjema-admin__button--primary mb-5"
        Text="Legg til handling" 
        OnClick="btnAttatch_Click">
    </asp:Button>
    
    <br/>
    <h2 runat="server" 
        class="skjema-admin__section-title"
        id="headerTemlates">
        Skjemaer
    </h2>

    <asp:GridView 
        HeaderStyle-CssClass="HeaderStyle" 
        runat="server" 
        CssClass="skjema-admin__table mb-5"
        Border="0"
        ID="gridTemplates" 
        AutoGenerateColumns="False">
        <Columns>
            <asp:HyperLinkField HeaderText="Navn" DataTextField="Name" DataNavigateUrlFields="eDocumentTemplateID" DataNavigateUrlFormatString="~/eDocumentTemplate/Details.aspx?eDocumentTemplateID={0}" />
            <asp:BoundField Visible="False" HeaderText="Form ID" DataField="ShortName" />
            <asp:BoundField HeaderText="Form ID" DataField="FormID" />
        </Columns>
    </asp:GridView>

<%--    <h2 
        runat="server" 
        class="skjema-admin__section-title"
        id="headerSubscriptions">
        Abonnementer
    </h2>

    <asp:GridView 
        HeaderStyle-CssClass="HeaderStyle" 
        runat="server" 
        CssClass="skjema-admin__table mb-5"
        Border="0"
        ID="gridSubscriptions" 
        AutoGenerateColumns="False">
        <Columns>
            <asp:HyperLinkField Text="Gå til abo" DataNavigateUrlFields="SubscriptionID" DataNavigateUrlFormatString="~/Subscription/Details.aspx?SubscriptionID={0}" />
            <asp:HyperLinkField HeaderText="Organisasjon" DataTextField="SubscribedByConsumerName" DataNavigateUrlFormatString="~/Consumer/Details.aspx?ConsumerID={0}" DataNavigateUrlFields="SubscribedByConsumerID" />
            <asp:HyperLinkField HeaderText="Skjema" DataTextField="eDocumentTemplateName" DataNavigateUrlFormatString="~/eDocumentTemplate/Details.aspx?eDocumentTemplateID={0}" DataNavigateUrlFields="eDocumentTemplateID" />
            <asp:BoundField Visible="False" HeaderText="Form ID" DataField="eDocumentTemplateShortName" />
            <asp:BoundField HeaderText="Form ID" DataField="FormID" />
        </Columns>
    </asp:GridView>--%>

    <h2 
        runat="server" 
        class="skjema-admin__section-title"
        id="headerSystems">
        Systemer
    </h2>

    <asp:GridView 
        HeaderStyle-CssClass="HeaderStyle" 
        CssClass="skjema-admin__table mb-5"
        Border="0"
        runat="server" 
        ID="gridSystem" 
        AutoGenerateColumns="False">
        <Columns>
            <asp:HyperLinkField HeaderText="System" DataTextField="Name" DataNavigateUrlFields="DestinationSystemID" DataNavigateUrlFormatString="~/DestinationSystem/Edit.aspx?DestinationSystemID={0}" />
            <asp:BoundField HeaderText="Beskrivelse" DataField="Description" />
        </Columns>
    </asp:GridView>

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