Skip to content

Commit 7ef547e

Browse files
committed
take attendance completed
1 parent b2a86c8 commit 7ef547e

File tree

6 files changed

+131
-148
lines changed

6 files changed

+131
-148
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
use App\User;
5+
use App\Group;
6+
use App\Course;
7+
use App\attendance;
8+
use Illuminate\Http\Request;
9+
10+
class attendanceController extends Controller
11+
{
12+
public function processRequest(Request $request,$cid){
13+
if(auth()->user()->user_level == 1) return redirect('home');
14+
$red = "/attendance/mark/".$cid."/".$request->input("class");
15+
return redirect($red);
16+
}
17+
public function showForm(Request $request,$cid,$gid){
18+
if(auth()->user()->user_level == 1) return redirect('home');
19+
$group = Group::find($gid);
20+
return view('attendance/markAttendance',compact('group','cid','gid'));
21+
}
22+
23+
public function markAttendance(Request $request,$cid,$gid){
24+
$att = new attendance;
25+
$att->date= $request->input('date');
26+
$att->course_id= $cid;
27+
$att->group_id =$gid;
28+
$att->taker= auth()->user()->name;
29+
$group = Group::find($gid);
30+
$str="";
31+
foreach ($group->users as $student)
32+
{
33+
if($request->input($student->roll_no)){
34+
$str.=$student->roll_no." ";
35+
}
36+
}
37+
$att->present = $str;
38+
$att->save();
39+
$red = "courses/".$cid;
40+
return redirect($red)->with('status', 'Attendance Marked');
41+
}
42+
}

