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

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

    <p class="mb-5">
        Fra denne siden kan du opprette et skjema. De obligatoriske feltene er 
        merket med *.
    </p>

    <div id="divMaxTemplateCountReached" runat="server" Visible="False" style="color:red">
        <asp:Label runat="server" id="lblMaxTemplatesReached">Du har nådd maksimalt antall skjema for denne lisensen:</asp:Label> 
        <asp:Label runat="server" ID="lblMaxTemplateCount" />&nbsp;<asp:HyperLink runat="server" NavigateUrl="~/Consumer/RequestNewLicense.aspx?focus=quota-forms">Gå hit for å be om endringer i lisensen.</asp:HyperLink>
        <br/>
    </div>
<br/>

    <div class="skjema-admin__page">
        <div class="mb-4">
            <asp:Label 
                ID="Label7" 
                CssClass="skjema-admin__page__label" 
                runat="server">
                Tittel *
            </asp:Label>

            <asp:TextBox 
                ID="txtName" 
                CssClass="skjema-admin__page__text" 
                runat="server">
            </asp:TextBox>
            
            <asp:RegularExpressionValidator
                EnableClientScript="True"
                ID="RegularExpressionValidator1"
                runat="server"
                ControlToValidate="txtName"
                ForeColor="Red"
                Display="Dynamic"
                ErrorMessage="Tittel kan bestå av bokstaver, tall, parentes, bindestrek, punktum og mellomrom."
                ValidationExpression="^[a-zA-Z0-9æøåÆØÅ. \/()\-]*$">
            </asp:RegularExpressionValidator>

            <asp:RequiredFieldValidator
                ForeColor="Red"
                ID="RequiredFieldValidator6"
                runat="server"
                ErrorMessage="Du må angi et navn."
                ControlToValidate="txtName">
            </asp:RequiredFieldValidator>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label12"
                CssClass="skjema-admin__page__label" 
                runat="server">
                FormID *
            </asp:Label>

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

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

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

        <div class="mb-4">   
		    <asp:Label id="Label8" runat="server">Aktiv</asp:Label>
		    <asp:CheckBox id="checkActive" runat="server" Checked="True"></asp:CheckBox>
		    Kryss av dersom skjemaet umiddelbart skal være tilgjengelig for publikum.
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label11" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Skjemafil *
            </asp:Label>

            <input 
                type="file" 
                runat="server" 
                id="fleDocumentBinary" 
                name="fleDocumentBinary" />

            <asp:RequiredFieldValidator 
                ForeColor="Red" 
                ID="Requiredfieldvalidator3" 
                runat="server" 
                ErrorMessage="Du må angi filbanen for skjemaet (.edoc) som skal lastes opp."
                ControlToValidate="fleDocumentBinary">
            </asp:RequiredFieldValidator>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label9" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Kategori *
            </asp:Label>

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

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

        <div class="mb-4" id="divBox" runat="server">
            <asp:Label 
                ID="Label5" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Mottak <asp:Label ID="lblBoxAsterisk" runat="server">*</asp:Label>
            </asp:Label>

            <asp:DropDownList 
                ID="ddlBox"
                CssClass="skjema-admin__page__text" 
                runat="server">
            </asp:DropDownList>
            
            <asp:RequiredFieldValidator ForeColor="Red" ID="requiredBox" runat="server" ControlToValidate="ddlBox" ErrorMessage="Du må velge et mottak."></asp:RequiredFieldValidator>
        </div>

<%--        <div class="mb-4">
            <asp:Label 
                ID="Label6" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                XSL
            </asp:Label>

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

<%--        <div class="mb-4">
            <label class="skjema-admin__page__label">
                E-post
            </label>
		    <asp:DropDownList 
                ID="ddlMail" 
                CssClass="skjema-admin__page__text"  
                runat="server">
		    </asp:DropDownList>
        </div>--%>

        <div class="mb-4">
            <label class="skjema-admin__page__label">
                Krav til pålogging
            </label>
            <asp:DropDownList 
                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</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 class="mb-4">
            <asp:Label 
                ID="Label15" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Instansnavn
            </asp:Label>

            <asp:TextBox 
                ID="txtInstanceName"
                CssClass="skjema-admin__page__text" 
                runat="server">
            </asp:TextBox>
            
            <p class="mt-4">
                Dersom de lagrede/innsendte instansene skal få et suffix som inneholder verdier fra skjemaet angir du malen for dette suffixet her. 
                <br />
                Feltnavn pakkes inn i krøllparenteser. <br />
                Eksempel: "- {STILLINGSTITTEL}". 
            </p>
        </div>

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

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

            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtFromDate"
                ErrorMessage="Feil datoformat, riktig format er dd.mm.åååå" Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="Label4" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Til dato
            </asp:Label>

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

            <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtToDate"
                ErrorMessage="Feil datoformat, riktig format er dd.mm.åååå" Operator="DataTypeCheck" Type="Date"></asp:CompareValidator>
        </div>

        <div class="mb-4">
            <label class="skjema-admin__page__label">
                Synlighet
            </label>

		    <asp:DropDownList 
                ID="ddlVisibility"
                CssClass="skjema-admin__page__text" 
                runat="server"  
                DataTextField="Name" 
                DataValueField="eDocumentTemplateCategoryID">
                <asp:ListItem Value="0" Selected="True">Ikke synlig for andre</asp:ListItem>
                <asp:ListItem Value="1">Synlig for tilknyttede organisasjoner</asp:ListItem>
                <asp:ListItem Value="2">Synlig for alle</asp:ListItem>
            </asp:DropDownList>
        </div>

        <div class="mb-4">
            <asp:Label 
                ID="lblDokumentbankenBlankett" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                PDF/XFT
            </asp:Label>

            <asp:DropDownList 
                ID="ddlDokumentbankenBlankett" 
                CssClass="skjema-admin__page__text" 
                runat="server" 
                DataTextField="Name"
                DataValueField="DokumentbankenBlankettID">
            </asp:DropDownList>

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

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

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

        <div class="mb-4">
            <label class="skjema-admin__page__label">
                Retur-URL: Send inn
            </label>
            
		    <asp:TextBox 
                ID="txtReturnUrlSubmit" 
                CssClass="skjema-admin__page__text" 
                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-5">
            <asp:Button 
                ID="btnCreate" 
                CssClass="skjema-admin__button skjema-admin__button--primary mt-3 mb-5"
                runat="server" 
                Text="Opprett" 
                OnClick="btnCreate_Click">
            </asp:Button>
        </div>

        <asp:Label 
            ID="lblMessage" 
            CssClass="skjema-admin__page__label mb-5"  
            runat="server" 
            ForeColor="Red">
        </asp:Label>
    </div>
</asp:Content>
