@php
$modules = DB::table('gnr_module')->where('status', 1)->orWhere('id', 5)->select('id','name','code','status')->get();
$subFunctions = DB::table('gnr_sub_function')->select('id','subfunctionName')->get();
@endphp
{{-- /////////// --}}
@foreach ($modules as $index => $module2)
@php
$functions = DB::table('gnr_function')->where('moduleIdFK',$module2->id)->select('id','name')->orderBy('name')->get();
@endphp
{{-- Print Functions --}}
@foreach($functions as $function)
@if($module2->status == 0 && $module2->name == 'HR & Payroll'
&& ($function->name == 'Employee List' || $function->name == 'Transfer' || $function->name == 'Transfer History' || $function->name == 'Resign' || $function->name == 'Resign Cancel' || $function->name == 'Employee Accounts' || $function->name == 'Promotion' || $function->name == 'Position'))
{!! Form::label($function->name,$function->name,['class'=>'textBold']) !!}
{!! Form::checkbox('checkAll', null, false,['class'=>'checkAll']) !!}
{!! Form::label($function->name,'Check/Uncheck All') !!}
@foreach($subFunctions as $subFunction)
{!! Form::checkbox($function->name, $subFunction->id, false,['moduleId'=>$module2->id,'functionId'=>$function->id,'class'=>'actions checkItem_'. $module2->id . '_' . $function->id . '_' . $subFunction->id]) !!}
{!! Form::label($subFunction->subfunctionName,$subFunction->subfunctionName) !!}
@endforeach
@elseif($module2->status == 1)
{!! Form::label($function->name,$function->name,['class'=>'textBold']) !!}
{!! Form::checkbox('checkAll', null, false,['class'=>'checkAll']) !!}
{!! Form::label($function->name,'Check/Uncheck All') !!}
@foreach($subFunctions as $subFunction)
{!! Form::checkbox($function->name, $subFunction->id, false,['moduleId'=>$module2->id,'functionId'=>$function->id,'class'=>'actions checkItem_'. $module2->id . '_' . $function->id . '_' . $subFunction->id]) !!}
{!! Form::label($subFunction->subfunctionName,$subFunction->subfunctionName) !!}
@endforeach
@endif
@endforeach
{{-- End Print Functions --}}
@endforeach