<%@ Page Title="Category Customize" Language="C#" MasterPageFile="~/SunMaster.Master"
    AutoEventWireup="true" CodeBehind="CategoryCustomize.aspx.cs" Inherits="SUNWEB.CategoryCustomize" %>

<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="javascript">
        function AllowOnlyNumeric() {
            // Get the ASCII value of the key that the user entered
            var key = window.event.keyCode;

            // Verify if the key entered was a numeric character (0-9) or a decimal (.)
            if ((key > 47 && key < 58) || key == 46)
            // If it was, then allow the entry to continue
                return;

            else
            // If it was not, then dispose the key and continue with entry
                window.event.returnValue = null;
            alert("Number Only Allowed")
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel runat="server" ID="updatepanel1" UpdateMode="Conditional">
        <ContentTemplate>
            <%--   <table style="margin-left: 1%; width: 98%;">
       <tr>
      <td style="font-size:large; width: 50%; font-family:'Open Sans', sans-serif; font-weight:bolder;">
       CATEGORY CUSTOMIZE
     </td>    
     
     </tr>
     </table>--%>
<%--            <div class="section-block">
                <h5 class="section-title">
                    CATEGORY CUSTOMIZE
                </h5>
            </div>--%>
             <table style="padding-bottom: 2px; width: 100%;">
                <tr>
                    <td style="max-width: 50%; min-width: 50%;">
                    </td>
                    <%-- <td style="font-size: large; width: 50%; font-family: 'Open Sans', sans-serif; font-weight: bolder;">
                        CONDIMENT
                    </td>--%>
                    <td style="max-width: 50%; min-width: 50%; text-align: right; padding-bottom: 7px;">
                        <label for="validationCustom03">
                            Branch
                        </label>
                        <%-- <asp:Label ID="lblBranchAliasName" ForeColor="Blue" runat="server" Text="Branch "></asp:Label>--%>
                        <asp:DropDownList ID="cmbBranches" CssClass="custom-select" runat="server" AutoPostBack="true"
                            OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged"  Width="200px" Height="40px">
                        </asp:DropDownList>
                    </td>
                </tr>
            </table>
            <div class="row" style="display:none">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="form-row">
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2" >
                                    <caption>
                                        <label for="validationCustom03">
                                            From
                                        </label>
                                        <asp:TextBox ID="txtStartDt" AutoCompleteType="None" class="form-control" runat="server"></asp:TextBox>
                                        <asp:CalendarExtender ID="calFirstDueDate" Format="yyyy-MM-dd" runat="server" TargetControlID="txtStartDt"
                                            PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                    </caption>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2" style="display:none">
                                    <label for="validationCustom03">
                                        To
                                    </label>
                                    <asp:TextBox ID="txtEndDt" class="form-control" runat="server"></asp:TextBox>
                                    <asp:CalendarExtender ID="CalendarExtender1" Format="yyyy-MM-dd" runat="server" TargetControlID="txtEndDt"
                                        PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                </div>
                          <%--      <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <label for="validationCustom03">
                                        <asp:Label ID="lblBranchAliasName" ForeColor="Gray" runat="server" Text="Branch"></asp:Label></label>
                                    <asp:DropDownList ID="cmbBranches" CssClass="custom-select" runat="server" AutoPostBack="true"
                                        OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </div>--%>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <asp:Button ID="btnGetReports" runat="server" Text="Apply" CssClass="btn btn-primary"
                                        OnClick="btnGetReports_Click" OnClientClick="return validate()" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div>
               <%-- <h4>
                    &nbsp;<asp:Label ID="lblGreeting" runat="server"></asp:Label></h4>--%>
                <%--<asp:Button ID="btnPdf" runat="server" Text="PDF" 
            ToolTip="To Export  the Report Click Here"  CssClass="btn btn-secondary" 
            onclick="btnPdf_Click"/>--%>
            </div>
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                        <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                            WEBORDER CATEGORY
                        </h5>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table id="example" class="table table-striped table-bordered second" style="width: 100%">
                                    <tbody>
                                        <caption>
                                            <asp:Panel ID="Panel8" runat="server" BackColor="white" Height="660px" ScrollBars="Auto"
                                                Width="1500px">
                                                <asp:GridView ID="grdCategoryCustom" runat="server" AutoGenerateColumns="False" EmptyDataRowStyle-CssClass="alert-dark"
                                                    Font-Size="15px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Record Found ! "
                                                    OnRowCommand="grdCategoryCustom_RowCommand" DataKeyNames="CategoryID" FooterStyle-BackColor="Green"
                                                    FooterStyle-ForeColor="white" Width="1000px" AllowPaging="true" PageSize="15000000"
                                                    BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" Height="500px"
                                                    BorderWidth="1px" CellPadding="3" OnRowDataBound="grdCategoryCustom_RowDataBound">
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="SNo" ItemStyle-Width="50px">
                                                            <ItemTemplate>
                                                                <%#Container.DataItemIndex+1 %>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <%--
                                                         <asp:TemplateField>  
                                                           <HeaderTemplate>   
                                                           <asp:CheckBox ID="chkAllSelect" runat="server" onclick="CheckAll(this);"  />  
                                                           </HeaderTemplate>  
                                                           <ItemTemplate>  
                                                           <asp:CheckBox ID="chkSelect" runat="server" />  
                                                           </ItemTemplate>  
                                                          </asp:TemplateField>  
                                                        --%>
                                                        <asp:TemplateField HeaderText="CategoryNo" Visible="false">
                                                            <ItemTemplate>
                                                                <asp:Label ID="lblCategoryNo1" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Category Name" ItemStyle-Width="180px">
                                                            <ItemTemplate>
                                                                <asp:Label ID="lblCategoryName" runat="server" Text='<%#Eval("Title") %>'></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Arrange By" ItemStyle-Width="75px" ItemStyle-HorizontalAlign="Center"
                                                        
                                                            ItemStyle-VerticalAlign="Middle">
                                                            <ItemTemplate>
                                                                <%--
                                                                <asp:Label ID="lblSeqNo" runat="server" 
                                                                    Text='<%#Eval("SeqNo") %>'></asp:Label>--%>
                                                                <asp:TextBox ID="txtSeqno" onkeypress="javascript:AllowOnlyNumeric()" Width="50px"
                                                                    runat="server" MaxLength="2" Text='<%#Eval("SeqNo") %>'></asp:TextBox>
                                                            </ItemTemplate> 
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Status" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center"
                                                            ItemStyle-VerticalAlign="Middle">
                                                            <ItemTemplate>
                                                                <asp:Label ID="lblVisiblityStatus" runat="server" Text='<%#Eval("Visibility") %>'></asp:Label>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="50px">
                                                            <ItemTemplate>
                                                                <asp:Button ID="btnEnable" runat="server" CssClass="btn btn-success" Text="Enable"
                                                                    CommandName="Enable" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="50px">
                                                            <ItemTemplate>
                                                                <asp:Button ID="btnDisable" runat="server" Text="Disable" CssClass="btn btn-warning"
                                                                    CommandName="Disable" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="50px" HeaderText="Start Time">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtFromtime" Width="80px" runat="server"  MaxLength="8" Text='<%#Eval("FromTime") %>'></asp:TextBox>
                                                                  <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtFromtime"
                                                                      Mask="99:99:99" MessageValidatorTip="true" MaskType="Time" InputDirection="RightToLeft"
                                                                      ErrorTooltipEnabled="True" />
                                                                      <asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlExtender="MaskedEditExtender1"
                                                                      ControlToValidate="txtFromtime" IsValidEmpty="false" MaximumValue="23:59:59" MinimumValue="00:00:00"
                                                                      EmptyValueMessage="Enter Time" MaximumValueMessage="23:59:59" InvalidValueBlurredMessage="Time is Invalid"
                                                                      MinimumValueMessage="Time must be grater than 00:00:00" EmptyValueBlurredText="Null Time"
                                                                      ToolTip="Enter time between 00:00:00 to 23:59:59"></asp:MaskedEditValidator>


                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField ItemStyle-Width="50px" HeaderText="End Time">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtTotime" Width="80px" runat="server" MaxLength="8" Text='<%#Eval("ToTime") %>'></asp:TextBox>
                                                                 <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtTotime"
                                                                 Mask="99:99:99" MessageValidatorTip="true" MaskType="Time" InputDirection="RightToLeft"
                                                                 ErrorTooltipEnabled="True" />
                                                                 <asp:MaskedEditValidator ID="MaskedEditValidator2" runat="server" ControlExtender="MaskedEditExtender2"
                                                                 ControlToValidate="txtTotime" IsValidEmpty="false" MaximumValue="23:59:59" MinimumValue="00:00:00"
                                                                 EmptyValueMessage="Enter Time" MaximumValueMessage="23:59:59" InvalidValueBlurredMessage="Time is Invalid"
                                                                 MinimumValueMessage="Time must be grater than 00:00:00" EmptyValueBlurredText="Null Time"
                                                                 ToolTip="Enter time between 00:00:00 to 23:59:59"></asp:MaskedEditValidator>

                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                          <asp:TemplateField ItemStyle-Width="50px" HeaderText="Activate">
                                                            <ItemTemplate>
                                                                <asp:CheckBox ID="chkActive" runat="server" AutoPostBack="true" OnCheckedChanged="chkActive_Changed" Checked='<%# Convert.ToBoolean(Eval("ActiveTiming")) %>' />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                          <asp:TemplateField ItemStyle-Width="50px" HeaderText="">
                                                            <ItemTemplate>
                                                                <asp:Button ID="btnSave" runat="server"  Text="Save" CssClass="btn btn-primary" CommandName="Save" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"  />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                    <PagerStyle CssClass="gridview"></PagerStyle>
                                                    <FooterStyle BackColor="#006699" ForeColor="White"></FooterStyle>
                                                    <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black"></HeaderStyle>
                                                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                                    <RowStyle ForeColor="#000066" />
                                                    <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                                    <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                                    <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                                    <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                                    <SortedDescendingHeaderStyle BackColor="#00547E" />
                                                </asp:GridView>
                                                <%--Newly Added Grid--%>
                                                <asp:GridView ID="GridView1" runat="server" AllowPaging="true" Visible="false">
                                                </asp:GridView>
                                            </asp:Panel>
                                        </caption>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>

     <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css?v=1.1" rel="stylesheet" />

    <!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />

<!-- Optional Bootstrap Icons -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet" />
</asp:Content>
