ソースを参照

add users, clone semester, choose dept, other loads

jquino 5 年 前
コミット
622785b348
共有46 個のファイルを変更した3008 個の追加780 個の削除を含む
  1. 19
    19
      app/Http/Controllers/Auth/LoginController.php
  2. 2
    2
      app/Http/Controllers/CourseController.php
  3. 71
    12
      app/Http/Controllers/DashboardController.php
  4. 15
    0
      app/Http/Controllers/HomeController.php
  5. 6
    5
      app/Http/Controllers/ProfessorController.php
  6. 2
    1
      app/Http/Kernel.php
  7. 29
    0
      app/Http/Middleware/SetDept.php
  8. 1
    1
      app/Professor.php
  9. 24
    0
      app/Schedule.php
  10. 6
    2
      app/Section.php
  11. 40
    0
      app/Semester.php
  12. 2
    2
      app/User.php
  13. 1
    0
      composer.json
  14. 112
    1
      composer.lock
  15. 1
    0
      config/app.php
  16. 2
    0
      config/logging.php
  17. 3
    3
      config/session.php
  18. 2
    3
      database/migrations/2014_10_12_000000_create_users_table.php
  19. 28
    28
      database/migrations/2019_07_07_152338_create_semesters_table.php
  20. 12
    11
      database/migrations/2019_07_07_183013_create_departments_table.php
  21. 1
    0
      database/migrations/2019_07_07_191614_create_sections_table.php
  22. 1
    1
      database/migrations/2019_07_07_230040_create_professors_table.php
  23. 1
    0
      database/migrations/2019_07_07_231850_create_professor_semester_table.php
  24. 1
    1
      database/migrations/2019_07_07_231913_create_professor_section_table.php
  25. 38
    0
      database/migrations/2019_10_08_184256_create_section_schedule_table.php
  26. 34
    0
      database/migrations/2019_10_08_184424_create_professor_system_name_table.php
  27. 8
    5
      database/seeds/DatabaseSeeder.php
  28. 2101
    527
      package-lock.json
  29. 1
    0
      package.json
  30. 2
    1
      resources/js/app.js
  31. 24
    10
      resources/js/createPDF.js
  32. 42
    5
      resources/js/dashboard.js
  33. 32
    8
      resources/sass/app.scss
  34. 58
    54
      resources/views/courses/index.blade.php
  35. 9
    15
      resources/views/courses/show.blade.php
  36. 61
    3
      resources/views/dashboard.blade.php
  37. 16
    4
      resources/views/layouts/app.blade.php
  38. 8
    0
      resources/views/modal/professor/loads.blade.php
  39. 65
    0
      resources/views/modal/semester-clone.blade.php
  40. 2
    2
      resources/views/modal/semester.blade.php
  41. 34
    0
      resources/views/modal/user-add.blade.php
  42. 16
    17
      resources/views/professors/index.blade.php
  43. 64
    28
      resources/views/professors/show.blade.php
  44. 3
    4
      resources/views/welcome.blade.php
  45. 8
    5
      routes/web.php
  46. 0
    0
      storage/logs/.gitignore

+ 19
- 19
app/Http/Controllers/Auth/LoginController.php ファイルの表示

@@ -41,7 +41,7 @@ class LoginController extends Controller
41 41
     }
42 42
 
43 43
 /**
44
-     * Redirect the user to the GitHub authentication page.
44
+     * Redirect the user to the Google authentication page.
45 45
      *
46 46
      * @return \Illuminate\Http\Response
47 47
      */
@@ -51,36 +51,36 @@ class LoginController extends Controller
51 51
     }
52 52
 
53 53
     /**
54
-     * Obtain the user information from GitHub.
54
+     * Obtain the user information from Google.
55 55
      *
56 56
      * @return \Illuminate\Http\Response
57 57
      */
58 58
     public function handleProviderCallback()
