Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
@@ -23,10 +23,11 @@
|
||||
}
|
||||
</style>
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
<h1>Opret Menuplan:</h1>
|
||||
<h1 id="errormesseages" >Opret Menuplan:</h1>
|
||||
<form action="{{ action('MenuPlanController@store') }}" method="post" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<label for="week">Uge nr.</label>
|
||||
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
|
||||
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
|
||||
<div id="editor">
|
||||
<h2 class="ql-align-center"><strong>Mandag:</strong></h2>
|
||||
@@ -53,7 +54,7 @@
|
||||
<input id="fileuploade" type="file" name="resource">
|
||||
|
||||
|
||||
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Opret Menuplan">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
@@ -107,6 +108,57 @@
|
||||
}
|
||||
change();
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#week').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('menuplans.nameCheck')}}',
|
||||
data: {'nameCheck':$value},
|
||||
success:function (data) {
|
||||
console.log(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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#week').on('keyup', function () {
|
||||
$value = $(this).val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('menuplans.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
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
@csrf
|
||||
@method("PUT")
|
||||
<label for="mandag">Uge:</label>
|
||||
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
|
||||
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
|
||||
<div id="editor">{!! $menuplan->menu !!}</div>
|
||||
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
|
||||
@@ -37,7 +38,7 @@
|
||||
<span class="toggle__text">Opret som nyhed</span>
|
||||
</span>
|
||||
</label>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
||||
<input id="disable" type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
@@ -78,5 +79,57 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#week').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('menuplans.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$menuplan->id}}},
|
||||
success:function (data) {
|
||||
console.log(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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#week').on('keyup', function () {
|
||||
$value = $(this).val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('menuplans.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$menuplan->id}}},
|
||||
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
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
<div class="row align-items-center">
|
||||
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('menu-plans.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Menuplan</a>
|
||||
</div>
|
||||
{!! session()->get('WeekExists') !!}
|
||||
|
||||
<table class="tbl mt-2">
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user