This commit is contained in:
Ludovic CANDELLIER
2021-08-21 19:48:21 +02:00
parent 7ec40145de
commit 9ca510086b
24 changed files with 423 additions and 65 deletions

View File

@@ -1,11 +1,35 @@
@component('components.layout.box-collapse', ['id' => 'comments', 'title' => __('comments')])
@if (!empty($comments))
@foreach ($comments as $comment)
{!! $comment !!}
<div class="row">
<div class="col-6">
<strong>{{ App\Repositories\Core\Auth\Users::getName($comment->user_id) }}</strong>
</div>
<div class="col-6 text-right"><i>{{ App\Repositories\Core\DateTime::DateToLocale($comment->updated_at) }}</i></div>
<div class="col-12">
{!! $comment->comment !!}
</div>
</div>
@endforeach
@endif
<button type="button" class="btn btn-primary">
Ajout note interne
<button type="button" class="btn btn-xs btn-primary" id="add-comment">
{{ __('comment_add') }}
<i class="fa fa-plus"></i>
</button>
@endcomponent
@endcomponent
@push('js')
<script>
function handleAddComment() {
$('#add-comment').click(function() {
openModal('{{ __('comment_add') }}', '#comment-form', '{{ route('Admin.Core.Comments.create', ['model' => $model, 'model_id' => $model_id]) }}', '{{ route('Admin.Core.Comments.store') }}' );
});
}
$(document).ready(function () {
handleAddComment();
});
</script>
@endpush

View File

@@ -0,0 +1,7 @@
@if ($model['id'] ?? true)
@include('components.datatable', ['route' => route('Admin.Core.Comments.index'), 'model' => 'comments', 'with_filters' => false, 'with_print' => false, 'dataTable' => $datatables['comments'], 'create_callback' => 'CommentCreate();', 'edit_callback' => 'CommentEdit(id);', 'delete_callback' => 'CommentRefresh();'])
@component('components.layout.modal', ['title' => 'Filtres', 'id' => 'modal-comments-filters'])
@include('Admin.Core.Comments.partials.filters')
@endcomponent
@endif

View File

@@ -0,0 +1,2 @@
<form id="comments-filters">
</form>

View File

@@ -0,0 +1,34 @@
{{ Form::open(['route' => 'Admin.Core.Comments.store', 'id' => 'comment-form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $comment['id'] ?? null }}">
<input type="hidden" name="commentable_type" value="{{ $comment['commentable_type'] ?? null }}">
<input type="hidden" name="commentable_id" value="{{ $comment['commentable_id'] ?? null }}">
@if ($comment['id'] ?? null)
<div class="row mb-3">
<div class="col-8">
{{ $comment['user_id'] }}
</div>
<div class="col-4">
{{ $comment['created_at'] }}
</div>
</div>
@endif
<div class="row mb-3">
<div class="col-12">
{{ Form::label('name', __('commentaire')) }}<br/>
@include('components.form.editor', ['name' => 'comment', 'value' => $comment['comment'] ?? null])
</div>
</div>
</form>
@include('load.form.editor')
<script>
$(function() {
initEditor();
});
</script>