Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
commit
376f37da8c
|
@ -59,10 +59,7 @@ class MenuPlanController extends Controller
|
||||||
{
|
{
|
||||||
$requestMenuPlanCreate = $request->validate([
|
$requestMenuPlanCreate = $request->validate([
|
||||||
"week" => "required|max:2",
|
"week" => "required|max:2",
|
||||||
"monday" => "required|max:255",
|
"menu" => "required",
|
||||||
"tuesday" => "required|max:255",
|
|
||||||
"wednesday" => "required|max:255",
|
|
||||||
"thursday" => "required|max:255"
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$menuPlan = new MenuPlan($requestMenuPlanCreate);
|
$menuPlan = new MenuPlan($requestMenuPlanCreate);
|
||||||
|
@ -79,7 +76,7 @@ class MenuPlanController extends Controller
|
||||||
$news = new News();
|
$news = new News();
|
||||||
|
|
||||||
$news->name = "Ny menuplan Uge " . $menuPlan->week;
|
$news->name = "Ny menuplan Uge " . $menuPlan->week;
|
||||||
$news->content = "";
|
$news->content = $menuPlan->menu;
|
||||||
|
|
||||||
$news->save();
|
$news->save();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +136,7 @@ class MenuPlanController extends Controller
|
||||||
$news = new News();
|
$news = new News();
|
||||||
|
|
||||||
$news->name = "Opdateret menuplan Uge " . $menuplan->week;
|
$news->name = "Opdateret menuplan Uge " . $menuplan->week;
|
||||||
$news->content = "";
|
$news->content = $menuplan->menu;
|
||||||
|
|
||||||
$news->save();
|
$news->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,6 @@ class MenuPlan extends Model
|
||||||
{
|
{
|
||||||
//protected variable which contains name of database field(s) to be filled.
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'week', 'monday', "tuesday", 'wednesday', 'thursday'
|
'week', 'menu'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,7 @@ class CreateMenuPlans extends Migration
|
||||||
Schema::create('menu_plans', function (Blueprint $table) {
|
Schema::create('menu_plans', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('week', 2);
|
$table->string('week', 2);
|
||||||
$table->string('monday', 255);
|
$table->longText('menu');
|
||||||
$table->string('tuesday', 255);
|
|
||||||
$table->string('wednesday', 255);
|
|
||||||
$table->string('thursday', 255);
|
|
||||||
$table->unique('week');
|
$table->unique('week');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
//$table->text('description');
|
//$table->text('description');
|
||||||
|
|
|
@ -17,14 +17,26 @@
|
||||||
.toggle__text::before {
|
.toggle__text::before {
|
||||||
border-color: black;
|
border-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tox-notification {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tox {
|
||||||
|
border-radius: 4px !important;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="https://cdn.ckeditor.com/ckeditor5/21.0.0/classic/ckeditor.js"></script>
|
<script src="https://cdn.tiny.cloud/1/ikwmbvigw8ass90tn37xiql6mk1gjoks77t3m6tld60hdjov/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
|
||||||
<h1>Opret Menuplan:</h1>
|
<h1>Opret Menuplan:</h1>
|
||||||
<form action="{{ action('MenuPlanController@store') }}" method="post">
|
<form action="{{ action('MenuPlanController@store') }}" method="post">
|
||||||
@csrf
|
@csrf
|
||||||
<label for="week">Uge nr.</label>
|
<label for="week">Uge nr.</label>
|
||||||
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
|
<input type="number" name="week" id="week" min="1" max="53" placeholder="1" required>
|
||||||
<textarea name="menuPlan" id="editor"></textarea>
|
<textarea name="menu" id="editor"><p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Mandag:<br /></span><span style="text-align: center;">{Mandag}</span></p>
|
||||||
|
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Tirsdag:<br /></span><span style="text-align: center;">{Tirsdag}</span></p>
|
||||||
|
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Onsdag:<br /></span><span style="text-align: center;">{Onsdag}</span></p>
|
||||||
|
<p style="text-align: center;"><span style="color: #00788a; font-size: 24px; font-weight: bold; text-align: center;">Torsdag:<br /></span><span style="text-align: center;">{Torsdag}</span></p></textarea>
|
||||||
<label class="toggle">
|
<label class="toggle">
|
||||||
<input class="toggle__input" type="checkbox" name="newsoption">
|
<input class="toggle__input" type="checkbox" name="newsoption">
|
||||||
<span class="toggle__label">
|
<span class="toggle__label">
|
||||||
|
@ -34,16 +46,14 @@
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
|
<input type="submit" class="btn btn-dark text-white" value="Opret Menuplan">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
ClassicEditor
|
tinymce.init({
|
||||||
.create( document.querySelector( '#editor' ) )
|
selector: 'textarea',
|
||||||
.then( editor => {
|
setup: function (editor) {
|
||||||
console.log( editor );
|
editor.on('change', function () {
|
||||||
} )
|
tinymce.triggerSave();
|
||||||
.catch( error => {
|
});
|
||||||
console.error( error );
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -17,21 +17,24 @@
|
||||||
.toggle__text::before {
|
.toggle__text::before {
|
||||||
border-color: black;
|
border-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tox-notification {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tox {
|
||||||
|
border-radius: 4px !important;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script src="https://cdn.tiny.cloud/1/ikwmbvigw8ass90tn37xiql6mk1gjoks77t3m6tld60hdjov/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
|
||||||
<h1>Rediger Menuplan:</h1>
|
<h1>Rediger Menuplan:</h1>
|
||||||
<form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}">
|
<form method="post" action="{{ route("menu-plans.update", [ "menu_plan" => $menuplan ]) }}">
|
||||||
@csrf
|
@csrf
|
||||||
@method("PUT")
|
@method("PUT")
|
||||||
<label for="mandag">Uge:</label>
|
<label for="mandag">Uge:</label>
|
||||||
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
|
<input type="number" name="week" id="week" min="1" max="53" value="{{ $menuplan->week }}" required>
|
||||||
<label for="mandag">Mandag:</label>
|
<textarea name="menu" id="editor">{!! $menuplan->menu !!}</textarea>
|
||||||
<input type="text" name="monday" id="mandag" value="{{ $menuplan->monday }}" required>
|
|
||||||
<label for="tirsdag">Tirsdag:</label>
|
|
||||||
<input type="text" name="tuesday" id="tirsdag" value="{{ $menuplan->tuesday }}" required>
|
|
||||||
<label for="onsdag">Onsdag:</label>
|
|
||||||
<input type="text" name="wednesday" id="onsdag" value="{{ $menuplan->wednesday }}" required>
|
|
||||||
<label for="torsdag">Torsdag:</label>
|
|
||||||
<input type="text" name="thursday" id="torsdag" value="{{ $menuplan->thursday }}" required>
|
|
||||||
<label class="toggle">
|
<label class="toggle">
|
||||||
<input class="toggle__input" type="checkbox" name="newsoption">
|
<input class="toggle__input" type="checkbox" name="newsoption">
|
||||||
<span class="toggle__label">
|
<span class="toggle__label">
|
||||||
|
@ -40,4 +43,15 @@
|
||||||
</label>
|
</label>
|
||||||
<input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
<input type="submit" class="btn btn-dark text-white" value="Rediger Menuplan">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
tinymce.init({
|
||||||
|
selector: 'textarea',
|
||||||
|
setup: function (editor) {
|
||||||
|
editor.on('change', function () {
|
||||||
|
tinymce.triggerSave();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -12,24 +12,9 @@
|
||||||
@foreach($menuPlans as $menuplan)
|
@foreach($menuPlans as $menuplan)
|
||||||
@if($menuplan->week == $Week)
|
@if($menuplan->week == $Week)
|
||||||
<h1 class="text-center sde-blue mb-0">{{ __('msg.menuplan') }}</h1>
|
<h1 class="text-center sde-blue mb-0">{{ __('msg.menuplan') }}</h1>
|
||||||
<span class="text-center sde-black-80 bold">{{ __('msg.uge') }}: {{$menuplan->week}}</span>
|
<span class="text-center sde-black-80 bold">{{ __('msg.ugestor') }}: {{$menuplan->week}}</span>
|
||||||
<div class="col w-100 mt-auto text-center">
|
<div class="col w-100 mt-auto">
|
||||||
<div class="w-100" id="mandag">
|
{!! $menuplan->menu !!}
|
||||||
<h3 class="sde-blue bold mb-0">{{ __('msg.mandag') }}</h3>
|
|
||||||
<p>{{$menuplan->monday}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="w-100" id="tirsdag">
|
|
||||||
<h3 class="sde-blue bold mb-0">{{ __('msg.tirsdag') }}</h3>
|
|
||||||
<p>{{$menuplan->tuesday}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="w-100" id="onsdag">
|
|
||||||
<h3 class="sde-blue bold mb-0">{{ __('msg.onsdag') }}</h3>
|
|
||||||
<p>{{$menuplan->wednesday}}</p>
|
|
||||||
</div>
|
|
||||||
<div class="w-100" id="torsdag">
|
|
||||||
<h3 class="sde-blue bold mb-0">{{ __('msg.torsdag') }}</h3>
|
|
||||||
<p>{{$menuplan->thursday}}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
Loading…
Reference in New Issue