v0.9.15h - NameCheck - Fixed Updates
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user