KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/_hpe.edukrypt.in/resources/views/admin/mcq/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/_hpe.edukrypt.in/resources/views/admin/mcq/mcq-options-list.blade.php
@extends('admin.layout')
@section('content')

    <!-- begin::main content -->
    <main class="main-content">
        <div class="container">
            <!-- begin::page header -->
            <div class="page-header">
                <h3>Question's Option List</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
                        <li class="breadcrumb-item"><a href="{{ asset('admin/mcq-question-list') }}">MCQ Question List</a>
                        </li>
                        <li class="breadcrumb-item active" aria-current="page">Option List</li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->
            <x-flashMessage />

            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Question</h4>
                    <hr>
                    <h5>
                        {!! $mcq_question->question !!}
                    </h5>
                    <hr>
                    @if ($mcq_question->type == 'mcq' || $mcq_question->type == 'single_mcq')
                        @if (count($mcq_options) < 6)
                            <a href="{{ asset('admin/add-new-option/' . $mcq_question->id) }}"
                                class="btn btn-success text-white m-r-10">
                                <i class="fa fa-plus"></i>&nbsp; Add New Choice</a>
                        @endif
                    @elseif($mcq_question->type == 'true_false')
                        @if (count($mcq_options) < 2)
                            <a href="{{ asset('admin/add-new-option/' . $mcq_question->id) }}"
                                class="btn btn-success text-white m-r-10">
                                <i class="fa fa-plus"></i>&nbsp; Add New Choice</a>
                        @endif
                    @endif
                </div>
                <div class="card-body">
                    @if (isset($mcq_options))
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered">
                                <thead>
                                    <tr>
                                        <th>#ID</th>
                                        <th>Value</th>
                                        <th>Sorting</th>
                                        <th>Correct</th>
                                        <th>Action</th>
                                    </tr>
                                </thead>
                                <tbody>

                                    @if (!empty($mcq_options))
                                        @foreach ($mcq_options as $mcq_option)
                                            <tr>
                                                <td>
                                                    {{ $mcq_option->id }}
                                                </td>
                                                <td>{!! $mcq_option->options !!}</td>
                                                <td>{{ $mcq_option->sort_order }}</td>
                                                <td>
                                                    @if ($mcq_question->type == 'mcq')
                                                        <input {{ $mcq_option->correct == true ? 'checked' : '' }}
                                                            type="checkbox" data-type="{{ $mcq_question->type }}"
                                                            data-question_id="{{ $mcq_question->id }}"
                                                            data-option_id="{{ $mcq_option->id }}"
                                                            value="{{ $mcq_option->id }}" name="correct_option"
                                                            class="correct_option" />
                                                    @elseif($mcq_question->type == 'single_mcq')
                                                        <input {{ $mcq_option->correct == true ? 'checked' : '' }}
                                                            type="radio" data-type="{{ $mcq_question->type }}"
                                                            data-question_id="{{ $mcq_question->id }}"
                                                            data-option_id="{{ $mcq_option->id }}"
                                                            value="{{ $mcq_option->id }}" name="correct_option"
                                                            class="correct_option" />
                                                    @else
                                                        <input {{ $mcq_option->correct == true ? 'checked' : '' }}
                                                            type="radio" data-type="{{ $mcq_question->type }}"
                                                            data-question_id="{{ $mcq_question->id }}"
                                                            data-option_id="{{ $mcq_option->id }}"
                                                            value="{{ $mcq_option->id }}" name="correct_option"
                                                            class="correct_option" />
                                                    @endif

                                                </td>

                                                <td>
                                                    <?php
                                                    $permission = App\Helpers\PermissionActivity::getPermissionByAdminId(session('loggedIn')['id'], 7);
                                                    ?>

                                                    @if ($permission == 'write')
                                                        <a href="{{ asset('admin/edit-mcq-option/' . $mcq_option->id) }}"><i
                                                                class="fa fa-edit text-success"></i></a>
                                                    @endif

                                                    @if ($permission == 'delete')
                                                        <a class="btn btn-sm btn-primary"
                                                            href="{{ asset('admin/edit-mcq-option/' . $mcq_option->id . '/' . $mcq_question->id) }}"><i
                                                                class="fa fa-edit text-white"></i></a>
                                                        <a class="btn btn-sm btn-danger delete-confirm"
                                                            href="{{ asset('admin/delete-mcq-option/' . $mcq_option->id) }}"><i
                                                                class="fa fa-trash text-white"></i></a>
                                                    @endif
                                                </td>
                                            </tr>
                                        @endforeach
                                    @else
                                        <h1>No Record Found!!</h1>
                                    @endif

                                </tbody>

                            </table>
                            <div class="pagination-block">
                                @if (isset($_GET['query']))
                                    {{ $mcq_options->appends(['query' => $_GET['query']])->links('admin.includes.paginationlinks') }}
                                @else
                                    {{ $mcq_options->links('admin.includes.paginationlinks') }}
                                @endif
                                <label>Total Record Found- <?php echo count($mcq_options); ?></label>
                            </div>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </main>
    <!-- end::main content -->

@endsection
@push('footer-script')
    <!-- begin::dataTable -->
    <script>
        $(document).ready(function() {

            $('.correct_option').change(function() {
                if (confirm('Do you want to change correct option.')) {
                    var correct = $(this).is(':checked');
                    var type = $(this).data('type');
                    var option_id = $(this).data('option_id');
                    var question_id = $(this).data('question_id');

                    $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                    });

                    $.ajax({
                        url: "{{ asset('admin/change-mcq-option') }}",
                        type: 'POST',
                        data: {
                            "correct": (correct == true ? '1' : '0'),
                            "type": type,
                            "option_id": option_id,
                            "question_id": question_id,
                        },
                        success: function(json) {
                            location.reload();
                        }
                    });
                }
            });

            $('#change_correct_option').click(function() {
                var option_id = $('input[name="correct_option"]:checked').val();
                var serial = $('input[name="correct_option"]:checked').data('serial');
                alert(option_id + ", " + serial);
                return false;
                $.ajaxSetup({
                    headers: {
                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                    }
                });
                var url = "{{ asset('admin/change-mcq-option') }}";
                $.ajax({
                    url: url,
                    type: 'POST',
                    data: {
                        "option_id": option_id,
                        "question_id": '{{ $mcq_question->id }}',
                        "serial": serial
                    },
                    success: function(json) {
                        var arr = JSON.parse(json);
                        if (arr.status == true) {
                            alert("Success");
                        } else {
                            alert("failed");
                        }
                        return false;
                    }
                });
            });
        });
    </script>
    <!-- end::dataTable -->
@endpush

Anon7 - 2021