@@ -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 | if(Auth::user()->super_admin ){ |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | |
47 | 47 | /** |
48 | - * @return \Illuminate\Support\Collection |
|
49 | - */ |
|
48 | + * @return \Illuminate\Support\Collection |
|
49 | + */ |
|
50 | 50 | public function export(Request $request) |
51 | 51 | { |
52 | - $request->validate([ |
|
52 | + $request->validate([ |
|
53 | 53 | 'class' => 'required' |
54 | 54 | ]); |
55 | 55 | return Excel::download(new UsersExport($request->input('class')), 'users.xlsx'); |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
61 | - * @return \Illuminate\Support\Collection |
|
62 | - */ |
|
61 | + * @return \Illuminate\Support\Collection |
|
62 | + */ |
|
63 | 63 | public function import(Request $request) |
64 | 64 | { |
65 | 65 |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function importExportView() |
36 | 36 | { |
37 | - if(Auth::user()->super_admin ){ |
|
37 | + if (Auth::user()->super_admin) { |
|
38 | 38 | return view('uploadcsv'); |
39 | - }else{ |
|
40 | - $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
|
41 | - return view('importExport')->with('classes',$classes); |
|
39 | + }else { |
|
40 | + $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
|
41 | + return view('importExport')->with('classes', $classes); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | |
74 | 74 | |
75 | 75 | $import = new UsersImport(); |
76 | - try{ |
|
76 | + try { |
|
77 | 77 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
78 | - Excel::import($import,request()->file('import_file')); |
|
78 | + Excel::import($import, request()->file('import_file')); |
|
79 | 79 | }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
80 | 80 | $failures = $e->failures(); |
81 | 81 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | if(Auth::user()->super_admin ){ |
38 | 38 | return view('uploadcsv'); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $classes = (!Auth::user()->permissions->isEmpty()) ? Auth::user()->permissions[0]->staff_class : Auth::user()->principal[0]->security_group_institution->institution_classes; |
41 | 41 | return view('importExport')->with('classes',$classes); |
42 | 42 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try{ |
77 | 77 | $files = Storage::disk('sis-bulk-data-files')->allFiles(); |
78 | 78 | Excel::import($import,request()->file('import_file')); |
79 | - }catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
79 | + } catch (\Maatwebsite\Excel\Validators\ValidationException $e) { |
|
80 | 80 | $failures = $e->failures(); |
81 | 81 | |
82 | 82 | foreach ($failures as $failure) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | DB::table('uploads') |
100 | 100 | ->where('id', $id) |
101 | 101 | ->update(['is_processed' => 0]); |
102 | - }elseif ($action == 200) { |
|
102 | + } elseif ($action == 200) { |
|
103 | 103 | DB::table('uploads') |
104 | 104 | ->where('id', $id) |
105 | 105 | ->update(['is_processed' => 4]); |
@@ -116,8 +116,7 @@ discard block |
||
116 | 116 | return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [ |
117 | 117 | 'Content-Length: '. filesize($file_path) |
118 | 118 | ]); |
119 | - } |
|
120 | - else |
|
119 | + } else |
|
121 | 120 | { |
122 | 121 | return response()->view('errors.404'); |
123 | 122 | } |
@@ -136,8 +135,7 @@ discard block |
||
136 | 135 | return Response::download($file_path, $filename, [ |
137 | 136 | 'Content-Length: '. filesize($file_path) |
138 | 137 | ]); |
139 | - } |
|
140 | - else |
|
138 | + } else |
|
141 | 139 | { |
142 | 140 | abort(404, 'We did not found an error file.'); |
143 | 141 | } |
@@ -151,8 +149,7 @@ discard block |
||
151 | 149 | return Response::download($file_path, $filename, [ |
152 | 150 | 'Content-Length: '. filesize($file_path) |
153 | 151 | ]); |
154 | - } |
|
155 | - else |
|
152 | + } else |
|
156 | 153 | { |
157 | 154 | |
158 | 155 | abort(404, 'We did not found an error file.'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param Request $request |
34 | 34 | * @return \Illuminate\Http\JsonResponse |
35 | 35 | */ |
36 | - public function upload(Request $request){ |
|
36 | + public function upload(Request $request) { |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $institution = auth()->user()->permissions->isEmpty() ? auth()->user()->principal[0]->institution_group[0]->institution->code : auth()->user()->permissions[0]->institution_staff->institution->code; |
76 | 76 | |
77 | 77 | |
78 | - $fileName = time().'_'.$institution.'_'.str_replace(' ','_', clean($class->name)).'_'.auth()->user()->openemis_no.'_student_bulk_data.xlsx'; |
|
78 | + $fileName = time().'_'.$institution.'_'.str_replace(' ', '_', clean($class->name)).'_'.auth()->user()->openemis_no.'_student_bulk_data.xlsx'; |
|
79 | 79 | Storage::disk('local')->putFileAs( |
80 | 80 | 'sis-bulk-data-files/', |
81 | 81 | $uploadFile, |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | |
85 | 85 | $upload = new Upload; |
86 | - $upload->fileName =$fileName; |
|
86 | + $upload->fileName = $fileName; |
|
87 | 87 | $upload->model = 'Student'; |
88 | 88 | $upload->node = 'None'; |
89 | 89 | $upload->institution_class_id = $class->id; |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | return redirect('/')->withSuccess('The file is uploaded, we will process and let you know by your email'); |
95 | 95 | } |
96 | 96 | |
97 | - public function updateQueueWithUnprocessedFiles($id, $action){ |
|
98 | - if($action == 100){ |
|
97 | + public function updateQueueWithUnprocessedFiles($id, $action) { |
|
98 | + if ($action == 100) { |
|
99 | 99 | DB::table('uploads') |
100 | 100 | ->where('id', $id) |
101 | 101 | ->update(['is_processed' => 0]); |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | - public function downloadTemplate(){ |
|
110 | + public function downloadTemplate() { |
|
111 | 111 | $filename = 'censusNo_className_sis_students_bulk_upload'; |
112 | 112 | $version = '2007_V2.2.0_20201012.xlsx'; |
113 | - $file_path = storage_path() .'/app/public/'. $filename.'_'.$version;; |
|
113 | + $file_path = storage_path().'/app/public/'.$filename.'_'.$version; ; |
|
114 | 114 | if (file_exists($file_path)) |
115 | 115 | { |
116 | 116 | return Response::download($file_path, Auth::user()->openemis_no.'_'.$filename.$version, [ |
117 | - 'Content-Length: '. filesize($file_path) |
|
117 | + 'Content-Length: '.filesize($file_path) |
|
118 | 118 | ]); |
119 | 119 | } |
120 | 120 | else |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * @param $filename |
129 | 129 | * @return Processed excel file with error |
130 | 130 | */ |
131 | - public function downloadErrorFile($filename){ |
|
131 | + public function downloadErrorFile($filename) { |
|
132 | 132 | |
133 | - $file_path = storage_path().'/app/sis-bulk-data-files/processed/'. $filename; |
|
133 | + $file_path = storage_path().'/app/sis-bulk-data-files/processed/'.$filename; |
|
134 | 134 | if (file_exists($file_path)) |
135 | 135 | { |
136 | 136 | return Response::download($file_path, $filename, [ |
137 | - 'Content-Length: '. filesize($file_path) |
|
137 | + 'Content-Length: '.filesize($file_path) |
|
138 | 138 | ]); |
139 | 139 | } |
140 | 140 | else |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | - public function downloadFile($filename){ |
|
148 | - $file_path = storage_path().'/app/sis-bulk-data-files/'. $filename; |
|
147 | + public function downloadFile($filename) { |
|
148 | + $file_path = storage_path().'/app/sis-bulk-data-files/'.$filename; |
|
149 | 149 | if (file_exists($file_path)) |
150 | 150 | { |
151 | 151 | return Response::download($file_path, $filename, [ |
152 | - 'Content-Length: '. filesize($file_path) |
|
152 | + 'Content-Length: '.filesize($file_path) |
|
153 | 153 | ]); |
154 | 154 | } |
155 | 155 | else |
@@ -80,7 +80,7 @@ |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | }) |
83 | - ->editColumn('error', function ($data) { |
|
83 | + ->editColumn('error', function ($data) { |
|
84 | 84 | if(\App::environment('local') || \App::environment('stage')){ |
85 | 85 | return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
86 | 86 |
@@ -13,101 +13,101 @@ |
||
13 | 13 | |
14 | 14 | public function index() |
15 | 15 | { |
16 | - return Datatables::of(Upload::with(['classRoom'])->where('security_user_id','=',Auth::user()->id)) |
|
17 | - ->editColumn('is_processed', function ($data) { |
|
16 | + return Datatables::of(Upload::with(['classRoom'])->where('security_user_id', '=', Auth::user()->id)) |
|
17 | + ->editColumn('is_processed', function($data) { |
|
18 | 18 | |
19 | 19 | $nowTime = \Carbon\Carbon::now(); |
20 | 20 | $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime); |
21 | 21 | $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at); |
22 | 22 | $diff_in_hours = $to->diffInHours($from); |
23 | 23 | |
24 | - if($diff_in_hours >= 2 && $data->is_processed == 3){ |
|
24 | + if ($diff_in_hours >= 2 && $data->is_processed == 3) { |
|
25 | 25 | return "Terminated"; |
26 | 26 | } |
27 | 27 | elseif ($data->is_processed === 1) { |
28 | 28 | return "Success"; |
29 | - }elseif ($data->is_processed === 2){ |
|
29 | + }elseif ($data->is_processed === 2) { |
|
30 | 30 | return "Failed"; |
31 | - }elseif($diff_in_hours < 2 && $data->is_processed == 3){ |
|
31 | + }elseif ($diff_in_hours < 2 && $data->is_processed == 3) { |
|
32 | 32 | return "Processing"; |
33 | - }elseif ($data->is_processed == 4){ |
|
33 | + }elseif ($data->is_processed == 4) { |
|
34 | 34 | return "Process Paused"; |
35 | - }else{ |
|
35 | + }else { |
|
36 | 36 | return 'Pending'; |
37 | 37 | }; |
38 | 38 | |
39 | 39 | }) |
40 | - ->editColumn('is_email_sent', function ($data) { |
|
40 | + ->editColumn('is_email_sent', function($data) { |
|
41 | 41 | if ($data->is_email_sent == 1) { |
42 | 42 | return "Success"; |
43 | - }elseif($data->is_email_sent == 2 ){ |
|
43 | + }elseif ($data->is_email_sent == 2) { |
|
44 | 44 | return 'Failed'; |
45 | - }else{ |
|
45 | + }else { |
|
46 | 46 | return 'Pending'; |
47 | 47 | }; |
48 | 48 | |
49 | 49 | }) |
50 | - ->editColumn('update', function ($data) { |
|
51 | - if ((int)$data->update == 0) { |
|
50 | + ->editColumn('update', function($data) { |
|
51 | + if ((int) $data->update == 0) { |
|
52 | 52 | return "No Processes"; |
53 | - }elseif((int)$data->update == 1 ){ |
|
53 | + }elseif ((int) $data->update == 1) { |
|
54 | 54 | return 'Success'; |
55 | - }elseif((int)$data->update == 2 ){ |
|
55 | + }elseif ((int) $data->update == 2) { |
|
56 | 56 | return 'Failed'; |
57 | - }elseif((int)$data->update == 3 ){ |
|
57 | + }elseif ((int) $data->update == 3) { |
|
58 | 58 | return 'Partial Success'; |
59 | 59 | }; |
60 | 60 | |
61 | 61 | }) |
62 | - ->editColumn('insert', function ($data) { |
|
62 | + ->editColumn('insert', function($data) { |
|
63 | 63 | if ($data->insert == 0) { |
64 | 64 | return "No Processes"; |
65 | - }elseif($data->insert == 1 ){ |
|
65 | + }elseif ($data->insert == 1) { |
|
66 | 66 | return 'Success'; |
67 | - }elseif($data->insert == 2 ){ |
|
67 | + }elseif ($data->insert == 2) { |
|
68 | 68 | return 'Failed'; |
69 | - }elseif($data->insert == 3 ){ |
|
69 | + }elseif ($data->insert == 3) { |
|
70 | 70 | return 'Partial Success'; |
71 | 71 | }; |
72 | 72 | |
73 | 73 | }) |
74 | - ->editColumn('filename', function ($data) { |
|
75 | - if(\App::environment('local') || \App::environment('stage')){ |
|
74 | + ->editColumn('filename', function($data) { |
|
75 | + if (\App::environment('local') || \App::environment('stage')) { |
|
76 | 76 | return '<a href="/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
77 | 77 | |
78 | - }else{ |
|
78 | + }else { |
|
79 | 79 | return '<a href="/bulk-upload/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
80 | 80 | } |
81 | 81 | |
82 | 82 | }) |
83 | - ->editColumn('error', function ($data) { |
|
84 | - if(\App::environment('local') || \App::environment('stage')){ |
|
83 | + ->editColumn('error', function($data) { |
|
84 | + if (\App::environment('local') || \App::environment('stage')) { |
|
85 | 85 | return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
86 | 86 | |
87 | - }else{ |
|
87 | + }else { |
|
88 | 88 | return '<a href="/bulk-upload/download/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
89 | 89 | } |
90 | 90 | |
91 | - })->editColumn('actions', function ($data) { |
|
91 | + })->editColumn('actions', function($data) { |
|
92 | 92 | |
93 | 93 | $nowTime = \Carbon\Carbon::now(); |
94 | 94 | $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $nowTime); |
95 | 95 | $from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', $data->updated_at); |
96 | 96 | $diff_in_hours = $to->diffInHours($from); |
97 | 97 | |
98 | - if($diff_in_hours >= 2 && $data->is_processed == 3){ |
|
98 | + if ($diff_in_hours >= 2 && $data->is_processed == 3) { |
|
99 | 99 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>'; |
100 | - }elseif ($data->is_processed == 1){ |
|
100 | + }elseif ($data->is_processed == 1) { |
|
101 | 101 | return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>'; |
102 | - }elseif ($data->is_processed == 2){ |
|
102 | + }elseif ($data->is_processed == 2) { |
|
103 | 103 | return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>'; |
104 | - }elseif ($data->is_processed == 0){ |
|
104 | + }elseif ($data->is_processed == 0) { |
|
105 | 105 | return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>'; |
106 | - }elseif ($data->is_processed == 4){ |
|
106 | + }elseif ($data->is_processed == 4) { |
|
107 | 107 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>'; |
108 | 108 | } |
109 | 109 | }) |
110 | - ->rawColumns(['filename','error','actions']) |
|
110 | + ->rawColumns(['filename', 'error', 'actions']) |
|
111 | 111 | ->make(true); |
112 | 112 | } |
113 | 113 |
@@ -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 ((int)$data->update == 0) { |
52 | 51 | return "No Processes"; |
53 | - }elseif((int)$data->update == 1 ){ |
|
52 | + } elseif((int)$data->update == 1 ){ |
|
54 | 53 | return 'Success'; |
55 | - }elseif((int)$data->update == 2 ){ |
|
54 | + } elseif((int)$data->update == 2 ){ |
|
56 | 55 | return 'Failed'; |
57 | - }elseif((int)$data->update == 3 ){ |
|
56 | + } elseif((int)$data->update == 3 ){ |
|
58 | 57 | return 'Partial Success'; |
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 == 2 ){ |
|
66 | + } elseif($data->insert == 2 ){ |
|
68 | 67 | return 'Failed'; |
69 | - }elseif($data->insert == 3 ){ |
|
68 | + } elseif($data->insert == 3 ){ |
|
70 | 69 | return 'Partial Success'; |
71 | 70 | }; |
72 | 71 | |
@@ -75,7 +74,7 @@ discard block |
||
75 | 74 | if(\App::environment('local') || \App::environment('stage')){ |
76 | 75 | return '<a href="/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
77 | 76 | |
78 | - }else{ |
|
77 | + } else{ |
|
79 | 78 | return '<a href="/bulk-upload/download_file/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
80 | 79 | } |
81 | 80 | |
@@ -84,7 +83,7 @@ discard block |
||
84 | 83 | if(\App::environment('local') || \App::environment('stage')){ |
85 | 84 | return '<a href="/download/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
86 | 85 | |
87 | - }else{ |
|
86 | + } else{ |
|
88 | 87 | return '<a href="/bulk-upload/download/'.$data->filename.'">'.$data->classRoom->name.'</a>'; |
89 | 88 | } |
90 | 89 | |
@@ -97,13 +96,13 @@ discard block |
||
97 | 96 | |
98 | 97 | if($diff_in_hours >= 2 && $data->is_processed == 3){ |
99 | 98 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-primary text-uppercase">reprocess</button>'; |
100 | - }elseif ($data->is_processed == 1){ |
|
99 | + } elseif ($data->is_processed == 1){ |
|
101 | 100 | return '<div><h6>Processing <span class="badge badge-success text-uppercase">Successful</span></h6></div>'; |
102 | - }elseif ($data->is_processed == 2){ |
|
101 | + } elseif ($data->is_processed == 2){ |
|
103 | 102 | return '<div><h6>Processing <span class="badge badge-danger text-uppercase">Failed</span></h6></div>'; |
104 | - }elseif ($data->is_processed == 0){ |
|
103 | + } elseif ($data->is_processed == 0){ |
|
105 | 104 | return '<button onclick="updateProcess('.($data->id).',200)" class="btn btn-block btn-warning text-uppercase">pause</button>'; |
106 | - }elseif ($data->is_processed == 4){ |
|
105 | + } elseif ($data->is_processed == 4){ |
|
107 | 106 | return '<button onclick="updateProcess('.($data->id).',100)" class="btn btn-block btn-success text-uppercase">resume</button>'; |
108 | 107 | } |
109 | 108 | }) |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * `select total from students_count_view where institution_id = $id` |
16 | 16 | * `select male from students_count_view where institution_id = $id` |
17 | 17 | * `select female from students_count_view where institution_id = $id` |
18 | - **/ |
|
18 | + **/ |
|
19 | 19 | DashboardViews::createOrUpdateStudentCount(); |
20 | 20 | |
21 | 21 | /** |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | */ |
49 | 49 | DashboardViews::createOrUpdateStudentsCountByGrade(); |
50 | 50 | |
51 | - /** |
|
52 | - * Students count by BMI |
|
53 | - * select * from students_count_by_bmi_view where institution_id = $id |
|
54 | - */ |
|
51 | + /** |
|
52 | + * Students count by BMI |
|
53 | + * select * from students_count_by_bmi_view where institution_id = $id |
|
54 | + */ |
|
55 | 55 | DashboardViews::createOrUpdateStudentCountByBMI(); |
56 | 56 | |
57 | 57 | /** |
@@ -8,7 +8,7 @@ |
||
8 | 8 | class DashboardViewsController extends Controller |
9 | 9 | { |
10 | 10 | |
11 | - public function callback(){ |
|
11 | + public function callback() { |
|
12 | 12 | |
13 | 13 | /** Total number of students by institutions |
14 | 14 | * In Grafana query to get total students count |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | use Maatwebsite\Excel\Concerns\WithBatchInserts; |
19 | 19 | use Maatwebsite\Excel\Concerns\WithChunkReading; |
20 | 20 | |
21 | -class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts , WithValidation ,WithMapping, SkipsOnFailure, SkipsOnError |
|
21 | +class ExaminationStudentsImport implements ToModel, WithStartRow, WithHeadingRow, WithChunkReading, WithBatchInserts, WithValidation, WithMapping, SkipsOnFailure, SkipsOnError |
|
22 | 22 | { |
23 | - use Importable , SkipsFailures, SkipsErrors; |
|
23 | + use Importable, SkipsFailures, SkipsErrors; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @return int |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | |
58 | 58 | private function transformDateTime(string $value, string $format = 'm/d/Y') |
59 | 59 | { |
60 | - try{ |
|
60 | + try { |
|
61 | 61 | $date = date_create_from_format('m/d/Y', $value); |
62 | - if(gettype($date)=='boolean'){ |
|
62 | + if (gettype($date) == 'boolean') { |
|
63 | 63 | $date = date_create_from_format('Y-m-d', $value); |
64 | 64 | } |
65 | 65 | $date = date_format($date, 'Y-m-d'); |
66 | 66 | return $date; |
67 | - }catch(\Exception $e){ |
|
67 | + }catch (\Exception $e) { |
|
68 | 68 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
69 | 69 | $failure = new Failure(2, 'remark', [0 => 'The given date is wrong']); |
70 | 70 | $failures = [0 => $failure]; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | } |
65 | 65 | $date = date_format($date, 'Y-m-d'); |
66 | 66 | return $date; |
67 | - }catch(\Exception $e){ |
|
67 | + } catch(\Exception $e){ |
|
68 | 68 | $error = \Illuminate\Validation\ValidationException::withMessages([]); |
69 | 69 | $failure = new Failure(2, 'remark', [0 => 'The given date is wrong']); |
70 | 70 | $failures = [0 => $failure]; |
@@ -30,13 +30,13 @@ |
||
30 | 30 | */ |
31 | 31 | public function handle() |
32 | 32 | { |
33 | - try{ |
|
33 | + try { |
|
34 | 34 | ini_set('memory_limit', '-1'); |
35 | 35 | (new ExaminationStudentsExport)->queue('/examination/student_data_with_nsid.csv')->chain([ |
36 | 36 | (new ExportReady($this->user)) |
37 | 37 | ]); |
38 | 38 | |
39 | - }catch(\Exception $e){ |
|
39 | + }catch (\Exception $e) { |
|
40 | 40 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
41 | 41 | $output->writeln($e->getMessage()); |
42 | 42 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | (new ExportReady($this->user)) |
37 | 37 | ]); |
38 | 38 | |
39 | - }catch(\Exception $e){ |
|
39 | + } catch(\Exception $e){ |
|
40 | 40 | $output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
41 | 41 | $output->writeln($e->getMessage()); |
42 | 42 | } |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | |
23 | 23 | $institution = Institution_class::find($file['institution_class_id']); |
24 | 24 | $this->user = User::find($file['security_user_id']); |
25 | - $this->subject = 'SIS Bulk Upload: Process Terminated'.$institution->institution->code.': '. $institution->name.' '. date('Y:m:d H:i:s'); |
|
25 | + $this->subject = 'SIS Bulk Upload: Process Terminated'.$institution->institution->code.': '.$institution->name.' '.date('Y:m:d H:i:s'); |
|
26 | 26 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
27 | 27 | $this->from_name = 'SIS Bulk Uploader'; |
28 | 28 | $this->with = [ |
29 | 29 | 'name' => $this->user->first_name, |
30 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
30 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
31 | 31 | ]; |
32 | 32 | $this->viewData = [ |
33 | 33 | 'name'=>$this->user->first_name, "body" => "Apologize ,The process of you file has been terminated in the middle, |
34 | 34 | We advice you to check the student data and re-upload with only with correct data which are not in the system ", |
35 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
35 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function build() |
45 | 45 | { |
46 | 46 | return $this->view('emails.mail') |
47 | - ->from($this->from_address,$this->from_name) |
|
47 | + ->from($this->from_address, $this->from_name) |
|
48 | 48 | ->to($this->user->email) |
49 | 49 | ->subject($this->subject) |
50 | 50 | ->with($this->with); |
@@ -19,17 +19,17 @@ discard block |
||
19 | 19 | public function __construct($user) |
20 | 20 | { |
21 | 21 | $this->user = $user; |
22 | - $this->subject = 'The DoE data is ready to download '. date('Y:m:d H:i:s'); |
|
22 | + $this->subject = 'The DoE data is ready to download '.date('Y:m:d H:i:s'); |
|
23 | 23 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
24 | 24 | $this->from_name = 'SIS Bulk Uploader'; |
25 | 25 | $this->with = [ |
26 | 26 | 'name' => $this->user->first_name, |
27 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/downloadExportexamination' : env('APP_URL').'/bulk-upload/downloadExportexamination' |
|
27 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/downloadExportexamination' : env('APP_URL').'/bulk-upload/downloadExportexamination' |
|
28 | 28 | ]; |
29 | 29 | |
30 | 30 | $this->viewData = [ |
31 | 31 | 'name'=>$this->user->first_name, "body" =>'Your requested file is ready to download', |
32 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/downloadExportexamination' : env('APP_URL').'/bulk-upload/downloadExportexamination' |
|
32 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/downloadExportexamination' : env('APP_URL').'/bulk-upload/downloadExportexamination' |
|
33 | 33 | ]; |
34 | 34 | } |
35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function build() |
42 | 42 | { |
43 | 43 | return $this->view('emails.mail') |
44 | - ->from($this->from_address,$this->from_name) |
|
44 | + ->from($this->from_address, $this->from_name) |
|
45 | 45 | ->to($this->user->email) |
46 | 46 | ->subject($this->subject) |
47 | 47 | ->with($this->with); |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | $institution = Institution_class::find($file['institution_class_id']); |
32 | 32 | |
33 | 33 | $this->user = User::find($file['security_user_id']); |
34 | - $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '. $institution->name . date('Y:m:d H:i:s'); |
|
34 | + $this->subject = 'SIS Bulk Upload: Upload Failed '.$institution->institution->code.': '.$institution->name.date('Y:m:d H:i:s'); |
|
35 | 35 | $this->from_address = env('MAIL_FROM_ADDRESS'); |
36 | 36 | $this->from_name = 'SIS Bulk Uploader'; |
37 | 37 | $this->with = [ |
38 | 38 | 'name' => $this->user->first_name, |
39 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
39 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
40 | 40 | ]; |
41 | 41 | $this->viewData = [ |
42 | 42 | 'name'=>$this->user->first_name, "body" => "The class you tried to import data is exceeded the student count limit.Please check the class / increase the student limit", |
43 | - 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/' .$file['filename'] : env('APP_URL').'/bulk-upload/download/' .$file['filename'] |
|
43 | + 'link' => \App::environment('local') || \App::environment('stage') ? env('APP_URL').'/download/'.$file['filename'] : env('APP_URL').'/bulk-upload/download/'.$file['filename'] |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function build() |
53 | 53 | { |
54 | 54 | return $this->view('emails.mail') |
55 | - ->from($this->from_address,$this->from_name) |
|
55 | + ->from($this->from_address, $this->from_name) |
|
56 | 56 | ->to($this->user->email) |
57 | 57 | ->subject($this->subject) |
58 | 58 | ->with($this->with); |