<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Confirmedregistration.aspx.cs" MasterPageFile="~/module/dashboardPage.master" Inherits="module_Confirmedregistration" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        var chkval21 = [];
        var chkval = [];
        $(document).ready(function () {
            $('select[id$=Select1] option:eq(1)').attr("selected", true);
            //$("#vehicle1").click(function () {
            //    alert("a");
            //    if ($("#vehicle1").prop("checked") == true) {
            //        $(".Reception").prop("checked", true);
            //    }
            //    else {
            //        $(".Reception").prop("checked", false);
            //    }
            //});
            //$("#rr1").click(function () {
               
            //    if ($("#rr1").prop("checked") == true) {
            //        alert("b");
            //        $(".vehicle2").prop("checked", true);
            //    }
            //    else {
            //        $(".vehicle2").prop("checked", false);
            //    }
            //});
            $('.vehicle2').click(function () { 
                var isChecked = $(this).prop("checked"); 
                $('#Table1 tr:has(td)').find('input[type="checkbox"]').prop('checked', isChecked);
            });
            $('.Reception').click(function () {
                var isChecked = $(this).prop("checked");
                $('#datatables tr:has(td)').find('input[type="checkbox"]').prop('checked', isChecked);
            });
            datatable();
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList4",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlyears]').empty();
                    $('select[id$=ddlyears]').append("<option value='0'>Select Year</option>");
                    $.each(result.d, function (key, value) {
                        var ddyear1 = value.DeptName;
                        var ddyear2 = value.year1;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear();

                        $('select[id$=ddlyears]').append($("<option data-toggle='tooltip' data-placement='top' title='" + stryr + "'></option>").val(value.DeptId).html(stryr));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlyears]').val('0').change();
                    $('select[id$=ddlyears]').trigger("change");
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList4",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlyears1]').empty();
                    $('select[id$=ddlyears1]').append("<option value='0'>Select Year</option>");
                    $.each(result.d, function (key, value) {
                        var ddyear1 = value.DeptName;
                        var ddyear2 = value.year1;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear();

                        $('select[id$=ddlyears1]').append($("<option data-toggle='tooltip' data-placement='top' title='" + stryr + "'></option>").val(value.DeptId).html(stryr));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlyears1]').val('0').change();
                    $('select[id$=ddlyears1]').trigger("change");
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList4",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlyears3]').empty();
                    $('select[id$=ddlyears3]').append("<option value='0'>Select Year</option>");
                    $.each(result.d, function (key, value) {
                        var ddyear1 = value.DeptName;
                        var ddyear2 = value.year1;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear();


                        $('select[id$=ddlyears3]').append($("<option data-toggle='tooltip' data-placement='top' title='" + stryr + "'></option>").val(value.DeptId).html(stryr));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlyears3]').val('0').change();
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
        
            $('select[id$=ddlyears]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownList5",
                    data: "",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddlsclass]').empty();
                        $('select[id$=ddlsclass]').append("<option value='0'>Select class</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddlsclass]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlsclass]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            $('select[id$=ddlsclass]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=ddlsclass]').val() + "'}",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddldivision]').empty();
                        $('select[id$=ddldivision]').append("<option value='0'>Select Division</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddldivision]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddldivision]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList5",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=clasrch]').empty();
                    $('select[id$=clasrch]').append("<option value='0'>Select class</option>");
                    $.each(result.d, function (key, value) {
                        var dd = value.DeptName;


                        $('select[id$=clasrch]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=clasrch]').val('0').change();
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
  
            $('select[id$=clasrch]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=clasrch]').val() + "'}",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=divisrch]').empty();
                        $('select[id$=divisrch]').append("<option value='0'>Select Division</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=divisrch]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=divisrch]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
           
          
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownListCaste",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlcaste]').empty();
                    $('select[id$=ddlcaste]').append("<option value='0'>Select Caste</option>");
                    $.each(result.d, function (key, value) {
                        var dd = value.DeptName;


                        $('select[id$=ddlcaste]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlcaste]').val('0').change();
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
            $('select[id$=ddlcaste]').change(function () {
                var obj = {};
                obj.yrs1 = $("select[id$=ddlyears1]").val();
                obj.castes = $("select[id$=ddlcaste]").val();
                obj.clsid = $("select[id$=clasrch]").val();
                obj.divsid = $("select[id$=divisrch]").val();
               
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownListstudent",
                    data: JSON.stringify(obj),
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddlstudent]').empty();
                        $('select[id$=ddlstudent]').append("<option value='0'>Select Year</option>");
                        $.each(result.d, function (key, value) {
                            var fullnm = value.ptitle + "." + value.fname + " " + value.mname + " " + value.lname;
                            $('select[id$=ddlstudent]').append($("<option data-toggle='tooltip' data-placement='top' title='" + fullnm + "'></option>").val(value.DeptName).html(fullnm));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlstudent]').val('0').change();

                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            $("select[id$=divisrch1]").change(function () {
                var obj4 = {};
                obj4.yrs = $('select[id$=ddlyears3]').val();
                obj4.clsid = $("select[id$=clasrch1]").val();
                obj4.divsid = $("select[id$=divisrch1]").val();
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownList8",
                    data: JSON.stringify(obj4),
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddlpkg]').empty();
                        $('select[id$=ddlpkg]').append("<option value='0'>Select Package</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddlpkg]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlpkg]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            //$('select[id$=ddlstudent]').change(function () {
            //    alert($('select[id$=ddlstudent]').val());
               
            //});
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownListCaste",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlcaste4]').empty();
                    $('select[id$=ddlcaste4]').append("<option value='0'>Select Caste</option>");
                    $.each(result.d, function (key, value) {
                        var dd = value.DeptName;


                        $('select[id$=ddlcaste4]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlcaste4]').val('0').change();
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
            $("select[id$=ddlcaste4]").change(function () {
                var obj = {};
                obj.yrs1 = $("select[id$=ddlyears3]").val();
                obj.castes = $("select[id$=ddlcaste4]").val();
                obj.clsid = $("select[id$=clasrch1]").val();
                obj.divsid = $("select[id$=divisrch1]").val();
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownListstudent",
                    data: JSON.stringify(obj),
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddlstudents]').empty();
                        $('select[id$=ddlstudents]').append("<option value='0'>Select Student</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;
                            var fullnm = value.ptitle + "." + value.fname + " " + value.mname + " " + value.lname;

                            $('select[id$=ddlstudents]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(dd).html(fullnm));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlstudents]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            $('select[id$=clasrch1]').change(function () { 
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "ConfirmedRegistration.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=clasrch1]').val() + "'}",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=divisrch1]').empty();
                        $('select[id$=divisrch1]').append("<option value='0'>Select Division</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=divisrch1]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=divisrch1]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
                      $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList5",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=clasrch1]').empty();
                    $('select[id$=clasrch1]').append("<option value='0'>Select class</option>");
                    $.each(result.d, function (key, value) {
                        var dd = value.DeptName;


                        $('select[id$=clasrch1]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=clasrch1]').val('0').change();
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
         
      
        });
        function getdata12() {
          
            $.ajax({
                url: "Confirmedregistration.aspx/Getdata",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{studid :'" + $('select[id$=ddlstudent]').val() + "'}",
                dataType: "json",
                success: function (data) {
                    console.log(JSON.stringify(data));
                    data = JSON.parse(data.d);

                    $("#datatables").show();
                    $("#Tbody1").empty();

                    for (var i = 0; i < data.length ; i++) {
                        {
                            var fullnm = data[i].title + "." + data[i].fname + " " + data[i].mname + " " + data[i].lname; 
                            var markup = '<tr><td><input class="form-check-input" type="checkbox"  name="Reception" class="Reception" value="' + data[i].studids + '" id="rr"' + i + '"></td><td>' + data[i].studid + '</td><td >' + fullnm + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td> '
                          
                            $("#Tbody1").append(markup);
                            
                        }
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }
        var markup = "";
        function getdata13() {
          
            $.ajax({
                url: "Confirmedregistration.aspx/GetDataUpdate",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{studid : '" + $("select[id$=ddlstudents]").val() + "'}",
                dataType: "json",
                success: function (data) {
                    console.log(JSON.stringify(data));
                    data = JSON.parse(data.d);
                   
                    $("#Table1").show();
                    $("#Tbody2").empty();

                    for (var i = 0; i < data.length ; i++) {
                        var fullname = data[i].title + "." + data[i].fname + " " + data[i].mname + " " + data[i].lname;
                        if (data[i].packageid != "") {
                        
                            //markup = '<tr><td><input class="form-check-input" type="checkbox"  name="vehicle2" class="vehicle2" value="' + data[i].studids + '" id="rr1' + i + '"></td><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';
                           markup = '<tr><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';

                            $("#Tbody2").append(markup);
                            $("#rr1" + i).trigger("click"); 

                        }
                        else {
                          
                            markup = '<tr><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';

                            $("#Tbody2").append(markup);
                        }
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }
        function updatepkg() {
           
            if ($('select[id$=ddlpkg]').val() == "0" || $('select[id$=ddlpkg]').val() == null) {
                noty({ text: 'Please Select Package', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            $("input:checkbox[name=Reception]:checked").each(function () {
                ids = $(this).attr('id');

                chkval21.push($(this).val());
            });
        
            $.ajax({
                url: 'Confirmedregistration.aspx/updatestudetails',
                method: 'post',
                contentType: 'application/json;charset=utf-8',
                dataType: 'json',
                data: "{ studidsids :'" + chkval21 + "',classids :'" + $('select[id$=clasrch]').val() + "',divsid :'" + $('select[id$=divisrch]').val() + "',pkgid:'" + $('select[id$=ddlpkg]').val() + "'}",
                success: function (data) {
                    console.log(data.d);
                    noty({ text: 'Assigned Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                    $("#mclose")[0].click();
                },
                error: function () {
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000); 
                }

            });
        }
        function datatable() {
            $.ajax({
                type: "POST",
                url: "Confirmedregistration.aspx/GetData1",
                contentType: "application/JSON; charset=utf-8",

                datatype: "JSON",
                success: function (data) {
                    var table = $('#dataemp').DataTable();
                    data = JSON.parse(data.d);
                    table.clear();
                 
                    for (var i = 0, count = 1; i < data.length; i++, count++) {
                        var ddyear1 = data[i].fromdate;
                        var ddyear2 = data[i].todate;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear(); 
                        table.row.add([
                             count, data[i].pkgid, data[i].packgenme, data[i].clsname, data[i].divsname, stryr, data[i].amount, 
                             "<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=editdata('" + data[i].pkgid + "') id='btnedit' class='btn btn-success' data-bs-toggle='modal' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button> <button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=deletedata('" + data[i].pkgid + "') id='btndelete' class='btn btn-danger'><i class='fadeIn animated bx bx-trash-alt'></i></button> <button  style='height:35px; width: 35px; padding-left:7px;' type='button' class='btn btn-primary'><i class='lni lni-save'></i></button> <button  style='height:35px; width: 35px; padding-left:7px;' type='button' class='btn btn-dark'><i class='bx bx-x'></i></span></button>"

                        ]).draw(true);

                    }
                }
            });
        }
        function editdata(id) {
            clears();
            getassignpackagelist(id);
         
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "ConfirmedRegistration.aspx/PopulateDropDownList8",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlpkg1]').empty();
                    $('select[id$=ddlpkg1]').append("<option value='0'>Select Package</option>");
                    $.each(result.d, function (key, value) {
                        var dd = value.DeptName;


                        $('select[id$=ddlpkg1]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                        //console.log(value.DeptName);
                    });
                  //  $('select[id$=ddlpkg1]').val('0').change();
                    $('select[id$=ddlpkg1]').val(id).change();
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
         
        }
        function getassignpackagelist(pkgdis) {
            $.ajax({
                url: "Confirmedregistration.aspx/GetDataUpdate",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{studid : '" + pkgdis + "'}",
                dataType: "json",
                success: function (data) {
                    console.log(JSON.stringify(data));
                    data = JSON.parse(data.d);

                    $("#Table1").show();
                    $("#Tbody2").empty();

                    for (var i = 0; i < data.length ; i++) {
                        var fullname = data[i].title + "." + data[i].fname + " " + data[i].mname + " " + data[i].lname;
                        if (data[i].packageid != "") {

                            //markup = '<tr><td><input class="form-check-input" type="checkbox"  name="vehicle2" class="vehicle2" value="' + data[i].studids + '" id="rr1' + i + '"></td><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';
                            markup = '<tr><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';

                            $("#Tbody2").append(markup);
                            $("#rr1" + i).trigger("click");

                        }
                        else {

                            markup = '<tr><td>' + data[i].studid + '</td><td >' + fullname + '</td><td >' + data[i].clsname + '</td><td>' + data[i].divsname + '</td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal6" ><i class="bx bx-message-square-edit"></i> </td></tr>';

                            $("#Tbody2").append(markup);
                        }
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }

                function updatepkg1() {
          
            if ($('select[id$=ddlpkg1]').val() == "0") {
                noty({ text: 'Please Select Package', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            $("input:checkbox[name=vehicle2]:checked").each(function () {
                ids = $(this).attr('id');

                chkval.push($(this).val());
            });
         
            $.ajax({
                url: 'Confirmedregistration.aspx/updatestudetails',
                method: 'post',
                contentType: 'application/json;charset=utf-8',
                dataType: 'json',
                data: "{ studidsids :'" + chkval + "',classids :'" + $('select[id$=clasrch1]').val() + "',divsid :'" + $('select[id$=divisrch1]').val() + "',pkgid:'" + $('select[id$=ddlpkg1]').val() + "'}",
                success: function (data) {
                    console.log(data.d);
                    noty({ text: 'Assigned Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                    $("#mclose1")[0].click();
                },
                error: function () {
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }
        function clears() {
            $("select[id$=ddlyears3]").val("0").change();
            $("select[id$=clasrch1]").val("0").change(); 
            $("select[id$=divisrch1]").val("0").change(); 
            $("select[id$=ddlcaste4]").val("0").change();
            $("select[id$=ddlstudents]").val("0").change();
        }
    </script>
    	<div class="page-wrapper">
			<div class="page-content">
				<div class="row">
					<div class="col-md-12 mx-auto" >
					
				<div class="card">
					<div class="card-body">
						<div class="card-title d-flex align-items-center">

							<h6>Confirmed Registration</h6>
						</div>
						<hr/>
						
						
						<form class="row g-2">
							<div class="col-md-2">
								<label>Year</label>
								<select id="ddlyears" class="form-select mb-3" aria-label="Default select example">
													
								</select>
							</div>	
                            <div class="col-md-2">
								<label>College</label>
								<select id="Select1" class="form-select mb-3" aria-label="Default select example">
									<option value="0">Select</option>
									<option value="1">Hi-Tech College of B. Pharmacy</option>
												
								</select>
							</div>															
							<div class="col-md-2">
								<label>Class</label>
								<select id="ddlsclass" class="form-select mb-3" aria-label="Default select example">
						
								</select>
							</div>
							<div class="col-md-2">
								<label>Division</label>
								<select id="ddldivision" class="form-select mb-3" aria-label="Default select example">
																			
								</select>
							</div>														
					       <div class="col-md-3" style="margin-top: 4.7vh;">
							<button type="button" onclick="getdata13();" class="btn btn-primary"><i class='bx bx-search'></i>Search</button>
							<button style="height:35px; width: 35px; padding-left:7px;" type="button" title="Assign Student"  class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal"><i class="fadeIn animated bx bx-user-plus"></i>
											</button>											
						   </div>						   
                           </form>
                       </div>
                   </div>				   				  						
				<!-- <div class="row row-cols-auto g-2">

				<div class="col">
					<button style="height:35px; width: 35px; padding-left:7px;"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal" type="button" class="btn btn-secondary"6><i class="fadeIn animated bx bx-user-plus"></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"><i class='bx bx-message-square-edit'></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-warning"><i class="lni lni-share"></i>
					</button>
				</div>
				
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-dark"><i class="fadeIn animated bx bx-printer"></i>
					</button>
				</div>
				</div>
				</div>
				</div> -->
				

				   <div class="overlay toggle-icon"></div>
				   <hr/>
				   <div class="col-md-12 mx-auto">
				   <div class="card">
					   <div class="card-body">
						   <div class="table-responsive">
							   <table id="dataemp" class="table table-striped table-bordered">
								   <thead>
									   <tr>
										   <th>Sr.no </th>	
										   <th>Package ID</th>
										   <th>Package Name</th>  
										   <th>Class Name</th>
										   <th>Divison</th>
										   <th>Academic Year</th>
										   <th>Total Amount</th>
										<%--   <th>Create Date</th>--%>
										   <th style="background-color:white;">Action</th>
									   </tr>
								   </thead>
                                
								   <%--<tbody>
									<tr>
										<td></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td style="background-color:white;"></td>
									</tr>
									   <tr>
										   <td>1</td>
										   <td>1321</td>	
										   <td>CAP</td>
										   <td>B.Pharm</td>
										   <td>1st Year</td>
										   <td>12-14-2022</td>
										   <td>749.00</td>
										   <td>14-10-2022</td>
										   <td style="background-color: white;">
											<button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal5"><i class="fadeIn animated bx bx-user-plus"></i>
											</button>							
											<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal5" ><i class='bx bx-message-square-edit'></i>
											</button>&nbsp;<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i>
											</button>
											<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-primary"><i class="lni lni-save"></i>
											</button>
										   </td>										
										   </tr>
										   <tr>
											<td>2</td>
											<td>1321</td>	
											<td>APC</td>
											<td>M.Pharm</td>
											<td>1st Year</td>
											<td>12-14-2022</td>
											<td>749.00</td>
											<td>14-10-2022</td>
											<td style="background-color: white;">
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal5"><i class="fadeIn animated bx bx-user-plus"></i>
											 </button>								
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal5" ><i class='bx bx-message-square-edit'></i>
											 </button>
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i>
											 </button>
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-primary"><i class="lni lni-save"></i>
											 </button>
											</td>										
											</tr>
									   </tbody>--%>
							   </table>
						   </div>
					   </div>
				   </div>
			   </div>
			   </div>
		    </div>			
   </div>
            </div>
    
	<div class="col">
		<!-- Button trigger modal -->
		
		<!-- Modal -->
		<div class="modal fade" id="exampleLargeModal" tabindex="-1" aria-hidden="true">
			<div class="modal-dialog modal-xl">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title">Assign Student</h5>
						<button type="button" class="btn-close" id="mclose" data-bs-dismiss="modal" aria-label="Close"></button>
					</div>
					<div class="modal-body"><form class="row g-2">
					<div class="col-md-2">
						
							<select class="form-select mb-3" id="ddlyears1" aria-label="Default select example">
							
							</select>
						</div>
						<div class="col-md-2">
						
							<select class="form-select mb-3" id="clasrch" aria-label="Default select example">
							
							</select>
						</div>
						
						
						<div class="col-md-2">
						
								<select class="form-select mb-3" id="divisrch" aria-label="Default select example">
							
							</select>
						</div>
                         
                        <div class="col-md-2">
						
								<select class="form-select mb-3" id="ddlcaste" aria-label="Default select example">
							
							</select>
						</div>
                        <div class="col-md-2">
						
								<select class="form-select mb-3" id="ddlstudent" aria-label="Default select example">
							
							</select>
						</div>
                       
                         <div class="col-md-1" style="margin-top: 1vh;">
						<button type="button" onclick="getdata12();" class="btn btn-primary">Search</button>
						
										
					   </div> 
                        <div class="col-md-2">
						
							<select class="form-select mb-3" id="ddlyears3" aria-label="Default select example">
						
							</select>
						</div>
						
                        <div class="col-md-2">
						
							<select class="form-select mb-3" id="clasrch1" aria-label="Default select example">
						
							</select>
						</div>
						
						
						<div class="col-md-2">
						
								<select class="form-select mb-3" id="divisrch1" aria-label="Default select example">
						
						
							</select>
						</div> 
						<div class="col-md-3">
						
								<select class="form-select mb-3" id="ddlpkg" aria-label="Default select example">
							
						
							</select>
						</div>
					  

				

					
					<div class="col-md-1" style="margin-top: 1vh;">
						<button type="button" onclick="updatepkg()" class="btn btn-primary">Assign</button>
						
										
					   </div>

					   
					   </form>

					   <div class="col-md-12 mx-auto">
						<div class="card">
							<div class="card-body">
								<table class="table mb-0" id="datatables">
									<thead class="table-dark">
										<tr>
											<th scope="col"><input type="checkbox" id="rr" name="Reception" class="Reception" value="0" /></th>
												
											<th scope="col">Stud ID</th>
											<th scope="col">Student Name</th>
											<th scope="col">Class</th>
											<th scope="col">Division</th>

										</tr>
									</thead>
									<tbody id="Tbody1">
										<tr>
										
										</tr>
									
									</tbody>
								</table>
							</div>
						</div>
					
					</div>
					</div>
				
				</div>
			</div>
		</div>
	</div> 
    <div class="col">
		<!-- Button trigger modal -->
		
		<!-- Modal -->
		<div class="modal fade" id="exampleLargeModal5" tabindex="-1" aria-hidden="true">
			<div class="modal-dialog modal-xl">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title">Assign Student</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" id="mclose1" aria-label="Close"></button>
					</div>
					<div class="modal-body"><form class="row g-2">
					
							 
                         <div class="col-md-2">
						
								<select class="form-select mb-3" id="ddlcaste4" aria-label="Default select example">
						
						
							</select>
						</div>
                        	<div class="col-md-2">
						
								<select class="form-select mb-3" id="ddlstudents" aria-label="Default select example">
						
						
							</select>
						</div>
                       
                       
                         <div class="col-md-1" style="margin-top: 1vh;">
						<button type="button" onclick="getdata13();" class="btn btn-primary">Search</button>
						
										
					   </div>
					
					   
					   </form>

					   <div class="col-md-12 mx-auto">
						<div class="card">
							<div class="card-body">
								<table class="table mb-0" id="Table1">
									<thead class="table-dark">
										<tr>
											
												
											<th scope="col">Stud ID</th>
											<th scope="col">Student Name</th>
											<th scope="col">Class</th>
											<th scope="col">Division</th>
                                            <th scope="col">Action</th>
										</tr>
									</thead>
									<tbody id="Tbody2">
										<tr>
										
										</tr>
									
									</tbody>
								</table>
							</div>
						</div>
					
					</div>
					</div>
				
				</div>
			</div>
		</div>
	</div>
   
    </asp:Content>