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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
    <style type="text/css">
        .Hide
        {
            display: none;
        }
    </style>

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

    <div>
        <div class="d-flex skjema-admin__mb-40">
            <h1 class="skjema-admin__page-title mt-0 mb-0 mr-3" ID="catalogHeader" runat="server" data-jscomponent="editFieldHeader"></h1>
            <asp:TextBox ID="txtTemplateCatalogName" CssClass="skjema-admin__page__text d-none mr-3" runat="server" data-jscomponent="editFieldText" />
            <button class="skjema-admin__button-edit" type="button" data-jscomponent="editFieldButton">
                <span class="skjema-admin__icon__pen"></span>
            </button>

            <asp:RequiredFieldValidator
                ID="requiredName"
                runat="server" 
                Display="Dynamic"
                ErrorMessage="Navn er obligatorisk" 
                ControlToValidate="txtTemplateCatalogName">
            </asp:RequiredFieldValidator>
        </div>
    </div>
    
    <div class="mb-5">
        <asp:Button id="btnSave" OnClick="btnSave_OnClick" Text="Lagre endringer" CssClass="skjema-admin__button skjema-admin__button--primary" runat="server" />
    </div>
    
    <div class="skjema-admin__mb-40">
       
        <asp:Label runat="server">
            <asp:CheckBox ID="checkIsSharedWithSeveral" runat="server" Width="15px"/>
            Standard katalog som er delt med flere
        </asp:Label>
        
    </div>

    <div class="skjema-admin__table__counter skjema-admin__mb-5" data-jscomponent="totalSelected" data-tableid="gvTemplatesOnCatalog">
        0 skjema er valgt.
    </div>

    <asp:GridView
            ID="gvTemplatesOnCatalog"
            data-id="gvTemplatesOnCatalog"
            runat="server"
            AutoGenerateColumns="False"
            Width="100%"
            Border="0"
            data-jscomponent="toggleTable"
            CssClass="skjema-admin__table skjema-admin__table--list skjema-admin__table--min-width-1" 
            OnRowDataBound="gvTemplatesOnCatalog_OnRowDataBound">
        <HeaderStyle CssClass="skjema-admin__table__header"></HeaderStyle>
        <Columns>
            <asp:BoundField DataField="templateId" HeaderText="Id" ItemStyle-CssClass="Hide" HeaderStyle-CssClass="Hide" />
            <asp:TemplateField>
                <%--<HeaderTemplate>
                    <asp:CheckBox ID="chkAll" CssClass="jsAllCheck" AutoPostBack="false" runat="server" />
                </HeaderTemplate>--%>
                <ItemTemplate>
                    <div class="skjema-admin__table__list-td skjema-admin__table__list-td--collapse-panel d-flex justify-content-center">
                        <asp:CheckBox ID="chkRow" CssClass="jsSingleCheck" runat="server" />
                    </div>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField>
                <ItemTemplate>
                    <div class="skjema-admin__table__list-td skjema-admin__table__list-td--collapse-panel skjema-admin__nbr">
                        <asp:label runat="server" text='<%#Eval("formId")%>'>
                        </asp:label>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField>
                <ItemTemplate>
                    <div class="skjema-admin__table__list-td skjema-admin__table__list-td--collapse-panel">
                        <asp:label runat="server" text='<%#Eval("templateName")%>'>
                        </asp:label>
                    </div>
                </ItemTemplate>
            </asp:TemplateField>

            <%-- <asp:BoundField DataField="formId" HeaderText="Id" />--%>
            <%-- <asp:BoundField DataField="templateName" HeaderText="Skjema" /> --%>

            <asp:TemplateField>
                <ItemTemplate>
                    <asp:HiddenField ID="category" runat="server" Value='<%#Eval("categoryName")%>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

    <div class="skjema-admin__table__counter skjema-admin__mb-20" data-jscomponent="totalSelected" data-tableid="gvTemplatesOnCatalog">
        0 skjema er valgt.
    </div>
 
    <asp:Button id="Button2" OnClick="btnSave_OnClick" Text="Lagre endringer" CssClass="skjema-admin__button skjema-admin__button--primary" runat="server" />
</asp:Content>
