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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <h1 class="skjema-admin__page-title">Opprett skjema</h1>
    <h3>Trinn 1/6 - opplasting</h3>
    <br/>
    <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>
    
    <div>
        Velkommen til veiviseren for opprettelse av skjema. Alle valg du gjør i veiviseren kan endres på et senere tidspunkt.
    </div>
    <div class="mb-4">
        <br/>
        <div runat="server" id="divUpload">
            <asp:Label ID="Label11" CssClass="skjema-admin__page__label"  runat="server">
                1. Velg en .edoc-fil *
            </asp:Label>
            <input type="file" runat="server" id="fleDocumentBinary" name="fleDocumentBinary" />
            <br/>
            <asp:RequiredFieldValidator ForeColor="Red" ID="Requiredfieldvalidator3" runat="server" ErrorMessage="Du må angi filbanen for skjemaet (.edoc) som skal lastes opp." ControlToValidate="fleDocumentBinary" />
            <br/>
            <br/>
            <asp:Label ID="Label1" CssClass="skjema-admin__page__label"  runat="server">
                2. Klikk her for å laste opp filen
            </asp:Label>
            <asp:Button runat="server" id="btnUpload" text="Last opp" onclick="btnUpload_OnClick" CausesValidation="False"/><br/>
            <asp:Label runat="server" ForeColor="Red" id="lblFileUploadErrorMessage" Text=""></asp:Label>
        </div>
        

        <div runat="server" id="divUploaded" Visible="False">
            Fil lastet opp: <asp:Label runat="server" id="lblUploadedFile"></asp:Label><br/>
            <asp:Button runat="server" id="btnRemove" text="Fjern filen" onclick="btnRemove_OnClick" CausesValidation="False"/>
        </div>
        
    </div>
    
    <div id="divNameAndId" runat="server" Visible="False">
        <div class="mb-4">
            <asp:Label ID="Label7" CssClass="skjema-admin__page__label" runat="server">
                Navn *
            </asp:Label>
            <asp:TextBox ID="txtName" CssClass="skjema-admin__page__text" runat="server"/>
            <asp:RequiredFieldValidator ForeColor="Red" EnableClientScript="False" ID="requireName" runat="server" ErrorMessage="Du må angi et navn." ControlToValidate="txtName" />
           
        </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" CausesValidation="True" AutoPostBack="True" OnTextChanged="txtFormID_OnTextChanged" />
            <asp:Label runat="server" id="lblFormIdError" ForeColor="Red" />
            <asp:RequiredFieldValidator ForeColor="Red" EnableClientScript="False" ID="requireFormId" runat="server" ErrorMessage="Du må angi FormID."  Display="Dynamic" ControlToValidate="txtFormID" />
            <asp:RegularExpressionValidator
                ID="requireValidFormId"
                ForeColor="Red"
                runat="server"
                EnableClientScript="False"
                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="Label9" 
                CssClass="skjema-admin__page__label"  
                runat="server">
                Hvilken kategori skal skjemaet publiseres i? *
            </asp:Label>
            <asp:DropDownList 
                ID="ddlTemplateCategory" 
                AutoPostBack="True"
                CssClass="skjema-admin__page__text" 
                runat="server" 
                DataTextField="Name" 
                OnSelectedIndexChanged="ddlTemplateCategory_OnSelectedIndexChanged"
                DataValueField="Id">
            </asp:DropDownList>
            <asp:RequiredFieldValidator EnableClientScript="True" ForeColor="Red" ID="RequiredFieldValidator2" runat="server" ControlToValidate="ddlTemplateCategory" InitialValue="---" ErrorMessage="Du må velge en kategori."/>
        </div>
    
        <div runat="server" id="divCreateCategory" Visible="False">
            <div class="mb-4">
                <asp:Label ID="Label2" CssClass="skjema-admin__page__label" runat="server">
                    Kategorinavn *
                </asp:Label>
                <asp:TextBox ID="txtCategoryName" CssClass="skjema-admin__page__text" runat="server" AutoPostBack="True" CausesValidation="False" OnTextChanged="txtCategoryName_OnTextChanged"/>
                <asp:Label runat="server" id="lblCategoryErrorMessage" ForeColor="Red" Text=""></asp:Label>
                <asp:RequiredFieldValidator EnableClientScript="True" ForeColor="Red" ID="requireCatgoryName" runat="server" ErrorMessage="Du må angi et navn." ControlToValidate="txtCategoryName" />
            </div>
        </div>
    </div>
    
    <div runat="server" id="divButtons" Visible="True">
        <div class="mb-5">
            <asp:Button 
                ID="btnNext" 
                CssClass="skjema-admin__button skjema-admin__button--primary mt-3 mb-5"
                runat="server" 
                Text="Neste" 
                Enabled="True"
                CausesValidation="True"
                OnClick="MoveNext">
            </asp:Button>
        </div>
    </div>

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