@extends('layouts.teacher')

@section('content')

<!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
	  <div class="container-full">
		<!-- Content Header (Page header) -->
		<div class="content-header">
			<div class="d-flex align-items-center">
				<div class="me-auto">
					<h3 class="page-title">Edit Student Mark</h3>
					<div class="d-inline-block align-items-center">
						<nav>
							<ol class="breadcrumb">
								<li class="breadcrumb-item"><a href="{{ route('teacher.index') }}"><i class="mdi mdi-home-outline"></i></a></li>
								<li class="breadcrumb-item" aria-current="page">Student Mark</li>
								<li class="breadcrumb-item active" aria-current="page">Edit</li>
							</ol>
						</nav>
					</div>
				</div>
				
			</div>
		</div>	  

		<!-- Main content -->
		<section class="content">
			<div class="row">			  
				
				<div class="col-lg-12 col-12">
					
					@if ($errors->any())
                        <div class="alert alert-danger">
                            <strong>Whoops!</strong> There were some problems with your input.<br><br>
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
					  <div class="box">
						<!-- /.box-header -->
						<form class="form" action="{{ route('teacher.student.mark.store') }}" method="post">
							@csrf
							<input type="hidden" name="mark_id" value="{{ $mark_details->id }}">
							<div class="box-body">
								<div class="row">
									<div class="col-md-6">
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Select Student</label>
												<div class="input-group mb-3">
													<select class="form-control @error('student_id') is-invalid @enderror select2" name="student_id">
														<option value="">Select Student</option>
														@if(count($students) > 0)
														@foreach($students as $key => $value)
														<option value="{{ $value->id }}" @if($value->id == $mark_details->student_id) selected @endif>{{ $value->name }}</option>
														@endforeach
														@endif
													</select>
												</div>
												@error('student_id')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
										    <div class="form-group">
												<label class="form-label">Exam Type</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('exam_type') is-invalid @enderror" name="exam_type" placeholder="Exam Type" value="{{ $mark_details->exam_type }}" required>
												</div>
												@error('exam_type')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Paper 1</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('paper_1') is-invalid @enderror" name="paper_1" placeholder="Paper 1" value="{{ $mark_details->paper_1 }}">
												</div>
												@error('paper_1')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Paper 2</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('paper_2') is-invalid @enderror" name="paper_2" value="{{ $mark_details->paper_2 }}" placeholder="Paper 2">
												</div>
												@error('paper_2')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
									</div>
									<div class="col-md-6">
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Paper 3</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('paper_3') is-invalid @enderror" name="paper_3" value="{{ $mark_details->paper_3 }}" placeholder="Paper 3">
												</div>
												@error('paper_3')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Paper 4</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('paper_4') is-invalid @enderror" name="paper_4" value="{{ $mark_details->paper_4 }}" placeholder="Paper 4">
												</div>
												@error('paper_4')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Paper 5</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('paper_5') is-invalid @enderror" name="paper_5" value="{{ $mark_details->paper_5 }}" placeholder="Paper 5">
												</div>
												@error('paper_5')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
										<div class="col-md-12">
											<div class="form-group">
												<label class="form-label">Grade / Rank</label>
												<div class="input-group mb-3">
													<input type="text" class="form-control @error('grade') is-invalid @enderror" name="grade" value="{{ $mark_details->grade }}" placeholder="Grade / Rank">
												</div>
												@error('grade')
				                                    <span class="invalid-feedback" role="alert">
				                                        <strong>{{ $message }}</strong>
				                                    </span>
				                                @enderror
											</div>
										</div>
									</div>
								</div>
							</div>
							<!-- /.box-body -->
							<div class="box-footer text-end">
								<input type="submit" name="submit" class="btn btn-primary" value="Submit">
								<!-- <button type="submit" class="btn btn-primary">
								  <i class="ti-save-alt"></i> Save
								</button> -->
							</div>  
						</form>
					  </div>
					  <!-- /.box -->			
				</div>

		    </div>
			
		  </div>
		  <!-- /.row -->

		</section>
		<!-- /.content -->
	  </div>
  </div>
  <!-- /.content-wrapper -->

@endsection