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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <div id="divTopp">
        <h1 class="skjema-admin__page-title">Rediger skjema
        </h1>

        <div class="skjema-admin__mb-40">
            <asp:Button
                ID="Button1"
                runat="server"
                CssClass="skjema-admin__button skjema-admin__button--reverse"
                Text="Lagre endringer"
                OnClick="btnUpdate_Click"></asp:Button>
        </div>

        <asp:Panel runat="server" ID="pnlDeleted">
            <div style="background-color: red; font-size: medium; height: 20px; vertical-align: auto">
                Dette skjemaet er slettet. 
            <a href="Restore.aspx?eDocumentTemplateID=<%= Request.QueryString["eDocumentTemplateID"] %>&return=Edit.aspx?eDocumentTemplateID=<%= Request.QueryString["eDocumentTemplateID"] %>">Trykk her for å gjenopprette.</a>
            </div>
        </asp:Panel>
    </div>

    <div id="skjemadetaljer">
        <h2 class="skjema-admin__underline-title">Skjemadetaljer
        </h2>

        <div class="skjema-admin__fixed-grid__row mb-3">
            <div class="skjema-admin__fixed-grid__col-140">
                <asp:Label ID="Label1" CssClass="skjema-admin__page__label" runat="server">Tittel *</asp:Label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:TextBox CssClass="skjema-admin__page__text" ID="txtName" runat="server">
                </asp:TextBox>
                <asp:RequiredFieldValidator
                    ID="RequiredFieldValidator1"
                    ForeColor="Red"
                    Display="Dynamic"
                    runat="server"
                    ErrorMessage="Du må angi et navn."
                    ControlToValidate="txtName">
                </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator
                    EnableClientScript="True"
                    ID="RegularExpressionValidator2"
                    runat="server"
                    ControlToValidate="txtName"
                    ForeColor="Red"
                    Display="Dynamic"
                    ErrorMessage="Tittel kan bestå av bokstaver, tall, parentes, bindestrek, punktum, komma og mellomrom."
                    ValidationExpression="^[a-zA-Z0-9æøåÆØÅ., \/()\-é–]*$">
                </asp:RegularExpressionValidator>
            </div>
        </div>

        <div class="skjema-admin__fixed-grid__row mb-3">
            <div class="skjema-admin__fixed-grid__col-140">
                <asp:Label ID="Label11" CssClass="skjema-admin__page__label" runat="server">ID *</asp:Label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:TextBox
                    ID="txtFormID"
                    CssClass="skjema-admin__page__text"
                    runat="server">
                </asp:TextBox>

                <asp:RequiredFieldValidator
                    ID="RequiredFieldValidator3"
                    runat="server"
                    ErrorMessage="Du må angi FormID."
                    ControlToValidate="txtFormID"
                    ForeColor="Red"
                    Display="Dynamic">
                </asp:RequiredFieldValidator>

                <asp:RegularExpressionValidator
                    EnableClientScript="True"
                    ID="RegularExpressionValidator1"
                    runat="server"
                    ControlToValidate="txtFormID"
                    ForeColor="Red"
                    Display="Dynamic"
                    ErrorMessage="ID kan bestå av a-z, 0-9 og tegnene _-"
                    ValidationExpression="^[a-zA-Z0-9_-]*$">
                </asp:RegularExpressionValidator>
            </div>
        </div>

        <div class="skjema-admin__fixed-grid__row mb-3">
            <div class="skjema-admin__fixed-grid__col-140">
                <asp:Label
                    ID="Label9"
                    CssClass="skjema-admin__page__label"
                    runat="server">
                Kategori *
                </asp:Label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:DropDownList
                    ID="ddlTemplateCategory"
                    runat="server"
                    CssClass="skjema-admin__page__text"
                    DataTextField="Name"
                    DataValueField="Id">
                </asp:DropDownList>

                <asp:HyperLink
                    ID="Hyperlink5"
                    runat="server"
                    NavigateUrl=""
                    Target="_blank"
                    Visible="False">
                Help
                </asp:HyperLink>

                <asp:RequiredFieldValidator
                    ID="RequiredFieldValidator2"
                    runat="server"
                    ForeColor="Red"
                    Display="Dynamic"
                    ControlToValidate="ddlTemplateCategory"
                    ErrorMessage="Du må velge en kategori.">
                </asp:RequiredFieldValidator>
            </div>
        </div>

        <div class="skjema-admin__fixed-grid__row mb-3">
            <div class="skjema-admin__fixed-grid__col-140">
                <label class="skjema-admin__page__label">
                    Sikkerhetsnivå
                </label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:DropDownList
                    AutoPostBack="True"
                    OnSelectedIndexChanged="ddlSecurityLevel_OnSelectedIndexChanged"
                    runat="server"
                    CssClass="skjema-admin__page__text"
                    ID="ddlSecurityLevel">
                    <asp:ListItem Selected="True" Value="---">Nei, krever ikke pålogging</asp:ListItem>
                    <asp:ListItem Value="1">Brukernavn og passord (nivå 1) - Feide eller Azure AD</asp:ListItem>
                    <%--<asp:ListItem Value="2"></asp:ListItem>--%>
                    <asp:ListItem Value="3">Mellomhøyt sikkerhetsnivå (nivå 3) - MinId</asp:ListItem>
                    <asp:ListItem Value="4">Høyeste sikkerhetsnivå (nivå 4) - BankID/Buypass</asp:ListItem>
                </asp:DropDownList>
            </div>
        </div>

        <div class="skjema-admin__fixed-grid__row mb-3" runat="server" Visible="False" id="divAvailableIdentityProviders">
            <div class="skjema-admin__fixed-grid__col-140">
                <label class="skjema-admin__page__label">
                    Tilgjengelige påloggingstilbydere&nbsp;&nbsp;
                </label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:CheckBoxList ID="cbIdentityProviders" CssClass="skjema-admin__page__tick" runat="server">
                    <asp:ListItem Value="IdPorten">ID-porten autentisering</asp:ListItem>
                    <asp:ListItem Value="Feide">Feide autentisering</asp:ListItem>
                    <asp:ListItem Value="AzureAD">Azure AD</asp:ListItem>
                </asp:CheckBoxList>
            </div>
        </div>

        <div class="skjema-admin__fixed-grid__row mb-5">
            <div class="skjema-admin__fixed-grid__col-140">
                <asp:Label ID="Label10" CssClass="skjema-admin__page__label" runat="server">
                Status
                </asp:Label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <%--<asp:RadioButtonList id="radioStatus" runat="server" CssClass="skjema-admin__form__radio" />--%>

                <div id="radioStatus">
                    <label class="skjema-admin__mr-40">
                        <asp:RadioButton ID="radioActiveForm" runat="server" GroupName="groupStatus" />
                        Aktiver
                    </label>

                    <label class="skjema-admin__mr-40">
                        <asp:RadioButton ID="radioDeactivateForm" runat="server" GroupName="groupStatus" />
                        Deaktiver
                    </label>

                    <label class="skjema-admin__mr-40">
                        <asp:RadioButton ID="radioSetTimeForm" runat="server" GroupName="groupStatus" />
                        Tidsbestemt
                    </label>
                </div>
            </div>
        </div>

        <asp:Panel ID="pnlTimed" runat="server" CssClass="mb-5">
            <div class="skjema-admin__fixed-grid__row mb-3">

                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label ID="Label3" CssClass="skjema-admin__page__label" runat="server">
                    Fra dato
                    </asp:Label>
                </div>

                <div class="skjema-admin__fixed-grid__col-180">
                    <asp:TextBox CssClass="skjema-admin__page__text datepick" ID="txtFromDate" runat="server"></asp:TextBox>
                    <asp:CompareValidator
                        ID="CompareValidator1"
                        runat="server"
                        ControlToValidate="txtFromDate"
                        ErrorMessage="Feil datoformat, riktig format er dd.mm.åååå"
                        Operator="DataTypeCheck"
                        ForeColor="Red"
                        Display="Dynamic"
                        Type="Date">
                    </asp:CompareValidator>
                </div>
            </div>

            <div class="skjema-admin__fixed-grid__row mb-3">
                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label ID="Label4" CssClass="skjema-admin__page__label" runat="server">
                    Til dato
                    </asp:Label>
                </div>

                <div class="skjema-admin__fixed-grid__col-180">
                    <asp:TextBox ID="txtToDate" CssClass="skjema-admin__page__text datepick" runat="server"></asp:TextBox>
                    <asp:CompareValidator
                        ID="CompareValidator2"
                        runat="server"
                        ControlToValidate="txtToDate"
                        ErrorMessage="Feil datoformat, riktig format er dd.mm.åååå"
                        Operator="DataTypeCheck"
                        ForeColor="Red"
                        Display="Dynamic"
                        Type="Date">
                    </asp:CompareValidator>
                </div>
            </div>
        </asp:Panel>
    </div>

    <div id="divForsendelse">
        <h2 class="skjema-admin__underline-title">
            <asp:Label Text="Forsendelse" runat="server"></asp:Label>
        </h2>

        <div class="skjema-admin__process-panel mb-2">
            <asp:Label CssClass="skjema-admin__process-panel__title" Text="System" runat="server" />
            <div class="mb-4">
                <asp:Label Text="Type" runat="server" />
                <asp:DropDownList runat="server" id="ddlSystems" AutoPostBack="True" OnSelectedIndexChanged="ddlSystems_OnSelectedIndexChanged"/>
            </div>
            
            <div id="divChooseSystemXsl" runat="server" Visible="False">
                <div class="mb-4">
                    <asp:Label Text="XSL" runat="server" />
                    <asp:DropDownList runat="server" id="ddlCustomXsl" AutoPostBack="True" OnSelectedIndexChanged="ddlCustomXsl_OnSelectedIndexChanged"/>
                </div>
            </div>

            <asp:LinkButton ID="btnAddDestinationSystemParams" runat="server" Text="Legg til parametere" CssClass="mr-2"
                            CommandArgument='<%# Eval("DestinationSystemId") + "," + Eval("ProcessID") %>'
                            OnClick="btnAddDestinationSystemParams_Click">
            </asp:LinkButton>
        </div>

        <div class="skjema-admin__process-panel mb-2">
            <asp:Label CssClass="skjema-admin__process-panel__title" Text="E-postkvittering" runat="server" />
            <div class="mb-4">
                <asp:Label Text="Type" runat="server" />
                <asp:DropDownList runat="server" id="ddlMail"/>
            </div>
        </div>


        <asp:Repeater ID="repeaterProcessesOnSubscription" runat="server" OnItemDataBound="repeaterProcessesOnSubscription_OnItemDataBound">
            <ItemTemplate>
                <div class="skjema-admin__process-panel mb-2">
                    <asp:Label CssClass="skjema-admin__process-panel__title" Text="Prosess" runat="server" />

                    <div class="mb-4">
                        <asp:Label Text="Velg prosess" runat="server"/>
                        <asp:DropDownList runat="server" DataValueField="Id" DataTextField="Name" id="ddlProcesses" AutoPostBack="True" OnSelectedIndexChanged="ddlProcesses_OnSelectedIndexChanged" />
                    </div>

                    <asp:HiddenField runat="server" Value='<%# Eval("Id") %>' id="hiddenProcessOnSubscrptionId" />

                    <div class="d-flex align-items-center">
                        <span class="skjema-admin__icon__plus mr-2"></span>
                        <asp:LinkButton
                            Visible="False"
                            ID="btnAddSubscriptionParams"
                            runat="server"
                            Text="Legg til parametere"
                            CssClass="mr-5"
                            CommandArgument='<%# Eval("Id") %>'
                            OnClick="btnAddSubscriptionParams_Click">
                        </asp:LinkButton>

                        <asp:LinkButton
                            ID="LinkDeleteProcessOnSubscription"
                            runat="server"
                            CommandArgument='<%# Eval("Id") %>'
                            OnClick="LinkDeleteProcessOnSubscription_OnClick">
                        Fjern
                        </asp:LinkButton>
                    </div>
                </div>
            </ItemTemplate>

            <FooterTemplate>
                <div class="mb-5">
                    <div class="d-flex align-items-center">
                        <span class="skjema-admin__icon__plus mr-2"></span>
                        <asp:LinkButton
                            ID="btnAttachProcess"
                            runat="server"
                            Text="Legg til prosess"
                            OnClick="btnAttachProcess_Click">
                        </asp:LinkButton>
                    </div>
                </div>
            </FooterTemplate>
        </asp:Repeater>
    </div>

    <div id="divOther">
        <div class="mb-4">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label ID="Label8" CssClass="skjema-admin__page__label" runat="server">Arbeidsflyt</asp:Label>
                </div>
                <div class="skjema-admin__fixed-grid__col">
                    <asp:DropDownList ID="ddlWorkflow" CssClass="skjema-admin__page__text" runat="server" />
                </div>
            </div>
        </div>

        <div class="mb-4" id="divBox" runat="server">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label
                        ID="Label6"
                        CssClass="skjema-admin__page__label"
                        runat="server">Mottak
                    <asp:Label ID="lblBoxAsterisk" runat="server">*</asp:Label>
                    </asp:Label>
                </div>
                <div class="skjema-admin__fixed-grid__col">
                    <asp:DropDownList
                        ID="ddlBox"
                        CssClass="skjema-admin__page__text"
                        runat="server">
                    </asp:DropDownList>
                </div>
            </div>
            <asp:RequiredFieldValidator ForeColor="Red" ID="requiredBox" runat="server" ControlToValidate="ddlBox" ErrorMessage="Du må velge et mottak."></asp:RequiredFieldValidator>
        </div>

        <%--<asp:Panel runat="server" ID="pnlXsl" class="mb-4">
        <div class="skjema-admin__fixed-grid__row">
            <div class="skjema-admin__fixed-grid__col-140">
                <asp:Label 
                    ID="Label7"
                    CssClass="skjema-admin__page__label"
                    runat="server">
                    XSL
                </asp:Label>
            </div>

            <div class="skjema-admin__fixed-grid__col">
                <asp:DropDownList
                    ID="ddlXsl"
                    CssClass="skjema-admin__page__text"
                    runat="server">
                </asp:DropDownList>
            </div>

            <asp:LinkButton
                ID="btnXslParams"
                runat="server"
                Text="Parametere"
                CssClass=""
                OnClick="btnXslParams_Click">
            </asp:LinkButton>
        </div>
    </asp:Panel>--%>

