<%@ control language="C#" autoeventwireup="true" inherits="controls_admin_notes, controls.admin" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="~/controls/admin/attachments.ascx" TagPrefix="ucNote" TagName="attachments" %>

<div class="container-fluid">
    <div class="row">

        <asp:UpdatePanel ID="upNotes" runat="server" UpdateMode="Always">
            <ContentTemplate>

                <div class="panel panel-primary">
                    <!-- Default panel contents -->
                    <div class="panel-heading">
                        <div class="row">
                            <div class="col-sm-8">
                                <asp:Label ID="lblNoteHeading" runat="server">History</asp:Label></div>
                            <div class="col-sm-4 text-right">
                                <asp:LinkButton ID="btnAttachments" CssClass="glyphicon glyphicon-paperclip palette-back palette-heading-button" data-toggle="tooltip" title="New File" OnClick="btnAttachments_Click" runat="server" />
                                <asp:LinkButton ID="btnNewNote" title="New Note" data-toggle="tooltip" runat="server" CssClass="glyphicon glyphicon-plus palette-add palette-heading-button" OnClick="btnNewNote_Click" />
                            </div>
                        </div>
                    </div>
                    <div class="panel-body">

                        <div class="row">
                            <div class="col-md-12">
                                <asp:Panel ID="pnlNoteList" runat="server">
                                    <div class="panel-group" id="accordion" runat="server" role="tablist" aria-multiselectable="true">
                                        <asp:Repeater ID="rptNotes" runat="server" OnItemDataBound="rptNotes_ItemDataBound" OnItemCreated="rptNotes_ItemCreated" ViewStateMode="Enabled">
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>

                                                <div class="panel panel-default">
                                                    <div class="panel-heading" role="tab" id='<%#DataBinder.Eval(Container, "DataItem.collapseHeadId")%>'>
                                                        <h5 class="panel-title">
                                                            <%#DataBinder.Eval(Container, "DataItem.title")%>
                                                                    (<%#DataBinder.Eval(Container, "DataItem.userNameSaved")%>&nbsp;<%#DataBinder.Eval(Container, "DataItem.dataSaveFormatted")%>)
                                                            <a role="button" data-toggle="collapse" class="pull-right" data-parent="#accordion" href='#<%#DataBinder.Eval(Container, "DataItem.collapseId")%>' aria-expanded='<%# Container.ItemIndex == 0 ? "true" : "false" %>' aria-controls='<%#DataBinder.Eval(Container, "DataItem.collapseId")%>'>
                                                                <span class="glyphicon glyphicon-resize-vertical " aria-hidden="true"></span>
                                                            </a>
                                                            <asp:LinkButton ID="lnkEdit" runat="server" OnClick="lnkEdit_Click"
                                                                CommandArgument='<%# Bind("recId") %>' CssClass="pull-right glyphicon glyphicon-edit palette-edit-accordian"
                                                                data-toggle="tootip" title="Edit">
                                                            </asp:LinkButton>
                                                        </h5>
                                                    </div>
                                                    <div id='<%#DataBinder.Eval(Container, "DataItem.collapseId")%>' class="panel-collapse <%# Container.ItemIndex == 0 ? "collapse in" : "collapse" %>" role="tabpanel" aria-labelledby='<%#DataBinder.Eval(Container, "DataItem.collapseHeadId")%>'>
                                                        <div class="panel-body">
                                                            <div>
                                                                <asp:Label ID="lblCaption" Text='<%#DataBinder.Eval(Container, "DataItem.caption")%>' runat="server" />
                                                            </div>
                                                            <div runat="server" id="divNoteAttachments">
                                                            </div>
                                                            <div class="noShow">
                                                                <asp:HiddenField ID="hfType" runat="server" Value='<%#DataBinder.Eval(Container, "DataItem.typeId")%>' />
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>


                                                <%--<div class="col-xs-12" style="border-bottom: solid; border-width: 1px; border-color: #20225F; padding-right: 0px;">
                                                    <div class="pull-left">
                                                        <h4>
                                                            <a style="color: #20225F; text-decoration: none" data-toggle="collapse" href='#<%#DataBinder.Eval(Container, "DataItem.collapseId")%>'><%#DataBinder.Eval(Container, "DataItem.title")%></a>
                                                        </h4>
                                                    </div>
                                                    <div class="pull-left" style="margin: 10px 0px 10px 5px;">
                                                        (<%#DataBinder.Eval(Container, "DataItem.userNameSaved")%>&nbsp;<%#DataBinder.Eval(Container, "DataItem.dataSaveFormatted")%>)
                                                    </div>
                                                    <div class="pull-right" style="margin: 10px 5px 10px 5px;">
                                                        <asp:LinkButton ID="lnkEdit" runat="server" Font-Size="Medium" OnClick="lnkEdit_Click"
                                                            CommandArgument='<%# Bind("recId") %>' CssClass="glyphicon glyphicon-edit palette-edit"
                                                            data-toggle="tootip" title="Edit">
                                                        </asp:LinkButton>
                                                    </div>
                                                </div>
                                                <div aria-expanded='<%# Container.ItemIndex == 0 ? "true" : "false" %>' aria-controls='<%#DataBinder.Eval(Container, "DataItem.collapseId")%>' class="col-xs-12 panel-collapse <%# Container.ItemIndex == 0 ? "collapse in" : "collapse" %>" id='<%#DataBinder.Eval(Container, "DataItem.collapseId")%>' style="padding-top: 10px; padding-bottom: 15px;">
                                                    <div class="panel-body">
                                                        <div>
                                                            <asp:Label ID="lblCaption" Text='<%#DataBinder.Eval(Container, "DataItem.caption")%>' runat="server" />
                                                        </div>
                                                        <div runat="server" id="divNoteAttachments">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="noShow">
                                                    <asp:HiddenField ID="hfType" runat="server" Value='<%#DataBinder.Eval(Container, "DataItem.typeId")%>' />
                                                </div>--%>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                            </FooterTemplate>
                                        </asp:Repeater>
                                    </div>
                                </asp:Panel>
                                <asp:Panel ID="pnlNotePage" runat="server" Visible="false">
                                    <div class="row">
                                        <div class="col-md-12">
                                            <hr />
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-6 col-lg-offset-2 form-horizontal">
                                            <div class="col-sm-offset-4 col-sm-8">
                                                <asp:ValidationSummary ID="ValidationSummary6" CssClass="alert alert-danger alert-dismissible" ShowMessageBox="false" runat="server" DisplayMode="BulletList"
                                                    Visible="true" ValidationGroup="Note" />
                                                <asp:Panel ID="pnlResult" Width="100%" Visible="false" runat="server">
                                                    <div class="alert alert-warning alert-dismissible" role="alert">
                                                        <p>
                                                            <asp:Label ID="lblResult" runat="server"></asp:Label>
                                                        </p>
                                                    </div>
                                                </asp:Panel>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-horizontal">
                                                <div class="row">
                                                    <div class="col-sm-8">
                                                        <div class="form-group">
                                                            <label for="txtTitle" class="col-sm-4 control-label">Title</label>
                                                            <div class="col-sm-8">
                                                                <input type="text" class="form-control" id="txtTitle" runat="server" placeholder="Note Title">
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" SetFocusOnError="true"
                                                                    ControlToValidate="txtTitle" ValidationGroup="Note" Display="None"
                                                                    ErrorMessage="Missing: Title"></asp:RequiredFieldValidator>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label for="txtCaption" class="col-sm-4 control-label">Caption</label>
                                                            <div class="col-sm-8">
                                                                <textarea id="txtCaption" runat="server" rows="5" style="min-width: 100%" class="form-control" placeholder="Note Caption"></textarea>
                                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" SetFocusOnError="true"
                                                                    ControlToValidate="txtCaption" ValidationGroup="Note" Display="None"
                                                                    ErrorMessage="Missing: Caption"></asp:RequiredFieldValidator>
                                                            </div>
                                                        </div>
                                                        <div class="form-group noShow">
                                                            <label for="ddNoteType" class="col-sm-4 control-label">Type</label>
                                                            <div class="col-sm-8">
                                                                <asp:DropDownList ID="ddNoteType" runat="server" CssClass="form-control"></asp:DropDownList>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <div id="divEditNoteFiles" runat="server" class="col-sm-12"></div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label for="radUploadNotes" class="col-sm-4 control-label">Select file:</label>
                                                            <div class="col-sm-8">
                                                                <telerik:RadAsyncUpload runat="server" ID="radUploadNotes" CssClass="radUploadClass" MultipleFileSelection="Automatic" OnFileUploaded="radUploadNotes_FileUploaded" AllowedFileExtensions=".jpg,.png,.gif,.jpeg,.doc,.docx,.pdf,.xls,.xlsx,.zip,.ppt,.pptx">
                                                                    <FileFilters>
                                                                        <telerik:FileFilter Description="Allowed" Extensions=".jpg,.png,.gif,.jpeg,.doc,.docx,.pdf,.xls,.xlsx,.zip,.ppt,.pptx,.mov,.mp4,.wmv,.mkv,.3gp,.flv" />
                                                                    </FileFilters>
                                                                </telerik:RadAsyncUpload>
                                                             <telerik:RadProgressManager ID="radProgressNotes" runat="server" />
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-4 noShow">
                                                        <div class="form-group">
                                                            <label for="chkActive" class="col-sm-4 control-label">Status</label>
                                                            <div class="col-sm-8">
                                                                <div>
                                                                    <asp:CheckBox ID="chkActive" runat="server" Checked="true" Text="active" />
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-md-12">
                                                        <div class="form-group">
                                                            <div class="col-sm-3 col-sm-offset-5">
                                                                <asp:Button ID="btnSave" runat="server" CssClass="btn btn-info" Text="Save" ValidationGroup="Note" OnClick="btnSave_Click" />
                                                                |
                                                                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-warning" Text="Back" OnClick="btnCancel_Click" OnClientClick="FileUploadCancel();" />
                                                            </div>

                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </asp:Panel>

                                <asp:Panel ID="pnlNoteAttachments" Visible="false" runat="server">
                                    <div class="row">
                                        <ucNote:attachments runat="server" ID="noteAttachments" />
                                    </div>
                                    <%--                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <asp:Button ID="btnCancelNoteAttachments" runat="server" CssClass="btn btn-default" Text="Cancel" />

                            </div>
                        </div>
                                    </div>--%>
                                </asp:Panel>
                            </div>
                        </div>
                    </div>
                </div>
            </ContentTemplate>
            
        </asp:UpdatePanel>

    </div>

</div>



