<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Edit.aspx.cs" Inherits="eDocument.Server.Administrator.DestinationSystem.Edit"  MasterPageFile="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="skjema-admin__page-pre-title">
        Forsendelse
    </div>
    
    <h1 class="skjema-admin__page-title mt-0">
        System <asp:Label ID="lblSystemName" runat="server"/>
    </h1>

    <h2 class="skjema-admin__underline-title d-flex justify-content-between align-items-end">
        Detaljer
    </h2>

    <div class="skjema-admin__page__field">

        <label class="skjema-admin__page__label skjema-admin__page__label--small">
            System-navn *
        </label>

        <asp:TextBox 
            ID="txtName" 
            CssClass="skjema-admin__page__text"
            runat="server">
        </asp:TextBox>

        <asp:RequiredFieldValidator 
            ForeColor="Red" 
            ID="RequiredFieldValidator1" 
            runat="server" 
            ErrorMessage="*" 
            Display="Dynamic"
            ControlToValidate="txtName">
        </asp:RequiredFieldValidator>
    </div>
    
    <label class="d-flex align-items-start">
        <asp:CheckBox
            ID="chkIsGlobal"
            CssClass="mr-2"
            runat="server"
            Checked="False" />

        <span>
            <asp:Label
                CssClass="skjema-admin__bold"
                ID="Label5"
                runat="server">
                Tilgjengelig fra siden "Innstillinger og opsjoner"
            </asp:Label>

            <span class="d-block">Kryss av her dersom kunden skal kunne velge dette systemet fra siden "Innstillinger og opsjoner".
            </span>
        </span>
    </label>
    
    <br/>

    <div class="mb-4">
        <asp:Button
            ID="btnUpdate"
            runat="server"
            CssClass="skjema-admin__button skjema-admin__button--reverse"
            Text="Lagre detaljer"
            OnClick="btnUpdate_Click"></asp:Button>
    </div>
    
    <br/>
        <div>
            <h2 class="skjema-admin__underline-title d-flex justify-content-between align-items-end">
                Prosesser
            </h2>
            <asp:DropDownList ID="ddlProcess" runat="server" CssClass="skjema-admin__page__text"></asp:DropDownList>
            <br/>
            <asp:Button ID="btnAddProcess" runat="server" Text="Legg til" OnClick="btnAddProcess_Click" CssClass="skjema-admin__button skjema-admin__button--reverse" />
            <br/>
            <%--<a href="../Process/Create.aspx">Opprett</a>--%>
            <br />
            <asp:GridView ID="gridProcess" runat="server" AutoGenerateColumns="false" DataKeyNames="Id" OnRowDeleting="gridProcess_RowDeleting" Border="0" Width="50%" CssClass="skjema-admin__table skjema-admin__table--min-width-2">
                <Columns>
                    <asp:HyperLinkField DataTextField="Name" HeaderText="Navn" DataNavigateUrlFields="Id"
                        DataNavigateUrlFormatString="../Process/Details.aspx?ProcessID={0}" />
                    <asp:BoundField DataField="Id" Visible="false" />
                    <%--<asp:BoundField DataField="Comment" HeaderText="Kommentar" />--%>
                    <asp:TemplateField HeaderText="Fjern">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkDelete" CommandArgument='<%# Eval("Id") %>' CommandName="Delete"
                                runat="server">Fjern</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <br/>
            <br/>
            <h2 class="skjema-admin__underline-title d-flex justify-content-between align-items-end">
                XSL filer
            </h2>
            <asp:DropDownList ID="ddlXsl" runat="server" CssClass="skjema-admin__page__text"></asp:DropDownList>
            <br/>
            <asp:Button ID="btnAddXsl" runat="server" Text="Legg til" OnClick="btnAddXsl_Click" CssClass="skjema-admin__button skjema-admin__button--reverse" />
            <br/>
            <br/>
            <%--<a href='../Xsl/Create.aspx?Return=~/DestinationSystem/Edit.aspx?DestinationSystemID=<%= Request.QueryString["DestinationSystemID"] %>'>Opprett</a>--%>
            <asp:GridView ID="gridXsl" runat="server" AutoGenerateColumns="false" DataKeyNames="Id" OnRowDeleting="gridXsl_RowDeleting" Border="0" Width="50%" CssClass="skjema-admin__table skjema-admin__table--min-width-2" >
                <Columns>
                    <asp:HyperLinkField DataTextField="Name" HeaderText="Navn" DataNavigateUrlFields="Id"
                        DataNavigateUrlFormatString="../Xsl/Details.aspx?XslID={0}" />
                    <asp:BoundField DataField="Id" Visible="false" />
                    <%--<asp:BoundField DataField="Comment" HeaderText="Kommentar" />--%>
                    <asp:TemplateField HeaderText="Fjern">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkDelete" CommandArgument='<%# Eval("Id") %>' CommandName="Delete"
                                runat="server">Fjern</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
</asp:Content>