DigiKaksha/app/attendance.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class attendance extends Model
8+
{
9+
//
10+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateAttendanceTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('attendances', function (Blueprint $table) {
17+
$table->id();
18+
$table->integer('course_id');
19+
$table->integer('group_id');
20+
$table->string('present');
21+
$table->string('taker');
22+
$table->string('date');
23+
$table->timestamps();
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::dropIfExists('attendances');
35+
}
36+
}

DigiKaksha/resources/views/groups/markAttendance.blade.php renamed to DigiKaksha/resources/views/attendance/markAttendance.blade.php

Lines changed: 29 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
<meta property="og:description" content="Start your development with a Dashboard for Bootstrap 4." />
4747
<meta property="og:site_name" content="Creative Tim" />
4848
<!-- Favicon -->
49-
<link rel="icon" href="../../assets/img/brand/favicon.png" type="image/png">
49+
<link rel="icon" href="/assets/img/brand/favicon.png" type="image/png">
5050
<!-- Fonts -->
5151
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
5252
<!-- Icons -->
53-
<link rel="stylesheet" href="../../assets/vendor/nucleo/css/nucleo.css" type="text/css">
54-
<link rel="stylesheet" href="../../assets/vendor/%40fortawesome/fontawesome-free/css/all.min.css" type="text/css">
53+
<link rel="stylesheet" href="/assets/vendor/nucleo/css/nucleo.css" type="text/css">
54+
<link rel="stylesheet" href="/assets/vendor/%40fortawesome/fontawesome-free/css/all.min.css" type="text/css">
5555
<!-- Argon CSS -->
56-
<link rel="stylesheet" href="../../assets/css/argon.min5438.css?v=1.2.0" type="text/css">
56+
<link rel="stylesheet" href="/assets/css/argon.min5438.css?v=1.2.0" type="text/css">
5757
<!-- Google Tag Manager -->
5858
<script>
5959
(function(w, d, s, l, i) {
@@ -428,7 +428,7 @@
428428
<div class="row align-items-center">
429429
<div class="col-auto">
430430
<!-- Avatar -->
431-
<img alt="Image placeholder" src="../../assets/img/theme/team-1.jpg" class="avatar rounded-circle">
431+
<img alt="Image placeholder" src="/assets/img/theme/team-1.jpg" class="avatar rounded-circle">
432432
</div>
433433
<div class="col ml--2">
434434
<div class="d-flex justify-content-between align-items-center">
@@ -447,7 +447,7 @@
447447
<div class="row align-items-center">
448448
<div class="col-auto">
449449
<!-- Avatar -->
450-
<img alt="Image placeholder" src="../../assets/img/theme/team-2.jpg" class="avatar rounded-circle">
450+
<img alt="Image placeholder" src="/assets/img/theme/team-2.jpg" class="avatar rounded-circle">
451451
</div>
452452
<div class="col ml--2">
453453
<div class="d-flex justify-content-between align-items-center">
@@ -466,7 +466,7 @@
466466
<div class="row align-items-center">
467467
<div class="col-auto">
468468
<!-- Avatar -->
469-
<img alt="Image placeholder" src="../../assets/img/theme/team-3.jpg" class="avatar rounded-circle">
469+
<img alt="Image placeholder" src="/assets/img/theme/team-3.jpg" class="avatar rounded-circle">
470470
</div>
471471
<div class="col ml--2">
472472
<div class="d-flex justify-content-between align-items-center">
@@ -574,7 +574,7 @@
574574
<a class="nav-link pr-0" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
575575
<div class="media align-items-center">
576576
<span class="avatar avatar-sm rounded-circle">
577-
<img alt="Image placeholder" src="../../assets/img/theme/team-4.jpg">
577+
<img alt="Image placeholder" src="/assets/img/theme/team-4.jpg">
578578
</span>
579579
<div class="media-body ml-2 d-none d-lg-block">
580580
<span class="mb-0 text-sm font-weight-bold"> {{ Auth::user()->name }} </span>
@@ -647,18 +647,21 @@
647647
<div class="row">
648648
<div class="col">
649649
<div class="card">
650+
<form id="att" method="post" action='<?php echo "/attendance/mark/".$cid."/".$gid;?>'>
651+
@csrf
650652
<!-- Card header -->
651653
<div class="card-header border-0">
652654
<div class="row">
653655
<div class="col-6">
654-
<h3 class="mb-0">Marking attendance for Class X</h3>
656+
<h3 class="mb-0">Marking attendance for Class {{$group->name}}</h3>
655657
</div>
656658
<div class="col-6 text-right">
657-
<input class="form-control" type="datetime-local" value="2018-11-23T10:30:00" id="example-datetime-local-input">
659+
<input class="form-control" name="date" type="datetime-local" value="2018-11-23T10:30:00" id="example-datetime-local-input">
658660
</div>
659661
</div>
660662
</div>
661-
<!-- Light table -->
663+
664+
<!-- Light table -->
662665
<div class="table-responsive">
663666
<table class="table align-items-center table-flush table-hover">
664667
<thead class="thead-light">
@@ -675,7 +678,9 @@
675678
<th>Present</th>
676679
</tr>
677680
</thead>
681+
678682
<tbody>
683+
@foreach ($group->users as $student)
679684
<tr class="table-">
680685
<th>
681686
<div class="custom-control custom-checkbox">
@@ -684,137 +689,22 @@
684689
</div>
685690
</th>
686691
<td class="table-user">
687-
<b>Alex Smith</b>
692+
<b> {{$student->name}}</b>
688693
</td>
689694
<td>
690-
<span class="text-muted">IIT2018040</span>
695+
<span class="text-muted">{{$student->roll_no}}</span>
691696
</td>
692697
<td>
693698
<input class="form-control" type="text" value="None" id="example-text-input">
694699
</td>
695700
<td>
696701
<label class="custom-toggle">
697-
<input type="checkbox">
702+
<input type="checkbox" name="{{$student->roll_no}}">
698703
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
699704
</label>
700705
</td>
701706
</tr>
702-
<tr class="table-">
703-
<th>
704-
<div class="custom-control custom-checkbox">
705-
<input class="custom-control-input" id="table-check-all" type="checkbox">
706-
<label class="custom-control-label" for="table-check-all"></label>
707-
</div>
708-
</th>
709-
<td class="table-user">
710-
<b>Alex Smith</b>
711-
</td>
712-
<td>
713-
<span class="text-muted">IIT2018040</span>
714-
</td>
715-
<td>
716-
<input class="form-control" type="text" value="None" id="example-text-input">
717-
</td>
718-
<td>
719-
<label class="custom-toggle">
720-
<input type="checkbox">
721-
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
722-
</label>
723-
</td>
724-
</tr>
725-
<tr class="table-">
726-
<th>
727-
<div class="custom-control custom-checkbox">
728-
<input class="custom-control-input" id="table-check-all" type="checkbox">
729-
<label class="custom-control-label" for="table-check-all"></label>
730-
</div>
731-
</th>
732-
<td class="table-user">
733-
<b>Alex Smith</b>
734-
</td>
735-
<td>
736-
<span class="text-muted">IIT2018040</span>
737-
</td>
738-
<td>
739-
<input class="form-control" type="text" value="None" id="example-text-input">
740-
</td>
741-
<td>
742-
<label class="custom-toggle">
743-
<input type="checkbox">
744-
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
745-
</label>
746-
</td>
747-
</tr>
748-
<tr class="table-">
749-
<th>
750-
<div class="custom-control custom-checkbox">
751-
<input class="custom-control-input" id="table-check-all" type="checkbox">
752-
<label class="custom-control-label" for="table-check-all"></label>
753-
</div>
754-
</th>
755-
<td class="table-user">
756-
<b>Alex Smith</b>
757-
</td>
758-
<td>
759-
<span class="text-muted">IIT2018040</span>
760-
</td>
761-
<td>
762-
<input class="form-control" type="text" value="None" id="example-text-input">
763-
</td>
764-
<td>
765-
<label class="custom-toggle">
766-
<input type="checkbox">
767-
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
768-
</label>
769-
</td>
770-
</tr>
771-
<tr class="table-">
772-
<th>
773-
<div class="custom-control custom-checkbox">
774-
<input class="custom-control-input" id="table-check-all" type="checkbox">
775-
<label class="custom-control-label" for="table-check-all"></label>
776-
</div>
777-
</th>
778-
<td class="table-user">
779-
<b>Alex Smith</b>
780-
</td>
781-
<td>
782-
<span class="text-muted">IIT2018040</span>
783-
</td>
784-
<td>
785-
<input class="form-control" type="text" value="None" id="example-text-input">
786-
</td>
787-
<td>
788-
<label class="custom-toggle">
789-
<input type="checkbox">
790-
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
791-
</label>
792-
</td>
793-
</tr>
794-
<tr class="table-">
795-
<th>
796-
<div class="custom-control custom-checkbox">
797-
<input class="custom-control-input" id="table-check-all" type="checkbox">
798-
<label class="custom-control-label" for="table-check-all"></label>
799-
</div>
800-
</th>
801-
<td class="table-user">
802-
<b>Alex Smith</b>
803-
</td>
804-
<td>
805-
<span class="text-muted">IIT2018040</span>
806-
</td>
807-
<td>
808-
<input class="form-control" type="text" value="None" id="example-text-input">
809-
</td>
810-
<td>
811-
<label class="custom-toggle">
812-
<input type="checkbox">
813-
<span class="custom-toggle-slider rounded-circle" data-label-off="No" data-label-on="Yes"></span>
814-
</label>
815-
</td>
816-
</tr>
817-
707+
@endforeach
818708
</tbody>
819709
</table>
820710
</div>
@@ -824,14 +714,14 @@
824714
<h3 class="mb-0"></h3>
825715
</div>
826716
<div class="col-6 text-right">
827-
<a href="#" class="btn btn-sm btn-success btn-round btn-icon" data-toggle="tooltip" data-original-title="Edit product">
717+
<a onclick="document.getElementById('att').submit();" class="btn btn-sm btn-success btn-round btn-icon" data-toggle="tooltip" data-original-title="Edit product">
828718
<span class="btn-inner--icon"><i class="fas fa-check"></i></span>
829719
<span class="btn-inner--text">Submit</span>
830720
</a>
831721
</div>
832-
833722
<!-- Card footer -->
834723
</div>
724+
</form>
835725
</div>
836726
</div>
837727
<!-- Footer -->
@@ -864,15 +754,14 @@
864754
</div>
865755
<!-- Argon Scripts -->
866756
<!-- Core -->
867-
<script src="../../assets/vendor/jquery/dist/jquery.min.js"></script>
868-
<script src="../../assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
869-
<script src="../../assets/vendor/js-cookie/js.cookie.js"></script>
870-
<script src="../../assets/vendor/jquery.scrollbar/jquery.scrollbar.min.js"></script>
871-
<script src="../../assets/vendor/jquery-scroll-lock/dist/jquery-scrollLock.min.js"></script>
757+
<script src="/assets/vendor/jquery/dist/jquery.min.js"></script>
758+
<script src="/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
759+
<script src="/assets/vendor/js-cookie/js.cookie.js"></script>
760+
<script src="/assets/vendor/jquery.scrollbar/jquery.scrollbar.min.js"></script>
761+
<script src="/assets/vendor/jquery-scroll-lock/dist/jquery-scrollLock.min.js"></script>
872762
<!-- Argon JS -->
873-
<script src="../../assets/js/argon.min5438.js?v=1.2.0"></script>
874-
<!-- Demo JS - remove this in your project -->
875-
<script src="../../assets/js/demo.min.js"></script>
763+
<script src="/assets/js/argon.min5438.js?v=1.2.0"></script>
764+
876765
<script>
877766
// Facebook Pixel Code Don't Delete
878767
! function(f, b, e, v, n, t, s) {

DigiKaksha/resources/views/courses/show.blade.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,12 @@
993993
</div>
994994
<!-- Card body -->
995995
<div class="card-body">
996-
<form>
997-
<select class="form-control" data-toggle="select">
998-
<option>Section A</option>
999-
<option>Section B</option>
996+
<form method="post" action='<?php echo "/attendance/request/".$course->id ?>'>
997+
@csrf
998+
<select class="form-control" name="class" data-toggle="select">
999+
@foreach($course->groups as $group)
1000+
<option value="{{$group->id}}" >{{$group->name}}</option>
1001+
@endforeach
10001002
</select>
10011003
<br>
10021004
<button class="btn btn-primary" type="submit">Go</button>

0 commit comments

Comments
 (0)