<%@ page language="C#" autoeventwireup="true" inherits="Pages_ZCRM_ClientFeedback, App_Web_glt3bfar" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Vidyalaya </title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <link rel="shortcut icon" href="../../../ContentTemplates/Brand/favicon.png" type="image/x-icon" />
    <link href="../../App_Themes/rating/css/sweetalert.min.css" rel="stylesheet" />
    <link href="../../App_Themes/rating/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../App_Themes/rating/css/style.css" rel="stylesheet" />

</head>
<body>
    <header>
        <nav>
            <div class="logo">
                <img src="../../App_Themes/rating/img/logo.png" />
            </div>
        </nav>
    </header>
    <form id="form1" runat="server">
        <div class="container margin_60_35">
            <div class="row">
                <div class="col-lg-12">
                    <div class="box_general write_review">
                        <h1>How would you Rate the Vidyalaya Service& Support you  have received ?</h1>
                        <div class="rating_submit">
                            <div class="form-group">
                                <label class="d-block">Overall rating</label>
                                <span class="rating">
                                    <input type="radio" class="rating-input" id="5_star" name="rating-input" value="5 Stars" onclick="StarCount(5)"/><label for="5_star" title="5" class="rating-star"></label>
                                    <input type="radio" class="rating-input" id="4_star" name="rating-input" value="4 Stars" onclick="StarCount(4)"/><label for="4_star" title="4" class="rating-star"></label>
                                    <input type="radio" class="rating-input" id="3_star" name="rating-input" value="3 Stars" onclick="StarCount(3)"/><label for="3_star" title="3" class="rating-star"></label>
                                    <input type="radio" class="rating-input" id="2_star" name="rating-input" value="2 Stars" onclick="StarCount(2)"/><label for="2_star" title="2" class="rating-star"></label>
                                    <input type="radio" class="rating-input" id="1_star" name="rating-input" value="1 Star" onclick="StarCount(1)"/><label for="1_star" title="1" class="rating-star"></label>
                                </span>
                            </div>
                        </div>
                        <!-- /rating_submit -->
                        <div class="form-group">
                            <label>Add a comment about the quality of support you received (optional):</label>
                            <textarea class="form-control" id="Remarktextarea" style="height: 180px;" placeholder="Write your review to help others learn about this online business"></textarea>
                        </div>
                        <a class="btn_1" >Submit review</a>
                        <asp:HiddenField ID="UserNameHiddenField" runat="server" />
                        <asp:HiddenField ID="LicencenoHiddenField" runat="server" />
                        <asp:HiddenField ID="MobileNoHiddenField" runat="server" />
                    </div>
                </div>
                <!-- /col -->
            </div>
            <!-- /row -->
        </div>
        <!-- /container -->
    </form>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
    <script>
        var UserName;
        var Licenceno;
        var MobileNo;
        var Star;
        var Remark;
        var myurl;
        $(document).ready(function () {
            myurl = window.location.search;
            var keyval = myurl.split('?')[1].split('&');
            var fixedstring = decodeURIComponent(keyval);
             $.ajax({
                type: "POST",
                url: "ClientFeedback.aspx/Url",
                data: JSON.stringify({ "Url": fixedstring }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var keyval = result.d.split('=')[1].split(',');
                    UserName = keyval[0].toString();
                    // UserName = keyval[0].split('=')[1].toString();
                    Licenceno = parseInt(keyval[1].toString());
                    //Licenceno = parseInt(keyval[1].split('=')[1].toString());
                    MobileNo = parseInt(keyval[2].toString());
                    //MobileNo = parseInt(keyval[2].split('=')[1].toString());
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                }
            });

            
            $(".btn_1").click(function () {
                Remark = $("#Remarktextarea").val();
                $.ajax({
                    type: "POST",
                    url: "ClientFeedback.aspx/Submit",
                    data: JSON.stringify({ "UserName": UserName, "Licenceno": Licenceno, "MobileNo": MobileNo, "Star": Star, "Remark": Remark }),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (result) {
                        swal("Thank You !!", "Your rating and review has been submitted", "success")
                        //location.reload();
                    },
                    error: function (xhr, status, error) {
                        var err = eval("(" + xhr.responseText + ")");
                        console.log(err.Message);
                    }
                });
                
            });
            $(document).on("click", ".confirm",function (){
                window.close();
            });
//            $(".confirm").click(function ()
//                window.top.close();
//});
        });      
        function StarCount(id)
        {Star = id;}
    </script>
</body>
</html>
