瀏覽代碼

Fixed modals and js

jquino 5 年之前
父節點
當前提交
e7476715f4

+ 2
- 2
app/Http/Controllers/Auth/LoginController.php 查看文件

@@ -28,7 +28,7 @@ class LoginController extends Controller
28 28
      *
29 29
      * @var string
30 30
      */
31
-    protected $redirectTo = '/dashboard';
31
+    // protected $redirectTo = '/dashboard';
32 32
 
33 33
     /**
34 34
      * Create a new controller instance.
@@ -82,7 +82,7 @@ class LoginController extends Controller
82 82
             $newUser->save();
83 83
             auth()->login($newUser, true);
84 84
         }
85
-        return redirect()->to('/');
85
+        return redirect()->back();
86 86
     }
87 87
 
88 88
     public function logout(Request $request) {

+ 14
- 28
app/Http/Controllers/CourseController.php 查看文件

@@ -42,17 +42,16 @@ class CourseController extends Controller
42 42
      */
43 43
     public function store(Request $request)
44 44
     {
45
-        // dd($request->validate(['code'      => ['required','unique:courses','size:8','regex:/[A-Za-z]{4}[0-9]{4}/', 'string']]));
45
+        // TODO: Validate syllabus is pdf
46 46
         $course = Course::create( $request->validate([
47 47
             'code'      => ['required','unique:courses','size:8','regex:/[A-Za-z]{4}[0-9]{4}/', 'string'],
48 48
             'title'     => ['required','max:255', 'string'],
49 49
             'dept_id'   => ['required','exists:departments,id', 'integer'],
50
-            'syllabus'  => ['nullable','file', 'mimes:pdf']
51 50
         ]));
52 51
 
53 52
         if ($request->file('syllabus')) {
54
-            $path = $request->file('syllabus')->store('course_syllabus', 'public');
55
-            $course->update(['syllabus' => asset($path)]);
53
+            $path = $request->file('syllabus')->store('course_syllabus');
54
+            $course->update(['syllabus' => '/storage/'.$path]);
56 55
         }
57 56
 
58 57
         return redirect('/course/' . $course->id);
@@ -66,23 +65,9 @@ class CourseController extends Controller
66 65
      */
67 66
     public function show(Course $course)
68 67
     {
69
-        // dd($course->toJson());
70
-        // dump(1);
71
-        // Auth::logout();
72
-        // $semesters = $course->semesters->unique()->loadMissing('sections');
73
-        // $course->loadMissing('semesters.sections');
74
-        // dd($semesters);
75 68
         $course->loadMissing(['semesters.sections.professors']);
76
-        // dd($course->semesters->unique());
77
-        // $semesters = $course->sections->groupBy('semester_code')->map( function ($sections) {
78
-        //     return collect(['alpha' => $sections[0]->semester->alpha, 'sections' => $sections->sortBy('code')]);
79
-        // })->sort();
80
-        // dd($semesters);
81
-        // dd($course->loadMissing(['sections.semester']));
82
-        // dd($course->sections->groupBy('semester_code'));
83 69
         return view('courses.show', [
84 70
             'course' => $course,
85
-            // 'semesters' => $semesters
86 71
         ]);
87 72
     }
88 73
 
@@ -106,22 +91,23 @@ class CourseController extends Controller
106 91
      */
107 92
     public function update(Request $request, Course $course)
108 93
     {
109
-
110
-        $course->update( $request->validate([
111
-            'code'      => ['unique:courses','size:8','regex:/[A-Za-z]{4}[0-9]{4}/', 'string'],
112
-            'title'     => ['max:255', 'string'],
113
-            'dept_id'   => ['exists:departments,id', 'integer'],
114
-            'syllabus'  => ['nullable', 'file', 'mimetypes:application/pdf'],
94
+        $data = array_filter($request->validate([
95
+            'code'      => ['nullable', 'unique:courses','size:8','regex:/[A-Za-z]{4}[0-9]{4}/', 'string'],
96
+            'title'     => ['nullable', 'max:255', 'string'],
97
+            'dept_id'   => ['nullable', 'exists:departments,id', 'integer'],
115 98
         ]));
116 99
 
100
+        $course->update($data);
101
+
117 102
         if ($request->file('syllabus')) {
118 103
             $path = $request->file('syllabus')->store('course_syllabus');
119
-            $course->update(['syllabus' => asset($path)]);
104
+            $course->update(['syllabus' => '/storage/'.$path]);
120 105
         }
121
-        dump(asset($path));
106
+        // dd($path);
107
+        // dd(asset($path));
122 108
         // dd($course->syllabus);
123
-        return redirect($course->syllabus);
124
-        return redirect('/course');
109
+        // return redirect($course->syllabus);
110
+        return redirect()->back();
125 111
     }
126 112
 
127 113
     /**

+ 2
- 2
app/Http/Controllers/DashboardController.php 查看文件

@@ -47,8 +47,8 @@ class DashboardController extends Controller
47 47
                 $section->professors = $section->professors;
48 48
             }
49 49
         }
50
-        // header('Content-Type: application/pdf');
51
-        // header(`Content-Disposition: attachment; filename="${semester_code}.pdf";`);
50
+        header('Content-Type: application/pdf');
51
+        header(`Content-Disposition: attachment; filename="${semester_code}.pdf";`);
52 52
         // return $data->toJson();
53 53
         return '<script type="text/javascript">var data='.$data->toJson().'</script><script type="text/javascript" src="/js/createPDF.js"></script>';
54 54
     }

+ 12
- 2
app/Http/Controllers/ProfessorController.php 查看文件

@@ -66,7 +66,7 @@ class ProfessorController extends Controller
66 66
         $professor->loadMissing(['sections.course', 'semesters.sections.course']);
67 67
         $loads = $professor->semesters()->get()->keyBy('code');
68 68
         $sections = $professor->sections()->with('course:id,code')->get()->groupBy('semester_code');
69
-        $semesters = Semester::whereIn('code', $loads->keys())->orWhereIn('code', $sections->keys())->get();
69
+        $semesters = Semester::whereIn('code', $loads->keys())->orWhereIn('code', $sections->keys())->orderBy('code', 'desc')->get();
70 70
 
71 71
         return view('professors.show', compact([
72 72
             'professor',
@@ -96,7 +96,7 @@ class ProfessorController extends Controller
96 96
      */
97 97
     public function update(Request $request, Professor $professor)
98 98
     {
99
-        // TODO: Add logic for updating professor
99
+        // TODO: Update section percent,schedule and eval
100 100
         if ($request->isMethod('put')) {
101 101
             $data = array_filter($request->validate([
102 102
                 'semester_code'         => ['required_with:admin_load,investigative_load', 'string','size:3'],
@@ -109,6 +109,16 @@ class ProfessorController extends Controller
109 109
             } else {
110 110
                 $professor->semesters()->updateExistingPivot($data['semester_code'], $data);
111 111
             }
112
+        } else if ($request->isMethod('patch')) {
113
+            $data = array_filter($request->validate([
114
+                'num_prof'      => ['nullable', 'unique:professors', 'max:16', 'string'],
115
+                'first_name'    => ['nullable', 'max:255', 'string', 'alpha'],
116
+                'last_name'     => ['nullable', 'max:255', 'string', 'alpha'],
117
+                'email'         => ['nullable', 'email'],
118
+                'type'          => ['nullable', 'in:plantilla,contrato,ta'],
119
+                'dept_id'       => ['nullable', 'exists:departments,id', 'integer'],
120
+            ]));
121
+            $professor->update($data);
112 122
         }
113 123
         return redirect()->back();
114 124
     }

+ 15
- 9
app/Http/Controllers/SectionController.php 查看文件

@@ -38,12 +38,14 @@ class SectionController extends Controller
38 38
      */
39 39
     public function store(Request $request)
40 40
     {
41
-        $request = $request->validate([
41
+        $data = $request->validate([
42 42
             'course_id'     => ['required', 'integer', 'exists:courses,id'],
43 43
             'semester_code' => ['required', 'size:3', 'exists:semesters,code'],
44 44
             'section_count' => ['required', 'integer', 'max:50'],
45 45
         ]);
46
-        for ($i=1; $i <= $request->section_count; $i++) {
46
+
47
+        // TODO: Check if section code is taken
48
+        for ($i=1; $i <= $request['section_count']; $i++) {
47 49
             Section::create([
48 50
                 'course_id'     => $request->course_id,
49 51
                 'semester_code' => $request->semester_code,
@@ -89,19 +91,23 @@ class SectionController extends Controller
89 91
             'code'              => ['nullable', 'size:3', 'string'],
90 92
             'professor_id'      => ['nullable', 'array'],
91 93
             'professor_id.*'    => ['exists:professors,id'],
92
-            'syllabus'          => ['nullable', 'file', 'mimes:pdf'],
93 94
             'credits'           => ['nullable', 'numeric'],
94 95
             'student_count'     => ['nullable', 'integer'],
95 96
         ]));
97
+        $section->update($data);
98
+
96 99
         // TODO: Insert syllabus
100
+        if ($request->file('syllabus')) {
101
+            $path = $request->file('syllabus')->store('section_syllabus');
102
+            $section->update(['syllabus' => '/storage/'.$path]);
103
+        }
97 104
 
98
-        $section->update($data);
99
-        foreach($data['professor_id'] as $professor_id) {
100
-            $section->professors()->attach($professor_id);
105
+        if (isset($data['professor_id'])) {
106
+            $section->professors()->detach();
107
+            foreach($data['professor_id'] as $professor_id) {
108
+                $section->professors()->attach($professor_id);
109
+            }
101 110
         }
102
-        // return 1;
103
-        // return $request;
104
-        // return next($request);
105 111
         return redirect()->back();
106 112
     }
107 113
 

+ 1
- 0
public/mix-manifest.json 查看文件

@@ -2,6 +2,7 @@
2 2
     "/js/app.js": "/js/app.js",
3 3
     "/css/app.css": "/css/app.css",
4 4
     "/js/course.js": "/js/course.js",
5
+    "/js/createPDF.js": "/js/createPDF.js",
5 6
     "/js/dashboard.js": "/js/dashboard.js",
6 7
     "/js/prof.js": "/js/prof.js"
7 8
 }

+ 25
- 22
resources/js/course.js 查看文件

@@ -1,36 +1,39 @@
1
-// import {MDCDataTable} from '@material/data-table';
2
-// const dataTable = new MDCDataTable(document.querySelector('.mdc-data-table'));
1
+import {MDCDataTable} from '@material/data-table';
2
+const dataTable = new MDCDataTable(document.querySelector('.mdc-data-table'));
3 3
 
4 4
 $(document).ready(function() {
5
-    // $('#course-table').DataTable({
6
-    //     paging: true,
7
-    //     pagingType: 'simple',
8
-    //     searching: false,
9
-    //     scrollCollapse: false,
10
-    //     columnDefs: [
11
-    //         {targets: [0,1], orderable: true},
12
-    //         {targets: '_all', orderable: false}
13
-    //     ]
14
-
15
-    // });
5
+    // INDEX //
16 6
     $(function () {
17 7
         $('[data-toggle="tooltip"]').tooltip();
18 8
     });
19
-    $('#modal-syllabus').on('show.bs.modal', function (event) {
9
+    $('#modal-course-syllabus').on('show.bs.modal', function (event) {
20 10
         var button = $(event.relatedTarget);
21 11
         var courseID = button.data('course-id');
22
-        $(this).find('#modal-syllabus-form').attr('action', `/course/${courseID}`);
12
+        $(this).find('#modal-course-syllabus-form').attr('action', `/course/${courseID}`);
23 13
     });
14
+
15
+    $('#modal-course-edit').on('show.bs.modal', function (event) {
16
+        var button = $(event.relatedTarget);
17
+        var courseID = button.data('course-id');
18
+        $(this).find('#modal-course-edit-form').attr('action', `/course/${courseID}`);
19
+    });
20
+    $('#modal-section-create').on('show.bs.modal', function (event) {
21
+        var button = $(event.relatedTarget);
22
+        var courseID = button.data('course-id');
23
+        var semCode = button.data('semester-code');
24
+        $(this).find('#modal-section-create-course_id').val(courseID);
25
+        $(this).find('#modal-section-create-semester_code').val(semCode);
26
+    });
27
+
28
+    // SHOW //
24 29
     $('#modal-section-edit').on('show.bs.modal', function (event) {
25 30
         var button = $(event.relatedTarget);
26 31
         var sectionID = button.data('section-id');
27 32
         $(this).find('#modal-section-edit-form').attr('action', `/section/${sectionID}`);
28 33
     });
34
+    $('#modal-section-syllabus').on('show.bs.modal', function (event) {
35
+        var button = $(event.relatedTarget);
36
+        var sectionID = button.data('section-id');
37
+        $(this).find('#modal-section-syllabus-form').attr('action', `/section/${sectionID}`);
38
+    });
29 39
 });
30
-
31
-function addSection (courseID, semCode) {
32
-    var modal = $('#modal-section-create');
33
-    modal.modal('toggle');
34
-    modal.find('#modal-section-create-course_id').val(courseID);
35
-    modal.find('#modal-section-create-semester_code').val(semCode);
36
-}

+ 6
- 75
resources/js/dashboard.js 查看文件

@@ -1,88 +1,19 @@
1 1
 // import {MDCDialog} from '@material/dialog';
2
-// import {MDCSelect} from '@material/select';
3
-// import {MDCTextField} from '@material/textfield';
2
+import {MDCSelect} from '@material/select';
3
+import {MDCTextField} from '@material/textfield';
4 4
 // const dialog = new MDCDialog(document.querySelector('.mdc-dialog'));
5
-// const select = new MDCSelect(document.querySelector('.mdc-select'));
6
-// const textfield = new MDCSelect(document.querySelector('.mdc-textfield'));
5
+const select = new MDCSelect(document.querySelector('.mdc-select'));
7 6
 
8
-// var fonts = {
9
-//     Roboto: {
10
-//         normal: 'fonts/Roboto-Regular.ttf',
11
-//         bold: 'fonts/Roboto-Medium.ttf',
12
-//         italics: 'fonts/Roboto-Italic.ttf',
13
-//         bolditalics: 'fonts/Roboto-.ttf',
14
-//     }
15
-// };
16 7
 
17
-var pdfMake = require('pdfmake/build/pdfmake.js');
18
-var pdfFonts = require('pdfmake/build/vfs_fonts.js');
19
-pdfMake.vfs = pdfFonts.pdfMake.vfs;
20
-
21
-function table(course) {
22
-    return {
23
-        widths: [100, 300],
24
-        headerRows: 2,
25
-        body: [
26
-            [{text: `${course.code} ${course.title}`, bold: true, colSpan: 2, alignment: 'center'}, {}],
27
-            ['Seccion', 'Profesor'],
28
-        ].concat( course.sections.map( function(section) {
29
-            if (section.hasOwnProperty('professors')) {
30
-                return [section.code, section.professors.map( function (professor) {
31
-                    return professor.first_name + ' ' + professor.last_name;
32
-                })];
33
-            } else {
34
-                return [section.code, ''];
35
-            }
36
-        }))
37
-    }
38
-}
39 8
 
40 9
 $(document).ready( function() {
41
-    // $('#button-semester-load').on('click', function (event) {
42
-    //     dialog.open();
43
-    // });
44
-    $('#button-load').on('show.bs.modal', function (event) {
45
-        // const select = new MDCSelect(document.querySelector('.mdc-select'));
10
+    $('#modal-semester').on('show.bs.modal', function (event) {
46 11
         var button = $(event.relatedTarget);
47 12
         var action = button.data('action');
48
-        $('#select-semester').change( function() {
49
-            $('#modal-semester-form').submit( function(event) {
50
-                event.preventDefault();
51
-                $.ajax({
52
-                    url: `/dashboard/${action}/${select.value}`,
53
-                    type: 'get',
54
-                    success: function(data) {
55
-                        var docDef = {
56
-                            content: [
57
-                                {text: `Horario BIOL ${data.alpha}`, style: 'header'},
58
-                                {text: 'sujeto a cambios', style: 'header', fontSize: 18},
59
-                            ].concat( data.courses.map( function(course) {
60
-                                return {
61
-                                    style: 'tableStyle',
62
-                                    alignment: 'center',
63
-                                    table: table(course)
64
-                                }
65
-                            })),
66
-                            styles: {
67
-                                header: {
68
-                                    fontSize: 22,
69
-                                    bold: true,
70
-                                    alignment: 'center',
71
-                                },
72
-                                tableStyle: {
73
-                                    margin: [50,10,0,15]
74
-                                },
75
-                            }
76
-
77
-                        };
78 13
 
79
-                        pdfMake.createPdf(docDef).download();
80
-                    }
81
-                })
82
-            });
14
+        select.listen('MDCSelect:change', () => {
15
+            $('#modal-semester-form').attr('action', `/dashboard/${action}/${select.value}`);
83 16
         });
84 17
 
85 18
     });
86 19
 });
87
-
88
-window.mdc.autoInit();

+ 5
- 1
resources/js/prof.js 查看文件

@@ -3,6 +3,10 @@ $(document).ready(function() {
3 3
         var button = $(event.relatedTarget);
4 4
         var semCode = button.data('semester-code');
5 5
         $(this).find('#modal-professor-loads-semester_code').val(semCode);
6
-        console.log(1);
7 6
     });
7
+    $('#modal-professor-edit').on('show.bs.modal', function (event) {
8
+        var button = $(event.relatedTarget);
9
+        var profID = button.data('professor-id');
10
+        $(this).find('#modal-professor-edit-form').attr('action', `/professor/${profID}`);
11
+    })
8 12
 });

+ 3
- 6
resources/sass/app.scss 查看文件

@@ -12,6 +12,7 @@
12 12
 @import '@material/typography/mdc-typography';
13 13
 @import '@material/button/mdc-button';
14 14
 @import '@material/icon-button/mdc-icon-button';
15
+@import '@material/checkbox/mdc-checkbox';
15 16
 @import '@material/data-table/mdc-data-table';
16 17
 
17 18
 body {
@@ -33,9 +34,6 @@ body {
33 34
         width: 80%;
34 35
         margin: auto 10%;
35 36
     }
36
-    .mdc-card {
37
-        width: 350px;
38
-    }
39 37
     text-align: center;
40 38
     * {
41 39
         margin: 8px;
@@ -45,8 +43,8 @@ body {
45 43
     @media screen and (min-width: map-get($mdc-layout-grid-breakpoints, desktop)) {
46 44
         width: 80%;
47 45
         margin: auto 10%;
48
-        text-align: center;
49 46
     }
47
+    text-align: center;
50 48
 }
51 49
 
52 50
 // MDC card media
@@ -138,11 +136,10 @@ body {
138 136
 }
139 137
 
140 138
 #prof-table {
141
-    height: 80vh;
142 139
 }
143 140
 
144 141
 #course-table {
145
-    @include mdc-data-table-column-widths(20px 50vw);
142
+    @include mdc-data-table-column-widths(20px 10px 56px);
146 143
 }
147 144
 
148 145
 .ellipsis {

+ 18
- 13
resources/views/courses/index.blade.php 查看文件

@@ -1,13 +1,13 @@
1 1
 @extends('layouts.app')
2 2
 
3
-@section('title', 'Cursos')
3
+@section('title', 'Cursos | Gerencia Docente')
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">
7
-        <div class="mdc-layout-grid__cell--span-2">
7
+        <div class="mdc-layout-grid__cell--span-2-desktop">
8 8
             <h1 class="mdc-typography--heading1">Cursos</h1>
9 9
         </div>
10
-        <div class="mdc-layout-grid__cell--span-2 mdc-layout-grid__cell--align-middle">
10
+        <div class="mdc-layout-grid__cell--span-2-desktop mdc-layout-grid__cell--align-middle">
11 11
             <button type="button" class="mdc-button mdc-button--outlined" data-toggle="modal" data-target="#modal-course-create">
12 12
                 <span class="mdc-button__label mdc-typography--button">Añadir Curso</span>
13 13
             </button>
@@ -34,6 +34,7 @@
34 34
                 <thead>
35 35
                     <tr class="mdc-data-table__header-row">
36 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>
37 38
                         <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Title</th>
38 39
                         <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Prontuario</th>
39 40
                         @foreach ($semesters as $semester)
@@ -47,13 +48,16 @@
47 48
                         <th scope="row" class="mdc-data-table__cell mdc-elevation--z1">
48 49
                             <a href="{{ route('course.show', ['id' => $course->id]) }}">{{ $course->code }}</a>
49 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>
50 54
                         <td class="mdc-data-table__cell" data-toggle="tooltip" title="{{ $course->title }}">{{ substr($course->title, 0, 50) . (strlen($course->title) > 50 ? '...' : '') }}</td>
51 55
                         <td class="mdc-data-table__cell">
52 56
                             @if (!is_null($course->syllabus))
53
-                                <a href="{{ $course->syllabus }}">PDF</a>
57
+                                <a href="{{ asset($course->syllabus) }}">PDF</a>
54 58
                             @else
55 59
                                 @auth
56
-                                    <button type="button" class="mdc-button mdc-button--dense mdc-button--unelevated" data-toggle="modal" data-target="#modal-syllabus" data-course-id="{{ $course->id }}">
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 }}">
57 61
                                         <span class="mdc-button__label">Subir</span>
58 62
                                     </button>
59 63
                                 @else
@@ -62,12 +66,12 @@
62 66
                             @endif
63 67
                         </td>
64 68
                         @foreach ($semesters as $semester)
65
-                        <td class="mdc-data-table__cell mdc-data-table__cell--numeric"
66
-                        @if (Auth::check() && $semesters->take(-6)->contains($semester->code))
67
-                            onclick="addSection({{ $course->id . ',\'' . $semester->code }}')"
68
-                        @endif >
69
-                            {{ $course->getSemesterSectionCount($semester->code) }}
70
-                        </td>
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>
73
+                                @endif
74
+                            </td>
71 75
                         @endforeach
72 76
                     </tr>
73 77
                 @endforeach
@@ -79,10 +83,11 @@
79 83
 
80 84
 @section('modals')
81 85
     @include('modal.course.create')
86
+    @include('modal.course.edit')
87
+    @include('modal.course.syllabus')
82 88
     @include('modal.section.create')
83
-    @include('modal.syllabus')
84 89
 @endsection
85 90
 
86 91
 @section('scripts')
87
-    <script type="text/javascript" src="/js/course.js" defer></script>
92
+    <script type="text/javascript" src="/js/course.js"></script>
88 93
 @endsection

+ 12
- 6
resources/views/courses/show.blade.php 查看文件

@@ -1,6 +1,6 @@
1 1
 @extends('layouts.app')
2 2
 
3
-@section('title', $course->title, 'Curso')
3
+@section('title', $course->title . ' | Gerencia Docente', 'Curso | Gerencia Docente')
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">
@@ -36,7 +36,7 @@
36 36
     {{-- TODO: Add button for new section if admin --}}
37 37
     <div class="mdc-layout-grid__inner">
38 38
         <div class="mdc-layout-grid__cell--span-12">
39
-            @foreach ($course->semesters->unique()->sort() as $semester)
39
+            @foreach ($course->semesters->unique()->sortByDesc('code') as $semester)
40 40
                 {{-- @dd($semester_code) --}}
41 41
                 <div class="mdc-layout-grid__inner">
42 42
                     <div class="mdc-layout-grid__cell">
@@ -60,7 +60,7 @@
60 60
                                 @foreach ($semester->sections->where('course_id', '=', $course->id)->sortBy('code') as $section)
61 61
                                     <tr class="mdc-data-table__row">
62 62
                                         <td class="mdc-data-table__cell" @guest style="display:none;" @endguest>
63
-                                            <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-section-edit" data-section-id="{{ $section->id }}">edit</button>
63
+                                            <button class="mdc-data-table__cell--checkbox mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-section-edit" data-section-id="{{ $section->id }}">edit</button>
64 64
                                         </td>
65 65
                                         <td class="mdc-data-table__cell">{{ $section->code }}</td>
66 66
                                         <td class="mdc-data-table__cell">
@@ -74,9 +74,15 @@
74 74
                                         <td class="mdc-data-table__cell">
75 75
                                             {{-- TODO: Add buton for uploading syllabus if admin --}}
76 76
                                             @if (!is_null($section->syllabus))
77
-                                                <a href="{{ $section->syllabus }}">PDF</a>
77
+                                                <a href="{{ asset($section->syllabus) }}">PDF</a>
78 78
                                             @else
79
-                                                n/a
79
+                                                @auth
80
+                                                    <button type="button" class="mdc-button mdc-button--dense mdc-button--unelevated" data-toggle="modal" data-target="#modal-section-syllabus" data-section-id="{{ $section->id }}">
81
+                                                        <span class="mdc-button__label">Subir</span>
82
+                                                    </button>
83
+                                                @else
84
+                                                    n/a
85
+                                                @endauth
80 86
                                             @endif
81 87
                                         </td>
82 88
                                         <td class="mdc-data-table__cell mdc-data-table__cell--numeric">
@@ -110,7 +116,7 @@
110 116
 @section('modals')
111 117
     @include('modal.course.edit')
112 118
     @include('modal.section.edit')
113
-    @include('modal.syllabus')
119
+    @include('modal.section.syllabus')
114 120
 @endsection
115 121
 
116 122
 @section('scripts')

+ 4
- 2
resources/views/dashboard.blade.php 查看文件

@@ -1,5 +1,7 @@
1 1
 @extends('layouts.app')
2 2
 
3
+@section('title', 'Dashboard | Gerencia Docente')
4
+
3 5
 @section('content')
4 6
 <div class="mdc-layout-grid__inner dashboard-grid">
5 7
     <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
@@ -22,13 +24,13 @@
22 24
                 </a>
23 25
             </div>
24 26
             <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-4">
25
-                <a data-toggle="modal" data-target="#modal-semester" data-action="schedule">
27
+                <a data-toggle="modal" data-target="#modal-semester" data-action="schedule" data-title="Escoge un semestre">
26 28
                     <div class="mdc-card">
27 29
                         <div class="mdc-card__primary-action" tabindex="0">
28 30
                             <div id="dash-button-schedule" class="mdc-card__media mdc-card__media--square"></div>
29 31
                             <hr>
30 32
                             <div>
31
-                                <h2 class="mdc-typography--heading2">Generar informe de cargas</h2>
33
+                                <h2 class="mdc-typography--heading2">Generar horario de semestre</h2>
32 34
                             </div>
33 35
                         </div>
34 36
                     </div>

+ 1
- 1
resources/views/layouts/app.blade.php 查看文件

@@ -7,7 +7,7 @@
7 7
     <!-- CSRF Token -->
8 8
     <meta name="csrf-token" content="{{ csrf_token() }}">
9 9
 
10
-    <title>{{ config('app.name', 'Laravel') }}</title>
10
+    <title>@yield('title')</title>
11 11
 
12 12
     <!-- Fonts -->
13 13
     <link rel="dns-prefetch" href="//fonts.gstatic.com">

+ 11
- 16
resources/views/modal/course/create.blade.php 查看文件

@@ -8,33 +8,28 @@
8 8
         @csrf
9 9
         <div class="row">
10 10
             <div class="form-group col-sm-6">
11
-                <label for="modal-course-create-code-field">Codificacion:</label>
12
-                <input id="modal-course-create-code-field" type="text" class="form-control" name="code" maxlength="8" minlength="8" size="8" required>
11
+                <label for="modal-course-create-code">Codificacion:</label>
12
+                <input id="modal-course-create-code" type="text" class="form-control" name="code" maxlength="8" minlength="8" size="8" required>
13 13
             </div>
14 14
         </div>
15 15
         <div class="form-group row">
16 16
             <div class="col-sm-12">
17
-                <label for="modal-course-create-title-field">Titulo:</label>
18
-                <input id="modal-course-create-title-field" type="text" class="form-control" name="title" maxlength="255">
17
+                <label for="modal-course-create-title">Titulo:</label>
18
+                <input id="modal-course-create-title" type="text" class="form-control" name="title" maxlength="255">
19 19
             </div>
20 20
         </div>
21 21
         <div class="row">
22 22
             <div class="form-group col-sm-8">
23
-                <label for="modal-course-create-syllabus-field">Prontuario:</label>
24
-                <input id="modal-course-create-syllabus-field" type="file" name="syllabus">
23
+                <label for="modal-course-create-syllabus">Prontuario:</label>
24
+                <input id="modal-course-create-syllabus" type="file" name="syllabus">
25 25
             </div>
26 26
             <div class="form-group col-sm-4">
27
-                <label for="modal-dept-field">Departamento:</label>
28
-                <select id="modal-dept-field" class="form-control" name="dept_id" default="1" required>
27
+                <label for="modal-course-create-dept">Departamento:</label>
28
+                <select id="modal-course-create-dept" class="form-control" name="dept_id" default="1" required>
29 29
                     @foreach (App\Department::all() as $department)
30
-                        <option value="{{ $department->id }}"
31
-                            @if ($department->id === 1)
32
-                                selected
33
-                            @else
34
-                            {{-- TODO: Check if this should be displayed --}}
35
-                                disabled hidden
36
-                            @endif
37
-                            >{{ $department->name }}</option>
30
+                        <option value="{{ $department->id }}" @if ($department->id === 1) selected @else disabled hidden @endif >
31
+                            {{ $department->name }}
32
+                        </option>
38 33
                     @endforeach
39 34
                 </select>
40 35
             </div>

+ 23
- 22
resources/views/modal/course/edit.blade.php 查看文件

@@ -1,44 +1,45 @@
1 1
 @extends('layouts.modal')
2 2
 
3 3
 @section('modal_id'){{ 'modal-course-edit' }}@overwrite
4
-@section('modal_title'){{ 'Editando Curso' }}@overwrite
4
+@section('modal_title'){{ 'Editando curso' }}@overwrite
5 5
 
6 6
 @section('modal_body')
7
-    <form method="POST" action="/course" enctype="multipart/form-data" id='modal-course-edit-form'>
7
+    <form method="POST" enctype="multipart/form-data" id='modal-course-edit-form'>
8 8
         @method('PATCH')
9 9
         @csrf
10
-        <input type="hidden" name="id">
10
+        <input type="hidden" name="id" id="modal-course-edit-id">
11
+        <div class="row">
12
+            <div class="form-group col-6">
13
+                <label for="modal-course-edit-code">Codificacion:</label>
14
+                <input id="modal-course-edit-code" type="text" class="form-control" name="code" maxlength="8" minlength="8" size="8">
15
+            </div>
16
+        </div>
17
+        <div class="row">
18
+            <div class="form-group col-12">
19
+                <label for="modal-course-edit-title">Titulo:</label>
20
+                <input id="modal-course-edit-title" type="text" class="form-control" name="title" maxlength="255">
21
+            </div>
22
+        </div>
11 23
         <div class="row">
12 24
             <div class="form-group col-8">
13
-                <label for="modal-course-edit-title-field">Titulo:</label>
14
-                <input id="modal-course-edit-title-field" type="text" class="form-control" name="title" maxlength="255">
25
+                <label for="modal-course-edit-syllabus">Prontuario:</label>
26
+                <input type="file" id="modal-course-edit-syllabus" name="syllabus">
15 27
             </div>
16 28
             <div class="form-group col-4">
17
-                <label for="modal-course-edit-dept-field">Departamento:</label>
18
-                <select id="modal-course-edit-dept-field" class="form-control" name="dept_id" default="1">
29
+                <label for="modal-course-edit-dept">Departamento:</label>
30
+                <select id="modal-course-edit-dept" class="form-control" name="dept_id" default="1">
19 31
                     @foreach (App\Department::all() as $department)
20
-                        <option value="{{ $department->id }}"
21
-                            @if ($department->id === 1)
22
-                                selected
23
-                            @else
24
-                            {{-- TODO: Check if this should be displayed --}}
25
-                                disabled hidden
26
-                            @endif
27
-                            >{{ $department->name }}</option>
32
+                        <option value="{{ $department->id }}" @if ($department->id === 1) selected @else disabled hidden @endif >
33
+                            {{ $department->name }}
34
+                        </option>
28 35
                     @endforeach
29 36
                 </select>
30 37
             </div>
31 38
         </div>
32
-        <div class="row">
33
-            <div class="form-group col-8">
34
-                <label for="modal-course-edit-syllabus-field">Prontuario:</label>
35
-                <input type="file" id="modal-course-edit-syllabus-field" name="syllabus">
36
-            </div>
37
-        </div>
38 39
     </form>
39 40
 @overwrite
40 41
 
41
-@section('modal_submit_text'){{ 'Crear curso' }}@overwrite
42
+@section('modal_submit_text'){{ 'Editar' }}@overwrite
42 43
 @section('modal_submit')
43 44
     function(){document.getElementById('modal-course-edit-form').submit()}
44 45
 @overwrite

+ 22
- 0
resources/views/modal/course/syllabus.blade.php 查看文件

@@ -0,0 +1,22 @@
1
+@extends('layouts.modal')
2
+
3
+@section('modal_id'){{ 'modal-course-syllabus' }}@overwrite
4
+@section('modal_title'){{ 'Anadiendo prontuario' }}@overwrite
5
+
6
+@section('modal_body')
7
+    <form method="POST" enctype="multipart/form-data" id='modal-course-syllabus-form'>
8
+        @method('PATCH')
9
+        @csrf
10
+        {{-- <input type="hidden" name="course_id" id="modal-course-syllabus-course_id"> --}}
11
+        <div class="row">
12
+            <div class="form-group col-12">
13
+                <input type="file" id="modal-course-syllabus-field" name="syllabus" required>
14
+            </div>
15
+        </div>
16
+    </form>
17
+@overwrite
18
+
19
+@section('modal_submit_text'){{ 'Subir prontuario' }}@overwrite
20
+@section('modal_submit')
21
+    function(){document.getElementById('modal-course-syllabus-form').submit()}
22
+@overwrite

+ 1
- 1
resources/views/modal/professor/edit.blade.php 查看文件

@@ -4,7 +4,7 @@
4 4
 @section('modal_title'){{ 'Editando profesor' }}@overwrite
5 5
 
6 6
 @section('modal_body')
7
-    <form method="POST" action="/professor" enctype="multipart/form-data" id='modal-professor-edit-form'>
7
+    <form method="POST" enctype="multipart/form-data" id='modal-professor-edit-form'>
8 8
         @method('PATCH')
9 9
         @csrf
10 10
         <input type="hidden" name="id">

+ 2
- 2
resources/views/modal/section/create.blade.php 查看文件

@@ -10,8 +10,8 @@
10 10
         <input id="modal-section-create-semester_code" type="hidden" name="semester_code">
11 11
         <div class="row">
12 12
             <div class="form-group col-6">
13
-                <label for="modal-section-create-amount-field">Cantidad de Secciones:</label>
14
-                <input id="modal-section-create-amount-field" type="number" class="form-control" name="section_count" min="1" required>
13
+                <label for="modal-section-create-amount">Cantidad de Secciones:</label>
14
+                <input id="modal-section-create-amount" type="number" class="form-control" name="section_count" min="1" required>
15 15
             </div>
16 16
         </div>
17 17
     </form>

resources/views/modal/syllabus.blade.php → resources/views/modal/section/syllabus.blade.php 查看文件

@@ -1,16 +1,15 @@
1 1
 @extends('layouts.modal')
2 2
 
3
-@section('modal_id'){{ 'modal-syllabus' }}@overwrite
3
+@section('modal_id'){{ 'modal-section-syllabus' }}@overwrite
4 4
 @section('modal_title'){{ 'Anadiendo prontuario' }}@overwrite
5 5
 
6 6
 @section('modal_body')
7
-    <form method="POST" enctype="multipart/form-data" id='modal-syllabus-form'>
7
+    <form method="POST" enctype="multipart/form-data" id='modal-section-syllabus-form'>
8 8
         @method('PATCH')
9 9
         @csrf
10
-        {{-- <input type="hidden" name="course_id" id="modal-syllabus-course_id"> --}}
11 10
         <div class="row">
12 11
             <div class="form-group col-12">
13
-                <input type="file" id="modal-syllabus-field" name="syllabus" required>
12
+                <input type="file" id="modal-section-syllabus-field" name="syllabus" required>
14 13
             </div>
15 14
         </div>
16 15
     </form>
@@ -18,5 +17,5 @@
18 17
 
19 18
 @section('modal_submit_text'){{ 'Subir prontuario' }}@overwrite
20 19
 @section('modal_submit')
21
-    function(){document.getElementById('modal-syllabus-form').submit()}
20
+    function(){document.getElementById('modal-section-syllabus-form').submit()}
22 21
 @overwrite

+ 1
- 1
resources/views/modal/semester.blade.php 查看文件

@@ -1,7 +1,7 @@
1 1
 @extends('layouts.modal')
2 2
 
3 3
 @section('modal_id'){{ 'modal-semester' }}@overwrite
4
-@section('modal_title'){{ 'Creando curso nuevo' }}@overwrite
4
+@section('modal_title'){{ 'Escoge un semestre' }}@overwrite
5 5
 
6 6
 @section('modal_body')
7 7
     <form method="GET" id="modal-semester-form">

+ 12
- 3
resources/views/professors/index.blade.php 查看文件

@@ -1,14 +1,14 @@
1 1
 @extends('layouts.app')
2 2
 
3
-@section('title', 'Profesores')
3
+@section('title', 'Profesores | Gerencia Docente')
4 4
 
5 5
 {{-- {{dd($professors)}} --}}
6 6
 @section('content')
7 7
     <div class="mdc-layout-grid__inner">
8
-        <div class="mdc-layout-grid__cell--span-2">
8
+        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop">
9 9
             <h1>Profesores</h1>
10 10
         </div>
11
-        <div class="mdc-layout-grid__cell--span-2 mdc-layout-grid__cell--align-middle">
11
+        <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-2-desktop">
12 12
             @auth
13 13
                 <button type="button" class="mdc-button mdc-button--outlined" data-toggle="modal" data-target="#modal-professor-create">
14 14
                     <span class="mdc-button__label">Añadir Profesor</span>
@@ -37,6 +37,7 @@
37 37
                 <thead>
38 38
                     <tr class="mdc-data-table__header-row">
39 39
                         <th class="mdc-data-table__header-cell mdc-elevation--z3" scope="col">Profesor</th>
40
+                        <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col" @guest style="display:none;" @endguest>Edit</th>
40 41
                         @foreach ($semesters as $semester)
41 42
                             <th class="mdc-data-table__header-cell mdc-elevation--z2" scope="col">Carga Total<br>{{ $semester->alpha }}</th>
42 43
                         @endforeach
@@ -48,6 +49,9 @@
48 49
                             <th scope="row" class="mdc-data-table__cell mdc-elevation--z1">
49 50
                                 <a href="/professor/{{ $professor->id }}">{{ $professor->last_name . ', ' . $professor->first_name }}</a>
50 51
                             </th>
52
+                            <td class="mdc-data-table__cell" @guest style="display:none;" @endguest>
53
+                                <button class="mdc-icon-button material-icons" data-toggle="modal" data-target="#modal-professor-edit" data-professor-id="{{ $professor->id }}">edit</button>
54
+                            </td>
51 55
                             @foreach ($semesters as $semester)
52 56
                                 <td class="mdc-data-table__cell mdc-data-table__cell--numeric">
53 57
                                     @php
@@ -74,4 +78,9 @@
74 78
 
75 79
 @section('modals')
76 80
     @include('modal.professor.create')
81
+    @include('modal.professor.edit')
82
+@endsection
83
+
84
+@section('scripts')
85
+    <script type="text/javascript" src="/js/prof.js"></script>
77 86
 @endsection

+ 1
- 1
resources/views/professors/show.blade.php 查看文件

@@ -1,6 +1,6 @@
1 1
 @extends('layouts.app')
2 2
 
3
-@section('title', $professor->full_name)
3
+@section('title', $professor->full_name . ' | Gerencia Docente')
4 4
 
5 5
 @section('content')
6 6
     <div class="mdc-layout-grid__inner">

+ 1
- 1
resources/views/welcome.blade.php 查看文件

@@ -1,6 +1,6 @@
1 1
 @extends('layouts.app')
2 2
 
3
-@section('title', 'Home')
3
+@section('title', 'Gerencia Docente')
4 4
 
5 5
 @section('content')
6 6
 {{-- TODO: Home page content --}}

+ 1
- 0
webpack.mix.js 查看文件

@@ -16,6 +16,7 @@ mix.js('resources/js/app.js', 'public/js')
16 16
     .js('resources/js/prof.js', 'public/js')
17 17
     .js('resources/js/course.js', 'public/js')
18 18
     .js('resources/js/dashboard.js', 'public/js')
19
+    .js('resources/js/createPDF.js', 'public/js')
19 20
     .sass('resources/sass/app.scss', 'public/css', {
20 21
         includePaths: [path.resolve(__dirname, 'node_modules')]
21 22
     });