59 59
     {
60
-        // $user = Socialite::driver('google')->user();
61 60
         try {
62
-            $user = Socialite::driver('google')->user();
61
+            $google_user = Socialite::driver('google')->user();
63 62
         } catch (Exception $e) {
64 63
             return redirect('/login');
65 64
         }
66 65
         // only allow people with @company.com to login
67
-        if(explode("@", $user->email)[1] !== 'upr.edu'){
68
-            return redirect()->to('/');
69
-        }
70
-        // check if they're an existing user
71
-        $existingUser = User::where('email', $user->email)->first();
66
+        // if(explode("@", $google_user->email)[1] !== 'upr.edu'){
67
+        //     return redirect()->to('/');
68
+        // }
69
+
70
+        // check if they're in the database
71
+        $user = \App\User::where('email', $google_user->email)->first();
72 72
 
73
-        if($existingUser){
73
+        if($user){
74
+            $user->update([
75
+                'name'      => $google_user->name,
76
+                'email'     => $google_user->email,
77
+                'google_id' => $google_user->id
78
+            ]);
79
+            // dd($user);
74 80
             // log them in
75
-            auth()->login($existingUser, true);
76
-        } else if (User::all()->count() === 0) {
77
-            // create a new user
78
-            $newUser                  = new User;
79
-            $newUser->name            = $user->name;
80
-            $newUser->email           = $user->email;
81
-            $newUser->google_id       = $user->id;
82
-            $newUser->save();
83
-            auth()->login($newUser, true);
81
+            auth()->login($user, true);
82
+        } else {
83
+            return redirect('/');
84 84
         }
85 85
         return redirect()->back();
86 86
     }

+ 2
- 2
app/Http/Controllers/CourseController.php ファイルの表示

@@ -17,10 +17,10 @@ class CourseController extends Controller
17 17
      *
18 18
      * @return \Illuminate\Http\Response
19 19
      */
20
-    public function index()
20
+    public function index(Request $request)
21 21
     {
22 22
         return view('courses.index', [
23
-            'courses' => Course::where('dept_id', '=', 1)->with('sections:id,course_id,semester_code')->get()->sort('cmpCourseCode'),
23
+            'courses' => Course::where('dept_id', '=', $request->session()->get('department'))->with('sections:id,course_id,semester_code')->get()->sort('cmpCourseCode'),
24 24
             'semesters' => Semester::orderBy('code', 'asc')->get(),
25 25
         ]);
26 26
     }

+ 71
- 12
app/Http/Controllers/DashboardController.php ファイルの表示

@@ -3,9 +3,13 @@
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\Course;
6
+use App\Department;
6 7
 use App\Professor;
7 8
 use Illuminate\Http\Request;
8 9
 use App\Semester;
10
+use App\User;
11
+use Exception;
12
+use phpDocumentor\Reflection\Types\Object_;
9 13
 
10 14
 class DashboardController extends Controller
11 15
 {
@@ -38,19 +42,31 @@ class DashboardController extends Controller
38 42
      * @param string $semester
39 43
      * @return View
40 44
      */
41
-    public function schedule($semester_code) {
42
-        $data = Semester::findOrFail($semester_code);
43
-        $data->courses = $data->courses->sort('cmpCourseCode');
44
-        foreach($data->courses as $course) {
45
-            $course->sections = $course->sections->where('semester_code', '=', $semester_code);
46
-            foreach($course->sections as $section) {
47
-                $section->professors = $section->professors;
48
-            }
49
-        }
50
-        header('Content-Type: application/pdf');
51
-        header(`Content-Disposition: attachment; filename="${semester_code}.pdf";`);
45
+    public function schedule(Request $request, $semester_code) {
46
+        $semester = Semester::findOrFail($semester_code);
47
+        $data = (object)['alpha' => $semester->alpha];
48
+        $data->dept = Department::find($request->session()->get('department'));
49
+        $data->courses = $semester->courses()->where('dept_id', '=', $data->dept->id)->distinct()->get();
50
+        // dd($data);
51
+        // $data->loadMissing(['courses.sections' => function ($query) use ($request, $semester_code) {
52
+        //     $query->where('semester_code', '=', $semester_code);
53
+        // }, 'courses.sections.professors:id,first_name,last_name', 'courses.sections.schedules']);
52 54
         // return $data->toJson();
53
-        return '<script type="text/javascript">var data='.$data->toJson().'</script><script type="text/javascript" src="/js/createPDF.js"></script>';
55
+        // $data->courses = $data->courses->sort('cmpCourseCode');
56
+        // dump($data->courses[0]->sections);
57
+        // foreach($data->courses as $course) {
58
+        //     $course->sections = $course->sections;
59
+        //     foreach($course->sections as $section) {
60
+        //         $section->professors = $section->professors;
61
+        //     }
62
+        // }
63
+        // dd($data);
64
+        dd(json_encode($data, JSON_PRETTY_PRINT));
65
+        // header('Content-Type: application/pdf');
66
+        // header(`Content-Disposition: attachment; filename="${semester_code}.pdf";`);
67
+        // return $data->toJson();
68
+
69
+        return '<script type="text/javascript">var data='.$data->toJson().';</script><script type="text/javascript" src="/js/createPDF.js"></script>';
54 70
     }
55 71
 
56 72
     public function export($semester_code) {
@@ -85,4 +101,47 @@ class DashboardController extends Controller
85 101
             die();
86 102
         }
87 103
     }
104
+
105
+    public function exportCourses(Request $request) {
106
+        $courses = Course::where('dept_id', '=', $request->session()->get('department'))->with('sections:id,course_id,semester_code')->get()->sort('cmpCourseCode');
107
+        $semesters = Semester::orderBy('code', 'asc')->get();
108
+        header('Content-Type: application/csv');
109
+        header(`Content-Disposition: attachment; filename="courses.csv";`);
110
+        if ($file = fopen('php://output', 'w+')) {
111
+            fputcsv($file, array_merge(['CURSO'], $semesters->pluck('alpha')->toArray()));
112
+            foreach ($courses as $course) {
113
+                fputcsv($file,
114
+                    array_merge([$course->code], $semesters->map(function ($semester) use ($course) {
115
+                        return $course->getSemesterSectionCount($semester->code);
116
+                    })->toArray())
117
+                );
118
+            }
119
+            fclose($file);
120
+            die();
121
+        }
122
+    }
123
+
124
+    public function cloneSemester(Request $request, $semester_code) {
125
+        $semester = Semester::findOrFail($semester_code);
126
+        // dd($semester->sections);
127
+        $data = $request->validate([
128
+            'new_semester'  => 'required|unique:semesters,code|regex:/^[a-zA-Z][0-9][123]$/',
129
+            'new_alpha'     => 'required|unique:semesters,alpha'
130
+        ]);
131
+        try {
132
+            $semester->clone(strtoupper($data['new_semester']), strtoupper($data['new_alpha']));
133
+        } catch (Exception $e) {
134
+            echo $e->getMessage();
135
+        }
136
+        return redirect()->back();
137
+    }
138
+
139
+    /**
140
+     * TODO: Ability to add non-google users
141
+     */
142
+    public function addUser(Request $request) {
143
+        $data = $request->validate(['email' => ['required', 'email']]);
144
+        User::create($data);
145
+        return redirect()->back();
146
+    }
88 147
 }

+ 15
- 0
app/Http/Controllers/HomeController.php ファイルの表示

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+namespace App\Http\Controllers;
4
+
5
+use Illuminate\Http\Request;
6
+use App\Department;
7
+
8
+class HomeController extends Controller
9
+{
10
+    public function index(Request $request) {
11
+        return view('welcome', [
12
+            // 'department' => Department::find($request->session()->get('department')),
13
+        ]);
14
+    }
15
+}

+ 6
- 5
app/Http/Controllers/ProfessorController.php ファイルの表示

@@ -14,11 +14,11 @@ class ProfessorController extends Controller
14 14
      *
15 15
      * @return \Illuminate\Http\Response
16 16
      */
17
-    public function index()
17
+    public function index(Request $request)
18 18
     {
19 19
         // dd(Professor::where('dept_id', '=', 1)->with(['sections:semester_code,credits,student_count', 'semesters:semester_code,admin_load,investigative_load'])->orderBy('professors.last_name')->get());
20 20
         return view('professors.index', [
21
-            'professors' => Professor::where('dept_id', '=', 1)->with(['sections:semester_code,credits,student_count', 'semesters:semester_code,admin_load,investigative_load'])->orderBy('professors.last_name')->get(),
21
+            'professors' => Professor::where('dept_id', '=', $request->session()->get('department'))->with(['sections:semester_code,credits,student_count', 'semesters:semester_code,admin_load,investigative_load,other'])->orderBy('professors.last_name')->get(),
22 22
             'semesters' => Semester::orderBy('semesters.code', 'asc')->get(),
23 23
         ]);
24 24
     }
@@ -63,7 +63,7 @@ class ProfessorController extends Controller
63 63
      */
64 64
     public function show(Professor $professor)
65 65
     {
66
-        $professor->loadMissing(['sections.course', 'semesters.sections.course']);
66
+        $professor->loadMissing(['sections.course', 'semesters.sections.course', 'sections.schedules']);
67 67
         $loads = $professor->semesters()->get()->keyBy('code');
68 68
         $sections = $professor->sections()->with('course:id,code')->get()->groupBy('semester_code');
69 69
         $semesters = Semester::whereIn('code', $loads->keys())->orWhereIn('code', $sections->keys())->orderBy('code', 'desc')->get();
@@ -99,9 +99,10 @@ class ProfessorController extends Controller
99 99
         // TODO: Update section percent,schedule and eval
100 100
         if ($request->isMethod('put')) {
101 101
             $data = array_filter($request->validate([
102
-                'semester_code'         => ['required_with:admin_load,investigative_load', 'string','size:3'],
102
+                'semester_code'         => ['required_with:admin_load,investigative_load,other', 'string','size:3'],
103 103
                 'admin_load'            => ['nullable', 'numeric'],
104
-                'investigative_load'    => ['nullable', 'numeric']
104
+                'investigative_load'    => ['nullable', 'numeric'],
105
+                'other'                 => ['nullable', 'numeric']
105 106
             ]));
106 107
             // dd($data);
107 108
             if (! $professor->semesters->contains($data['semester_code'])) {

+ 2
- 1
app/Http/Kernel.php ファイルの表示

@@ -31,10 +31,11 @@ class Kernel extends HttpKernel
31 31
             \App\Http\Middleware\EncryptCookies::class,
32 32
             \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
33 33
             \Illuminate\Session\Middleware\StartSession::class,
34
-            // \Illuminate\Session\Middleware\AuthenticateSession::class,
34
+            \Illuminate\Session\Middleware\AuthenticateSession::class,
35 35
             \Illuminate\View\Middleware\ShareErrorsFromSession::class,
36 36
             \App\Http\Middleware\VerifyCsrfToken::class,
37 37
             \Illuminate\Routing\Middleware\SubstituteBindings::class,
38
+            \App\Http\Middleware\SetDept::class,
38 39
         ],
39 40
 
40 41
         'api' => [

+ 29
- 0
app/Http/Middleware/SetDept.php ファイルの表示

@@ -0,0 +1,29 @@
1
+<?php
2
+
3
+namespace App\Http\Middleware;
4
+
5
+use Closure;
6
+
7
+class SetDept
8
+{
9
+    /**
10
+     * Sets the department session variable to the desired department id or the default if none is set.
11
+     *
12
+     * @param  \Illuminate\Http\Request  $request
13
+     * @param  \Closure  $next
14
+     * @return mixed
15
+     */
16
+    public function handle($request, Closure $next)
17
+    {
18
+        if ($request->has('setdept')) {
19
+            $data = $request->validate(['setdept' => 'integer|exists:departments,id']);
20
+            $request->session()->put('department', $data['setdept']);
21
+        }
22
+        if (!$request->session()->has('department')) {
23
+            $default_dept_id = \App\Department::whereNull('name')->first()->id;
24
+            $request->session()->put('department', $default_dept_id);
25
+        }
26
+        // dump($request->session()->get('department'));
27
+        return $next($request);
28
+    }
29
+}

+ 1
- 1
app/Professor.php ファイルの表示

@@ -23,7 +23,7 @@ class Professor extends Model
23 23
     }
24 24
 
25 25
     public function semesters() {
26
-        return $this->belongsToMany(Semester::class)->withPivot('admin_load', 'investigative_load');
26
+        return $this->belongsToMany(Semester::class)->withPivot('admin_load', 'investigative_load', 'other');
27 27
     }
28 28
 
29 29
     public function getFullNameAttribute() {

+ 24
- 0
app/Schedule.php ファイルの表示

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+namespace App;
4
+
5
+use Illuminate\Database\Eloquent\Model;
6
+
7
+class Schedule extends Model
8
+{
9
+    protected $table = 'section_schedule';
10
+
11
+    public $incrementing = false;
12
+    public $timestamps = false;
13
+
14
+    public function section() {
15
+        return $this->belongsTo(Section::class);
16
+    }
17
+
18
+    public function getLocationAttribute() {
19
+        return $this->building . ' ' . $this->room;
20
+    }
21
+    public function getHoursAttribute() {
22
+        return $this->days . ' ' . $this->time_start . '-' . $this->time_end;
23
+    }
24
+}

+ 6
- 2
app/Section.php ファイルの表示

@@ -7,14 +7,14 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
7 7
 
8 8
 class Section extends Model
9 9
 {
10
-
11 10
     protected $fillable = [
12 11
         'course_id',
13 12
         'semester_code',
14 13
         'code',
15 14
         'credits',
16 15
         'student_count',
17
-        'syllabus'
16
+        'syllabus',
17
+        'quota'
18 18
     ];
19 19
 
20 20
     public $timestamps = false;
@@ -31,6 +31,10 @@ class Section extends Model
31 31
         return $this->belongsToMany(Professor::class);
32 32
     }
33 33
 
34
+    public function schedules() {
35
+        return $this->hasMany(Schedule::class);
36
+    }
37
+
34 38
     public function getExtraCreditsAttribute() {
35 39
         return calcExtraCredits($this->credits, $this->student_count);
36 40
     }

+ 40
- 0
app/Semester.php ファイルの表示

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace App;
4 4
 
5
+use Exception;
5 6
 use Illuminate\Database\Eloquent\Model;
6 7
 
7 8
 class Semester extends Model
@@ -11,6 +12,10 @@ class Semester extends Model
11 12
     public $timestamps = false;
12 13
 
13 14
     protected $keyType = 'string';
15
+    protected $fillable = [
16
+        'code',
17
+        'alpha'
18
+    ];
14 19
 
15 20
 
16 21
     public function courses() {
@@ -29,5 +34,40 @@ class Semester extends Model
29 34
         return Semester::orderBy('code', 'desc')->take(6)->get()->contains('code', $this->code);
30 35
     }
31 36
 
37
+    /**
38
+     * Returns a clone of this semester with the provided code and alpha.
39
+     * This functions also copies every section and professor_section
40
+     *
41
+     * @param string $newSemCode
42
+     * @param string $newSemAlpha
43
+     *
44
+     * @return Semester
45
+     */
46
+    public function clone(string $newSemCode, string $newSemAlpha) {
47
+        if (Semester::find($newSemCode)) {
48
+            throw new Exception('A semester with code ' . $newSemCode . ' already exists');
49
+        }
50
+        $newSem = Semester::create([
51
+            'code'  => $newSemCode,
52
+            'alpha' => $newSemAlpha,
53
+        ]);
54
+
55
+        // Copy all sections to new semester
56
+        foreach($this->sections as $section) {
57
+            $sectionClone = $section->replicate();
58
+            $sectionClone->semester_code = $newSem->code;
59
+            $sectionClone->save();
60
+
61
+            foreach($section->professors as $professor) {
62
+                $sectionClone->professors()->attach($professor, ['percent' => $professor->pivot->percent]);
63
+            }
64
+
65
+            foreach($section->schedules as $schedule) {
66
+                $sectionClone->schedules()->save($schedule);
67
+            }
68
+        }
69
+
70
+        return $newSem;
71
+    }
32 72
 
33 73
 }

+ 2
- 2
app/User.php ファイルの表示

@@ -16,7 +16,7 @@ class User extends Authenticatable
16 16
      * @var array
17 17
      */
18 18
     protected $fillable = [
19
-        'name', 'email', 'password',
19
+        'name', 'email', 'password', 'google_id',
20 20
     ];
21 21
 
22 22
     /**
@@ -25,7 +25,7 @@ class User extends Authenticatable
25 25
      * @var array
26 26
      */
27 27
     protected $hidden = [
28
-        'password', 'remember_token',
28
+        'password', 'remember_token', 'google_id',
29 29
     ];
30 30
 
31 31
     /**

+ 1
- 0
composer.json ファイルの表示

@@ -18,6 +18,7 @@
18 18
         "beyondcode/laravel-dump-server": "^1.0",
19 19
         "filp/whoops": "^2.0",
20 20
         "fzaninotto/faker": "^1.4",
21
+        "laravel/telescope": "^2.1",
21 22
         "mockery/mockery": "^1.0",
22 23
         "nunomaduro/collision": "^3.0",
23 24
         "phpunit/phpunit": "^7.5"

+ 112
- 1
composer.lock ファイルの表示

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "290e3b855c274897254c0edf8fbcd746",
7
+    "content-hash": "aaacdbc762efbb1ffd2f6bb2c60d7bf1",
8 8
     "packages": [
9 9
         {
10 10
             "name": "dnoegel/php-xdg-base-dir",
@@ -3557,6 +3557,68 @@
3557 3557
             "time": "2016-01-20T08:20:44+00:00"
3558 3558
         },
3559 3559
         {
3560
+            "name": "laravel/telescope",
3561
+            "version": "v2.1",
3562
+            "source": {
3563
+                "type": "git",
3564
+                "url": "https://github.com/laravel/telescope.git",
3565
+                "reference": "d9c5c53d3a0c60dcd4ef3777884d0cf368eb3e6f"
3566
+            },
3567
+            "dist": {
3568
+                "type": "zip",
3569
+                "url": "https://api.github.com/repos/laravel/telescope/zipball/d9c5c53d3a0c60dcd4ef3777884d0cf368eb3e6f",
3570
+                "reference": "d9c5c53d3a0c60dcd4ef3777884d0cf368eb3e6f",
3571
+                "shasum": ""
3572
+            },
3573
+            "require": {
3574
+                "ext-json": "*",
3575
+                "laravel/framework": "~5.8.0|^6.0|^7.0",
3576
+                "moontoast/math": "^1.1",
3577
+                "php": "^7.1.3",
3578
+                "symfony/var-dumper": "^4.1"
3579
+            },
3580
+            "require-dev": {
3581
+                "orchestra/testbench": "^3.8|^4.0|^5.0"
3582
+            },
3583
+            "type": "library",
3584
+            "extra": {
3585
+                "branch-alias": {
3586
+                    "dev-master": "2.0-dev"
3587
+                },
3588
+                "laravel": {
3589
+                    "providers": [
3590
+                        "Laravel\\Telescope\\TelescopeServiceProvider"
3591
+                    ]
3592
+                }
3593
+            },
3594
+            "autoload": {
3595
+                "psr-4": {
3596
+                    "Laravel\\Telescope\\": "src/"
3597
+                }
3598
+            },
3599
+            "notification-url": "https://packagist.org/downloads/",
3600
+            "license": [
3601
+                "MIT"
3602
+            ],
3603
+            "authors": [
3604
+                {
3605
+                    "name": "Taylor Otwell",
3606
+                    "email": "taylor@laravel.com"
3607
+                },
3608
+                {
3609
+                    "name": "Mohamed Said",
3610
+                    "email": "mohamed@laravel.com"
3611
+                }
3612
+            ],
3613
+            "description": "An elegant debug assistant for the Laravel framework.",
3614
+            "keywords": [
3615
+                "debugging",
3616
+                "laravel",
3617
+                "monitoring"
3618
+            ],
3619
+            "time": "2019-08-30T11:58:27+00:00"
3620
+        },
3621
+        {
3560 3622
             "name": "mockery/mockery",
3561 3623
             "version": "1.2.2",
3562 3624
             "source": {
@@ -3622,6 +3684,55 @@
3622 3684
             "time": "2019-02-13T09:37:52+00:00"
3623 3685
         },
3624 3686
         {
3687
+            "name": "moontoast/math",
3688
+            "version": "1.1.2",
3689
+            "source": {
3690
+                "type": "git",
3691
+                "url": "https://github.com/ramsey/moontoast-math.git",
3692
+                "reference": "c2792a25df5cad4ff3d760dd37078fc5b6fccc79"
3693
+            },
3694
+            "dist": {
3695
+                "type": "zip",
3696
+                "url": "https://api.github.com/repos/ramsey/moontoast-math/zipball/c2792a25df5cad4ff3d760dd37078fc5b6fccc79",
3697
+                "reference": "c2792a25df5cad4ff3d760dd37078fc5b6fccc79",
3698
+                "shasum": ""
3699
+            },
3700
+            "require": {
3701
+                "ext-bcmath": "*",
3702
+                "php": ">=5.3.3"
3703
+            },
3704
+            "require-dev": {
3705
+                "jakub-onderka/php-parallel-lint": "^0.9.0",
3706
+                "phpunit/phpunit": "^4.7|>=5.0 <5.4",
3707
+                "satooshi/php-coveralls": "^0.6.1",
3708
+                "squizlabs/php_codesniffer": "^2.3"
3709
+            },
3710
+            "type": "library",
3711
+            "autoload": {
3712
+                "psr-4": {
3713
+                    "Moontoast\\Math\\": "src/Moontoast/Math/"
3714
+                }
3715
+            },
3716
+            "notification-url": "https://packagist.org/downloads/",
3717
+            "license": [
3718
+                "Apache-2.0"
3719
+            ],
3720
+            "authors": [
3721
+                {
3722
+                    "name": "Ben Ramsey",
3723
+                    "email": "ben@benramsey.com",
3724
+                    "homepage": "https://benramsey.com"
3725
+                }
3726
+            ],
3727
+            "description": "A mathematics library, providing functionality for large numbers",
3728
+            "homepage": "https://github.com/ramsey/moontoast-math",
3729
+            "keywords": [
3730
+                "bcmath",
3731
+                "math"
3732
+            ],
3733
+            "time": "2017-02-16T16:54:46+00:00"
3734
+        },
3735
+        {
3625 3736
             "name": "myclabs/deep-copy",
3626 3737
             "version": "1.9.1",
3627 3738
             "source": {

+ 1
- 0
config/app.php ファイルの表示

@@ -166,6 +166,7 @@ return [
166 166
          * Package Service Providers...
167 167
          */
168 168
         Laravel\Socialite\SocialiteServiceProvider::class,
169
+        // Laravel\Telescope\TelescopeServiceProvider::class,
169 170
 
170 171
         /*
171 172
          * Application Service Providers...

+ 2
- 0
config/logging.php ファイルの表示

@@ -44,6 +44,7 @@ return [
44 44
             'driver' => 'single',
45 45
             'path' => storage_path('logs/laravel.log'),
46 46
             'level' => 'debug',
47
+            'permission' => 0644,
47 48
         ],
48 49
 
49 50
         'daily' => [
@@ -51,6 +52,7 @@ return [
51 52
             'path' => storage_path('logs/laravel.log'),
52 53
             'level' => 'debug',
53 54
             'days' => 14,
55
+            'permission' => 0664,
54 56
         ],
55 57
 
56 58
         'slack' => [

+ 3
- 3
config/session.php ファイルの表示

@@ -31,9 +31,9 @@ return [
31 31
     |
32 32
     */
33 33
 
34
-    'lifetime' => env('SESSION_LIFETIME', 120),
34
+    'lifetime' => env('SESSION_LIFETIME', 60),
35 35
 
36
-    'expire_on_close' => false,
36
+    'expire_on_close' => true,
37 37
 
38 38
     /*
39 39
     |--------------------------------------------------------------------------
@@ -46,7 +46,7 @@ return [
46 46
     |
47 47
     */
48 48
 
49
-    'encrypt' => false,
49
+    'encrypt' => true,
50 50
 
51 51
     /*
52 52
     |--------------------------------------------------------------------------

+ 2
- 3
database/migrations/2014_10_12_000000_create_users_table.php ファイルの表示

@@ -15,11 +15,10 @@ class CreateUsersTable extends Migration
15 15
     {
16 16
         Schema::create('users', function (Blueprint $table) {
17 17
             $table->bigIncrements('id');
18
-            $table->string('name');
19
-            $table->string('google_id');
20 18
             $table->string('email')->unique();
19
+            $table->string('name')->nullable();
20
+            $table->string('google_id')->nullable();
21 21
             $table->timestamp('email_verified_at')->nullable();
22
-            // $table->string('password')->nullable();
23 22
             $table->rememberToken();
24 23
             $table->timestamps();
25 24
         });

+ 28
- 28
database/migrations/2019_07_07_152338_create_semesters_table.php ファイルの表示

@@ -19,34 +19,34 @@ class CreateSemestersTable extends Migration
19 19
             $table->string('alpha');
20 20
         });
21 21
 
22
-        DB::table('semesters')->insert(
23
-            array(
24
-                array('code' => 'B31','alpha' => '2013-2014 SEM 1'),
25
-                array('code' => 'B32','alpha' => '2013-2014 SEM 2'),
26
-                array('code' => 'B33','alpha' => '2013-2014 VERANO'),
27
-                array('code' => 'B41','alpha' => '2014-2015 SEM 1'),
28
-                array('code' => 'B42','alpha' => '2014-2015 SEM 2'),
29
-                array('code' => 'B43','alpha' => '2014-2015 VERANO'),
30
-                array('code' => 'B51','alpha' => '2015-2016 SEM 1'),
31
-                array('code' => 'B52','alpha' => '2015-2016 SEM 2'),
32
-                array('code' => 'B53','alpha' => '2015-2016 VERANO'),
33
-                array('code' => 'B61','alpha' => '2016-2017 SEM 1'),
34
-                array('code' => 'B62','alpha' => '2016-2017 SEM 2'),
35
-                array('code' => 'B63','alpha' => '2016-2017 VERANO'),
36
-                array('code' => 'B71','alpha' => '2017-2018 SEM 1'),
37
-                array('code' => 'B72','alpha' => '2017-2018 SEM 2'),
38
-                array('code' => 'B73','alpha' => '2017-2018 VERANO'),
39
-                array('code' => 'B81','alpha' => '2018-2019 SEM 1'),
40
-                array('code' => 'B82','alpha' => '2018-2019 SEM 2'),
41
-                array('code' => 'B83','alpha' => '2018-2019 VERANO'),
42
-                array('code' => 'B91','alpha' => '2019-2020 SEM 1'),
43
-                array('code' => 'B92','alpha' => '2019-2020 SEM 2'),
44
-                array('code' => 'B93','alpha' => '2019-2020 VERANO'),
45
-                array('code' => 'C01','alpha' => '2020-2021 SEM 1'),
46
-                array('code' => 'C02','alpha' => '2020-2021 SEM 2'),
47
-                array('code' => 'C03','alpha' => '2020-2021 VERANO')
48
-              )
49
-            );
22
+        // DB::table('semesters')->insert(
23
+        //     array(
24
+        //         array('code' => 'B31','alpha' => '2013-2014 SEM 1'),
25
+        //         array('code' => 'B32','alpha' => '2013-2014 SEM 2'),
26
+        //         array('code' => 'B33','alpha' => '2013-2014 VERANO'),
27
+        //         array('code' => 'B41','alpha' => '2014-2015 SEM 1'),
28
+        //         array('code' => 'B42','alpha' => '2014-2015 SEM 2'),
29
+        //         array('code' => 'B43','alpha' => '2014-2015 VERANO'),
30
+        //         array('code' => 'B51','alpha' => '2015-2016 SEM 1'),
31
+        //         array('code' => 'B52','alpha' => '2015-2016 SEM 2'),
32
+        //         array('code' => 'B53','alpha' => '2015-2016 VERANO'),
33
+        //         array('code' => 'B61','alpha' => '2016-2017 SEM 1'),
34
+        //         array('code' => 'B62','alpha' => '2016-2017 SEM 2'),
35
+        //         array('code' => 'B63','alpha' => '2016-2017 VERANO'),
36
+        //         array('code' => 'B71','alpha' => '2017-2018 SEM 1'),
37
+        //         array('code' => 'B72','alpha' => '2017-2018 SEM 2'),
38
+        //         array('code' => 'B73','alpha' => '2017-2018 VERANO'),
39
+        //         array('code' => 'B81','alpha' => '2018-2019 SEM 1'),
40
+        //         array('code' => 'B82','alpha' => '2018-2019 SEM 2'),
41
+        //         array('code' => 'B83','alpha' => '2018-2019 VERANO'),
42
+        //         array('code' => 'B91','alpha' => '2019-2020 SEM 1'),
43
+        //         array('code' => 'B92','alpha' => '2019-2020 SEM 2'),
44
+        //         array('code' => 'B93','alpha' => '2019-2020 VERANO'),
45
+        //         array('code' => 'C01','alpha' => '2020-2021 SEM 1'),
46
+        //         array('code' => 'C02','alpha' => '2020-2021 SEM 2'),
47
+        //         array('code' => 'C03','alpha' => '2020-2021 VERANO')
48
+        //       )
49
+        //     );
50 50
     }
51 51
 
52 52
     /**

+ 12
- 11
database/migrations/2019_07_07_183013_create_departments_table.php ファイルの表示

@@ -15,19 +15,20 @@ class CreateDepartmentsTable extends Migration
15 15
     {
16 16
         Schema::create('departments', function (Blueprint $table) {
17 17
             $table->unsignedBigInteger('id')->primary();
18
-            $table->string('name');
18
+            $table->string('name')->nullable();
19
+            $table->string('title')->nullable();
19 20
         });
20 21
 
21
-        DB::table('departments')->insert(
22
-            array(
23
-                array('id' => '1','name' => 'BIOL'),
24
-                array('id' => '4','name' => 'CIAM'),
25
-                array('id' => '2','name' => 'FISI'),
26
-                array('id' => '3','name' => 'MATE'),
27
-                array('id' => '5','name' => 'PGCN'),
28
-                array('id' => '6','name' => 'QUIM'),
29
-                array('id' => '7','name' => 'default'),
30
-            ));
22
+        // DB::table('departments')->insert(
23
+        //     array(
24
+        //         array('id' => '1','name' => 'BIOL', 'title' => 'Biolo'),
25
+        //         array('id' => '4','name' => 'CIAM', 'title' => ),
26
+        //         array('id' => '2','name' => 'FISI', 'title' => ),
27
+        //         array('id' => '3','name' => 'MATE', 'title' => ),
28
+        //         array('id' => '5','name' => 'PGCN', 'title' => ),
29
+        //         array('id' => '6','name' => 'QUIM', 'title' => ),
30
+        //         array('id' => '7','name' => 'default'),
31
+        //     ));
31 32
     }
32 33
 
33 34
     /**

+ 1
- 0
database/migrations/2019_07_07_191614_create_sections_table.php ファイルの表示

@@ -21,6 +21,7 @@ class CreateSectionsTable extends Migration
21 21
             $table->unsignedInteger('student_count')->nullable();
22 22
             $table->string('syllabus')->nullable();
23 23
             $table->unsignedDecimal('credits')->nullable();
24
+            $table->unsignedDecimal('quota')->nullable();
24 25
 
25 26
 
26 27
             $table->foreign('semester_code')->references('code')->on('semesters');

+ 1
- 1
database/migrations/2019_07_07_230040_create_professors_table.php ファイルの表示

@@ -21,7 +21,7 @@ class CreateProfessorsTable extends Migration
21 21
             $table->string('system_name')->nullable();
22 22
             $table->string('email')->nullable();
23 23
             $table->enum('type', ['plantilla', 'contrato', 'ta'])->nullable();
24
-            $table->unsignedBigInteger('dept_id')->default(0);
24
+            $table->unsignedBigInteger('dept_id');
25 25
 
26 26
             $table->foreign('dept_id')->references('id')->on('departments')->onUpdate('cascade');
27 27
         });

+ 1
- 0
database/migrations/2019_07_07_231850_create_professor_semester_table.php ファイルの表示

@@ -18,6 +18,7 @@ class CreateProfessorSemesterTable extends Migration
18 18
             $table->char('semester_code', 3);
19 19
             $table->decimal('admin_load')->nullable();
20 20
             $table->decimal('investigative_load')->nullable();
21
+            $table->decimal('other')->nullable();
21 22
 
22 23
             $table->foreign('professor_id')->references('id')->on('professors')->onUpdate('cascade');
23 24
             $table->foreign('semester_code')->references('code')->on('semesters');

+ 1
- 1
database/migrations/2019_07_07_231913_create_professor_section_table.php ファイルの表示

@@ -21,7 +21,7 @@ class CreateProfessorSectionTable extends Migration
21 21
             $table->float('eval')->nullable();
22 22
 
23 23
             $table->foreign('professor_id')->references('id')->on('professors')->onUpdate('cascade');
24
-            $table->foreign('section_id')->references('id')->on('sections')->onDelete('cascade')->onUpdate('cascade');
24
+            $table->foreign('section_id')->references('id')->on('sections')->onUpdate('cascade');
25 25
 
26 26
             $table->unique(['professor_id', 'section_id']);
27 27
         });

+ 38
- 0
database/migrations/2019_10_08_184256_create_section_schedule_table.php ファイルの表示

@@ -0,0 +1,38 @@
1
+<?php
2
+
3
+use Illuminate\Support\Facades\Schema;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Database\Migrations\Migration;
6
+
7
+class CreateSectionScheduleTable extends Migration
8
+{
9
+    /**
10
+     * Run the migrations.
11
+     *
12
+     * @return void
13
+     */
14
+    public function up()
15
+    {
16
+        Schema::create('section_schedule', function (Blueprint $table) {
17
+            $table->bigIncrements('id');
18
+            $table->unsignedBigInteger('section_id');
19
+            $table->string('building', 4);
20
+            $table->string('room', 5);
21
+            $table->string('days', 5);
22
+            $table->string('time_start', 8);
23
+            $table->string('time_end', 8);
24
+
25
+            $table->foreign('section_id')->references('id')->on('sections')->onUpdate('cascade')->onDelete('cascade');
26
+        });
27
+    }
28
+
29
+    /**
30
+     * Reverse the migrations.
31
+     *
32
+     * @return void
33
+     */
34
+    public function down()
35
+    {
36
+        Schema::dropIfExists('section_schedule');
37
+    }
38
+}

+ 34
- 0
database/migrations/2019_10_08_184424_create_professor_system_name_table.php ファイルの表示

@@ -0,0 +1,34 @@
1
+<?php
2
+
3
+use Illuminate\Support\Facades\Schema;
4
+use Illuminate\Database\Schema\Blueprint;
5
+use Illuminate\Database\Migrations\Migration;
6
+
7
+class CreateProfessorSystemNameTable extends Migration
8
+{
9
+    /**
10
+     * Run the migrations.
11
+     *
12
+     * @return void
13
+     */
14
+    public function up()
15
+    {
16
+        Schema::create('professor_system_name', function (Blueprint $table) {
17
+            $table->bigIncrements('id');
18
+            $table->unsignedBigInteger('professor_id');
19
+            $table->string('system_name');
20
+
21
+            $table->foreign('professor_id')->references('id')->on('professors')->onUpdate('cascade');
22
+        });
23
+    }
24
+
25
+    /**
26
+     * Reverse the migrations.
27
+     *
28
+     * @return void
29
+     */
30
+    public function down()
31
+    {
32
+        Schema::dropIfExists('professor_system_name');
33
+    }
34
+}

+ 8
- 5
database/seeds/DatabaseSeeder.php ファイルの表示

@@ -11,10 +11,13 @@ class DatabaseSeeder extends Seeder
11 11
      */
12 12
     public function run()
13 13
     {
14
-        $this->call(CourseSeeder::class);
15
-        $this->call(SectionSeeder::class);
16
-        $this->call(ProfessorSeeder::class);
17
-        $this->call(ProfessorSectionSeeder::class);
18
-        $this->call(ProfessorSemesterSeeder::class);
14
+        $sql = file_get_contents(database_path() . '/seeds/biologia.sql');
15
+
16
+        DB::unprepared($sql);
17
+        // $this->call(CourseSeeder::class);
18
+        // $this->call(SectionSeeder::class);
19
+        // $this->call(ProfessorSeeder::class);
20
+        // $this->call(ProfessorSectionSeeder::class);
21
+        // $this->call(ProfessorSemesterSeeder::class);
19 22
     }
20 23
 }

+ 2101
- 527
package-lock.json
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 1
- 0
package.json ファイルの表示

@@ -36,6 +36,7 @@
36 36
         "@material/select": "^3.2.0",
37 37
         "@material/textfield": "^3.2.0",
38 38
         "@material/typography": "^3.1.0",
39
+        "material-components-web": "^4.0.0",
39 40
         "pdfmake": "^0.1.59"
40 41
     }
