Ekapp/skolehjem/resources/views/admin/menuplans/create.blade.php

131 lines
4.6 KiB
PHP
Raw Normal View History

2020-06-15 10:29:03 +00:00
@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Menuplan - Opret
@endsection
@section("path")
2020-06-25 14:16:08 +00:00
<a href="{{ route('menu-plans.create') }}" class="text-white">Opret Menuplan</a> /
2020-06-15 10:29:03 +00:00
@endsection
@section("content")
<style>
.toggle__label::before, .toggle__label::after {
border-color: black;
}
.toggle__text::before {
border-color: black;
}
#editor {
margin-bottom: 1rem;
}
</style>
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
2020-08-17 07:21:47 +00:00
<h1 id="errormesseages" >Opret Menuplan:</h1>
2020-08-12 10:28:05 +00:00
<form action="{{ action('MenuPlanController@store') }}" method="post" enctype="multipart/form-data">
2020-06-25 16:43:46 +00:00
@csrf
<label for="week">Uge nr.</label>
2020-08-17 07:21:47 +00:00
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
<label for="monday">Mandag:</label>
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required>
<label for="tuesday">Tirsdag:</label>
<input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required>
<label for="wednesday">Onsdag:</label>
<input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required>
<label for="thursday">Torsdag:</label>
<input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required>
<label class="toggle">
<input class="toggle__input" id="isNews" type="checkbox" name="newsoption" onclick="change()">
<span class="toggle__label">
<span class="toggle__text">Opret som nyhed</span>
</span>
</label>
2020-08-12 10:28:05 +00:00
<label id="fileuploadee"for="fileuploade">Baggrundsbillede til nyheden (Valgfri):</label>
<input id="fileuploade" type="file" name="resource" accept="image/*">
2020-08-17 07:21:47 +00:00
<input type="submit" id="disable" class="btn btn-dark text-white" value="Opret Menuplan">
2020-06-15 10:29:03 +00:00
</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.'
}
);
});
function change() {
if ($('#isNews').is(":checked"))
{
2020-08-12 10:28:05 +00:00
$('#fileuploade').show(400);
$('#fileuploadee').show(200);
}else {
$('#fileuploade').hide();
2020-08-12 10:28:05 +00:00
$('#fileuploadee').hide();
}
}
change();
2020-08-17 07:21:47 +00:00
//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