

<script>
    var editor_config = {
            path_absolute : "/",
            selector: "textarea",
            plugins: [
                "advlist autolink lists link image charmap print preview hr anchor pagebreak",
                "searchreplace wordcount visualblocks visualchars code fullscreen",
                "insertdatetime media nonbreaking save table contextmenu directionality",
                "emoticons template paste textcolor colorpicker textpattern"
            ],
            toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
            relative_urls: false,
            file_browser_callback : function(field_name, url, type, win) {
                var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
                var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;

                var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
                if (type == 'image') {
                    cmsURL = cmsURL + "&type=Images";
                } else {
                    cmsURL = cmsURL + "&type=Files";
                }

                tinyMCE.activeEditor.windowManager.open({
                    file : cmsURL,
                    title : 'Filemanager',
                    width : x * 0.8,
                    height : y * 0.8,
                    resizable : "yes",
                    close_previous : "no"
                });
            }
        };

        tinymce.init(editor_config);
</script>


<!-- ------Get Department Data---- -->
<script>
    $(document).ready(function(){
         $('select[name="classname_id"]').on('change',function(){
            var classname_id = $(this).val();
            if(classname_id){
            $.ajax({
            url: "<?php echo e(url('/get_department/')); ?>/" + classname_id,
            type:"GET",
            dataType:"json",
            success:function(data){
                $("#department_id").empty();
                $("#department_id").append('<option value="" selected disabled>বিভাগ সিলেক্ট করুন</option>');
                $.each(data,function(key,value){
                    
                    $("#department_id").append('<option value="'+value.id+'">'+value.department_name+'</option>');
                });
              },
            });
            }else{
                alert('danger');
            }   
            
        }); 
            
        });
</script>


<!-- ------Get Subject Data---- -->
<script>
    $(document).ready(function(){
         $('select[name="department_id"]').on('change',function(){
            var department_id = $(this).val();
            if(department_id){

                console.log(department_id);
            $.ajax({
            url: "<?php echo e(url('/get_subject/')); ?>/" + department_id,
            type:"GET",
            dataType:"json",
            success:function(data){
                $("#subject_id").empty();
                $("#subject_id").append('<option value="" selected disabled>বিষয় সিলেক্ট করুন</option>');
                $.each(data,function(key,value){
                    
                    $("#subject_id").append('<option value="'+value.id+'">'+value.subject_name+'</option>');
                });
              },
            });
            }else{
                alert('danger');
            }   
            
        }); 
            
        });
</script>


<!-- ------Get Chapter Data---- -->
<script>
    $(document).ready(function(){
         $('select[name="subject_id"]').on('change',function(){
            var subject_id = $(this).val();
            if(subject_id){

                console.log(subject_id);
            $.ajax({
            url: "<?php echo e(url('/get_chapter/')); ?>/" + subject_id,
            type:"GET",
            dataType:"json",
            success:function(data){
                $("#chapter_id").empty();
                $("#chapter_id").append('<option value="" selected disabled>অধ্যায় সিলেক্ট করুন</option>');
                $.each(data,function(key,value){
                    
                    $("#chapter_id").append('<option value="'+value.id+'">'+value.chapter_name+'</option>');
                });
              },
            });
            } 
        }); 
            
        });



        //To add exam-data...
        function addExamData() {
            var examName = $("#exam_name").val();

            var url = "<?php echo e(route('add-exam-data')); ?>";
            if(examName != ''){
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
                });
                $.ajax({
                    type: 'post',
                    url: url,
                    data: {
                        examName: examName
                    },
                    success: function (data) {
                        $("#exam_id").html(data);
                        // $("#addExamData").modal('hide');
                    }
                });
            }
        }
</script><?php /**PATH E:\Project\Personal-Project\Office-Project\update\test-paper-final\resources\views/admin/post/partial/script.blade.php ENDPATH**/ ?>