@extends('training.inc.master')

@section('title','Dashboard')

@section('content')

<main class="content">
				<div class="container-fluid p-0">

				<h1 class="h3 mb-3"><strong>Trainers Registration</strong> Page</h1>
					@include('training.alerts.alert')
					<div class="row">
						<div class="col-3">
							<div class="card">
								<div class="card-header">
									<h5 class="card-title mb-0">Register an approved Trainer</h5>
								</div>
								<div class="card-body">
								<form action="{{ route('register.trainer') }}" method="post" autocomplete="off">
									@csrf
									<div class="mb-3">
										<label for="pin" class="form-label">Trainer PIN</label>
										<input type="text" class="form-control" id="pin" name="pin" value="{{ old('pin') }}" placeholder="Enter Trainer PIN" required>
										@error('pin')
											<small class="text-danger">{{ $message }}</small>
										@enderror
									</div>

									<div class="mb-3">
										<label for="name" class="form-label">Trainer Name</label>
										<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }}" placeholder="Enter Trainer Name" required>
										@error('name')
											<small class="text-danger">{{ $message }}</small>
										@enderror
									</div>

									<div class="mb-3">
										<label for="contact" class="form-label">Contact Number</label>
										<input type="text" class="form-control" id="contact" name="contact" value="{{ old('contact') }}" placeholder="Enter Contact Number" required>
										@error('contact')
											<small class="text-danger">{{ $message }}</small>
										@enderror
									</div>

									<button type="submit" class="btn btn-primary">Register Trainer</button>
								</form>

									
								</div>
							</div>
						</div>
					
						<div class="col-9">
						<div class="card">
								<div class="card-header">
									<h5 class="card-title">Registered SJAK Trainers</h5>									
								</div>
								<div class="card-body">
									<table id="datatables-reponsive" class="table table-striped" style="width:100%">
										<thead>
											<tr>
												<th>ID</th>
												<th>Trainer Pin</th>
												<th>Trainer Names</th>
												<th>Trainer Contact</th>
												<th>Action</th>
											</tr>
										</thead>
										<tbody>
											@foreach ($trainers as $data)
												<tr>
													<td>{{ $data->id }}</td>
													<td>{{ $data->pin }}</td>
													<td>{{ $data->name }}</td>
													<td>{{ $data->contact }}</td>
													<td> </td>
												</tr>
											@endforeach
										</tbody>
									</table>
								</div>
							</div>

				</div>
				
			</main>
@endsection