Skip to content

Commit

Permalink
Admin Dashboard Layout Change (#1760)
Browse files Browse the repository at this point in the history
* Dashboard layout changes

* Update news.blade.php

* Failsafe for deleted staff/admin

---------

Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
  • Loading branch information
FatihKoz and nabeelio authored Feb 21, 2024
1 parent d3b0b9b commit 548d7b1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 49 deletions.
4 changes: 2 additions & 2 deletions resources/views/admin/dashboard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
@endif

<div class="row">
<div class="col-md-7">
<div class="col-md-9">
@include('admin.dashboard.news')
</div>
<div class="col-md-5">
<div class="col-md-3">
@component('admin.components.infobox')
@slot('icon', 'pe-7s-users')
@slot('type', 'Pilots')
Expand Down
95 changes: 48 additions & 47 deletions resources/views/admin/dashboard/news.blade.php
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
<div id="pjax_news_wrapper">
<div class="card border-blue-bottom">
@if($news->count() === 0)
<div class="text-center text-muted" style="padding: 30px;">
No news items
</div>
@endif
@foreach($news as $item)
<div class="content">
<div class="header">
<h5 class="title">
<b>{{ $item->subject }}</b>
</h5>
<div class="text-right">
{{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'delete', 'class' => 'pjax_news_form']) }}
{{ Form::hidden('news_id', $item->id) }}
{{
Form::button('<i class="far fa-trash-alt"></i>&nbsp;delete', [
'type' => 'submit',
'class' => ' btn btn-danger btn-xs text-small',
'onclick' => "return confirm('Are you sure?')"
])
}}
{{ Form::close() }}
</div>
</div>
<div class="body">
{!! $item->body !!}
</div>
<div class="footer text-right">
{{ $item->user->name }} - {{ show_datetime($item->created_at) }}
</div>
</div>
<hr/>
@endforeach
<div class="content">
<div class="header">
<h4 class="title">Add News</h4>
</div>
{{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'post', 'class' => 'pjax_news_form']) }}
<table class="table">
<tr>
<td>{{ Form::label('subject', 'Subject:') }}</td>
<td>{{ Form::text('subject', '', ['class' => 'form-control']) }}</td>
</tr>
<tr>
<td>{{ Form::label('body', 'Body:') }}</td>
<td>{!! Form::textarea('body', '', ['id' => 'news_editor', 'class' => 'editor']) !!}</td>
</tr>
</table>
<div class="text-right">
{{ Form::button('<i class="fas fa-plus-circle"></i>&nbsp;add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }}
{{ Form::close() }}
</div>
<table class="table">
<tr>
<td>{{ Form::label('subject', 'Subject:') }}</td>
<td>{{ Form::text('subject', '', ['class' => 'form-control']) }}</td>
</tr>
<tr>
<td>{{ Form::label('body', 'Body:') }}</td>
<td>{!! Form::textarea('body', '', ['id' => 'news_editor', 'class' => 'editor']) !!}</td>
</tr>
<tr>
<td colspan="2" class="text-right">
{{ Form::button('<i class="fas fa-plus-circle"></i>&nbsp;add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }}
</td>
</table>
{{ Form::close() }}
</div>
</div>
<div class="card border-blue-bottom">
<div class="content">
@if($news->count() === 0)
<div class="text-center text-muted" style="padding: 30px;">
No news items
</div>
@else
<table class="table">
<tr>
<th>Subject</th>
<th>Body</th>
<th>Poster</th>
<th>Date</th>
<th>Actions</th>
</tr>
@foreach($news as $item)
<tr>
<th>{{ $item->subject }}</th>
<td>{!! $item->body!!}</td>
<td>{{ optional($item->user)->name_private }}</td>
<td>{{ $item->created_at->format('d.M.y') }}</td>
<td>
{{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'delete', 'class' => 'pjax_news_form']) }}
{{ Form::hidden('news_id', $item->id) }}
{{ Form::button('Delete', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs text-small', 'onclick' => "return confirm('Are you sure?')"]) }}
{{ Form::close() }}
</td>
</tr>
@endforeach
</table>
@endif
</div>
</div>
</div>
Expand Down

0 comments on commit 548d7b1

Please sign in to comment.