<style>
	.custom_margin {
		margin-left: 25px;
		margin-right: 25px;
	}
	.wrs_tickContainer {
            display: none;
        }
        .cke_notification_warning{
            display: none;
        }

	@font-face {
		font-family: 'Shruti';
		src: url("{{ url('public/assets/fonts/ShrutiFont.ttf')}}") format('ttf');
	}
</style>



<div class="row custom_margin">
	<div class="col-md-3 ">
		<div class="form-group {{ $errors->has('board_id') ? ' has-error' : '' }}">
			<label class="control-label" style="">Board <span class="text-danger">*</span></label>
			{!! Form::select('board_id',['' => '---- Select Board ----']+\App\Model\Board::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'board_id','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('board_id') }}</strong></span>
		</div>
	</div>
	<!--<div class="form-group {{ $errors->has('medium_id') ? ' has-error' : '' }}">
            <label class="control-label">Medium <span class="text-danger">*</span></label>
            {!! Form::select('medium_id',App\Model\Medium::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('medium_id') }}</strong></span>
        </div>
		<div class="form-group {{ $errors->has('standard_id') ? ' has-error' : '' }}">
            <label class="control-label">Standard <span class="text-danger">*</span></label>
            {!! Form::select('standard_id',App\Model\Standard::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('standard_id') }}</strong></span>
        </div>-->
	<div class="col-md-3 ">
		<div class="form-group {{ $errors->has('standard_id') ? ' has-error' : '' }}">
			<label class="control-label">Standard <span class="text-danger">*</span></label>
			{!! Form::select('standard_id',['' => '---- Select Standard ----']+(!empty($record)  && !empty($record->standard_id)?$standard:[]) ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'standard_id','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('standard_id') }}</strong></span>
		</div>
	</div>
	<!--<div class="form-group {{ $errors->has('subject_id') ? ' has-error' : '' }}">
            <label class="control-label">Subject <span class="text-danger">*</span></label>
            {!! Form::select('subject_id',App\Model\Subject::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('subject_id') }}</strong></span>
        </div>-->
	<div class="col-md-2 ">
		<div class="form-group {{ $errors->has('semester_id') ? ' has-error' : '' }}">
			<label class="control-label">Semester </label>
			{!! Form::select('semester_id',[''=>'-- Select Semester --']+(!empty($record)  && !empty($record->semester_id)?$semester:[]) ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'semester_id']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('semester_id') }}</strong></span>
		</div>
	</div>
   
	<div class="col-md-2 ">
		<div class="form-group {{ $errors->has('subject_id') ? ' has-error' : '' }}">
			<label class="control-label">Subject <span class="text-danger">*</span></label>
			<select class="form-control js-example-basic-multiple" name="subject_id" id="subject_id" required>
				@if(!empty($record))
				@foreach($subject as $key=>$s)
				<option value="{{$key}}" @if($record['subject_id']==$key) <?php echo 'selected="selected"'; ?> @endif>{{$s}}</option>
				@endforeach
				@endif
			</select>
			<span class="help-block" id="error_subject_id"><strong>{{ $errors->first('subject_id') }}</strong></span>
		</div>
	</div>
	<!--<div class="form-group {{ $errors->has('chapter_id') ? ' has-error' : '' }}">
            <label class="control-label">Chapter <span class="text-danger">*</span></label>
            {!! Form::select('chapter_id',App\Model\Chapter::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('chapter_id') }}</strong></span>
        </div>-->
	<div class="col-md-2 ">
		<div class="form-group {{ $errors->has('chapter_id') ? ' has-error' : '' }}">
			<label class="control-label">Chapter <span class="text-danger">*</span></label>
			<select class="form-control js-example-basic-multiple" name="chapter_id" id="chapter_id" required>
				@if(!empty($record))
				@foreach($chapter as $key=>$c)
				<option value="{{$key}}" @if($record['chapter_id']==$key) <?php echo 'selected="selected"'; ?> @endif>{{$c}}</option>
				@endforeach
				@endif
			</select>
			<span class="help-block" id="error_chapter_id"><strong>{{ $errors->first('chapter_id') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('question_type') ? 'has-error' : '' }}">
			<label class="control-label">Question Type <span class="text-danger">*</span></label><br>
			<div class="form-check form-check-inline">
    {{ Form::radio('question_type', 'question', (empty($record) ||!empty($record) && $record->question_type == 'question'), ['class' => 'form-check-input', 'id' => 'question_type_question', 'required' => 'required']) }}
    <label class="form-check-label" for="question_type_question">Question</label>
</div>
<div class="form-check form-check-inline">
    {{ Form::radio('question_type', 'multiple', (!empty($record) && $record->question_type == 'multiple'), ['class' => 'form-check-input', 'id' => 'question_type_multiple', 'required' => 'required']) }}
    <label class="form-check-label" for="question_type_multiple">Multiple</label>
</div>
<div class="form-check form-check-inline">
    {{ Form::radio('question_type', 'true/false', (!empty($record) && $record->question_type == 'true/false'), ['class' => 'form-check-input', 'id' => 'question_type_true_false', 'required' => 'required']) }}
    <label class="form-check-label" for="question_type_true_false">True/False</label>
</div>
			@if ($errors->has('question_type'))
			<span class="help-block">
				<strong>{{ $errors->first('question_type') }}</strong>
			</span>
			@endif
		</div>
	</div>
	<div class="col-md-3 ">
		<div class="form-group {{ $errors->has('difficulty') ? ' has-error' : '' }}">
			<label class="control-label">Difficulty<span class="text-danger">*</span></label><br>
			{!! Form::select('difficulty',[ '' => 'Select Difficulty','hard' => 'Hard','medium' => 'Medium','easy' => 'Easy'] ,null, ['class' => 'form-control js-example-basic-multiple','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('difficulty') }}</strong></span>
		</div>
	</div>
	<div class="col-md-2">
		<div class="form-group {{ $errors->has('section_id') ? ' has-error' : '' }}">
			<label class="control-label">Section<span class="text-danger">*</span></label><br>
			{!! Form::select('section_id',[ '' => 'Select Type']+(!empty($record)  && !empty($record->section_id)?$section:[]),null, ['class' => 'form-control js-example-basic-multiple','id'=>'section_id','required'=>'required']) !!}
            <span class="help-block" id="error_category_id"><strong>{{ $errors->first('section_id') }}</strong></span>
		</div>
	</div>
	<div class="col-md-2">
		<div class="form-group {{ $errors->has('marks') ? ' has-error' : '' }}">
			<label class="control-label">Marks<span class="text-danger">*</span></label><br>
			{!! Form::number('marks',null, ['class' => 'form-control digit','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('marks') }}</strong></span>
		</div>
	</div>
	<div class="col-md-2">
		<div class="form-group {{ $errors->has('question_line') ? ' has-error' : '' }}">
			<label class="control-label">Question line<span class="text-danger">*</span></label><br>
			{!! Form::number('question_line',null, ['class' => 'form-control digit','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('question_line') }}</strong></span>
		</div>
	</div>


</div>
<div class="row custom_margin">
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('category_id') ? ' has-error' : '' }}">
			<label class="control-label">Category <span class="text-danger">*</span></label>
			{!! Form::select('category_id',['' => '---- Select Category ----']+App\Model\Category::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'category_id','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('category_id') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('reference_id') ? ' has-error' : '' }}">
			<label class="control-label">Reference <span class="text-danger">*</span></label>
			{!! Form::select('reference_id',['' => '---- Select Reference ----'] + App\Model\Reference::all()->pluck('name','id')->toArray() ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'reference_id','required'=>'required']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('reference_id') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('imp') ? ' has-error' : '' }}">
			<label class="control-label">IMP <span class="text-danger"></span></label>
			{!! Form::select('imp',['' => 'Select IMP','Yes' => 'Yes','No' =>'No'] ,null, ['class' => 'form-control js-example-basic-multiple','id'=>'imp']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('imp') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('imp_year') ? ' has-error' : '' }}">
			<label class="control-label">IMP Year<span class="text-danger"></span></label>
			{!! Form::text('imp_year',null, ['class' => 'form-control yearpicker','id'=>'imp']) !!}
			<span class="help-block" id="error_category_id"><strong>{{ $errors->first('imp_year') }}</strong></span>
		</div>
	</div>
	<div class="col-md-12">
		<div class="form-group {{ $errors->has('question_title') ? ' has-error' : '' }}">
			<label class="control-label">Question Title<span class="text-danger"></span></label>
			{!! Form::textarea('question_title',null, ['class' => 'form-control','required'=>'required','rows'=>'2','id'=>'question_title']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('question_title') }}</strong></span>
		</div>
	</div>
	<div id="que_answer" style="display:none;">
	<div class="col-md-12">
		@php $array = ['true','false','A','B','C','D']; @endphp
		<div class="form-group {{ $errors->has('question_answer') ? ' has-error' : '' }}">
			<label class="control-label">Question Answer <span class="text-danger"></span></label>
			{!! Form::textarea('question_answer',!empty($record)?in_array($record->answer,$array)?'':$record->answer:'', ['class' => 'form-control','rows'=>'2','id'=>'question_answer']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('question_answer') }}</strong></span>
		</div>
	</div>
	</div>
	<div id="multiple_option" style="display:none;">
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('optionA') ? ' has-error' : '' }}">
			<label class="control-label">Option A <span class="text-danger"></span></label>
			{!! Form::textarea('optionA',null, ['class' => 'form-control','id'=>'optionA']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('optionA') }}</strong></span>
		</div>
	</div>

	<div class="col-md-3">
		<div class="form-group {{ $errors->has('optionB') ? ' has-error' : '' }}">
			<label class="control-label">Option B <span class="text-danger"></span></label>
			{!! Form::textarea('optionB',null, ['class' => 'form-control','id'=>'optionB']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('optionB') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('optionC') ? ' has-error' : '' }}">
			<label class="control-label">Option C <span class="text-danger"></span></label>
			{!! Form::textarea('optionC',null, ['class' => 'form-control','id'=>'optionC']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('optionC') }}</strong></span>
		</div>
	</div>
	<div class="col-md-3">
		<div class="form-group {{ $errors->has('optionD') ? ' has-error' : '' }}">
			<label class="control-label">Option D <span class="text-danger"></span></label>
			{!! Form::textarea('optionD',null, ['class' => 'form-control','id'=>'optionD']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('optionD') }}</strong></span>
		</div>
	</div>
	</div>
	<div id="answer" style="display:none;">
		<div class="col-md-6" style="margin-bottom:15px;">
			<label class="control-label">Answer<span class="text-danger">*</span></label><br>
			<div id="option" style="display:none;">
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="multiple_answer" id="optionA" value="A" {{ !empty($record) && $record->answer == 'A' ? 'checked' : '' }}>
					Option A
				</label>
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="multiple_answer" id="optionB" value="B" {{ !empty($record) && $record->answer == 'B' ? 'checked' : '' }}>
					Option B
				</label>
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="multiple_answer" id="optionC" value="C" {{ !empty($record) && $record->answer == 'C' ? 'checked' : '' }}>
					Option C
				</label>
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="multiple_answer" id="optionD" value="D" {{ !empty($record) && $record->answer == 'D' ? 'checked' : '' }}>
					Option D
				</label>
				<span class="help-block" id="error_name"><strong>{{ $errors->first('multiple_answer') }}</strong></span>
			</div>
			<div id="true_false" style="display:none">
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="true_false_answer" id="True" value="true" {{ !empty($record) && $record->answer == 'true' ? 'checked' : '' }}>
					True
				</label>
				<label class="btn btn-warning" style="color:white;">
					<input type="radio" name="true_false_answer" id="false" value="false" {{ !empty($record) && $record->answer == 'false' ? 'checked' : '' }}>
					False
				</label>
				<span class="help-block" id="error_name"><strong>{{ $errors->first('true_false_answer') }}</strong></span>
			</div>
		</div>
	</div>
	<div id="formate" style="display:none;">
		<div class="col-md-6" style="margin-bottom:15px;">
			<label class="control-label">Formate<span class="text-danger">*</span></label><br>
			<label class="btn btn-warning" style="color:white;">
				<input type="radio" name="formate" id="noformate" value="no_formate" {{ !empty($record) && $record->formate == 'no_formate' ? 'checked' : '' }}>
				No Formate
			</label>
			<label class="btn btn-warning" style="color:white;">
				<input type="radio" name="formate" id="2_column" value="2_column" {{ !empty($record) && $record->formate == '2_column' ? 'checked' : '' }}>
				2 Column
			</label>
			<label class="btn btn-warning" style="color:white;">
				<input type="radio" name="formate" id="raw_by_raw" value="raw_by_raw" {{ !empty($record) && $record->formate == 'raw_by_raw' ? 'checked' : '' }}>
				Raw By Raw
			</label>
			<span class="help-block" id="error_name"><strong>{{ $errors->first('formate') }}</strong></span>

		</div>
	</div>

	<br><br><br><br>
	<div class="col-md-12">
		<div class="form-group {{ $errors->has('explanation') ? ' has-error' : '' }}">
			<label class="control-label">Explaination -(optional) <span class="text-danger"></span></label>
			{!! Form::textarea('explanation',null, ['class' => 'form-control','rows'=>'1','id'=>'explanation']) !!}
			<span class="help-block" id="error_name"><strong>{{ $errors->first('explanation') }}</strong></span>
		</div>
	</div>

</div>
@section('js')



    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>






		
<script type="text/javascript">
        var record = <?php echo json_encode($record); ?>;
</script>
<script type="text/javascript">
	$(document).ready(function() {
		
		
		$('.js-example-basic-multiple').select2();
		$('.yearpicker').datepicker({
			format: "yyyy",
			viewMode: "years",
			minViewMode: "years",
			autoclose: true
		});
		
		        $('#answer').css('display', 'none');
                $('#option').css('display', 'none');
                $('#formate').css('display', 'none');
                $('#true_false').css('display', 'none');
				$('#multiple_option').css('display', 'none');
				$('#option input, #formate input, #true_false input').removeAttr('required');
				
       
		function updateDisplay(record) {
        // Hide all sections initially
        $('#answer').css('display', 'none');
        $('#option').css('display', 'none');
        $('#formate').css('display', 'none');
        $('#true_false').css('display', 'none');
        $('#multiple_option').css('display', 'none');
		$('#que_answer').css('display', 'none');
        $('#option input, #formate input,#true_false input').removeAttr('required');
        
       
        // Get the selected value of the radio button
        var selectedValue = $('input[type=radio][name=question_type]:checked').val();
            
        // Show and require the relevant sections based on the selected value
        if (selectedValue === 'multiple') {
            $('#answer').css('display', 'block');
            $('#option').css('display', 'block');
            $('#formate').css('display', 'block');
            $('#multiple_option').css('display', 'block');
            $('#option input, #formate input').attr('required', 'required');
			$('#question_answer').val('');
			$('#true_false input[type=radio]').prop('checked', false);
			if (record && record.question_type === 'multiple' ) {
                        $('#option input[type=radio]').each(function() {
                            if ($(this).val() == record.answer) {
                                $(this).prop('checked', true);
                            }
                        });
                        $('#formate input[type=radio]').each(function() {
                            if ($(this).val() == record.formate) {
                                $(this).prop('checked', true);
                            }
                        });
					}
        } else if (selectedValue === 'true/false') {
            $('#answer').css('display', 'block');
            $('#true_false').css('display', 'block');
            $('#true_false input').attr('required', 'required');
			$('#question_answer').val('');
			$('#multiple_option textarea').val('');
			$('#option input[type=radio],#formate input[type=radio]').prop('checked', false);
			if (record && record.question_type === 'true/false' ) {
                        $('#true_false input[type=radio]').each(function() {
                            if ($(this).val() == record.answer) {
                                $(this).prop('checked', true);
                            }
                        });
			}
        }else if(selectedValue === 'question'){
			$('#multiple_option textarea').val('');
			$('#option input[type=radio],#formate input[type=radio]').prop('checked', false);
			$('#true_false input[type=radio]').prop('checked', false);
			$('#que_answer').css('display', 'block');
			if (record && record.question_type === 'question' ) {
                       $('#question_answer').val(record.answer);
			}
			
		}
    }

    // Update the display when the page loads
    updateDisplay(record);

    // Update the display when the radio button changes
    $('input[type=radio][name=question_type]').change(function() {
        updateDisplay(record);
    });
	
   

	});
</script>
<
<script type="text/javascript">

$("body").on("change", "#board_id", function() {
		var row_id = $(this).val();
        var board_id = $('#board_id').val();
		$.ajax({
			type: "GET",
			url: "{{ url('admin/getstandard') }}",
			data: {
				"_token": "{{ csrf_token() }}",
				"board_id":board_id,

			},
			error: function(result) {},
			success: function(result) {
				if (result == '') {
					$('#standard_id option').remove();
				} else {
					$('#standard_id option').remove();
					$('#standard_id').append('<option value="">---- Select Standard ----</option>');
					$.each(result, function(key, value) {
						$('#standard_id')
							.append($('<option>', {
									value: key
								})
								.text(value));
					});
				}
			}
		});
		
	});


	$("body").on("change", "#standard_id", function() {
		var row_id = $(this).val();
        var board_id = $('#board_id').val();
		$.ajax({
			type: "post",
			url: "{{ url('admin/getsubject') }}",
			data: {
				"_token": "{{ csrf_token() }}",
				"standard_id": row_id,
				"board_id":board_id,

			},
			error: function(result) {},
			success: function(result) {
				if (result.subjects == '') {
					$('#subject_id option').remove();
				} else {
					$('#subject_id option').remove();
					$('#subject_id').append('<option value="">---- Select Subject ----</option>');
					$.each(result.subjects, function(key, value) {
						$('#subject_id')
							.append($('<option>', {
									value: key
								})
								.text(value));
					});
				}
				if(result.semesters == '')
				{
					$('#semester_id option').remove();
				}
				else{
					$('#semester_id option').remove();
					$('#semester_id').append('<option value="">---- Select Semester ----</option>');
					$.each(result.semesters, function(key, value) {
						$('#semester_id')
							.append($('<option>', {
									value: key
								})
								.text(value));
					});
				}
			}
		});
		
	});
</script>
<script type="text/javascript">
	$("body").on("change", "#subject_id", function() {
		var row_id = $(this).val();

		$.ajax({
			type: "post",
			url: "{{ url('admin/getchapter') }}",
			data: {
				"_token": "{{ csrf_token() }}",
				"subject_id": row_id
			},
			error: function(result) {},
			success: function(result) {
				if (result.chapter == '') {
					$('#chapter_id option').remove();
				} else {
					$('#chapter_id option').remove();
					$('#chapter_id').append('<option value="">---- Select Chapter ----</option>');
					$.each(result.chapter, function(key, value) {
						$('#chapter_id')
							.append($('<option>', {
									value: key
								})
								.text(value));
					});
				}
				if (result.questiontype == '') {
					$('#section_id option').remove();
				} else {
					$('#section_id option').remove();
					$('#section_id').append('<option value="">---- Select Type ----</option>');
					$.each(result.questiontype, function(key, value) {
						$('#section_id')
							.append($('<option>', {
									value: key
								})
								.text(value));
					});
				}
			}
		});
	});
</script>
<script>
	document.addEventListener("DOMContentLoaded", function() {
    var digitInputs = document.querySelectorAll('.digit');
    digitInputs.forEach(function(input, index, array) {
        input.addEventListener('input', function(event) {
            // Remove non-numeric characters
            this.value = this.value.replace(/\D/g, '');
        });
    });

		CKEDITOR.env.isCompatible = true;
		var mathElements = [
			'math',
			'maction',
			'maligngroup',
			'malignmark',
			'menclose',
			'merror',
			'mfenced',
			'mfrac',
			'mglyph',
			'mi',
			'mlabeledtr',
			'mlongdiv',
			'mmultiscripts',
			'mn',
			'mo',
			'mover',
			'mpadded',
			'mphantom',
			'mroot',
			'mrow',
			'ms',
			'mscarries',
			'mscarry',
			'msgroup',
			'msline',
			'mspace',
			'msqrt',
			'msrow',
			'mstack',
			'mstyle',
			'msub',
			'msup',
			'msubsup',
			'mtable',
			'mtd',
			'mtext',
			'mtr',
			'munder',
			'munderover',
			'semantics',
			'annotation',
			'annotation-xml'
		];
		CKEDITOR.plugins.addExternal('ckeditor_wiris', 'https://ckeditor.com/docs/ckeditor4/4.16.2/examples/assets/plugins/ckeditor_wiris/', 'plugin.js');
	
		CKEDITOR.replace('question_title', {
			extraPlugins: 'ckeditor_wiris,image2,uploadimage',
			extraAllowedContent: mathElements.join(' ') + '(*)[*]{*};img[data-mathml,data-custom-editor,role](Wirisformula)',
			filebrowserUploadUrl: "{{route('admin.question.upload', ['_token' => csrf_token() ])}}",
			filebrowserUploadMethod: 'form',
			removeButtons: 'ExportPdf,Form,ImageButton',
			font_names: 
			'Shruti/Shruti; Calibri/Calibri;Noto Sans Gujarati/Noto Sans Gujarati;' + 
			CKEDITOR.config.font_names, 
			
		});
		CKEDITOR.replace('explanation', {
			extraPlugins: 'ckeditor_wiris,image2,uploadimage',
			extraAllowedContent: mathElements.join(' ') + '(*)[*]{*};img[data-mathml,data-custom-editor,role](Wirisformula)',
			filebrowserUploadUrl: "{{route('admin.question.upload', ['_token' => csrf_token() ])}}",
			filebrowserUploadMethod: 'form',
			removeButtons: 'ExportPdf,Form,ImageButton',  
			filebrowserBrowseUrl: "{{asset('ckeditor/filemanager/dialog.php')}}?type=2&editor=ckeditor&fldr=",
			filebrowserImageBrowseUrl: "{{asset('ckeditor/filemanager/dialog.php')}}?type=1&editor=ckeditor&fldr=",
		});
		CKEDITOR.replace('question_answer', { 
			extraPlugins: 'ckeditor_wiris,image2,uploadimage',
			extraAllowedContent: mathElements.join(' ') + '(*)[*]{*};img[data-mathml,data-custom-editor,role](Wirisformula)',
			filebrowserUploadUrl: "{{route('admin.question.upload', ['_token' => csrf_token() ])}}",
			filebrowserUploadMethod: 'form',
			removeButtons: 'ExportPdf,Form,ImageButton',
			filebrowserBrowseUrl: "{{asset('ckeditor/filemanager/dialog.php')}}?type=2&editor=ckeditor&fldr=",
			filebrowserImageBrowseUrl: "{{asset('ckeditor/filemanager/dialog.php')}}?type=1&editor=ckeditor&fldr=",
		});


		CKEDITOR.replace('optionA', {
			toolbar: [{
				name: 'clipboard',
				items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
			}],
			language: 'en',
			image: {
				toolbar: ['imageTextAlternative']
			},
			table: {
				contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
			},
			licenseKey: '', // Replace with your license key if applicable
		});
		CKEDITOR.replace('optionB', {
			toolbar: [{
				name: 'clipboard',
				items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
			}],
			language: 'en',
			image: {
				toolbar: ['imageTextAlternative']
			},
			table: {
				contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
			},
			licenseKey: '', // Replace with your license key if applicable
		});
		CKEDITOR.replace('optionC', {
			toolbar: [{
				name: 'clipboard',
				items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
			}],
			language: 'en',
			image: {
				toolbar: ['imageTextAlternative']
			},
			table: {
				contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
			},
			licenseKey: '', // Replace with your license key if applicable
		});
		CKEDITOR.replace('optionD', {
			toolbar: [{
				name: 'clipboard',
				items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']
			}],
			language: 'en',
			image: {
				toolbar: ['imageTextAlternative']
			},
			table: {
				contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
			},
			licenseKey: '', // Replace with your license key if applicable
		}); 
	});
</script>
@endsection