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

<asp:Content runat="server" ID="Main" ContentPlaceHolderID="MainContent">

    <a class="skjema-admin__page__back skjema-admin__mb-20" href="List.aspx">
        <div class="d-flex align-items-center">
            <div class="skjema-admin__page__back-circle mr-3"></div>
            Forsendelse / Kvitteringsepost
        </div>
    </a>

    <h1 class="skjema-admin__page-title mt-0">
        Opprett ny kvitteringsepost
    </h1>

<%--    <p class="mb-4">
        Fra denne siden kan du opprette/redigere en e-post mal.
    </p>--%>

    <div class="skjema-admin__page__field">
        <label class="skjema-admin__page__label skjema-admin__page__label--small">
            Tittel *
        </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>

    <div class="skjema-admin__page__field">
        <label class="skjema-admin__page__label skjema-admin__page__label--small skjema-admin__mb-20">
            Avsender *
        </label>
        
        <asp:RadioButtonList 
            runat="server" 
            AutoPostBack="True" 
            ID="rblSenderType" 
            CssClass="skjema-admin__form__radio"
            OnSelectedIndexChanged="rblSenderType_OnSelectedIndexChanged">
            <Items>
                <asp:ListItem Value="org" Text="Organisasjonens e-postadresse"></asp:ListItem>
                <asp:ListItem Value="other" Text="Bruk annen e-postadresse"></asp:ListItem>
            </Items>
        </asp:RadioButtonList>

        <asp:RequiredFieldValidator 
            ForeColor="Red" 
            ID="RequiredFieldValidator2" 
            runat="server" 
            Display="Dynamic" 
            ErrorMessage="Du må velge hvilken adresse som skal benyttes som avsender." 
            ControlToValidate="rblSenderType" />

<%--        <asp:CheckBox 
            AutoPostBack="True" 
            CssClass="skjema-admin__page__tick"
            Text="Avsender skal være organisasjonen." 
            runat="server" 
            ID="checkSenderIsOrg" 
            OnCheckedChanged="checkSenderIsOrg_CheckedChanged"/>--%>
        
        
        <div runat="server" id="divOtherSender" Visible="False" class="skjema-admin__mt-20">
            <label class="skjema-admin__page__label skjema-admin__page__label--small skjema-admin__page__label--thin skjema-admin__page__label--gray">
                E-postadresse
            </label>

            <asp:TextBox 
                CssClass="skjema-admin__page__text"
                ID="txtFromAddress" 
                runat="server">
            </asp:TextBox>
            
            <asp:RequiredFieldValidator 
                ForeColor="Red" 
                ID="requireFromAddress" 
                runat="server" 
                Display="Dynamic" 
                ErrorMessage="Avsender må oppgis" 
                ControlToValidate="txtFromAddress" />
        </div>

        <asp:RegularExpressionValidator 
            runat="server" 
            ControlToValidate="txtFromAddress" 
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
            Display="Dynamic" 
            ErrorMessage="Ugyldig e-postadresse" 
            ForeColor="Red" />
    </div>

    <div class="skjema-admin__page__field">
        <label class="skjema-admin__page__label skjema-admin__page__label--small">
            Mottaker *
        </label>

        <asp:CheckBox 
            runat="server" 
            AutoPostBack="True" 
            CssClass="skjema-admin__form__checkbox skjema-admin__mb-20 d-block"
            ID="checkReceipt" 
            OnCheckedChanged="chkReceipt_CheckedChanged" 
            Text="Send til innsender" />

        <label class="skjema-admin__page__label skjema-admin__page__label--small skjema-admin__page__label--thin skjema-admin__page__label--gray">
            Legg til e-postadresser eller placeholder fra feltnavn *
        </label>

        <asp:TextBox 
            ID="txtToAddress" 
            CssClass="skjema-admin__page__text mb-4"
            runat="server" />

        <asp:RequiredFieldValidator 
            ID="requireToAddress" 
            ErrorMessage="Mottaker må oppgis" 
            runat="server" 
            ControlToValidate="txtToAddress" 
            ForeColor="Red" 
            Display="Dynamic"/>

<%--        <asp:RegularExpressionValidator 
            runat="server" 
            ControlToValidate="txtToAddress" 
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
            Display="Dynamic" 
            ErrorMessage="Ugyldig e-postadresse" 
            ForeColor="Red">
        </asp:RegularExpressionValidator>--%>
    </div>

<%--    <div class="skjema-admin__page__field">
        <label class="skjema-admin__page__label">
            Send som HTML
        </label>

        <asp:CheckBox 
             CssClass="skjema-admin__page__tick"
            runat="server" 
            ID="checkIsHtml"/>
    </div>--%>

    <div class="skjema-admin__page__field">
        <label class="skjema-admin__page__label skjema-admin__page__label--small">
            Emne *
        </label>

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

        <asp:RequiredFieldValidator 
            ControlToValidate="txtSubject" 
            ForeColor="Red" 
            ID="RequiredFieldValidator3" 
            runat="server" 
            Display="Dynamic"
            ErrorMessage="*">
        </asp:RequiredFieldValidator>
    </div>

    <div class="skjema-admin__page__field skjema-admin__mb-60">
        <label class="skjema-admin__page__label skjema-admin__page__label--small">
            Meldingstekst *
        </label>

        <asp:TextBox 
            TextMode="MultiLine" 
            CssClass="skjema-admin__page__text"
            ID="txtBody" 
            runat="server" 
            Height="200px">
        </asp:TextBox>

        <asp:RequiredFieldValidator 
            ControlToValidate="txtBody" 
            ForeColor="Red" 
            ID="RequiredFieldValidator4" 
            Display="Dynamic"
            runat="server" 
            ErrorMessage="*">
        </asp:RequiredFieldValidator>
    </div>

    <hr class="skjema-admin__hr" />

	<asp:Button 
        id="btnCreate" 
        runat="server" 
        Text="Lagre" 
        CssClass="skjema-admin__button skjema-admin__button--primary"
        onclick="btnCreate_Click">
	</asp:Button>
</asp:Content>
