2020-06-25 06:12:53 +00:00
|
|
|
@extends("admin.layout.base")
|
|
|
|
@extends("admin.layout.header")
|
|
|
|
|
|
|
|
@section("title")
|
|
|
|
Menuplan - Rediger
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("path")
|
2020-06-29 06:31:36 +00:00
|
|
|
<a href="{{ route('menu-plans.edit', [ "menu_plan" => $menuplan ]) }}" class="text-white">Rediger Menuplan</a> /
|
2020-06-25 06:12:53 +00:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("content")
|
2020-08-07 08:58:50 +00:00
|
|
|
<style>
|
2020-08-12 06:42:58 +00:00
|
|
|
.toggle__label::before, .toggle__label::after {
|
|
|
|
border-color: black;
|
|
|
|
}
|
|
|
|
.toggle__text::before {
|
|
|
|
border-color: black;
|
|
|
|
}
|
2020-08-07 10:20:15 +00:00
|
|
|
|
2020-08-12 06:42:58 +00:00
|
|
|
#editor {
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
2020-08-07 08:58:50 +00:00
|
|
|
</style>
|
2020-06-25 06:12:53 +00:00
|
|
|
<h1>Rediger Menuplan:</h1>
|
2020-06-29 06:31:36 +00:00
|
|
|
<form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}">
|
|
|
|
@csrf
|
|
|
|
@method("PUT")
|
2020-06-30 10:38:02 +00:00
|
|
|
<label for="mandag">Uge:</label>
|
2020-08-17 08:21:02 +00:00
|
|
|
<label hidden id="error" for="errormesseages">Menuplan findes allerede</label>
|
2020-06-30 10:38:02 +00:00
|
|
|
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
|
2020-08-17 10:24:43 +00:00
|
|
|
<label for="monday">Mandag:</label>
|
|
|
|
<input type="text" name="monday" id="monday" placeholder="Hawaii Pizza" required value="{{ $menuplan->monday }}">
|
|
|
|
<label for="tuesday">Tirsdag:</label>
|
|
|
|
<input type="text" name="tuesday" id="tuesday" placeholder="Pasta Bolognese" required value="{{ $menuplan->tuesday }}">
|
|
|
|
<label for="wednesday">Onsdag:</label>
|
|
|
|
<input type="text" name="wednesday" id="wednesday" placeholder="Pandekager" required value="{{ $menuplan->wednesday }}">
|
|
|
|
<label for="thursday">Torsdag:</label>
|
|
|
|
<input type="text" name="thursday" id="thursday" placeholder="Bøf med løg" required value="{{ $menuplan->thursday }}">
|
2020-08-07 08:58:50 +00:00
|
|
|
<label class="toggle">
|
|
|
|
<input class="toggle__input" type="checkbox" name="newsoption">
|
|
|
|
<span class="toggle__label">
|
2020-11-26 14:22:59 +00:00
|
|
|
<span class="toggle__text">Opdater / Opret som nyhed?</span>
|
2020-08-07 08:58:50 +00:00
|
|
|
</span>
|
|
|
|
</label>
|
2020-08-17 08:21:02 +00:00
|
|
|
<input id="disable" type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
2020-06-25 06:12:53 +00:00
|
|
|
</form>
|
|
|
|
@endsection
|
2020-08-11 08:54:01 +00:00
|
|
|
@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.'
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2020-08-17 08:21:02 +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.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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
2020-08-11 08:54:01 +00:00
|
|
|
</script>
|
|
|
|
@endsection
|