2020-08-04 11:21:23 +00:00
|
|
|
@extends("admin.layout.base")
|
|
|
|
@extends("admin.layout.header")
|
|
|
|
|
|
|
|
@section("title")
|
|
|
|
Vejledning - Rediger
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("path")
|
|
|
|
<a href="{{route('guides.edit', ['guide' => $guide])}}" class="text-white">Rediger vejledning</a> /
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("content")
|
|
|
|
<style>
|
2020-08-07 07:47:23 +00:00
|
|
|
.toggle__label::before, .toggle__label::after {
|
|
|
|
border-color: black;
|
|
|
|
}
|
|
|
|
.toggle__text::before {
|
|
|
|
border-color: black;
|
|
|
|
}
|
2020-08-12 06:42:58 +00:00
|
|
|
|
|
|
|
#editor {
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
}
|
2020-08-04 11:21:23 +00:00
|
|
|
</style>
|
2020-08-19 08:35:44 +00:00
|
|
|
<link href="{{ asset("/css/quill/quill.snow.css") }}" rel="stylesheet">
|
2020-08-04 11:21:23 +00:00
|
|
|
<h1>Rediger vejledning:</h1>
|
2020-11-26 14:22:59 +00:00
|
|
|
<form method="post" action="{{route("guides.update", ["guide" => $guide])}}" enctype="multipart/form-data">
|
2020-08-04 11:21:23 +00:00
|
|
|
@csrf
|
|
|
|
@method("PUT")
|
|
|
|
<label for="title">Navn</label>
|
2020-08-17 08:21:02 +00:00
|
|
|
<label hidden id="error" for="errormesseages">Navn findes allerede</label>
|
2020-08-04 11:21:23 +00:00
|
|
|
<input value="{{$guide->name}}" type="text" name="name" id="title" required>
|
2020-09-11 10:30:37 +00:00
|
|
|
<div>
|
2020-09-22 08:45:27 +00:00
|
|
|
<select name="guide_category_id" id="guidesCategory" required>
|
2020-09-11 10:30:37 +00:00
|
|
|
<option disabled selected value> -- Vælg en kategori -- </option>
|
|
|
|
@foreach(\App\GuidesCategory::query()->get() as $guideCategory)
|
|
|
|
{{ $selected = "" }}
|
|
|
|
@if($guide->guide_category_id == $guideCategory->id)
|
|
|
|
{{ $selected = "selected" }}
|
|
|
|
@endif
|
|
|
|
<option {{ $selected }} value="{{ $guideCategory->id }}">{{ $guideCategory->guidesCategoryName }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select> <label>Vælg en kategori</label>
|
|
|
|
<a class="btn btn-inline btn-sde-blue mb-0 ml-1" href="{{ route('guides-category.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret kategori</a>
|
|
|
|
</div>
|
2020-08-04 11:21:23 +00:00
|
|
|
<label for="editor">Vejledning</label>
|
2020-10-07 09:59:58 +00:00
|
|
|
<small class="form-text text-muted">For at kunne indsætte et link, skal du markere den text du vil lave som et link først.</small>
|
2020-08-12 06:42:58 +00:00
|
|
|
<div id="editor">{!! $guide->guide_articles !!}</div>
|
|
|
|
<textarea name="guide_articles" class="d-none" id="hiddenArea"></textarea>
|
2020-10-26 13:59:16 +00:00
|
|
|
<label id="fileuploadee"for="fileuploade">Baggrundsbillede (Forbliv tom hvis billede ikke skal ændres):</label>
|
|
|
|
<input id="fileuploade" type="file" name="resource" accept="image/*" value="{{$guide->resource_id}}">
|
2020-08-07 07:47:23 +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 07:47:23 +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">
|
2020-08-04 11:21:23 +00:00
|
|
|
</form>
|
|
|
|
|
2020-08-19 08:35:44 +00:00
|
|
|
<script src="{{ asset("/js/quill/quill.js") }}"></script>
|
2020-08-04 11:21:23 +00:00
|
|
|
<script>
|
2020-08-12 06:42:58 +00:00
|
|
|
var container = document.getElementById("editor");
|
|
|
|
var fullEditor = new Quill(container, {
|
|
|
|
modules: {
|
|
|
|
'toolbar': [
|
|
|
|
[ 'bold', 'italic', 'underline', 'strike' ],
|
2020-08-12 13:17:48 +00:00
|
|
|
[{ 'color': [] }],
|
2020-08-12 06:42:58 +00:00
|
|
|
[{ 'script': 'super' }, { 'script': 'sub' }],
|
2020-08-12 13:17:48 +00:00
|
|
|
[{ 'header': '1' }, { 'header': '2' }, 'blockquote' ],
|
2020-08-12 06:42:58 +00:00
|
|
|
[{ 'list': 'ordered' }, { 'list': 'bullet'}, { 'indent': '-1' }, { 'indent': '+1' }],
|
|
|
|
[ {'direction': 'rtl'}, { 'align': [] }],
|
2020-10-07 09:59:58 +00:00
|
|
|
[ 'link', 'image', 'video' ],
|
2020-08-12 06:42:58 +00:00
|
|
|
[ '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;
|
|
|
|
}
|
2020-08-04 11:21:23 +00:00
|
|
|
</script>
|
|
|
|
@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
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
$value = $('#title').val();
|
|
|
|
console.log($value);
|
|
|
|
$.ajax({
|
|
|
|
type: 'get',
|
|
|
|
url: '{{route('guides.nameCheckUpdate')}}',
|
|
|
|
data: {'nameCheck':$value, 'id':{{$guide->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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#title').on('keyup', function () {
|
|
|
|
$value = $(this).val();
|
|
|
|
$.ajax({
|
|
|
|
type: 'get',
|
|
|
|
url: '{{route('guides.nameCheckUpdate')}}',
|
|
|
|
data: {'nameCheck':$value, 'id':{{$guide->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
|