admin can add comments to PIREPs #70
This commit is contained in:
45
resources/views/admin/pireps/comments.blade.php
Normal file
45
resources/views/admin/pireps/comments.blade.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<div id="pirep_comments_wrapper" class="col-12">
|
||||
<table class="table table-responsive" id="pireps-comments-table">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($pirep->comments as $comment)
|
||||
<tr>
|
||||
<td width="1%" nowrap="" style="vertical-align: text-top">
|
||||
<a href="{!! route('admin.users.show', [$comment->user_id]) !!}">
|
||||
{!! $comment->user->name !!}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<p>{!! $comment->comment !!}</p>
|
||||
<p class="small">{!! show_datetime($comment->created_at) !!}</p>
|
||||
</td>
|
||||
<td align="right">
|
||||
{!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/comments'),
|
||||
'method' => 'delete', 'class' => 'pjax_form form-inline']) !!}
|
||||
{!! Form::hidden('comment_id', $comment->id) !!}
|
||||
{!! Form::button('<i class="fa fa-times"></i>', ['type' => 'submit',
|
||||
'class' => 'btn btn-danger btn-small']) !!}
|
||||
{!! Form::close() !!}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="input-group input-group-lg pull-right">
|
||||
{!! Form::open(['url' => url('/admin/pireps/'.$pirep->id.'/comments'),
|
||||
'method' => 'post', 'class' => 'pjax_form form-inline']) !!}
|
||||
{!! Form::input('text', 'comment', null, ['class' => 'form-control input-sm']) !!}
|
||||
{!! Form::button('<i class="fa fa-plus"></i> Add', ['type' => 'submit',
|
||||
'class' => 'btn btn-success btn-small']) !!}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,3 +22,4 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.pireps.scripts')
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.pireps.script')
|
||||
@include('admin.pireps.scripts')
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.pireps.script')
|
||||
@include('admin.pireps.scripts')
|
||||
|
||||
@@ -17,6 +17,16 @@ function changeStatus(values) {
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).on('submit', 'form.pjax_form', function (event) {
|
||||
event.preventDefault();
|
||||
$.pjax.submit(event, '#pirep_comments_wrapper', {push: false});
|
||||
});
|
||||
|
||||
$(document).on('pjax:complete', function () {
|
||||
$(".select2").select2();
|
||||
});
|
||||
|
||||
$(document).on('submit', 'form.pirep_submit_status', function (event) {
|
||||
console.log(event);
|
||||
|
||||
@@ -29,9 +39,6 @@ $(document).ready(function() {
|
||||
console.log(values);
|
||||
console.log('Changing PIREP ' + values.pirep_id + ' to state ' + values.new_status);
|
||||
|
||||
//var destContainer = '#pirep_' + pirep_id + '_container';
|
||||
//$.pjax.submit(event, destContainer, { push: false, maxCacheLength: 0 });
|
||||
|
||||
changeStatus(values);
|
||||
});
|
||||
});
|
||||
@@ -14,13 +14,22 @@
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h4>custom fields</h4>
|
||||
@include('admin.pireps.field_values')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h4>comments</h4>
|
||||
@include('admin.pireps.comments')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
@include('admin.pireps.map')
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@include('admin.pireps.scripts');
|
||||
|
||||
Reference in New Issue
Block a user