@extends('backend._partials.app')
@section('maincontent')
<?php $mode='edit'; $id=$role->id; ?>
    <style>
        .accordion {
            border-bottom: 0;
        }

        .accordion .panel-heading {
            background-color: #F5F5F5;
            padding-left: 15px;
            padding-right: 15px;
        }

        .panel-default > .panel-heading {
            position: relative;
        }

        .accordion .panel-heading .fa {
            position: absolute;
            right: 15px;
            top: 18px;
        }

        .panel-group .accordion .panel-heading + .panel-collapse > .panel-body {
            border-top: none;
            box-shadow: none;
        }

        .menu-row li,
        .menu-row ul {
            display: inline-block;
        }

        .menu-row li label,.menu-row > input[type=checkbox] + span {
            font-weight: 400;
            cursor: pointer;
        }

        .menu-row ul li {
            padding-left: 10px;
        }

        .menu-row ul {
            float: right;
            padding-left: 0;
        }

        .menu-row {
            display: block !important;
            padding-left: 0;
            margin-bottom: 0;
        }

        .menu-row input[type=checkbox] {
            margin-right: 5px;
        }
        .onlymenu td span{
            font-weight: 400;
            cursor: pointer;
            padding-left: 5px;
        }

    </style>
{!! Form::open(['url'=>'permission','id'=>'myForm']) !!}
    {!! Form::hidden('role_id',$role->id) !!}
    <div class="col-sm-12">
        <div class="card">
                <p class="text-center" style="padding:10px 0px;">Permission For: <strong>{{@$role->title}}</strong>
                    <button class="btn btn-info btn-fill btn-sm pull-right" style="margin:-3px 5px;">Save Changes</button>
                </p>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="card">
            <div class="content">
                <div class="panel-group" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default accordion">
                        <div class="panel-heading" role="tab">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" href="#collapseOne" >
                                    Basic Setup<i class="fa fa-plus" style="display: none"></i><i class="fa fa-minus"></i></a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body  table-full-width">

                                <table class="table rota-table table-bordered">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox"class="check-all"> Sub Menu <span class="pull-right">Permission</span></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="basic_setup[]" value="designation#designation.index"/><span>{{Lang::get('nav.designation')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['designation.index','designation.create','designation.store'])==true ? 'checked':'' }} @endif value="{{json_encode(['designation.index','designation.create','designation.store'])}}">{{Lang::get('nav.add')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['designation.index','designation.edit','designation.update'])==true ? 'checked':'' }} @endif value="{{json_encode(['designation.index','designation.edit','designation.update'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['designation.index','deleteDesignation'])==true ? 'checked':'' }} @endif value="{{json_encode(['designation.index','deleteDesignation'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="basic_setup[]" value="leave_type#client-leave-type.index"/><span>{{Lang::get('nav.leave_type')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['client-leave-type.index','client-leave-type.create','client-leave-type.store','holiday-type.create','holiday-type.store'])==true ? 'checked':'' }} @endif value="{{json_encode(['client-leave-type.index','client-leave-type.create','client-leave-type.store','holiday-type.create','holiday-type.store'])}}">{{Lang::get('nav.add')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['client-leave-type.index','client-leave-type.edit','client-leave-type.update','holiday-type.edit','holiday-type.update'])==true ? 'checked':'' }} @endif value="{{json_encode(['client-leave-type.index','client-leave-type.edit','client-leave-type.update','holiday-type.edit','holiday-type.update'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['client-leave-type.index','clientLeaveTypeDelete'])==true ? 'checked':'' }} @endif value="{{json_encode(['client-leave-type.index','clientLeaveTypeDelete','holidayTypeDelete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="basic_setup[]" value="user_group#user-group.index"/><span>{{Lang::get('nav.user_group')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-group.index','user-group.create','user-group.store'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-group.index','user-group.create','user-group.store'])}}">{{Lang::get('nav.add')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-group.index','user-group.edit','user-group.update'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-group.index','user-group.edit','user-group.update'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-group.index','userGroupDelete'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-group.index','userGroupDelete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="basic_setup[]" value="event_type#event-type.index"/><span>{{Lang::get('nav.event_type')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['event-type.index','event-type.create','event-type.store'])==true ? 'checked':'' }} @endif value="{{json_encode(['event-type.index','event-type.create','event-type.store'])}}">{{Lang::get('nav.add')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['event-type.index','event-type.edit','event-type.update'])==true ? 'checked':'' }} @endif value="{{json_encode(['event-type.index','event-type.edit','event-type.update'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['event-type.index','clientEventTypeDelete'])==true ? 'checked':'' }} @endif value="{{json_encode(['event-type.index','clientEventTypeDelete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>

                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default accordion">
                        <div class="panel-heading" role="tab">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" href="#collapseTwo" >
                                    {{Lang::get('nav.leave_or_exchange')}}<i class="fa fa-plus"></i><i class="fa fa-minus" style="display: none"></i></a>
                            </h4>
                        </div>
                        <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body table-full-width">

                                <table class="table rota-table table-bordered">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox"class="check-all"> Sub Menu <span class="pull-right">Permission</span></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="leave_or_exchange[]" value="leave#user-leave"/><span>{{Lang::get('nav.leave')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-leave','user-leave.post','user-leave-apply','user-leave-apply.post','leave-notification-view'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-leave','user-leave.post','user-leave-apply','user-leave-apply.post','leave-notification-view'])}}">{{Lang::get('nav.leave_apply')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-leave','leave_apply_edit','leave_apply_edit.post'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-leave','leave_apply_edit','leave_apply_edit.post'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-leave','leave-apply-delete'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-leave','leave-apply-delete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="leave_or_exchange[]" value="exchange#exchange"/><span>{{Lang::get('nav.exchange')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['exchange','exchange.post','exchange-apply','exchange-apply.post','exchange-notification-view'])==true ? 'checked':'' }} @endif value="{{json_encode(['exchange','exchange.post','exchange-apply','exchange-apply.post','exchange-notification-view'])}}">{{Lang::get('nav.leave_apply')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['exchange','exchange-edit','exchange-edit.post'])==true ? 'checked':'' }} @endif value="{{json_encode(['exchange','exchange-edit','exchange-edit.post'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['exchange','exchange-delete'])==true ? 'checked':'' }} @endif value="{{json_encode(['exchange','exchange-delete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>

                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default accordion">
                        <div class="panel-heading" role="tab">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" href="#collapseThree" >
                                    {{Lang::get('nav.reports')}}<i class="fa fa-plus"></i><i class="fa fa-minus" style="display: none"></i></a>
                            </h4>
                        </div>
                        <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body table-full-width">

                                <table class="table rota-table table-bordered">
                                    <thead>
                                    <tr>
                                        <th><input type="checkbox"class="check-all"> Sub Menu <span class="pull-right">Permission</span></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="reports[]" value="attendance#attendance-details"/><span>{{Lang::get('nav.attendance')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['attendance-details','attendance-details.post'])==true ? 'checked':'' }} @endif value="{{json_encode(['attendance-details','attendance-details.post'])}}">{{Lang::get('nav.view')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="reports[]" value="leave#leave-reports"/><span>{{Lang::get('nav.leave')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['leave-reports'])==true ? 'checked':'' }} @endif value="{{json_encode(['leave-reports','leave-reports.post'])}}">{{Lang::get('nav.view')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ul class="menu-row">
                                                <li class="menu-row">
                                                    <input type="checkbox" name="reports[]" value="exchange#exchange-reports"/><span>{{Lang::get('nav.exchange')}}</span>
                                                    <ul>
                                                        <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['exchange-reports'])==true ? 'checked':'' }} @endif value="{{json_encode(['exchange-reports','exchange-reports.post'])}}">{{Lang::get('nav.view')}}</label></li>
                                                    </ul>
                                                </li>
                                            </ul>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