41 42
 }

+ 2
- 1
resources/js/app.js ファイルの表示

@@ -1 +1,2 @@
1
-window.mdc.autoInit();
1
+const mdc = require('material-components-web');
2
+mdc.autoInit();

+ 24
- 10
resources/js/createPDF.js ファイルの表示

@@ -13,25 +13,38 @@ pdfMake.vfs = pdfFonts.pdfMake.vfs;
13 13
 
14 14
 function table(course) {
15 15
     return {
16
-        widths: [100, 300],
16
+        widths: [50, 100, 50, 50],
17 17
         headerRows: 2,
18 18
         body: [
19
-            [{text: `${course.code} ${course.title}`, bold: true, colSpan: 2, alignment: 'center'}, {}],
20
-            ['Seccion', 'Profesor'],
19
+            [{text: `${course.code} ${course.title}`, bold: true, colSpan: 4, alignment: 'center'}, {}, {}, {}],
20
+            ['Seccion', 'Profesor', 'Lugar', 'Horas'],
21 21
         ].concat( course.sections.map( function(section) {
22
-            if (section.hasOwnProperty('professors')) {
23
-                return [section.code, section.professors.map( function (professor) {
24
-                    return professor.first_name + ' ' + professor.last_name;
25
-                })];
22
+            var res = [section.code];
23
+            if (section.hasOwnProperty('professors') && !section.professors.length) {
24
+                res = res.concat( section.professors.reduce( function (acc, professor) {
25
+                    return  acc + '\n' + professor.first_name + ' ' + professor.last_name;
26
+                }));
26 27
             } else {
27
-                return [section.code, ''];
28
+                res = res.concat('');
28 29
             }
30
+            if (section.hasOwnProperty('schedules') && !section.professors.length) {
31
+                res = res.concat( section.schedules.reduce( function (acc, schedule) {
32
+                    return acc + '\n' + schedule.building + ' ' + schedule.room;
33
+                }));
34
+                res = res.concat( section.schedules.reduce( function (acc, schedule) {
35
+                    return acc + '\n' + schedule.time_start + '-' + schedule.time_end;
36
+                }));
37
+            } else {
38
+                res = res.concat(['', '']);
39
+            }
40
+            return res;
29 41
         }))
30 42
     }
31 43
 }
44
+
32 45
 var docDef = {
33 46
     content: [
34
-        {text: `Horario BIOL ${data.alpha}`, style: 'header'},
47
+        {text: `Horario ${data.dept.name} ${data.alpha}`, style: 'header'},
35 48
         {text: 'sujeto a cambios', style: 'header', fontSize: 18},
36 49
     ].concat( data.courses.map( function(course) {
37 50
         return {
@@ -53,5 +66,6 @@ var docDef = {
53 66
 
54 67
 };
55 68
 
69
+console.log(docDef);
56 70
 pdfMake.createPdf(docDef).download();
57
-window.location.replace("/dashboard");
71
+// window.location.replace("/dashboard");

+ 42
- 5
resources/js/dashboard.js ファイルの表示

@@ -1,18 +1,55 @@
1 1
 // import {MDCDialog} from '@material/dialog';
2 2
 import {MDCSelect} from '@material/select';
3 3
 import {MDCTextField} from '@material/textfield';
4
-// const dialog = new MDCDialog(document.querySelector('.mdc-dialog'));
5
-const select = new MDCSelect(document.querySelector('.mdc-select'));
6
-
4
+import {MDCTextFieldHelperText} from '@material/textfield/helper-text';
7 5
 
6
+// const dialog = new MDCDialog(document.querySelector('.mdc-dialog'));
7
+// const semCloneSelect = new MDCSelect(document.querySelector('.mdc-select#sem-clone-select'));
8
+// const textfield = new MDCTextField(document.querySelector('.mdc-text-field'));
8 9
 
9 10
 $(document).ready( function() {
10 11
     $('#modal-semester').on('show.bs.modal', function (event) {
12
+        var form = $(this).find('#modal-semester-form');
13
+        form.attr('method', 'GET');
14
+        form.removeAttr('action');
11 15
         var button = $(event.relatedTarget);
12 16
         var action = button.data('action');
13 17
 
14
-        select.listen('MDCSelect:change', () => {
15
-            $('#modal-semester-form').attr('action', `/dashboard/${action}/${select.value}`);
18
+        const semSelect = new MDCSelect($(this).find('#sem-select')[0]);
19
+        if (semSelect.value !== '') {
20
+            form.attr('method', 'POST');
21
+            form.attr('action', `/dashboard/${action}/${semSelect.value}`);
22
+        }
23
+        semSelect.listen('MDCSelect:change', () => {
24
+            if (semSelect.value !== '') {
25
+                form.attr('method', 'POST');
26
+                form.attr('action', `/dashboard/${action}/${semSelect.value}`);
27
+            }
28
+        });
29
+
30
+    });
31
+
32
+    $('#modal-semester-clone').on('show.bs.modal', function (event) {
33
+        var form = $(this).find('#modal-semester-clone-form');
34
+        var button = $(event.relatedTarget);
35
+        var action = button.data('action');
36
+
37
+        console.log($(this));
38
+        const semCloneSelect = new MDCSelect($(this).find('#sem-clone-select')[0]);
39
+        // console.log(textfields);
40
+        // const t1 = new MDCTextField(document.querySelector('.mdc-text-field'));
41
+
42
+        form.attr('method', 'GET');
43
+        form.removeAttr('action');
44
+        if (semCloneSelect.value !== '') {
45
+            form.attr('method', 'POST');
46
+            form.attr('action', `/dashboard/clone/${semCloneSelect.value}`);
47
+        }
48
+        semCloneSelect.listen('MDCSelect:change', () => {
49
+            if (semCloneSelect.value !== '') {
50
+                form.attr('method', 'POST');
51
+                form.attr('action', `/dashboard/clone/${semCloneSelect.value}`);
52
+            }
16 53
         });
17 54
 
18 55
     });

+ 32
- 8
resources/sass/app.scss ファイルの表示

@@ -8,15 +8,23 @@
8 8
 @import '~bootstrap/scss/bootstrap';
9 9
 
10 10
 // Material Design
11
-@import '@material/layout-grid/mdc-layout-grid';
11
+// @import "material-components-web/material-components-web";
12 12
 @import '@material/typography/mdc-typography';
13
+@import '@material/layout-grid/mdc-layout-grid';
14
+@import '@material/elevation/mdc-elevation';
13 15
 @import '@material/button/mdc-button';
14 16
 @import '@material/icon-button/mdc-icon-button';
15 17
 @import '@material/checkbox/mdc-checkbox';
18
+@import '@material/card/mdc-card';
19
+@import '@material/select/mdc-select';
20
+@import "@material/list/mdc-list";
21
+@import "@material/textfield/mdc-text-field";
22
+@import "@material/textfield/helper-text/mdc-text-field-helper-text";
16 23
 @import '@material/data-table/mdc-data-table';
17 24
 
18 25
 body {
19 26
     padding-top: 80px;
27
+    overflow-x: hidden;
20 28
 }
21 29
 
22 30
 /* Rules for sizing the icon. */
@@ -129,19 +137,13 @@ body {
129 137
 
130 138
 .table--fit-screen {
131 139
     height: 80vh;
140
+    width: 96vw;
132 141
 }
133 142
 
134 143
 .course-sections-table {
135 144
     @include mdc-data-table-column-widths(10% 10% 40% 10% 10% 10%);
136 145
 }
137 146
 
138
-#prof-table {
139
-}
140
-
141
-#course-table {
142
-    @include mdc-data-table-column-widths(20px 10px 56px);
143
-}
144
-
145 147
 .ellipsis {
146 148
     @include mdc-typography-overflow-ellipsis;
147 149
 }
@@ -158,3 +160,25 @@ body {
158 160
 [id|="delete-confirm"] {
159 161
     padding-top: 4px;
160 162
 }
163
+
164
+h1 {
165
+    @include mdc-typography(headline1)
166
+}
167
+h2 {
168
+    @include mdc-typography(headline2)
169
+}
170
+h3 {
171
+    @include mdc-typography(headline3)
172
+}
173
+h4 {
174
+    @include mdc-typography(headline4)
175
+}
176
+h5 {
177
+    @include mdc-typography(headline5)
178
+}
179
+h6 {
180
+    @include mdc-typography(headline6)
181
+}
182
+button {
183
+    @include mdc-typography(button)
184
+}

+ 58
- 54
resources/views/courses/index.blade.php ファイルの表示

@@ -4,18 +4,20 @@
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">
7
-        <div class="mdc-layout-grid__cell--span-2-desktop">
8
-            <h1 class="mdc-typography--heading1">Cursos</h1>
9
-        </div>
10
-        <div class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--align-middle">
11
-            <button type="button" class="mdc-button mdc-button--outlined" data-toggle="modal" data-target="#modal-course-create">
12
-                <span class="mdc-button__label mdc-typography--button">Añadir Curso</span>
13
-            </button>
7
+        <div class="mdc-layout-grid__cell--span-12-desktop">
8
+            <h1>Cursos</h1>
14 9
         </div>
10
+        @auth
11
+            <div class="mdc-layout-grid__cell--span-4">
12
+                <button type="button" class="mdc-button mdc-button--outlined" data-toggle="modal" data-target="#modal-course-create">
13
+                    <span class="mdc-button__label">Añadir Curso</span>
14
+                </button>
15
+            </div>
16
+        @endauth
15 17
     </div>
16 18
     @if ($errors->any())
17 19
         <div class="mdc-layout-grid__inner">
18
-            <div class="alert alert-danger alert-dismissible fade show mdc-layout-grid__cell--span-12" role="alert">
20
+            <div class="alert alert-danger alert-dismissible fade show mdc-layout-grid__cell mdc-layout-grid__cell--span-12" role="alert">
19 21
                 <button type="button" class="close" data-dismiss="modal" aria-label="close">
20 22
                     <span aria-hidden="true">&times;</span>
21 23
                 </button>
@@ -27,56 +29,58 @@
27 29
             </div>
28 30
         </div>
29 31
     @endif
30
-
32
+    <hr>
31 33
     <div class="mdc-layout-grid__inner">
32
-        <div class="mdc-data-table mdc-layout-grid__cell--span-12 table-fixed-row-head table-fixed-col-head table--fit-screen">
33
-            <table id="course-table" class="mdc-data-table__table">
34
-                <thead>
35
-                    <tr class="mdc-data-table__header-row">
36
-                        <th class="mdc-data-table__header-cell mdc-elevation--z3" scope="col">Curso</th>
37
-                        <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col" @guest style="display:none;" @endguest>Edit</th>
38
-                        <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Title</th>
39
-                        <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Prontuario</th>
40
-                        @foreach ($semesters as $semester)
41
-                            <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col"># de Secciones<br>{{ $semester->alpha }}</th>
42
-                        @endforeach
43
-                    </tr>
44
-                </thead>
45
-                <tbody class="mdc-data-table__content">
46
-                @foreach ($courses as $course)
47
-                    <tr class="mdc-data-table__row">
48
-                        <th scope="row" class="mdc-data-table__cell mdc-elevation--z1">
49
-                            <a href="{{ route('course.show', ['id' => $course->id]) }}">{{ $course->code }}</a>
50
-                        </th>
51
-                        <td class="mdc-data-table__cell" @guest style="display:none;" @endguest>
52
-                            <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-course-edit" data-course-id="{{ $course->id }}">edit</button>
53
-                        </td>
54
-                        <td class="mdc-data-table__cell" data-toggle="tooltip" title="{{ $course->title }}">{{ substr($course->title, 0, 50) . (strlen($course->title) > 50 ? '...' : '') }}</td>
55
-                        <td class="mdc-data-table__cell">
56
-                            @if (!is_null($course->syllabus))
57
-                                <a href="{{ asset($course->syllabus) }}">PDF</a>
58
-                            @else
59
-                                @auth
60
-                                    <button type="button" class="mdc-button mdc-button--dense mdc-button--unelevated" data-toggle="modal" data-target="#modal-course-syllabus" data-course-id="{{ $course->id }}">
61
-                                        <span class="mdc-button__label">Subir</span>
62
-                                    </button>
34
+        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
35
+            <div class="mdc-data-table table-fixed-row-head table-fixed-col-head table--fit-screen">
36
+                <table id="course-table" class="mdc-data-table__table">
37
+                    <thead>
38
+                        <tr class="mdc-data-table__header-row">
39
+                            <th class="mdc-data-table__header-cell mdc-elevation--z3" scope="col">Curso</th>
40
+                            <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col" @guest style="display:none;" @endguest>Edit</th>
41
+                            <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Title</th>
42
+                            <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Prontuario</th>
43
+                            @foreach ($semesters as $semester)
44
+                                <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col"># de Secciones<br>{{ $semester->alpha }}</th>
45
+                            @endforeach
46
+                        </tr>
47
+                    </thead>
48
+                    <tbody class="mdc-data-table__content">
49
+                    @foreach ($courses as $course)
50
+                        <tr class="mdc-data-table__row">
51
+                            <th scope="row" class="mdc-data-table__cell mdc-elevation--z1">
52
+                                <a href="{{ route('course.show', ['id' => $course->id]) }}">{{ $course->code }}</a>
53
+                            </th>
54
+                            <td class="mdc-data-table__cell" @guest style="display:none;" @endguest>
55
+                                <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-course-edit" data-course-id="{{ $course->id }}">edit</button>
56
+                            </td>
57
+                            <td class="mdc-data-table__cell" data-toggle="tooltip" title="{{ $course->title }}">{{ substr($course->title, 0, 50) . (strlen($course->title) > 50 ? '...' : '') }}</td>
58
+                            <td class="mdc-data-table__cell">
59
+                                @if (!is_null($course->syllabus))
60
+                                    <a href="{{ asset($course->syllabus) }}">PDF</a>
63 61
                                 @else
64
-                                    n/a
65
-                                @endauth
66
-                            @endif
67
-                        </td>
68
-                        @foreach ($semesters as $semester)
69
-                            <td class="mdc-data-table__cell mdc-data-table__cell--numeric">
70
-                                {{ $course->getSemesterSectionCount($semester->code) }}
71
-                                @if (Auth::check() && $semesters->take(-6)->contains($semester->code))
72
-                                    <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-section-create" data-course-id="{{ $course->id }}" data-semester-code="{{ $semester->code }}">add</button>
62
+                                    @auth
63
+                                        <button type="button" class="mdc-button mdc-button--dense mdc-button--unelevated" data-toggle="modal" data-target="#modal-course-syllabus" data-course-id="{{ $course->id }}">
64
+                                            <span class="mdc-button__label">Subir</span>
65
+                                        </button>
66
+                                    @else
67
+                                        n/a
68
+                                    @endauth
73 69
                                 @endif
74 70
                             </td>
75
-                        @endforeach
76
-                    </tr>
77
-                @endforeach
78
-                </tbody>
79
-            </table>
71
+                            @foreach ($semesters as $semester)
72
+                                <td class="mdc-data-table__cell mdc-data-table__cell--numeric">
73
+                                    {{ $course->getSemesterSectionCount($semester->code) }}
74
+                                    @if (Auth::check() && $semesters->take(-6)->contains($semester->code))
75
+                                        <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-section-create" data-course-id="{{ $course->id }}" data-semester-code="{{ $semester->code }}">add</button>
76
+                                    @endif
77
+                                </td>
78
+                            @endforeach
79
+                        </tr>
80
+                    @endforeach
81
+                    </tbody>
82
+                </table>
83
+            </div>
80 84
         </div>
81 85
     </div>
82 86
 @endsection

+ 9
- 15
resources/views/courses/show.blade.php ファイルの表示

@@ -4,15 +4,10 @@
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">
7
-        <h1 class="mdc-layout-grid__cell mdc-typography--heading1">{{ $course->code }}</h1>
8
-    </div>
9
-    <div class="mdc-layout-grid__inner">
10
-        <h3 class="mdc-layout-grid__cell--span-8 mdc-typography--heading3">{{ $course->title }}</h3>
11
-    </div>
12
-    <br>
13
-    <div class="mdc-layout-grid__inner">
14
-        <div class="mdc-layout-grid__cell">
15
-            <h5 class="mdc-typography--heading5">
7
+        <h1 class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">{{ $course->code }}</h1>
8
+        <h3 class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">{{ $course->title }}</h3>
9
+        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
10
+            <h5>
16 11
                 Prontuario:
17 12
                 @if (!is_null($course->syllabus))
18 13
                     <a href="{{ $course->syllabus }}">PDF</a>
@@ -30,7 +25,7 @@
30 25
     <hr>
31 26
     <div class="mdc-layout-grid__inner">
32 27
         <div class="mdc-layout-grid__cell">
33
-            <h2 class="mdc-typography--heading2">Semestres</h2>
28
+            <h2>Semestres</h2>
34 29
         </div>
35 30
     </div>
36 31
     {{-- TODO: Add button for new section if admin --}}
@@ -39,12 +34,10 @@
39 34
             @foreach ($course->semesters->unique()->sortByDesc('code') as $semester)
40 35
                 {{-- @dd($semester_code) --}}
41 36
                 <div class="mdc-layout-grid__inner">
42
-                    <div class="mdc-layout-grid__cell">
43
-                        <h4 class="mdc-typography--heading4">{{ $semester->alpha }}</h4>
37
+                    <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
38
+                        <h4>{{ $semester->alpha }}</h4>
44 39
                     </div>
45
-                </div>
46
-                <div class="mdc-layout-grid__inner">
47
-                    <div class="mdc-data-table mdc-layout-grid__cell--span-6 course-sections-table">
40
+                    <div class="mdc-data-table mdc-layout-grid__cell--span-12 course-sections-table">
48 41
                         <table class="mdc-data-table__table">
49 42
                             <thead class="thead-light">
50 43
                                 <tr class="mdc-data-table__header-row">
@@ -107,6 +100,7 @@
107 100
                 </div>
108 101
                 @if (!$loop->last)
109 102
                     <br>
103
+                    <br>
110 104
                 @endif
111 105
             @endforeach
112 106
         </div>

+ 61
- 3
resources/views/dashboard.blade.php ファイルの表示

@@ -9,7 +9,24 @@
9 9
             <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12-desktop mdc-layout-grid__cell--span-8-tablet mdc-layout-grid__cell--span-4-phone">
10 10
                 <h1 class="mdc-typography--heading1">Dashboard</h1>
11 11
             </div>
12
-            <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop"></div>
12
+        </div>
13
+        @if ($errors->any())
14
+            <div class="mdc-layout-grid__inner">
15
+                <div class="alert alert-danger alert-dismissible fade show mdc-layout-grid__cell mdc-layout-grid__cell--span-12" role="alert">
16
+                    <button type="button" class="close" data-dismiss="modal" aria-label="close">
17
+                        <span aria-hidden="true">&times;</span>
18
+                    </button>
19
+                    <ul class="mdc-list">
20
+                        @foreach ($errors->all() as $error)
21
+                            <li class="mcd-list-item"><span class="mdc-list-item__text">{{ $error }}</span></li>
22
+                        @endforeach
23
+                    </ul>
24
+                </div>
25
+            </div>
26
+            <br>
27
+        @endif
28
+        <div class="mdc-layout-grid__inner">
29
+            {{-- <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop"></div> --}}
13 30
             <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
14 31
                 <a data-toggle="modal" data-target="#modal-semester" data-action="export" data-title="Escoge un semestre">
15 32
                     <div class="mdc-card">
@@ -17,7 +34,7 @@
17 34
                             <div id="dash-button-csv" class="mdc-card__media mdc-card__media--square"></div>
18 35
                             <hr>
19 36
                             <div>
20
-                                <h2 class="mdc-typography--heading2">Generar informe de cargas</h2>
37
+                                <h3>Generar informe de cargas</h3>
21 38
                             </div>
22 39
                         </div>
23 40
                     </div>
@@ -30,7 +47,46 @@
30 47
                             <div id="dash-button-schedule" class="mdc-card__media mdc-card__media--square"></div>
31 48
                             <hr>
32 49
                             <div>
33
-                                <h2 class="mdc-typography--heading2">Generar horario de semestre</h2>
50
+                                <h3>Generar horario de semestre</h3>
51
+                            </div>
52
+                        </div>
53
+                    </div>
54
+                </a>
55
+            </div>
56
+            <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
57
+                <a data-toggle="modal" data-target="#modal-user-add">
58
+                    <div class="mdc-card">
59
+                        <div class="mdc-card__primary-action" tabindex="0">
60
+                            <div id="dash-button-schedule" class="mdc-card__media mdc-card__media--square"></div>
61
+                            <hr>
62
+                            <div>
63
+                                <h3>Anadir usuario</h3>
64
+                            </div>
65
+                        </div>
66
+                    </div>
67
+                </a>
68
+            </div>
69
+            <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
70
+                <a data-toggle="modal" data-target="#modal-semester-clone" data-action="clone" data-title="Escoge un semestre">
71
+                    <div class="mdc-card">
72
+                        <div class="mdc-card__primary-action" tabindex="0">
73
+                            <div id="dash-button-clone" class="mdc-card__media mdc-card__media--square"></div>
74
+                            <hr>
75
+                            <div>
76
+                                <h3>Copiar un semestre</h3>
77
+                            </div>
78
+                        </div>
79
+                    </div>
80
+                </a>
81
+            </div>
82
+            <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
83
+                <a href="{{ route('exportCourses') }}">
84
+                    <div class="mdc-card">
85
+                        <div class="mdc-card__primary-action" tabindex="0">
86
+                            <div id="dash-button-schedule" class="mdc-card__media mdc-card__media--square"></div>
87
+                            <hr>
88
+                            <div>
89
+                                <h3>Generar informe de cursos</h3>
34 90
                             </div>
35 91
                         </div>
36 92
                     </div>
@@ -43,6 +99,8 @@
43 99
 
44 100
 @section('modals')
45 101
     @include('modal.semester')
102
+    @include('modal.semester-clone')
103
+    @include('modal.user-add')
46 104
 @endsection
47 105
 
48 106
 @section('scripts')

+ 16
- 4
resources/views/layouts/app.blade.php ファイルの表示

@@ -17,11 +17,10 @@
17 17
     <!-- Bootstrap CSS -->
18 18
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
19 19
     <!-- Material Design Components -->
20
-    <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
20
+    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
21
+    {{-- <link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet"> --}}
21 22
     <!-- Font Awesome Icons -->
22 23
     <script src="https://kit.fontawesome.com/1cc169c87a.js"></script>
23
-    <!-- Material Icons -->
24
-    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
25 24
     <link href="{{ asset('css/app.css') }}" rel="stylesheet">
26 25
 </head>
27 26
 <body class="mdc-typography">
@@ -43,6 +42,19 @@
43 42
                     <li class="nav-item">
44 43
                         <a class="nav-link mdc-typography--body1" href="{{ route('professor.index') }}">Profesores</a>
45 44
                     </li>
45
+                    <li class="nav-item dropdown">
46
+                        @php
47
+                            $department = \App\Department::find(Request()->session()->get('department'));
48
+                        @endphp
49
+                        <a class="nav-link dropdown-toggle mdc-typography--body1" href="#" data-toggle="dropdown">
50
+                            {{ $department->title ?: $department->name ?? 'Departamento' }} <span class="caret"></span>
51
+                        </a>
52
+                        <div class="dropdown-menu">
53
+                            @foreach (App\Department::whereNotNull('name')->orderBy('title')->get() as $dept)
54
+                                <a class="dropdown-item mdc-typography--body1" href="{{ url()->current() }}?setdept={{ $dept->id }}">{{ $dept->title ?: $dept->name }}</a>
55
+                            @endforeach
56
+                        </div>
57
+                    </li>
46 58
                 </ul>
47 59
 
48 60
                 <!-- Right Side Of Navbar -->
@@ -87,7 +99,7 @@
87 99
     <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
88 100
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
89 101
     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
90
-    <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
102
+    {{-- <script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script> --}}
91 103
     <script src="/js/app.js"></script>
92 104
     @yield('scripts')
93 105
 </body>

+ 8
- 0
resources/views/modal/professor/loads.blade.php ファイルの表示

@@ -13,11 +13,19 @@
13 13
                 <label for="modal-professor-loads-admin_load">Carga administrativa:</label>
14 14
                 <input id="modal-professor-loads-admin_load" type="number" step="0.01" class="form-control" name="admin_load">
15 15
             </div>
16
+        </div>
17
+        <div class="form-group row">
16 18
             <div class="col-6">
17 19
                 <label for="modal-professor-loads-investigative_load">Carga investigativa:</label>
18 20
                 <input id="modal-professor-loads-investigative_load" type="number" step="0.01" class="form-control" name="investigative_load">
19 21
             </div>
20 22
         </div>
23
+        <div class="form-group row">
24
+            <div class="col-6">
25
+                <label for="modal-professor-loads-other">Otras cargas:</label>
26
+                <input id="modal-professor-loads-other" type="number" step="0.01" class="form-control" name="other">
27
+            </div>
28
+        </div>
21 29
     </form>
22 30
 @overwrite
23 31
 

+ 65
- 0
resources/views/modal/semester-clone.blade.php ファイルの表示

@@ -0,0 +1,65 @@
1
+@extends('layouts.modal')
2
+
3
+@section('modal_id'){{ 'modal-semester-clone' }}@overwrite
4
+@section('modal_title'){{ 'Escoge un semestre' }}@overwrite
5
+
6
+@section('modal_body')
7
+    <form method="POST" id="modal-semester-clone-form">
8
+        @csrf
9
+        <div class="row">
10
+            <div class="col">
11
+                <div class="mdc-form-field">
12
+                    <div class="mdc-select" id="sem-clone-select">
13
+                        <i class="mdc-select__dropdown-icon"></i>
14
+                        <select id="select-semester" class="mdc-select__native-control">
15
+                            <option value="" disabled selected></option>
16
+                            @foreach (App\Semester::all() as $semester)
17
+                                <option value="{{ $semester->code }}">{{ $semester->alpha }}</option>
18
+                            @endforeach
19
+                        </select>
20
+                        <label class="mdc-floating-label">Semestre a copiar</label>
21
+                        <div class="mdc-line-ripple"></div>
22
+                    </div>
23
+                </div>
24
+            </div>
25
+        </div>
26
+        <br>
27
+        <div class="row">
28
+            <div class="col">
29
+                <div class="mdc-form-field">
30
+                    <div class="mdc-text-field mdc-text-field--no-label" id="semester-clone-form-new_semester" data-mdc-auto-init="MDCTextField">
31
+                        <input type="text" class="mdc-text-field__input" name="new_semester" maxlength="3">
32
+                        <div class="mdc-line-ripple"></div>
33
+                    </div>
34
+                    <div class="mdc-text-field-helper-line">
35
+                        <p class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent">
36
+                            Codigo del semestre nuevo
37
+                        </p>
38
+                    </div>
39
+                </div>
40
+            </div>
41
+            <div class="col">
42
+                <div class="mdc-form-field">
43
+                    <div class="mdc-text-field mdc-text-field--no-label" id="semester-clone-form-new_alpha" data-mdc-auto-init="MDCTextField">
44
+                        <input type="text" class="mdc-text-field__input" name="new_alpha" >
45
+                        <div class="mdc-line-ripple"></div>
46
+                    </div>
47
+                    <div class="mdc-text-field-helper-line">
48
+                        <p class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent">
49
+                            Descripcion del semestre e.g. 20XX-20XX SEM 1
50
+                        </p>
51
+                    </div>
52
+                </div>
53
+            </div>
54
+        </div>
55
+    </form>
56
+@overwrite
57
+
58
+@section('modal_submit_text'){{ 'OK' }}@overwrite
59
+@section('modal_submit')
60
+    function(){document.getElementById('modal-semester-clone-form').submit()}
61
+@overwrite
62
+
63
+
64
+
65
+

+ 2
- 2
resources/views/modal/semester.blade.php ファイルの表示

@@ -4,9 +4,9 @@
4 4
 @section('modal_title'){{ 'Escoge un semestre' }}@overwrite
5 5
 
6 6
 @section('modal_body')
7
-    <form method="GET" id="modal-semester-form">
7
+    <form method="POST" id="modal-semester-form">
8 8
         @csrf
9
-        <div class="mdc-select">
9
+        <div id="sem-select" class="mdc-select">
10 10
             <i class="mdc-select__dropdown-icon"></i>
11 11
             <select id="select-semester" class="mdc-select__native-control">
12 12
                 <option value="" disabled selected></option>

+ 34
- 0
resources/views/modal/user-add.blade.php ファイルの表示

@@ -0,0 +1,34 @@
1
+@extends('layouts.modal')
2
+
3
+@section('modal_id'){{ 'modal-user-add' }}@overwrite
4
+@section('modal_title'){{ 'Anadir usuario' }}@overwrite
5
+
6
+@section('modal_body')
7
+    <form method="POST" id="modal-user-add-form" action="{{ route('addUser') }}">
8
+        @csrf
9
+        <div class="row">
10
+            <div class="col">
11
+                <div class="mdc-form-field">
12
+                    <div class="mdc-text-field mdc-text-field--no-label" id="semester-clone-form-new_semester" data-mdc-auto-init="MDCTextField">
13
+                        <input type="email" class="mdc-text-field__input" name="email">
14
+                        <div class="mdc-line-ripple"></div>
15
+                    </div>
16
+                    <div class="mdc-text-field-helper-line">
17
+                        <p class="mdc-text-field-helper-text mdc-text-field-helper-text--persistent">
18
+                            Email del usuario
19
+                        </p>
20
+                    </div>
21
+                </div>
22
+            </div>
23
+        </div>
24
+    </form>
25
+@overwrite
26
+
27
+@section('modal_submit_text'){{ 'OK' }}@overwrite
28
+@section('modal_submit')
29
+    function(){document.getElementById('modal-user-add-form').submit()}
30
+@overwrite
31
+
32
+
33
+
34
+

+ 16
- 17
resources/views/professors/index.blade.php ファイルの表示

@@ -2,35 +2,34 @@
2 2
 
3 3
 @section('title', 'Profesores | Gerencia Docente')
4 4
 
5
-{{-- {{dd($professors)}} --}}
6 5
 @section('content')
7 6
     <div class="mdc-layout-grid__inner">
8
-        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop">
7
+        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12-desktop">
9 8
             <h1>Profesores</h1>
10 9
         </div>
11
-        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop">
12
-            @auth
10
+        @auth
11
+            <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
13 12
                 <button type="button" class="mdc-button mdc-button--outlined" data-toggle="modal" data-target="#modal-professor-create">
14 13
                     <span class="mdc-button__label">Añadir Profesor</span>
15 14
                 </button>
16
-            @endauth
17
-        </div>
15
+            </div>
16
+        @endauth
18 17
     </div>
19 18
     @if ($errors->any())
20
-        <div class="row">
21
-            <div class="alert alert-danger alert-dismissible fade show col-6" role="alert">
22
-              <button type="button" class="close" data-dismiss="alert" aria-label="Close">
23
-                <span aria-hidden="true">&times;</span>
24
-              </button>
25
-              <ul>
26
-                  @foreach ($errors->all() as $error)
27
-                      <li>{{ $error }}</li>
28
-                  @endforeach
29
-              </ul>
19
+        <div class="mdc-layout-grid__inner">
20
+            <div class="alert alert-danger alert-dismissible fade show mdc-layout-grid__cell mdc-layout-grid__cell--span-12" role="alert">
21
+                <button type="button" class="close" data-dismiss="modal" aria-label="close">
22
+                    <span aria-hidden="true">&times;</span>
23
+                </button>
24
+                <ul class="mdc-list">
25
+                    @foreach ($errors->all() as $error)
26
+                        <li class="mcd-list-item"><span class="mdc-list-item__text">{{ $error }}</span></li>
27
+                    @endforeach
28
+                </ul>
30 29
             </div>
31 30
         </div>
32 31
     @endif
33
-
32
+    <hr>
34 33
     <div class="mdc-layout-grid__inner">
35 34
         <div class="mdc-data-table mdc-layout-grid__cell--span-12 table-fixed-col-head table-fixed-row-head table--fit-screen">
36 35
             <table id="prof-table" class="mdc-data-table__table">

+ 64
- 28
resources/views/professors/show.blade.php ファイルの表示

@@ -4,17 +4,17 @@
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">
7
-        <h1 class="mdc-layout-grid__cell mdc-typography--heading1">{{ $professor->full_name }}</h1>
7
+        <h1 class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12-desktop">{{ $professor->full_name }}</h1>
8 8
     </div>
9 9
     <br>
10 10
     <div class="mdc-layout-grid__inner">
11
-        <h5 class="mdc-layout-grid__cell mdc-typography--heading5">
11
+        <h5 class="mdc-layout-grid__cell">
12 12
             Email: {{ $professor->email ?? 'n/a' }}
13 13
         </h5>
14 14
     </div>
15 15
     <hr>
16 16
     <div class="mdc-layout-grid__inner">
17
-        <h2 class="mdc-layout-grid__cell mdc-typography--heading2">Semestres</h2>
17
+        <h2 class="mdc-layout-grid__cell">Semestres</h2>
18 18
     </div>
19 19
     <div class="mdc-layout-grid__inner">
20 20
         <div class="mdc-layout-grid__cell--span-12">
@@ -23,49 +23,75 @@
23 23
                     $semester_sections = $sections->get($semester->code);
24 24
                     $semester_loads = $loads->get($semester->code);
25 25
                 @endphp
26
-                @if ($semester_sections || ($semester_loads && (is_numeric($semester_loads->pivot->investigative_load) || is_numeric($semester_loads->pivot->investigative_load))))
26
+                @if ($semester_sections || ($semester_loads && (is_numeric($semester_loads->pivot->admin_load) || is_numeric($semester_loads->pivot->investigative_load || is_numeric($semester_loads->pivot->other)))))
27 27
                     <div class="mdc-layout-grid__inner">
28 28
                         <div class="mdc-layout-grid__cell">
29 29
                             <h4 class="mdc-typography--heading4">{{ $semester->alpha }}</h4>
30 30
                         </div>
31 31
                     </div>
32 32
                     <div class="mdc-layout-grid__inner">
33
-                        <div class="mdc-data-table mdc-layout-grid__cell--span-6 prof-sections-table">
33
+                        <div class="mdc-data-table mdc-layout-grid__cell--span-12 prof-sections-table">
34 34
                             <div class="mdc-data-table">
35 35
                                 <table class="mdc-data-table__table">
36 36
                                     <thead class="thead-light">
37 37
                                         <tr class="mdc-data-table__header-row">
38 38
                                             <th scope="col" class="mdc-data-table__header-cell">Curso</th>
39 39
                                             <th scope="col" class="mdc-data-table__header-cell">Sección</th>
40
-                                            <th scope="col" class="mdc-data-table__header-cell">Horario</th>
40
+                                            <th scope="col" class="mdc-data-table__header-cell">Lugar</th>
41
+                                            <th scope="col" class="mdc-data-table__header-cell">Horas</th>
41 42
                                             <th scope="col" class="mdc-data-table__header-cell">Evaluación</th>
42 43
                                             <th scope="col" class="mdc-data-table__header-cell"># de Estudiantes</th>
43 44
                                             <th scope="col" class="mdc-data-table__header-cell">Créditos</th>
44 45
                                         </tr>
45 46
                                     </thead>
46 47
                                     <tbody class="mdc-data-table__content">
47
-                                        @php $academic_load = $professor->getAcademicLoad($semester); @endphp
48
-                                            @if ($semester_sections)
49
-                                                @foreach ($semester_sections as $section)
50
-                                                    <tr class="mdc-data-table__row">
51
-                                                        <td class="mdc-data-table__cell">
52
-                                                            <a href="/course/{{ $section->course->id }}">{{ $section->course->code }}</a>
53
-                                                        </td>
54
-                                                        <td class="mdc-data-table__cell">{{ $section->code }}</td>
55
-                                                        <td class="mdc-data-table__cell">{{ $section->schedule ?: 'n/a'}}</td>
56
-                                                        <td class="mdc-data-table__cell">{{ $section->eval ?? 'n/a' }}</td>
57
-                                                        <td class="mdc-data-table__cell">{{ $section->student_count ?? 'n/a' }}</td>
58
-                                                        <td class="mdc-data-table__cell">{{ $section->credits ?? 'n/a' }}</td>
59
-                                                    </tr>
60
-                                                @endforeach
48
+                                        @php
49
+                                            $academic_load = $professor->getAcademicLoad($semester);
50
+                                        @endphp
51
+                                        @if ($semester_sections)
52
+                                            @foreach ($semester_sections as $section)
61 53
                                                 <tr class="mdc-data-table__row">
62
-                                                    <th scope="row" class="mdc-data-table__cell" colspan="5">Carga Academica</th>
63
-                                                    <td class="mdc-data-table__cell">{{ $academic_load }}</td>
54
+                                                    <td class="mdc-data-table__cell">
55
+                                                        <a href="/course/{{ $section->course->id }}">{{ $section->course->code }}</a>
56
+                                                    </td>
57
+                                                    <td class="mdc-data-table__cell">{{ $section->code }}</td>
58
+                                                    <td class="mdc-data-table__cell">
59
+                                                        @if ($section->schedules)
60
+                                                            @foreach ($section->schedules as $schedule)
61
+                                                                {{ $schedule->location }}
62
+                                                                @if (!$loop->last)
63
+                                                                    <br>
64
+                                                                @endif
65
+                                                            @endforeach
66
+                                                        @else
67
+                                                            n/a
68
+                                                        @endif
69
+                                                    </td>
70
+                                                    <td class="mdc-data-table__cell">
71
+                                                            @if ($section->schedules)
72
+                                                            @foreach ($section->schedules as $schedule)
73
+                                                                {{ $schedule->hours }}
74
+                                                                @if (!$loop->last)
75
+                                                                    <br>
76
+                                                                @endif
77
+                                                            @endforeach
78
+                                                        @else
79
+                                                            n/a
80
+                                                        @endif
81
+                                                    </td>
82
+                                                    <td class="mdc-data-table__cell">{{ $section->eval ?? 'n/a' }}</td>
83
+                                                    <td class="mdc-data-table__cell">{{ $section->student_count ?? 'n/a' }}</td>
84
+                                                    <td class="mdc-data-table__cell">{{ $section->credits ?? 'n/a' }}</td>
64 85
                                                 </tr>
65
-                                            @endif
86
+                                            @endforeach
87
+                                            <tr class="mdc-data-table__row">
88
+                                                <th scope="row" class="mdc-data-table__cell" colspan="6">Carga Academica</th>
89
+                                                <td class="mdc-data-table__cell">{{ $academic_load }}</td>
90
+                                            </tr>
91
+                                        @endif
66 92
                                         @if (Auth::check() || $semester_loads && is_numeric($semester_loads->pivot->admin_load))
67 93
                                             <tr class="mdc-data-table__row">
68
-                                                <th class="mdc-data-table__cell" scope="row" @auth colspan="4" @else colspan="5" @endauth>Carga Administrativa</th>
94
+                                                <th class="mdc-data-table__cell" scope="row" @auth colspan="5" @else colspan="6" @endauth>Carga Administrativa</th>
69 95
                                                 @auth
70 96
                                                     <td class="mdc-data-table__cell">
71 97
                                                         <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-professor-loads" data-semester-code="{{ $semester->code }}">edit</button>
@@ -76,7 +102,7 @@
76 102
                                         @endif
77 103
                                         @if (Auth::check() || $semester_loads && is_numeric($semester_loads->pivot->investigative_load))
78 104
                                             <tr class="mdc-data-table__row">
79
-                                                <th class="mdc-data-table__cell" scope="row" @auth colspan="4" @else colspan="5" @endauth>Carga Investigativa</th>
105
+                                                <th class="mdc-data-table__cell" scope="row" @auth colspan="5" @else colspan="6" @endauth>Carga Investigativa</th>
80 106
                                                 @auth
81 107
                                                     <td class="mdc-data-table__cell">
82 108
                                                         <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-professor-loads" data-semester-code="{{ $semester->code }}">edit</button>
@@ -85,10 +111,21 @@
85 111
                                                 <td class="mdc-data-table__cell">{{ $semester_loads ? $semester_loads->pivot->investigative_load : 'n/a' }}</td>
86 112
                                             </tr>
87 113
                                         @endif
114
+                                        @if (Auth::check() || $semester_loads && is_numeric($semester_loads->pivot->other))
115
+                                            <tr class="mdc-data-table__row">
116
+                                                <th class="mdc-data-table__cell" scope="row" @auth colspan="5" @else colspan="6" @endauth>Otras Cargas</th>
117
+                                                @auth
118
+                                                    <td class="mdc-data-table__cell">
119
+                                                        <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-professor-loads" data-semester-code="{{ $semester->code }}">edit</button>
120
+                                                    </td>
121
+                                                @endauth
122
+                                                <td class="mdc-data-table__cell">{{ $semester_loads ? $semester_loads->pivot->other : 'n/a' }}</td>
123
+                                            </tr>
124
+                                        @endif
88 125
                                         @if ($semester_sections || $semester_loads)
89 126
                                             <tr class="mdc-data-table__row">
90
-                                                <th class="mdc-data-table__cell" scope="row" colspan="5">Carga Total</th>
91
-                                                <td class="mdc-data-table__cell">{{ $academic_load + ($semester_loads->pivot->admin_load ?? 0) + ($semester_loads->pivot->investigative_load ?? 0) }}</td>
127
+                                                <th class="mdc-data-table__cell" scope="row" colspan="6">Carga Total</th>
128
+                                                <td class="mdc-data-table__cell">{{ $academic_load + ($semester_loads->pivot->admin_load ?? 0) + ($semester_loads->pivot->investigative_load ?? 0) + ($semester_loads->pivot->other ?? 0) }}</td>
92 129
                                             </tr>
93 130
                                         @endif
94 131
 
@@ -109,7 +146,6 @@
109 146
 @section('modals')
110 147
     @include('modal.professor.edit')
111 148
     @include('modal.professor.loads')
112
-    {{-- @include('modal.semesterload') --}}
113 149
 @endsection
114 150
 
115 151
 @section('scripts')

+ 3
- 4
resources/views/welcome.blade.php ファイルの表示

@@ -3,7 +3,6 @@
3 3
 @section('title', 'Gerencia Docente')
4 4
 
5 5
 @section('content')
6
-{{-- TODO: Home page content --}}
7 6
 <div class="mdc-layout-grid__inner landing-page-grid">
8 7
     <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
9 8
         <div class="mdc-layout-grid__inner">
@@ -18,7 +17,7 @@
18 17
                             </div>
19 18
                             <hr>
20 19
                             <div>
21
-                                <h1 class="mdc-typography--heading1">Cursos</h1>
20
+                                <h3>Cursos</h3>
22 21
                             </div>
23 22
                         </div>
24 23
                     </div>
@@ -32,7 +31,7 @@
32 31
                             </div>
33 32
                             <hr>
34 33
                             <div>
35
-                                <h1 class="mdc-typography--heading1">Profesores</h1>
34
+                                <h3>Profesores</h3>
36 35
                             </div>
37 36
                         </div>
38 37
                     </div>
@@ -46,7 +45,7 @@
46 45
                             </div>
47 46
                             <hr>
48 47
                             <div>
49
-                                <h1 class="mdc-typography--heading1">Dashboard</h1>
48
+                                <h3>Dashboard</h3>
50 49
                             </div>
51 50
                         </div>
52 51
                     </div>

+ 8
- 5
routes/web.php ファイルの表示

@@ -11,9 +11,9 @@
11 11
 |
12 12
 */
13 13
 
14
-Route::get('/', function () {
15
-    return view('welcome');
16
-});
14
+use App\Http\Controllers\DashboardController;
15
+
16
+Route::get('/', 'HomeController@index')->name('home');
17 17
 
18 18
 Route::resource('course', 'CourseController')->except([
19 19
     'create', 'edit'
@@ -28,8 +28,11 @@ Route::resource('section', 'SectionController')->only([
28 28
 // Auth::routes();
29 29
 
30 30
 Route::get('/dashboard', 'DashboardController@index')->name('dashboard');
31
-Route::get('/dashboard/schedule/{semester}', 'DashboardController@schedule')->name('schedule');
32
-Route::get('/dashboard/export/{semester}', 'DashboardController@export')->name('export');
31
+Route::post('/dashboard/schedule/{semester}', 'DashboardController@schedule')->name('schedule');
32
+Route::post('/dashboard/export/{semester}', 'DashboardController@export')->name('export');
33
+Route::post('/dashboard/export-courses', 'DashboardController@exportCourses')->name('exportCourses');
34
+Route::post('/dashboard/clone/{semester}', 'DashboardController@cloneSemester')->name('cloneSemester');
35
+Route::post('/dashboard/add-user', 'DashboardController@addUser')->name('addUser');
33 36
 
34 37
 Route::get('/login', 'Auth\LoginController@redirectToProvider')->name('login');
35 38
 Route::get('/callback', 'Auth\LoginController@handleProviderCallback')->name('callback');

+ 0
- 0
storage/logs/.gitignore ファイルの表示