Communication by weebsockets
This commit is contained in:
parent
07c6ea06f6
commit
171abe3d18
@ -12,13 +12,13 @@
|
|||||||
<button type="button" class="checkout-button end-button add-mn-btn"> Dodaj studenta ręcznie</button>
|
<button type="button" class="checkout-button end-button add-mn-btn"> Dodaj studenta ręcznie</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="refresh"></div>
|
<div id="refresh"></div>
|
||||||
<p class="code-p"> <b>Kod:</b> {{ $classes_code }}</p>
|
<p class="code-p"><b>Kod:</b> <span id="classes_code_input">{{ $classes_code }}</span></p>
|
||||||
<h1 class="main-text main-seat-text">Przyłóż legitymację do czytnika</h1>
|
<h1 class="main-text main-seat-text">Przyłóż legitymację do czytnika</h1>
|
||||||
<div class="card-reader">
|
<div class="card-reader">
|
||||||
<form method="POST" action="{{ route('user_start_classes_verified') }}" class="card-reader-form">
|
<form method="POST" action="{{ route('user_start_classes_verified') }}" class="card-reader-form">
|
||||||
<div>
|
<div>
|
||||||
<label for="classes_code"> Kod: </label>
|
<label for="classes_code"> Kod: </label>
|
||||||
<input type="text" name="classes_code" id="classes_code" value="{{ $classes_code }}" required>
|
<input type="text" name="classes_code" id="classes_code" value="" required>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="student_id_number"> Nr indeksu: </label>
|
<label for="student_id_number"> Nr indeksu: </label>
|
||||||
@ -32,16 +32,24 @@
|
|||||||
<label for="student_surname"> Nazwisko: </label>
|
<label for="student_surname"> Nazwisko: </label>
|
||||||
<input type="text" name="student_surname" id="student_surname" required>
|
<input type="text" name="student_surname" id="student_surname" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="checkout-button"> Dodaj studenta </button>
|
<button type="submit" id="submit" class="checkout-button"> Dodaj studenta</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{{--<script>--}}
|
<script>
|
||||||
{{--// Your application has indicated there's an error--}}
|
var classes_code_input = $('#classes_code_input').html();
|
||||||
{{--window.setTimeout(function(){--}}
|
const client = new WebSocket('ws://127.0.0.1:8888', classes_code_input);
|
||||||
{{--// Move to a new location or you can do something else--}}
|
|
||||||
{{--window.location.href = window.location.href;--}}
|
|
||||||
|
|
||||||
{{--}, 5000);--}}
|
client.onmessage = function onmessage1(message) {
|
||||||
{{--</script>--}}
|
message = JSON.parse(message.data);
|
||||||
|
if (message.type = "data") {
|
||||||
|
$('#student_id_number').val(message['id']);
|
||||||
|
$('#student_name').val(message['name']);
|
||||||
|
$('#student_surname').val(message['surname']);
|
||||||
|
$('#classes_code').val(message['classes_code']);
|
||||||
|
$('#submit').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
Reference in New Issue
Block a user