Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 35 |
| AttendanceRequestController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 8 |
210 | |
0.00% |
0 / 35 |
| index | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| create | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
| store | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 8 |
|||
| show | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| edit | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| update | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| destroy | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| updateAttendancePeriod | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 8 |
|||
| <?php | |
| namespace App\Http\Controllers\Setting; | |
| use App\Http\Controllers\Controller; | |
| use Illuminate\Http\Request as Request; | |
| use App\Models\Admin\Setting; | |
| use App\Models\Admin\Timezone; | |
| use App\Helpers\AttendanceHelper; | |
| use Laminas\Diactoros\Response; | |
| use Session; | |
| class AttendanceRequestController extends Controller | |
| { | |
| /** | |
| * Display a listing of the resource. | |
| * | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function index() | |
| { | |
| } | |
| /** | |
| * Show the form for creating a new resource. | |
| * | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function create(Request $request ) | |
| { | |
| $title = '/Attendance Control'; | |
| // $value = $request->input('thisvalue'); | |
| $setting = Setting::pluck('value', 'name')->all(); // Setting::all(); | |
| $currentSelectedDay = Setting::where('name','=','attendance_period')->first(); | |
| if($currentSelectedDay){ | |
| $currentSelectedDays = $currentSelectedDay->value; | |
| }else{ | |
| $currentSelectedDays= 0; | |
| } | |
| $currentSelectedTime = Setting::where('name','=','attendance_freq')->first(); | |
| if($currentSelectedTime){ | |
| $currentSelectedTimes = $currentSelectedTime->value; | |
| } | |
| else{ | |
| $currentSelectedTimes = 0; | |
| } | |
| // $setting=[]; | |
| // foreach($settings as $value) { | |
| // $setting[$value['name']] = $value['value']; | |
| // } | |
| // For Attendance Marking | |
| $val = AttendanceHelper::getAttendanceMarkValue(); | |
| $valTeam = AttendanceHelper::getAttendanceTeam($request); | |
| $valUser = AttendanceHelper::getAttendanceUser($request); | |
| return view('administrationForms.Setting.attendanceRequest', compact('title','currentSelectedDays','currentSelectedTimes','val','valTeam','valUser'))->with('setting',$setting); | |
| } | |
| /** | |
| * Store a newly created resource in storage. | |
| * | |
| * @param \Illuminate\Http\Request $request | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function store(Request $request) | |
| { //to save the attendacne frequency value in table | |
| if(auth()->user()->can('Edit Settings module')) | |
| { | |
| $value=$request->times_value; | |
| $keyexist=Setting::where('name','attendance_freq')->where('category','general')->exists(); | |
| if($keyexist){ | |
| Setting::where('name','=','attendance_freq')->where('category','=','general')->update(['value'=>$value]); | |
| } | |
| else{ | |
| Setting::create(['name'=>"attendance_freq", 'value'=> $value, 'category'=> 'general', 'fieldtype'=>'text']); | |
| } | |
| return response()->json(['success' => 'Attendance Setting Saved Successfully!']); | |
| }else{ | |
| return Response()->json(['warning' => 'You do not have permission to edit it!']); | |
| } | |
| } | |
| /** | |
| * Display the specified resource. | |
| * | |
| * @param int $id | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function show($id) | |
| { | |
| // | |
| } | |
| /** | |
| * Show the form for editing the specified resource. | |
| * | |
| * @param int $id | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function edit($id) | |
| { | |
| // | |
| } | |
| /** | |
| * Update the specified resource in storage. | |
| * | |
| * @param \Illuminate\Http\Request $request | |
| * @param int $id | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function update(Request $request, $id) | |
| { | |
| // Setting::where('name', $id)->update(['value' => $request->input('thisvalue')]); | |
| } | |
| /** | |
| * Remove the specified resource from storage. | |
| * | |
| * @param int $id | |
| * @return \Illuminate\Http\Response | |
| */ | |
| public function destroy($id) | |
| { | |
| // | |
| } | |
| public function updateAttendancePeriod(Request $request){ | |
| if(auth()->user()->can('Edit Settings module')){ | |
| $value=$request->week_starts; | |
| $keyexist=Setting::where('name','attendance_period')->where('category','general')->exists(); | |
| if($keyexist){ | |
| Setting::where('name','=','attendance_period')->where('category','=','general')->update(['value'=>$value]); | |
| } | |
| else | |
| { | |
| Setting::create(['name'=>"attendance_period", 'value'=> $value, 'category'=> 'general', 'fieldtype'=>'text']); | |
| } | |
| return response()->json(['success' => 'Attendance Setting Saved Successfully']); | |
| } | |
| else | |
| { | |
| return response()->json(['warning' => 'You do not have permission to edit it!']); | |
| } | |
| } | |
| } |