<%@ page language="C#" autoeventwireup="true" inherits="Pages_MobileView_Default, App_Web_rc2j4paz" masterpagefile="~/Pages/Common/MasterPages/MobileViewMasterPage.master" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <div class="whiteboxpaddingleft dashboard">
                <div class="himssuHeader1WireBox row padd-40">
                    <div class="himsBoxContent page-bar col-xl-12 col-md-12 col-sm-12" id="MDashboard" runat="server" visible="true">

                                <div id="StudentAttendanceDiv" runat="server">
                                    <div class="himssuHeader1WireBox col-md-12 pTop5">
                                        <div class="himsBoxHeader page-bar col-xl-12 col-md-12 col-sm-12 padd-0">
                                            <div class="width-100 border-bottom-inline">
                                                <div class="pull-left  main-topic">
                                                    <asp:Label ID="StudentAttendance_Label" CssClass="page-title" runat="server" Text="Student Attendance Master"></asp:Label>

                                                </div>
                                            </div>
                                           <%-- <div class="pull-right mt-27">
                                                <asp:Button ID="BackButton" runat="Server" OnClick="BackButton_Click" SkinID="0" CssClass="btn btn-back fas" Text="&#xf30a;  Back" />
                                            </div>--%>
                                        </div>
                                        <div class="himsBoxContent card-body col-md-12 col-xl-12" >
                                            <div class="table-responsive col-md-12">
                                                <asp:GridView runat="server" ID="StudentAttendanceGridView" Width="100%" AutoGenerateColumns="False"
                                                    EmptyDataText="No Records Found !!" AllowPaging="false" CssClass="table table-striped table-bordered table-hover"
                                                    ShowHeader="True" DataKeyNames="TotalCount,AbsentCount,AttendanceCount,PresentCount,AveragePresence">
                                                    <Columns>                                       

                                                         <asp:BoundField DataField="TotalCount" HeaderText="Total Student" ItemStyle-Width="20%"
                                                            HeaderStyle-HorizontalAlign="Left" />
                                                         <asp:BoundField DataField="PresentCount" HeaderText="Present Student" ItemStyle-Width="20%"
                                                            HeaderStyle-HorizontalAlign="Left" />
                                                         <asp:BoundField DataField="AbsentCount" HeaderText="Absent Student" ItemStyle-Width="20%"
                                                            HeaderStyle-HorizontalAlign="Left" />
                                                         <asp:BoundField DataField="AveragePresence" HeaderText="Average Presence" ItemStyle-Width="20%"
                                                            HeaderStyle-HorizontalAlign="Left" />
                                                         <asp:BoundField DataField="AttendanceCount" HeaderText="Attendance Count" ItemStyle-Width="20%"
                                                            HeaderStyle-HorizontalAlign="Left" />
                                                        
                                                    </Columns>
                                                    <PagerSettings Visible="False" />
                                                </asp:GridView>
                                            </div>
                                      
                                    </div>

                                    <div class="row">
                                                
                                        <div class="col-md-4">
                                            <div class="panel panel-custom-horrible-red">
                                                <div class="panel-heading">Attendance Summary List</div>
                                                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
                                                    <ContentTemplate>
                                                        <div id="DivDepartmnet">
                                                            <asp:GridView ID="DepartmentGridView" OnRowDataBound="DepartmentGridView_RowDataBound" runat="server" ShowFooter="true" AutoGenerateColumns="False" CssClass="table table-bordered table-striped"
                                                                SkinID="" ShowHeader="true" PagerSettings-Visible="false" EmptyDataText="No Records Found">
                                                                <Columns>
                                                                    <asp:TemplateField HeaderText="Category" HeaderStyle-CssClass="abc" ItemStyle-Wrap="true">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="PresentStudentLabel" runat="server" Text="Present Student"></asp:Label>
                                                                            <asp:Label ID="AbsentStudentLabel" runat="server" Text="Absent Student"></asp:Label>
                                                                            <asp:Label ID="TotalCountLabel" runat="server" Text="Total Count"></asp:Label>
                                                                        </ItemTemplate>
                                                                        <FooterTemplate>
                                                                            <div style="text-align: center;">
                                                                                <asp:Label ID="lblOPD" runat="server" Text="Total" />
                                                                            </div>
                                                                        </FooterTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Count" HeaderStyle-CssClass="abc" ItemStyle-Wrap="true" ItemStyle-Width="20%">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="PresentStudentValueLabel" runat="server" Text='<%# Bind("PresentCount") %>'></asp:Label>
                                                                            <asp:Label ID="AbsentStudentValueLabel" runat="server" Text='<%# Bind("AbsentCount") %>'></asp:Label>
                                                                            <asp:Label ID="TotalCountValueLabel" runat="server" Text='<%# Bind("TotalCount") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                        <HeaderStyle HorizontalAlign="Center" />
                                                                        <ItemStyle HorizontalAlign="Center" />
                                                                        <FooterTemplate>
                                                                            <div style="text-align: center;">
                                                                                <asp:Label ID="lblDepartmentTotalqty" runat="server" />
                                                                            </div>
                                                                        </FooterTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                                <FooterStyle BackColor="#cccccc" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
                                                            </asp:GridView>
                                                        </div>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </div>
                                        </div>
                                            </div>

                                     <asp:HiddenField ID="hfPresentStudentYaxis" runat="server" />
                                     <asp:HiddenField ID="hfPresentStudentpring" runat="server" />
                                     <asp:HiddenField ID="hfAbsentStudentpring" runat="server" />
                                     <asp:HiddenField ID="hfAbsentStudentYaxis" runat="server" />
                                     <asp:HiddenField ID="hfLeaveLablepring" runat="server" />
                                     <asp:HiddenField ID="hfLeaveYaxis" runat="server" />
                                     <asp:HiddenField ID="hflistbaseonemployeetype" runat="server" />
                                     <asp:HiddenField ID="hfCommanLablepring" runat="server" />

                                    <div class="row">
                                        <div class="col-md-4">
                                            <div id="Visible" runat="server" visible="false">
                                                <div class="panel panel-primary">
                                                    <div class="panel-heading">Student Attendance</div>
                                                    <canvas id="myTotal"></canvas>
                                                </div>
                                            </div>
                                        </div>                                                
                                   </div>

                                </div>
                             
                    </div>
                </div>
            </div>        
        </ContentTemplate>
    </asp:UpdatePanel>
    <script type="text/javascript" src='<%=ResolveUrl("~/JavaScript/jquery-1.10.2.min.js")%>'></script>
    <script type="text/javascript" src='<%=ResolveUrl("~/JavaScript/Chart.min.js")%>'></script>   
     <script type="text/javascript">
         function Comman() {
             var hfLablepring4 = document.getElementById('<%=hfCommanLablepring.ClientID%>').value;
            var aLabels = hfLablepring4.split(",");
            var hfYaxis55 = document.getElementById('<%=hfLeaveYaxis.ClientID%>').value;
            var aDatasets2 = hfYaxis55.split(",");
            var hfYaxis1 = document.getElementById('<%=hfAbsentStudentYaxis.ClientID%>').value;
            var aDatasets3 = hfYaxis1.split(",");
            var hfYaxis3 = document.getElementById('<%=hfPresentStudentYaxis.ClientID%>').value;
            var aDatasets4 = hfYaxis3.split(",");
            var data = {
                labels: aLabels,
                exportEnabled: true,
                datasets: [{
                    label: "Leave",
                    fillColor: "rgba(220,220,220,0.2)",
                    strokeColor: "rgba(220,220,220,1)",
                    pointColor: "rgba(220,220,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    backgroundColor: ["#FFCE56"],
                    pointHighlightStroke: "rgba(220,220,220,1)",
                    borderColor: ['rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                       'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)',
                                       'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'
                                       , 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                       'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'],
                    borderWidth: 1,
                    data: aDatasets2
                }, {
                    label: "Absent Student",
                    fillColor: "rgba(220,220,220,0.2)",
                    strokeColor: "rgba(220,220,220,1)",
                    pointColor: "rgba(220,220,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    backgroundColor: ["#36A2EB"],
                    pointHighlightStroke: "rgba(220,220,220,1)",
                    borderColor: ['rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)',
                                 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'
                                 , 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'],
                    borderWidth: 1,
                    data: aDatasets3

                }, {
                    label: "Present Student",
                    fillColor: "rgba(220,220,220,0.2)",
                    strokeColor: "rgba(220,220,220,1)",
                    pointColor: "rgba(220,220,220,1)",
                    pointStrokeColor: "#fff",
                    pointHighlightFill: "#fff",
                    backgroundColor: ["#FF6384"],
                    pointHighlightStroke: "rgba(220,220,220,1)",
                    borderColor: ['rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)', 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)',
                                 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'
                                 , 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)',
                                 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)'],
                    borderWidth: 1,
                    data: aDatasets4
                }]
            };
            var ctx = $("#myTotal").get(0).getContext('2d');
            ctx.canvas.height = 100;
            ctx.canvas.width = 100;
            var imgageData = ctx.canvas.toDataURL("image/png");
           
            var opt = {
                responsive: true,
                legend: { position: 'top' },
                scales: {
                    yAxes: [{
                        ticks: {
                            beginAtZero: true
                        }
                    }]
                }
            };
            var myNewChart2 = new Chart(ctx, {
                type: "bar",
                data: data,
                options: opt,
            });
        }
  
        function Download() {
            html3canvas($("#myTotal"), {
                onrendered: function (canvas) {
                    var imgData = canvas.toDataURL(
                        'image/png');
                    var doc = new jsPDF('p', 'mm');
                    doc.addImage(imgData, 'PNG', 10, 10);
                    doc.save('sample-file.pdf');
                }
            });
        }

        function ListBaseEmployeetype() {
            $.ajax({
                type: "POST",
                url: "/Pages/Examination/OPDDashBoard.aspx/getLineChartData",
                data: '{"ListData":"' + document.getElementById('<%=hflistbaseonemployeetype.ClientID%>').value + '"}',
                contentType: "application/json;charset=utf-8",
                dataType: "json",
                success: function (reponse) {
                    var aData = reponse.d;
                    var aLabels = aData[0];
                    var aDatasets1 = aData[1];

                    var data = {
                        labels: aLabels,
                        datasets: [{
                            label: "Employee Type Wise Count",
                            fillColor: "rgba(220,220,220,0.2)",
                            strokeColor: "rgba(220,220,220,1)",
                            pointColor: "rgba(220,220,220,1)",
                            pointStrokeColor: "#fff",
                            pointHighlightFill: "#fff",
                            pointHighlightStroke: "rgba(220,220,220,1)",
                            backgroundColor: ["#FF6384", "#36A2EB", "#FFCE56", "#D35400", "#CD5C5C", "#C0C0C0", "#cc65fe", "#196F3D", "#5499C7", "#E67E22",
                                          "#27AE60", "#F08080", "#FA8072", "#E9967A", "#FFA07A", "#16A085", "#512E5F", "#7D6608", "#1B4F72", "#008080",
                                          "#FF00FF", "#01DF01"],
                            borderWidth: 1,
                            data: aDatasets1
                        }]
                    };
                    var ctx = $("#MyOPDListOnEmployeeType").get(0).getContext('2d');
                    ctx.canvas.height = 100;
                    ctx.canvas.width = 100;
                    var imgageData1 = ctx.canvas.toDataURL("image/png");
                    
                    var opt = {
                        responsive: true,
                        legend: { position: 'top' },
                        scales: {
                            yAxes: [{
                                ticks: {
                                    beginAtZero: true
                                }
                            }]
                        }
                    };
                    var myNewChart3 = new Chart(ctx, {
                        type: "bar",
                        data: data,
                        options: opt,
                    });
                }
            });
        }
        
    </script>

</asp:Content>
