Ekapp/skolehjem/resources/views/admin/multiple-events/create.blade.php

153 lines
5.8 KiB
PHP
Raw Normal View History

@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Ugentligt aktivitet - Vis
@endsection
@section("path")
<a href="{{ route('events.create') }}" class="text-white">Opret ugentligt aktivitet</a> /
@endsection
@section("content")
<style>
.toggle__label::before, .toggle__label::after {
border-color: black;
}
.toggle__text::before {
border-color: black;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
text-align: left;
padding: 8px;
}
</style>
<link href="{{ asset("/css/quill/quill.snow.css") }}" rel="stylesheet">
<h1 id="errormesseages" >Opret ugentligt aktivitet:</h1>
<form method="post" action="{{ route("multiple-events.store") }}" enctype="multipart/form-data">
<!--datetime-local-->
@csrf
<input type="text" name="week" placeholder="week">
<label id="fileuploadee"for="fileuploade">Baggrundsbillede til nyheden (Valgfri)</label>
<input id="fileuploade" type="file" name="resource" accept="image/*">
<table>
<tr>
<th>Ugedag</th>
<th>Aktivitets navn</th>
<th>Aktivitets beskrivelse</th>
<th>Tovholder</th>
<th>Tidsrum (Start)</th>
</tr>
<tr>
<td>Mandag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.0") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.0") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.0") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.0") }}"></td>
</tr>
<tr>
<td>Tirsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.1") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.1") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.1") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.1") }}"></td>
</tr>
<tr>
<td>Onsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.2") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.2") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.2") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.2") }}"></td>
</tr>
<tr>
<td>Torsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.3") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.3") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.3") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.3") }}"></td>
</tr>
</table>
<label class="toggle">
<input id="isNews" class="toggle__input" type="checkbox" name="newsoption" onclick="change()">
<span class="toggle__label">
<span class="toggle__text">Opret som nyhed</span>
</span>
</label>
<input id="disable" type="submit" class="btn btn-dark text-white" value="Opret">
</form>
@endsection
@section("scripts")
<script>
$(function() {
$('form').areYouSure(
{
message: 'It looks like you have been editing something. '
+ 'If you leave before saving, your changes will be lost.'
}
);
});
$(document).ready(function () {
$value = $('#name').val();
$.ajax({
type: 'get',
url: '{{route('events.nameCheck')}}',
data: {'nameCheck':$value},
success:function (data) {
if(data){
$("#error").show(100);
$("#error").css('color', 'red');
$("#disable").prop('disabled', true);
$('#disable').css('cursor','not-allowed');
}else{
$("#error").hide();
$("#disable").prop('disabled', false);
$('#disable').css('cursor','pointer');
}
},
error:function (data) {
console.log(data);
}
});
});
$('#name').on('keyup', function () {
$value = $(this).val();
$.ajax({
type: 'get',
url: '{{route('events.nameCheck')}}',
data: {'nameCheck':$value},
success:function (data) {
if(data){
$("#error").show(100);
$("#error").css('color', 'red');
$("#disable").prop('disabled', true);
$('#disable').css('cursor','not-allowed');
}else{
$("#error").hide();
$("#disable").prop('disabled', false);
$('#disable').css('cursor','pointer');
}
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection