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

113 lines
3.9 KiB
PHP

@extends("admin.layout.base")
@extends("admin.layout.header")
@section("title")
Menuplan - Opret
@endsection
@section("path")
<a href="{{ route('menu-plans.create') }}" class="text-white">Opret Menuplan</a> /
@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">
<h1>Opret Menuplan:</h1>
<form action="{{ action('MenuPlanController@store') }}" method="post" enctype="multipart/form-data">
@csrf
<label for="week">Uge nr.</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>
<p class="ql-align-center">{Mandag}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Tirsdag:</strong></h2>
<p class="ql-align-center">{Tirsdag}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Onsdag:</strong></h2>
<p class="ql-align-center">{Onsdag}</p>
<p class="ql-align-center"><br></p>
<h2 class="ql-align-center"><strong>Torsdag:</strong></h2>
<p class="ql-align-center">{Torsdag}</p>
</div>
<textarea name="menu" class="d-none" id="hiddenArea"></textarea>
<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>
<label id="fileuploadee"for="fileuploade">Baggrundsbillede til nyheden (Valgfri):</label>
<input id="fileuploade" type="file" name="resource">
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
</form>
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<script>
var container = document.getElementById("editor");
var fullEditor = new Quill(container, {
modules: {
'toolbar': [
[ 'bold', 'italic', 'underline', 'strike' ],
[{ 'color': [] }],
[{ 'script': 'super' }, { 'script': 'sub' }],
[{ 'header': '1' }, { 'header': '2' }, 'blockquote' ],
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
[ {'direction': 'rtl'}, { 'align': [] }],
[ 'link' ],
[ 'clean' ]
],
},
theme: 'snow'
});
</script>
<script>
var form = document.querySelector('form');
form.onsubmit = function() {
var myEditor = document.getElementById('editor');
var html = myEditor.children[0].innerHTML;
document.getElementById('hiddenArea').innerText = html;
}
</script>
@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"))
{
$('#fileuploade').show(400);
$('#fileuploadee').show(200);
}else {
$('#fileuploade').hide();
$('#fileuploadee').hide();
}
}
change();
</script>
@endsection