Skip to content

Commit

Permalink
new list design
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Oct 7, 2017
1 parent bcc0606 commit e2744b4
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 20 deletions.
4 changes: 4 additions & 0 deletions app/Providers/FormServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public function boot()
'item', 'url', 'text' => '', 'value' => 'name', 'id' => 'id',
]);

Form::component('deleteLink', 'partials.form.delete_link', [
'item', 'url', 'text' => '', 'value' => 'name', 'id' => 'id',
]);

Form::component('saveButtons', 'partials.form.save_buttons', [
'cancel', 'col' => 'col-md-12',
]);
Expand Down
31 changes: 27 additions & 4 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
border-radius: 15px;
}

.table-responsive {
overflow-x: hidden;
}

div.required .control-label:not(span):after, td.required:after {
content: ' *';
color: #F00;
Expand Down Expand Up @@ -423,6 +419,33 @@ ul.add-new.nav.navbar-nav.pull-left {
color: #d8d8d8;
}

.delete-link:hover, .delete-link:focus {
background-color: #e1e3e9 !important;
color: #333 !important;
text-decoration: none !important;
outline: none !important;
}

.delete-link {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #777;
white-space: nowrap;
width: 100%;
text-align: left;
/* button to link */
background-color: transparent !important;
border: none;
cursor: pointer;
}

.table-responsive {
overflow-x: visible;
}

@media only screen and (max-width : 768px) {
.main-header .add-new.nav.navbar-nav i {
margin-top: 3px;
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en-GB/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
'all_type' => 'All :type',
'upcoming' => 'Upcoming',
'created' => 'Created',
'id' => 'ID',

'title' => [
'new' => 'New :type',
Expand Down
40 changes: 24 additions & 16 deletions resources/views/companies/companies/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<!-- Default box -->

<div class="box box-success">
<div class="box-header">
<div class="box-header with-border">
{!! Form::open(['url' => 'companies/companies', 'role' => 'form', 'method' => 'GET']) !!}
<div class="pull-left">
<span class="title-filter">{{ trans('general.search') }}:</span>
<span class="title-filter hidden-xs">{{ trans('general.search') }}:</span>
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
{!! Form::button('<span class="fa fa-filter"></span> &nbsp;' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
</div>
<div class="pull-right">
<span class="title-filter">{{ trans('general.show') }}:</span>
<span class="title-filter hidden-xs">{{ trans('general.show') }}:</span>
{!! Form::select('limit', $limits, request('limit', setting('general.list_limit', '25')), ['class' => 'form-control input-filter input-sm', 'onchange' => 'this.form.submit()']) !!}
</div>
{!! Form::close() !!}
Expand All @@ -29,29 +29,37 @@

<div class="box-body">
<div class="table table-responsive">
<table class="table table-bordered table-striped table-hover" id="tbl-companies">
<table class="table table-striped table-hover" id="tbl-companies">
<thead>
<tr>
<th class="col-md-1 hidden-xs">@sortablelink('id', trans('general.id'))</th>
<th class="col-md-4">@sortablelink('name', trans('general.name'))</th>
<th class="col-md-2">@sortablelink('domain', trans('companies.domain'))</th>
<th class="col-md-2">@sortablelink('email', trans('general.email'))</th>
<th class="col-md-1">@sortablelink('created_at', trans('general.created'))</th>
<th class="col-md-3">{{ trans('general.actions') }}</th>
<th class="col-md-2 hidden-xs">@sortablelink('domain', trans('companies.domain'))</th>
<th class="col-md-2 hidden-xs">@sortablelink('email', trans('general.email'))</th>
<th class="col-md-2 hidden-xs">@sortablelink('created_at', trans('general.created'))</th>
<th class="col-md-1">{{ trans('general.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($companies as $item)
<tr>
<td class="hidden-xs">{{ $item->id }}</td>
<td><a href="{{ url('companies/companies/' . $item->id . '/edit') }}">{{ $item->company_name }}</a></td>
<td>{{ $item->domain }}</td>
<td>{{ $item->company_email }}</td>
<td>{{ Date::parse($item->created_at)->format($date_format) }}</td>
<td class="hidden-xs">{{ $item->domain }}</td>
<td class="hidden-xs">{{ $item->company_email }}</td>
<td class="hidden-xs">{{ Date::parse($item->created_at)->format($date_format) }}</td>
<td>
<a href="{{ url('companies/companies/' . $item->id . '/set') }}" class="btn btn-info btn-xs"><i class="fa fa-arrow-right" aria-hidden="true"></i> {{ trans('general.change') }}</a>
<a href="{{ url('companies/companies/' . $item->id . '/edit') }}" class="btn btn-primary btn-xs"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {{ trans('general.edit') }}</a>
@permission('delete-companies-companies')
{!! Form::deleteButton($item, 'companies/companies', '', 'company_name') !!}
@endpermission
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-toggle-position="left" aria-expanded="false">
<i class="fa fa-ellipsis-h"></i>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="{{ url('companies/companies/' . $item->id . '/edit') }}">{{ trans('general.edit') }}</a></li>
@permission('delete-companies-companies')
<li>{!! Form::deleteLink($item, 'companies/companies', '', 'company_name') !!}</li>
@endpermission
</ul>
</div>
</td>
</tr>
@endforeach
Expand Down
18 changes: 18 additions & 0 deletions resources/views/partials/form/delete_link.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@php
$page = explode('/', $url)[1];
$text = $text ? $text : $page;
@endphp

{!! Form::open([
'id' => str_singular($page) . '-' . $item->$id,
'method' => 'DELETE',
'url' => [$url, $item->$id],
'style' => 'display:inline'
]) !!}
{!! Form::button(trans('general.delete'), array(
'type' => 'button',
'class' => 'delete-link',
'title' => trans('general.delete'),
'onclick' => 'confirmDelete("' . '#' . str_singular($page) . '-' . $item->$id . '", "' . trans_choice('general.' . $text, 2) . '", "' . trans('general.delete_confirm', ['name' => '<strong>' . $item->$value . '</strong>', 'type' => strtolower(trans_choice('general.' . $text, 1))]) . '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
)) !!}
{!! Form::close() !!}

0 comments on commit e2744b4

Please sign in to comment.