<div class="col-sm-6">
    <div class="card">
        <div class="content">
            <div class="panel-group" role="tablist" aria-multiselectable="true">
                <div class="panel panel-default accordion">
                    <div class="panel-heading" role="tab">
                        <h4 class="panel-title">
                            <a role="button" data-toggle="collapse" href="#collapseFive" >
                                Other Permission<i class="fa fa-plus" style="display: none"></i><i class="fa fa-minus"></i></a>
                        </h4>
                    </div>
                    <div id="collapseFive" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                        <div class="panel-body table-full-width">

                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td>
                                        <ul class="menu-row">
                                            <li class="menu-row">
                                                <input type="checkbox" name="dashboard" value="dashboard"/><span>{{Lang::get('nav.dashboard')}}</span>
                                                <ul>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['in','out','taskSubmit','taskUpdate'])==true ? 'checked':'' }} @endif value="{{json_encode(['in','out','taskSubmit','taskUpdate'])}}">{{Lang::get('nav.in_out')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['userWiseEvent'])==true ? 'checked':'' }} @endif value="{{json_encode(['userWiseEvent'])}}">{{Lang::get('nav.calendar')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['in-out-record'])==true ? 'checked':'' }} @endif value="{{json_encode(['in-out-record'])}}">{{Lang::get('nav.in_out_record')}}</label></li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <ul class="menu-row">
                                            <li class="menu-row">
                                                <input type="checkbox" name="user" value="user.index"/><span>{{Lang::get('nav.user')}}</span>
                                                <ul>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user.index','user.create'])==true ? 'checked':'' }} @endif value="{{json_encode(['user.index','user.create','user.store'])}}">{{Lang::get('nav.add')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user.index','user.edit','user.update'])==true ? 'checked':'' }} @endif value="{{json_encode(['user.index','user.edit','user.update'])}}">{{Lang::get('nav.edit')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user.index','userDelete'])==true ? 'checked':'' }} @endif value="{{json_encode(['user.index','userDelete'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['user-details-report','updateUserAttendance'])==true ? 'checked':'' }} @endif value="{{json_encode(['user-details-report','updateUserAttendance','daily-in-out-report','deleteAttendance'])}}">{{Lang::get('nav.attendance_modify')}}</label></li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <ul class="menu-row">
                                            <li class="menu-row">
                                                <input type="checkbox" name="event_setup" value="event"/><span>{{Lang::get('nav.event_setup')}}</span>
                                                <ul>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['loadCalendar','selectEventType','getEvent','saveEvent','getMembersByUserGroup','getEventByMonth','deleteEvent'])==true ? 'checked':'' }} @endif value="{{json_encode(['loadCalendar','selectEventType','getEvent','saveEvent','getMembersByUserGroup','getEventByMonth','deleteEvent'])}}">{{Lang::get('nav.add')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['loadCalendar','deleteEvent'])==true ? 'checked':'' }} @endif value="{{json_encode(['loadCalendar','deleteEvent'])}}">{{Lang::get('nav.delete')}}</label></li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <ul class="menu-row">
                                            <li class="menu-row">
                                                <input type="checkbox" name="leave_exchange_manage" value="leave-manage"/><span>{{Lang::get('nav.leave_exchange_manage')}}</span>
                                                <ul>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['leave-manage','leave-manage.post'])==true ? 'checked':'' }} @endif value="{{json_encode(['leave-manage','leave-manage.post'])}}">{{Lang::get('nav.leave')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['exchange-manage','reply-exchange-comment'])==true ? 'checked':'' }} @endif value="{{json_encode(['exchange-manage','reply-exchange-comment'])}}">{{Lang::get('nav.exchange')}}</label></li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <ul class="menu-row">
                                            <li class="menu-row">
                                                <input type="checkbox" name="access_control" value="acl"/><span>{{Lang::get('nav.access_control')}}</span>
                                                <ul>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['acl','roleSave'])==true ? 'checked':'' }} @endif value="{{json_encode(['acl','roleSave','roleEditModal','deleteRole','roleUpdate','roleCreateModal'])}}">{{Lang::get('nav.role_manage')}}</label></li>
                                                    <li><label><input type="checkbox"  name="routes[]" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['acl','permission','permission.post'])==true ? 'checked':'' }} @endif value="{{json_encode(['acl','permission','permission.post'])}}">{{Lang::get('nav.permission_manage')}}</label></li>
                                                </ul>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr class="onlymenu">
                                    <td><label><input type="checkbox" name="rota_setup" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['shift-assign-modal'])==true ? 'checked':'' }} @endif value="{{json_encode(['route'=>'rota-setup','others'=>['shift-assign-modal','shift-edit-modal','shift-edit-modal.post','shift-assign-modal-all','shift-assign','shift-assign-all','rotaNextWeek','rotaPrevWeek','deleteRota','copyRota','pasteRota','clearWeekRota','weekShift','copyIndividualRota','pasteIndividualRota']])}}"/><span>{{Lang::get('nav.rota_setup')}}</span></label></td>
                                </tr>

                                <tr class="onlymenu">
                                    <td><label><input type="checkbox" name="my_report" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['my-report.post','my-report'])==true ? 'checked':'' }} @endif value="{{json_encode(['route'=>'my-report','others'=>['my-report.post','details-view-report']])}}"/><span>{{Lang::get('nav.my_report')}}<small> (User's daily attendance report. recommended for Employee)</small></span></label></td>
                                </tr>
                                <tr class="onlymenu">
                                    <td><label><input type="checkbox" name="my_rota" @if($mode=='edit') {{ Helper::urlGroupCheck($id,['my-rota','getMyRotaData'])==true ? 'checked':'' }} @endif value="{{json_encode(['route'=>'my-rota','others'=>['getMyRotaData']])}}"/><span>{{Lang::get('nav.my_rota')}}<small> (User's rota report. recommended for Employee)</small></span></label></td>
                                </tr>

                                </tbody>
                            </table>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

{!! Form::close() !!}
    <script>
        // panel icon change on opem
        $('.panel-collapse').on('show.bs.collapse', function() {
            $(this).parent('.panel').find('.fa-minus').show();
            $(this).parent('.panel').find('.fa-plus').hide();
        })
        $('.panel-collapse').on('hide.bs.collapse', function() {
            $(this).parent('.panel').find('.fa-minus').hide();
            $(this).parent('.panel').find('.fa-plus').show();
        })
        // select & unselect
        function checkedParent(input) {
            $(input).parent().find('li input[type=checkbox]').prop('checked', $(input).is(':checked'));
            var sibs = false;
            $(input).closest('ul').children('li').each(function() {
                if ($('input[type=checkbox]', this).is(':checked')) sibs = true;
            })
            $(input).parents('ul').prev().prev().prop('checked', sibs);
        }


        $('.menu-row input[type=checkbox]').click(function() {
            checkedParent(this);
        });
        $('.menu-row input[type=checkbox]:checked').each(function() {
            checkedParent(this);
        });

        $(".menu-row > input[type=checkbox] + span").click(function() {
            $(this).prev().trigger('click');
        });
        $(".check-all").click(function() {
            if ($(this).is(':checked')) {
                $(this).closest('thead').next().find("input[type=checkbox]").each(function() {
                    $(this).prop("checked", true);
                });

            } else {
                $(this).closest('thead').next().find("input[type=checkbox]").each(function() {
                    $(this).prop("checked", false);
                });
            }
        });
    </script>

@endsection