@component('components.layout.box-collapse', ['id' => 'comments', 'title' => __('comments')])
	@include('Admin.Core.Comments.partials.list-comments')
@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') }}', 'refreshComments()' );
			});
		}

		function refreshComments() {
			var url = '{{ route('Admin.Core.Comments.index') }}/{{ $model }}/{{ $model_id }}';
			console.log('refresh');
			console.log(url);
			$("#comments").load(url);
		}

		$(document).ready(function () {
			handleAddComment();
		});
			
	</script>
@endpush