
<div class="modal fade stick-up " id="add_Evaluation_Question" tabindex="-1" role="dialog" aria-hidden="true" style="width:40%;margin:0 auto">
    <div class="modal-dialog  width:5px;">
        <div class="modal-content width: 494px;">
            <div class="modal-header clearfix text-left">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="pg-close fs-14"></i></button>
                <h5><span class="semi-bold"><?php print CommonLanguage::getMessage('new_ev_question'); ?></span></h5>
                <div id="addQuestionAlert"></div>
            </div>
            <div class="modal-body">
                <form id="AddQuestionPostForm" method="POST" onsubmit="return false">
                    <div class="row">
                        <div class="col-md-12" >
                            <div class="col-md-12">
                                <div><label><?php print CommonLanguage::getMessage('question'); ?> </label><span class="red-star">*</span></div>
                                <div class="input-group required">
                                    <span class="input-group-addon bg-success">
                                        <i class="fa fa-question-circle inputIcon" ></i>
                                    </span>
                                    <textarea type="text" placeholder="<?php print CommonLanguage::getMessage('question'); ?>" id="Question_Name" name="Question_Name" class="form-control "  style=" word-wrap: break-word; resize:vertical " required></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer ">
                <div class="pull-right">
                    <button class="btn btn-default" id="CloseQuestion"   > <?php print CommonLanguage::getMessage('Close'); ?> </button>
                    <button class="btn btn-success" id="SubmitQuestion"  > <?php print CommonLanguage::getMessage('Save'); ?>   </button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var Submitted_Successfully = <?php echo json_encode(CommonLanguage::getMessage('Submitted_Successfully')); ?>,
            Failed_Submit = <?php echo json_encode(CommonLanguage::getMessage('Failed_Submit')); ?>,
            Required_Fields = <?php echo json_encode(CommonLanguage::getMessage('Required_Fields')); ?>;
    $(function () {
        $("#SubmitQuestion").on("click", function () {
            if($("#Question_Name").val() ==''){
                $("#addQuestionAlert").addClass("alert alert-danger").show().html(Required_Fields);
                return;
            }
//            $("#addQuestionAlert").attr("class", "").html("")
//            $("#IsBusy").remove();
//            $("#add_Evaluation_Question").append('<div id="IsBusy" style="position:absolute;left:0;right:0;top:0px;height:100%;background:rgba(255,255,255,0.9);z-index:9999;opacity:0"><img class="image-responsive-height demo-mw-50" src="img/demo/progress.svg" alt="Progress" style="position: absolute;left: 50%;top: 50%;margin: -25px 0 0 -25px;" /></div>');
//            $("#IsBusy").animate({opacity: 1});
            var Data = {
                Question_Name: $("#Question_Name").val()
            }
            $.ajax({
                url: 'HRMAjax/AddEvaluationQuestionRequest',
                data: Data,
                method: "POST",
                complete: function (v1, v2) {
                    if (v2 = 'success') {
                        $("#IsBusy").remove();
                        $("#addQuestionAlert").addClass("alert alert-success").show().html(Submitted_Successfully);
                        setTimeout(function () {
                            $("#add_Evaluation_Question").modal('hide');
                            $("#addQuestionAlert").hide();
                        }, 1500)
                    } else {
                        $("#addQuestionAlert").addClass("alert alert-danger").show().html(Failed_Submit);
                    }
                    $("#IsBusy").remove();
                }
            })
        })
        $("#CloseQuestion").on("click", function () {
            $("#add_Evaluation_Question input").val('');
            //$("#AddProductPostForm").validate().resetForm();
            $("#add_Evaluation_Question").modal("hide");
        })
        $("#add_Evaluation_Question input").val('');
    })
</script>