@@ -18,9 +18,9 @@ |
||
| 18 | 18 | // dd($request->user()->permissions); |
| 19 | 19 | if ($request->user() && (!($request->user()->permissions->isEmpty())) && $request->user()->permissions[0]->roles && $request->user()->permissions[0]->roles->code === 'HOMEROOM_TEACHER') { |
| 20 | 20 | return $next($request); |
| 21 | - }elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
| 21 | + } elseif($request->user() && (!($request->user()->principal->isEmpty())) && $request->user()->principal[0]->roles && $request->user()->principal[0]->roles->code === 'PRINCIPAL'){ |
|
| 22 | 22 | return $next($request); |
| 23 | - }elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
| 23 | + } elseif($request->user() && (!($request->user()->zonal_cordinator->isEmpty())) && $request->user()->zonal_cordinator[0]->roles && $request->user()->zonal_cordinator[0]->roles->code === 'PRINCIPAL'){ |
|
| 24 | 24 | return $next($request); |
| 25 | 25 | } |
| 26 | 26 | return redirect('/login')->with('status', 'Your dont have access for upload data. Please get assign your to the class and try'); |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | ->editColumn('filename', function ($data) { |
| 75 | 75 | return '<a href='.env('APP_URL').'/download_file/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>'; |
| 76 | 76 | }) |
| 77 | - ->editColumn('error', function ($data) { |
|
| 77 | + ->editColumn('error', function ($data) { |
|
| 78 | 78 | return '<a href='.env('APP_URL').'/download/'.$data->filename.'>'.substr($data->classRoom->name, 0, 10).'</a>'; |
| 79 | 79 | })->editColumn('actions', function ($data) { |
| 80 | 80 | |
@@ -23,16 +23,15 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | if($diff_in_hours >= 2 && $data->is_processed == 3){ |
| 25 | 25 | return "Terminated"; |
| 26 | - } |
|
| 27 | - elseif ($data->is_processed === 1) { |
|
| 26 | + } elseif ($data->is_processed === 1) { |
|
| 28 | 27 | return "Success"; |
| 29 | - }elseif ($data->is_processed === 2){ |
|
| 28 | + } elseif ($data->is_processed === 2){ |
|
| 30 | 29 | return "Failed"; |
| 31 | - }elseif($diff_in_hours < 2 && $data->is_processed == 3){ |
|
| 30 | + } elseif($diff_in_hours < 2 && $data->is_processed == 3){ |
|
| 32 | 31 | return "Processing"; |
| 33 | - }elseif ($data->is_processed == 4){ |
|
| 32 | + } elseif ($data->is_processed == 4){ |
|
| 34 | 33 | return "Process Paused"; |
| 35 | - }else{ |
|
| 34 | + } else{ |
|
| 36 | 35 | return 'Pending'; |
| 37 | 36 | }; |
| 38 | 37 | |
@@ -40,9 +39,9 @@ discard block |
||
| 40 | 39 | ->editColumn('is_email_sent', function ($data) { |
| 41 | 40 | if ($data->is_email_sent === 1) { |
| 42 | 41 | return "Success"; |
| 43 | - }elseif($data->is_email_sent === 2 ){ |
|
| 42 | + } elseif($data->is_email_sent === 2 ){ |
|
| 44 | 43 | return 'Failed'; |
| 45 | - }else{ |
|
| 44 | + } else{ |
|
| 46 | 45 | return 'Pending'; |
| 47 | 46 | }; |
| 48 | 47 | |
@@ -50,11 +49,11 @@ discard block |
||
| 50 | 49 | ->editColumn('update', function ($data) { |
| 51 | 50 | if ($data->update === 0) { |
| 52 | 51 | return "No Processes"; |
| 53 | - }elseif($data->update === 1 ){ |
|
| 52 | + } elseif($data->update === 1 ){ |
|
| 54 | 53 | return 'Success'; |
| 55 | - }elseif($data->update === 3 ){ |
|
| 54 | + } elseif($data->update === 3 ){ |
|
| 56 | 55 | return 'Partial Success'; |
| 57 | - }else{ |
|
| 56 | + } else{ |
|
| 58 | 57 | return 'Failed'; |
| 59 | 58 | }; |
| 60 | 59 | |
@@ -62,11 +61,11 @@ discard block |
||
| 62 | 61 | ->editColumn('insert', function ($data) { |
| 63 | 62 | if ($data->insert === 0) { |
| 64 | 63 | return "No Processes"; |
| 65 | - }elseif($data->insert === 1 ){ |
|
| 64 | + } elseif($data->insert === 1 ){ |
|
| 66 | 65 | return 'Success'; |
| 67 | - }elseif($data->insert === 3 ){ |
|
| 66 | + } elseif($data->insert === 3 ){ |
|
| 68 | 67 | return 'Partial Success'; |
| 69 | - }else{ |
|
| 68 | + } else{ |
|
| 70 | 69 | return 'Failed'; |
| 71 | 70 | }; |
| 72 | 71 | |
@@ -85,13 +84,13 @@ discard block |
||
| 85 | 84 | |
| 86 | 85 | if($diff_in_hours >= 2 && $data->is_processed == 3){ |
| 87 | 86 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>'; |
| 88 | - }elseif ($data->is_processed == 1){ |
|
| 87 | + } elseif ($data->is_processed == 1){ |
|
| 89 | 88 | return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>'; |
| 90 | - }elseif ($data->is_processed == 2){ |
|
| 89 | + } elseif ($data->is_processed == 2){ |
|
| 91 | 90 | return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>'; |
| 92 | - }elseif ($data->is_processed == 0){ |
|
| 91 | + } elseif ($data->is_processed == 0){ |
|
| 93 | 92 | return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>'; |
| 94 | - }elseif ($data->is_processed == 4){ |
|
| 93 | + } elseif ($data->is_processed == 4){ |
|
| 95 | 94 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>'; |
| 96 | 95 | } |
| 97 | 96 | }) |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return \Illuminate\Support\Collection |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @return \Illuminate\Support\Collection |
|
| 34 | + */ |
|
| 35 | 35 | public function importExportView() |
| 36 | 36 | { |
| 37 | 37 | $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * @return \Illuminate\Support\Collection |
|
| 46 | - */ |
|
| 45 | + * @return \Illuminate\Support\Collection |
|
| 46 | + */ |
|
| 47 | 47 | public function export(Request $request) |
| 48 | 48 | { |
| 49 | - $request->validate([ |
|
| 49 | + $request->validate([ |
|
| 50 | 50 | 'class' => 'required' |
| 51 | 51 | ]); |
| 52 | 52 | return Excel::download(new UsersExport($request->input('class')), 'users.xlsx'); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * @return \Illuminate\Support\Collection |
|
| 59 | - */ |
|
| 58 | + * @return \Illuminate\Support\Collection |
|
| 59 | + */ |
|
| 60 | 60 | public function import(Request $request) |
| 61 | 61 | { |
| 62 | 62 | |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | try{ |
| 74 | 74 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
| 75 | 75 | Excel::import($import,request()->file('import_file')); |
| 76 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 76 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
| 77 | 77 | $failures = $e->failures(); |
| 78 | 78 | |
| 79 | 79 | foreach ($failures as $failure) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | DB::table('uploads') |
| 101 | 101 | ->where('id', $id) |
| 102 | 102 | ->update(['is_processed' => 0]); |
| 103 | - }elseif ($action == 200) { |
|
| 103 | + } elseif ($action == 200) { |
|
| 104 | 104 | DB::table('uploads') |
| 105 | 105 | ->where('id', $id) |
| 106 | 106 | ->update(['is_processed' => 4]); |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [ |
| 118 | 118 | 'Content-Length: '. filesize($file_path) |
| 119 | 119 | ]); |
| 120 | - } |
|
| 121 | - else |
|
| 120 | + } else |
|
| 122 | 121 | { |
| 123 | 122 | return View::make('errors.404'); |
| 124 | 123 | } |
@@ -137,8 +136,7 @@ discard block |
||
| 137 | 136 | return Response::download($file_path, $filename, [ |
| 138 | 137 | 'Content-Length: '. filesize($file_path) |
| 139 | 138 | ]); |
| 140 | - } |
|
| 141 | - else |
|
| 139 | + } else |
|
| 142 | 140 | { |
| 143 | 141 | abort(404, 'We did not found an error file.'); |
| 144 | 142 | } |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | return Response::download($file_path, $filename, [ |
| 153 | 151 | 'Content-Length: '. filesize($file_path) |
| 154 | 152 | ]); |
| 155 | - } |
|
| 156 | - else |
|
| 153 | + } else |
|
| 157 | 154 | { |
| 158 | 155 | |
| 159 | 156 | abort(404, 'We did not found an error file.'); |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $this->isValidSheet = false; |
| 102 | 102 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 103 | - $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
|
| 104 | - $failures = [0 => $failure]; |
|
| 105 | - throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
|
| 103 | + $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
|
| 104 | + $failures = [0 => $failure]; |
|
| 105 | + throw new \Maatwebsite\Excel\Validators\ValidationException($error, $failures); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | protected function checkKeys($key,$count,$row){ |
| 197 | - if(array_key_exists($key,$row)){ |
|
| 198 | - return true; |
|
| 199 | - }else{ |
|
| 197 | + if(array_key_exists($key,$row)){ |
|
| 198 | + return true; |
|
| 199 | + }else{ |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | 201 | $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
| 202 | 202 | $failures = [0 => $failure]; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function map($row): array { |
| 218 | 218 | try { |
| 219 | - $row = $this->mapFields($row); |
|
| 219 | + $row = $this->mapFields($row); |
|
| 220 | 220 | } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
| 221 | 221 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 222 | 222 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | return $row; |
| 153 | - }catch (Exception $e){ |
|
| 153 | + } catch (Exception $e){ |
|
| 154 | 154 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 155 | 155 | $failure = new Failure(3, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'], [null]); |
| 156 | 156 | $failures = [0 => $failure]; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | protected function checkKeys($key,$count,$row){ |
| 197 | 197 | if(array_key_exists($key,$row)){ |
| 198 | 198 | return true; |
| 199 | - }else{ |
|
| 199 | + } else{ |
|
| 200 | 200 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
| 201 | 201 | $failure = new Failure($count, 'remark', [0 => 'Template is not valid for upload, use the template given in the system'. $key ,' Is missing form the template'], [null]); |
| 202 | 202 | $failures = [0 => $failure]; |
@@ -423,8 +423,9 @@ |
||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | protected function insertSubject($subject){ |
| 426 | - if(!Institution_subject_student::isDuplicated($subject)) |
|
| 427 | - Institution_subject_student::updateOrInsert($subject); |
|
| 426 | + if(!Institution_subject_student::isDuplicated($subject)) { |
|
| 427 | + Institution_subject_student::updateOrInsert($subject); |
|
| 428 | + } |
|
| 428 | 429 | } |
| 429 | 430 | |
| 430 | 431 | |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * @param array $row |
|
| 22 | - * |
|
| 23 | - * @return \Illuminate\Database\Eloquent\Model|null |
|
| 24 | - */ |
|
| 21 | + * @param array $row |
|
| 22 | + * |
|
| 23 | + * @return \Illuminate\Database\Eloquent\Model|null |
|
| 24 | + */ |
|
| 25 | 25 | |
| 26 | 26 | public function sheets(): array |
| 27 | 27 | { |
@@ -25,11 +25,11 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function boot() |
|
| 29 | - { |
|
| 30 | - // |
|
| 31 | - if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
| 32 | - URL::forceScheme('https'); |
|
| 33 | - } |
|
| 34 | - } |
|
| 28 | + public function boot() |
|
| 29 | + { |
|
| 30 | + // |
|
| 31 | + if((\App::environment('dev')) | (\App::environment('stage')) | (\App::environment('prod'))) { |
|
| 32 | + URL::forceScheme('https'); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -135,13 +135,13 @@ |
||
| 135 | 135 | } |
| 136 | 136 | protected function validateNic($attribute, $value, $perameters, $validator){ |
| 137 | 137 | $valid = preg_match('/^([0-9]{9}[VX]|[0-9]{12})$/i', $value); |
| 138 | - if(!$valid){ |
|
| 139 | - $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
|
| 140 | - $this->_set_custom_stuff(); |
|
| 141 | - return false; |
|
| 142 | - }else{ |
|
| 143 | - return true; |
|
| 144 | - } |
|
| 138 | + if(!$valid){ |
|
| 139 | + $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
|
| 140 | + $this->_set_custom_stuff(); |
|
| 141 | + return false; |
|
| 142 | + }else{ |
|
| 143 | + return true; |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | protected function validateUserUnique($attribute, $value, $perameters, $validator) { |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | return true; |
| 89 | 89 | } |
| 90 | - }else{ |
|
| 90 | + } else{ |
|
| 91 | 91 | $this->_custom_messages['bmi'] = $attribute.' is required for '. $educationGrade->name; |
| 92 | 92 | $this->_set_custom_stuff(); |
| 93 | 93 | return false; |
| 94 | 94 | } |
| 95 | - }else{ |
|
| 95 | + } else{ |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | $check = Institution_class_student::where('student_id', '=', $student['id'])->where('institution_class_id','=',$perameters[0])->count(); |
| 126 | 126 | if($check == 1){ |
| 127 | 127 | return true; |
| 128 | - }else{ |
|
| 128 | + } else{ |
|
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | - }else{ |
|
| 131 | + } else{ |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $this->_custom_messages['nic'] = $attribute. ' is not valid, Please check the NIC number'; |
| 140 | 140 | $this->_set_custom_stuff(); |
| 141 | 141 | return false; |
| 142 | - }else{ |
|
| 142 | + } else{ |
|
| 143 | 143 | return true; |
| 144 | 144 | } |
| 145 | 145 | } |