<%--        <div class="mb-4">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <label class="skjema-admin__page__label">
                        Kvitteringsepost
                    </label>
                </div>

                <div class="skjema-admin__fixed-grid__col">
                    <asp:DropDownList
                        ID="ddlMail"
                        CssClass="skjema-admin__page__text"
                        runat="server">
                    </asp:DropDownList>
                </div>
            </div>
        </div>--%>

        <asp:Panel ID="pnlInstanceName" class="mb-4" runat="server">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label
                        ID="Label15"
                        CssClass="skjema-admin__page__label"
                        runat="server">
                    Instansnavn
                    </asp:Label>
                </div>

                <div class="skjema-admin__fixed-grid__col">
                    <asp:TextBox
                        ID="txtInstanceName"
                        CssClass="skjema-admin__page__text mb-2"
                        runat="server">
                    </asp:TextBox>

                    <div>
                        Dersom de lagrede/innsendte instansene skal få et suffix som inneholder verdier fra skjemaet angir du malen for dette suffixet her. 
                    Feltnavn pakkes inn i krøllparenteser. Eksempel: "- {STILLINGSTITTEL}". 
                    </div>
                </div>
            </div>
        </asp:Panel>

        <div class="mb-4" id="divVisibility" runat="server">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <label class="skjema-admin__page__label">
                        Delt skjema
                    </label>
                </div>
                <div class="skjema-admin__fixed-grid__col">
                    <asp:DropDownList
                        ID="ddlVisibility"
                        runat="server"
                        CssClass="skjema-admin__page__text"
                        DataTextField="Name"
                        DataValueField="eDocumentTemplateCategoryID">
                        <asp:ListItem Value="2">Ja</asp:ListItem>
                        <asp:ListItem Value="0" Selected="True">Nei</asp:ListItem>
                        <%--<asp:ListItem Value="1">Synlig for tilknyttede organisasjoner</asp:ListItem>--%>
                    </asp:DropDownList>
                </div>
            </div>
        </div>

        <div class="skjema-admin__mb-80" runat="server" id="divXft">
            <div class="skjema-admin__fixed-grid__row">
                <div class="skjema-admin__fixed-grid__col-140">
                    <asp:Label
                        ID="lblDokumentbankenBlankett"
                        CssClass="skjema-admin__page__label"
                        runat="server">
                    PDF/XFT
                    </asp:Label>
                </div>

                <div class="skjema-admin__fixed-grid__col">
                    <asp:DropDownList
                        ID="ddlDokumentbankenBlankett"
                        CssClass="skjema-admin__page__text"
                        runat="server"
                        DataTextField="Name"
                        DataValueField="Id">
                    </asp:DropDownList>
                </div>
            </div>

            <asp:HyperLink
                ID="HyperLink7"
                runat="server"
                Target="_blank"
                Visible="False">
            Help
            </asp:HyperLink>
        </div>
    </div>

    <div id="divTabs">
        <div class="skjema-admin__tabs">
            <button class="skjema-admin__tabs__tab skjema-admin__tabs__tab--active skjema-admin__mr-40" type="button" data-jscomponent="tabToggle" data-tab-id="1">
                Versjoner
            </button>

            <button class="skjema-admin__tabs__tab skjema-admin__mr-40" type="button" data-jscomponent="tabToggle" data-tab-id="2">
                Avansert
            </button>

            <button class="skjema-admin__tabs__tab" type="button" data-jscomponent="tabToggle" data-tab-id="3">
                Kommentar
            </button>
        </div>

        <div class="mb-5">
            <div data-jscomponent="tabPanel" data-tab-id="1">
                <asp:Panel runat="server" ID="pnlVersions" Visible="False">
                    <asp:Panel ID="pnlUpdateSavedToCurrentVersion" class="mb-4" runat="server">
                        <label class="d-flex align-items-start">
                            <asp:CheckBox
                                ID="chkUpdateSavedToCurrentVersion"
                                CssClass="mr-2"
                                runat="server"
                                Checked="False"></asp:CheckBox>

                            <span>
                                <asp:Label
                                    CssClass="skjema-admin__bold"
                                    ID="Label5"
                                    runat="server">
                                Oppdater lagrede søknader til gjeldende versjon
                                </asp:Label>

                                <span class="d-block">Kryss av her dersom lagrede søknader skal benytte gjeldende skjemaversjon. 
                                Hvis ikke benyttes den versjonen søknaden opprinnelig hadde.
                                </span>
                            </span>
                        </label>
                    </asp:Panel>

                    <div class="mb-5">
                        <asp:DataGrid
                            ID="dgVersions"
                            Border="0"
                            CssClass="skjema-admin__table"
                            runat="server"
                            AutoGenerateColumns="False"
                            HeaderStyle-CssClass="skjema-admin__table__header"
                            ItemStyle-CssClass="ItemStyle"
                            AlternatingItemStyle-CssClass="AlternatingItemStyle"
                            Width="100%">

                            <AlternatingItemStyle CssClass="AlternatingItemStyle"></AlternatingItemStyle>
                            <ItemStyle CssClass="skjema-admin__table__important-row"></ItemStyle>
                            <HeaderStyle CssClass="skjema-admin__table__table-header"></HeaderStyle>

                            <Columns>
                                <asp:BoundColumn Visible="False" DataField="Id"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Version" SortExpression="Version ASC" HeaderText="Versjon"></asp:BoundColumn>
                                <asp:BoundColumn DataField="CreatedOn" SortExpression="CreatedOn ASC" HeaderText="Opprettet"></asp:BoundColumn>
                                <asp:BoundColumn DataField="PublishDate" DataFormatString="{0:d}" HeaderText="Publiseringsdato"></asp:BoundColumn>
                                <asp:BoundColumn DataField="Comment" HeaderText="Kommentar"></asp:BoundColumn>
                                <asp:ButtonColumn Text="Detaljer" CommandName="Details"></asp:ButtonColumn>
                                <asp:ButtonColumn Text="Rediger" CommandName="Edit"></asp:ButtonColumn>
                                <asp:ButtonColumn Text="Sett som gjeldende" CommandName="SetAsCurrent"></asp:ButtonColumn>
                                <asp:ButtonColumn Text="Slett" CommandName="Delete" Visible="false"></asp:ButtonColumn>
                            </Columns>

                        </asp:DataGrid>

                        <div class="mb-4">
                            <asp:Label ID="lblNoVersionsMessage" runat="server">Ingen versjoner.</asp:Label>
                        </div>

                        <asp:LinkButton
                            ID="btnCreateVersion"
                            runat="server"
                            Text="Opprett versjon"
                            CssClass=""
                            OnClick="btnCreateVersion_Click"></asp:LinkButton>


                        <div runat="server" id="divConvertFeature" Visible="False">
                            <br/>
                            <br/>

                            <asp:LinkButton
                                ID="lnkConvertToWebDesigner"
                                runat="server"
                                Text="Oppdater til web-designer"
                                CssClass=""
                                Visible = "False"
                                OnClick="btnConvertToWebDesigner_Click"></asp:LinkButton>
                        </div>

                        <asp:BulletedList runat="server" ID="errorList" Visible="False" ForeColor="Red">
                        </asp:BulletedList>
                    </div>
                </asp:Panel>
            </div>

            <div class="d-none" data-jscomponent="tabPanel" data-tab-id="2">
                <asp:Panel runat="server" ID="pnlAdvanced" Visible="True">
                    <asp:Panel ID="pnlFriendlyPDFResponse" class="mb-4" runat="server" Visible="False">
                        <label class="d-flex">
                            <asp:CheckBox
                                ID="cbFriendlyPDFResponse"
                                runat="server"
                                CssClass="mr-2"
                                Checked="True"></asp:CheckBox>

                            <asp:Label
                                ID="Label12"
                                runat="server">
                            Autogenerert PDF-respons
                            </asp:Label>
                        </label>
                    </asp:Panel>

                    <asp:Panel ID="pnlFriendlyPDFPrint" class="skjema-admin__mb-40" runat="server" Visible="False">
                        <label class="d-flex">
                            <asp:CheckBox
                                ID="cbFriendlyPDFPrint"
                                CssClass="mr-2"
                                runat="server"
                                Checked="True"></asp:CheckBox>

                            <asp:Label
                                ID="Label13"
                                runat="server">
                            Autogenerert PDF-utskrift
                            </asp:Label>
                        </label>
                    </asp:Panel>

                    <div class="mb-4">
                        <label class="skjema-admin__page__label">
                            Retur-URL: Send inn 
                        </label>

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

                    <div class="mb-4">
                        <label class="skjema-admin__page__label">
                            Retur-URL: Lagre
                        </label>

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

                    <div class="mb-4">
                        <label class="skjema-admin__page__label">
                            Retur-URL: Avbryt
                        </label>
                        <asp:TextBox
                            ID="txtReturnUrlAbort"
                            CssClass="skjema-admin__page__text"
                            runat="server"></asp:TextBox>
                    </div>
                    
                    <div class="mb-4">
                        <asp:Label ID="lblPrintPdf" Text='Last ned pdf' class="skjema-admin__page__label" runat="server"></asp:Label>
                        <asp:Panel ID="panelPrintPdf" runat="server" />
                    </div>
                </asp:Panel>
            </div>

            <div class="d-none" data-jscomponent="tabPanel" data-tab-id="3">
                <asp:Label
                    ID="Label2"
                    class="skjema-admin__page__label"
                    runat="server">
                Kommentar
                </asp:Label>

                <asp:TextBox
                    ID="txtComment"
                    runat="server"
                    CssClass="skjema-admin__page__text"
                    TextMode="MultiLine"
                    Height="160px">
                </asp:TextBox>
            </div>
        </div>
    </div>

    <div id="divBottom">
        <hr class="skjema-admin__hr" />
        
        <asp:Label ID="lblMessage" runat="server" ForeColor="Red"/>

        <div class="mb-4">
            <asp:Button
                ID="btnUpdate1"
                runat="server"
                CssClass="skjema-admin__button skjema-admin__button--reverse"
                Text="Lagre endringer"
                OnClick="btnUpdate_Click"></asp:Button>
        </div>

        <script type="text/javascript">
            $(document).ready(function () {
                $(function () {
                    $('.datepick').each(function () {
                        $(this).datepicker({
                            dateFormat: 'dd.mm.yy',
                            firstDay: 1
                        });
                    });
                });

                var togglePanelTimed = function (selectedValue) {
                    var panelTimed = $("[id*='pnlTimed']");

                    if (selectedValue === 'radioSetTimeForm') {
                        panelTimed.show();
                    } else {
                        panelTimed.hide();
                    }
                }

                var currentSelectedValue = Array.prototype.slice.call(document.querySelectorAll("#radioStatus input[type='radio']"))
                    .filter(function (elm) {
                        return elm.getAttribute("checked");
                    })[0].value;

                togglePanelTimed(currentSelectedValue);

                $("[id*=radioStatus] input").on("click", function () {
                    var selectedValue = $(this).val();
                    togglePanelTimed(selectedValue);
                });
            });
        </script>
    </div>
</asp:Content>
