144 lines
5.5 KiB
PHP
144 lines
5.5 KiB
PHP
|
@extends("admin.layout.base")
|
||
|
@extends("admin.layout.header")
|
||
|
|
||
|
@section("title")
|
||
|
Aktivitet - Rediger
|
||
|
@endsection
|
||
|
|
||
|
@section("path")
|
||
|
<a href="{{route("events.edit", ["event" => $event])}}" class="text-white">Rediger Aktivitet</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="{{ asset("/css/quill/quill.snow.css") }}" rel="stylesheet">
|
||
|
<h1>Rediger Aktivitet:</h1>
|
||
|
<form method="post" action="{{route("events.update", ["event" => $event])}}" enctype="multipart/form-data">
|
||
|
@csrf
|
||
|
@method("PUT")
|
||
|
<label for="name">Aktivitet Navn:</label>
|
||
|
<label hidden id="error" for="errormesseages">Dette Aktivitet navn findes allerede</label>
|
||
|
<input value="{{$event->name}}" type="text" name="name" id="name" required>
|
||
|
<label for="accountable">Aktivitet Ansvarlig:</label>
|
||
|
<input value="{{$event->accountable}}" type="text" name="accountable" id="accountable" required>
|
||
|
<label for="description">Aktivitet Beskrivelse:</label>
|
||
|
<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>
|
||
|
<div id="editor">{!! $event->description !!}</div>
|
||
|
<textarea name="description" class="d-none" id="hiddenArea"></textarea>
|
||
|
<label for="date">Aktivitet Dato:</label>
|
||
|
<input value="{{$event->date}}" type="datetime-local" name="date" id="date" required>
|
||
|
<label id="fileuploadee"for="fileuploade">Baggrundsbillede (Forbliv tom hvis billede ikke skal ændres):</label>
|
||
|
<input id="fileuploade" type="file" name="resource" accept="image/*" value="{{$event->resource_id}}">
|
||
|
<label class="toggle">
|
||
|
<input class="toggle__input" type="checkbox" name="newsoption">
|
||
|
<span class="toggle__label">
|
||
|
<span class="toggle__text">Opdater / Opret som nyhed?</span>
|
||
|
</span>
|
||
|
</label>
|
||
|
<input id="disable" type="submit" class="btn btn-dark text-white" value="Rediger">
|
||
|
</form>
|
||
|
|
||
|
<script src="{{ asset("/js/quill/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', 'image', 'video' ],
|
||
|
[ '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.'
|
||
|
}
|
||
|
);
|
||
|
});
|
||
|
|
||
|
$(document).ready(function () {
|
||
|
$value = $('#name').val();
|
||
|
$.ajax({
|
||
|
type: 'get',
|
||
|
url: '{{route('events.nameCheckUpdate')}}',
|
||
|
data: {'nameCheck':$value, 'id':{{$event->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);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#name').on('keyup', function () {
|
||
|
$value = $(this).val();
|
||
|
console.log($value);
|
||
|
$.ajax({
|
||
|
type: 'get',
|
||
|
url: '{{route('events.nameCheckUpdate')}}',
|
||
|
data: {'nameCheck':$value, 'id':{{$event->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);
|
||
|
}
|
||
|
});
|
||
|
})
|
||
|
</script>
|
||
|
@endsection
|