Commit 7052f2e8 authored by TTS Tran Viet Anh's avatar TTS Tran Viet Anh

validate fix

parent c1c82bd2
...@@ -7,13 +7,15 @@ ...@@ -7,13 +7,15 @@
</div> </div>
</nav> </nav>
<div class="container"> <div class="container">
<form action=""> <form action="{{ route('upload') }}" method="post" enctype="multipart/form" id="uploadForm">
@csrf
<div class="row"> <div class="row">
<div class="col-2"> <div class="col-2">
<label for="">Danh mục:</label> <label for="">Danh mục:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<select name="category" class="form-control"> <select name="category" class="form-control @error('category') is-invalid @enderror" required>
<option value="">--Chọn danh mục--</option>
<option value="1">danh mục 1</option> <option value="1">danh mục 1</option>
<option value="2">danh mục 2</option> <option value="2">danh mục 2</option>
<option value="3">danh mục 3</option> <option value="3">danh mục 3</option>
...@@ -21,6 +23,11 @@ ...@@ -21,6 +23,11 @@
<option value="5">danh mục 5</option> <option value="5">danh mục 5</option>
</select> </select>
</div> </div>
@error('category')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
</div> </div>
<div class="row"> <div class="row">
...@@ -29,22 +36,34 @@ ...@@ -29,22 +36,34 @@
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="file" for="question">Chọn file</label> <label class="file" for="question">Chọn file</label>
<input type="file" name="question" id="question" hidden /> <input type="file" name="question" class="@error('question') is-invalid @enderror" id="question"
hidden />
</div> </div>
<div class="col-8"> <div class="col-8">
<p class="file">(Chỉ chọn file PDF)</p> <p class="file">(Chỉ chọn file PDF)</p>
</div> </div>
@error('question')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
<div class="col-2"> <div class="col-2">
<label for="">Tệp lời giải:</label> <label for="">Tệp lời giải:</label>
</div> </div>
<div class="col-2"> <div class="col-2">
<label class="file" for="answer">Chọn file</label> <label class="file" for="answer">Chọn file</label>
<input type="file" name="answer" id="answer" hidden /> <input type="file" name="answer" class="@error('answer') is-invalid @enderror" id="answer"
hidden />
</div> </div>
<div class="col-8"> <div class="col-8">
<p class="file">(Chỉ chọn file PDF)</p> <p class="file">(Chỉ chọn file PDF)</p>
</div> </div>
@error('answer')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
</div> </div>
<div class="row"> <div class="row">
...@@ -52,14 +71,20 @@ ...@@ -52,14 +71,20 @@
<label for="">Tên đề thi:</label> <label for="">Tên đề thi:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<input type="text" id="name" name="name" class="form-control" /> <input type="text" id="name" name="name" value="{{ old('name') }}"
</div> class="form-control @error('name') is-invalid @enderror" required />
</div>
@error('name')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
<div class="col-2"> <div class="col-2">
<label for="">Giới thiệu:</label> <label for="">Giới thiệu:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<textarea style="height:100px ;" name="introduction" class="form-control"></textarea> <textarea style="height:100px ;" name="introduction" class="form-control" value="{{ old('introduction') }}"></textarea>
</div> </div>
<div class="col-2"> <div class="col-2">
...@@ -67,7 +92,7 @@ ...@@ -67,7 +92,7 @@
</div> </div>
<div class="col-10"> <div class="col-10">
<input type="text" name="keyWord" class="form-control" data-role="tagsinput" <input type="text" name="keyWord" class="form-control" data-role="tagsinput"
placeholder="+ Thêm từ khóa" /> value="{{ old('keyWord') }}" placeholder="+ Thêm từ khóa" />
</div> </div>
</div> </div>
...@@ -76,34 +101,59 @@ ...@@ -76,34 +101,59 @@
<label for="">Phí thi:</label> <label for="">Phí thi:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<input type="text" id="fee" name="fee" class="form-control" placeholder="đ" /> <input type="text" id="fee" name="fee" value="{{ old('fee') }}"
</div> class="form-control @error('fee') is-invalid @enderror" placeholder="đ" required />
</div>
@error('fee')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
<div class="col-2"> <div class="col-2">
<label for="">Mức độ:</label> <label for="">Mức độ:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<select name="level" id="level" class="form-control"> <select name="level" id="level" class="form-control @error('level') is-invalid @enderror"
<option value="0">--Chọn mức độ--</option> required>
<option value="">--Chọn mức độ--</option>
<option value="1">Dễ</option> <option value="1">Dễ</option>
<option value="2">Khó</option> <option value="2">Khó</option>
</select> </select>
</div> </div>
@error('level')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
<div class="col-2"> <div class="col-2">
<label for="">Thời gian thi:</label> <label for="">Thời gian thi:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<input type="number" id="time" name="time" class="form-control" placeholder="phút" /> <input type="number" min="0" id="time" name="time" value="{{ old('time') }}"
</div> class="form-control @error('time') is-invalid @enderror" placeholder="phút" required />
</div>
@error('time')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
<div class="col-2"> <div class="col-2">
<label for="">Số câu hỏi:</label> <label for="">Số câu hỏi:</label>
</div> </div>
<div class="col-10"> <div class="col-10">
<input type="number" name="numberOfQuestion" id="numberOfQuestion" class="form-control" <input type="number" min="0" name="numberOfQuestion" id="numberOfQuestion"
placeholder="câu" /> value="{{ old('numberOfQuestion') }}"
</div> class="form-control @error('numberOfQuestion') is-invalid @enderror" placeholder="câu" required />
</div>
@error('numberOfQuestion')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
@enderror
</div> </div>
<div class="row" id="questionForm" name="questionForm"> <div class="row" id="questionForm" name="questionForm">
...@@ -147,6 +197,7 @@ ...@@ -147,6 +197,7 @@
alert("Chỉ có thể chọn file " + fileExtension.join(', ')); alert("Chỉ có thể chọn file " + fileExtension.join(', '));
} }
}); });
}) })
</script> </script>
@endsection @endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment