From 183680bbc0a21f4462e1c5d2f7179eafd9d779f9 Mon Sep 17 00:00:00 2001 From: Ahmad Syamim Date: Thu, 14 Nov 2019 11:25:41 +0900 Subject: [PATCH] update voyager/users/browse.blade.php from latest --- .../vendor/voyager/users/browse.blade.php | 203 +++++++++++++----- 1 file changed, 147 insertions(+), 56 deletions(-) diff --git a/resources/views/vendor/voyager/users/browse.blade.php b/resources/views/vendor/voyager/users/browse.blade.php index 7db72a4..985778a 100644 --- a/resources/views/vendor/voyager/users/browse.blade.php +++ b/resources/views/vendor/voyager/users/browse.blade.php @@ -1,11 +1,11 @@ @extends('voyager::master') -@section('page_title', __('voyager::generic.viewing').' '.$dataType->display_name_plural) +@section('page_title', __('voyager::generic.viewing').' '.$dataType->getTranslatedAttribute('display_name_plural')) @section('page_header')

- {{ $dataType->display_name_plural }} + {{ $dataType->getTranslatedAttribute('display_name_plural') }}

@can('add', app($dataType->model_name)) @@ -17,11 +17,21 @@ @endcan @can('edit', app($dataType->model_name)) @if(isset($dataType->order_column) && isset($dataType->order_display_column)) - + {{ __('voyager::bread.order') }} @endif @endcan + @can('delete', app($dataType->model_name)) + @if($usesSoftDeletes) + + @endif + @endcan + @foreach($actions as $action) + @if (method_exists($action, 'massAction')) + @include('voyager::bread.partials.actions', ['action' => $action, 'data' => null]) + @endif + @endforeach @include('voyager::multilingual.language-selector')
@stop @@ -36,15 +46,19 @@ @if ($isServerSide) @endif
- @can('delete',app($dataType->model_name)) + @if($showCheckboxColumn) - @endcan + @endif @foreach($dataType->browseRows as $row) @foreach($dataTypeContent as $data) - @can('delete',app($dataType->model_name)) + @if($showCheckboxColumn) - @endcan + @endif @foreach($dataType->browseRows as $row) - + @php + if ($data->{$row->field.'_browse'}) { + $data->{$row->field} = $data->{$row->field.'_browse'}; + } + @endphp @endforeach @endforeach @@ -219,7 +277,8 @@ 'filter' => $search->filter, 'key' => $search->key, 'order_by' => $orderBy, - 'sort_order' => $sortOrder + 'sort_order' => $sortOrder, + 'showSoftDeleted' => $showSoftDeleted, ])->links() }} @endif @@ -235,7 +294,7 @@
@if ($isServerSide) - + @endif - {{ $row->display_name }} + {{ $row->getTranslatedAttribute('display_name') }} @if ($isServerSide) - @if ($row->isCurrentSortField()) - @if (!isset($_GET['sort_order']) || $_GET['sort_order'] == 'asc') + @if ($row->isCurrentSortField($orderBy)) + @if ($sortOrder == 'asc') @else @@ -89,31 +107,33 @@
- @if($row->type == 'image') + @if (isset($row->details->view)) + @include($row->details->view, ['row' => $row, 'dataType' => $dataType, 'dataTypeContent' => $dataTypeContent, 'content' => $data->{$row->field}, 'action' => 'browse']) + @elseif($row->type == 'image') @elseif($row->type == 'relationship') - @include('voyager::formfields.relationship', ['view' => 'browse', 'options' => $row->details]) + @include('voyager::formfields.relationship', ['view' => 'browse','options' => $row->details]) @elseif($row->type == 'select_multiple') @if(property_exists($row->details, 'relationship')) @foreach($data->{$row->field} as $item) - @if($item->{$row->field . '_page_slug'}) - {{ $item->{$row->field} }}@if(!$loop->last), @endif - @else - {{ $item->{$row->field} }} - @endif + {{ $item->{$row->field} }} @endforeach @elseif(property_exists($row->details, 'options')) - @if (count(json_decode($data->{$row->field})) > 0) + @if (!empty(json_decode($data->{$row->field}))) @foreach(json_decode($data->{$row->field}) as $item) @if (@$row->details->options->{$item}) {{ $row->details->options->{$item} . (!$loop->last ? ', ' : '') }} @@ -124,18 +144,27 @@ @endif @endif - @elseif($row->type == 'select_dropdown' && property_exists($row->details, 'options')) + @elseif($row->type == 'multiple_checkbox' && property_exists($row->details, 'options')) + @if (@count(json_decode($data->{$row->field})) > 0) + @foreach(json_decode($data->{$row->field}) as $item) + @if (@$row->details->options->{$item}) + {{ $row->details->options->{$item} . (!$loop->last ? ', ' : '') }} + @endif + @endforeach + @else + {{ __('voyager::generic.none') }} + @endif - @if($data->{$row->field . '_page_slug'}) - {!! $row->details->options->{$data->{$row->field}} !!} - @else - {!! isset($row->details->options->{$data->{$row->field}}) ? $row->details->options->{$data->{$row->field}} : '' !!} - @endif + @elseif(($row->type == 'select_dropdown' || $row->type == 'radio_btn') && property_exists($row->details, 'options')) + + {!! $row->details->options->{$data->{$row->field}} ?? '' !!} - @elseif($row->type == 'select_dropdown' && $data->{$row->field . '_page_slug'}) - {{ $data->{$row->field} }} @elseif($row->type == 'date' || $row->type == 'timestamp') - {{ property_exists($row->details, 'format') ? \Carbon\Carbon::parse($data->{$row->field})->formatLocalized($row->details->format) : $data->{$row->field} }} + @if ( property_exists($row->details, 'format') && !is_null($data->{$row->field}) ) + {{ \Carbon\Carbon::parse($data->{$row->field})->formatLocalized($row->details->format) }} + @else + {{ $data->{$row->field} }} + @endif @elseif($row->type == 'checkbox') @if(property_exists($row->details, 'on') && property_exists($row->details, 'off')) @if($data->{$row->field}) @@ -150,13 +179,13 @@ {{ $data->{$row->field} }} @elseif($row->type == 'text') @include('voyager::multilingual.input-hidden-bread-browse') -
{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}
+
{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}
@elseif($row->type == 'text_area') @include('voyager::multilingual.input-hidden-bread-browse') -
{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}
+
{{ mb_strlen( $data->{$row->field} ) > 200 ? mb_substr($data->{$row->field}, 0, 200) . ' ...' : $data->{$row->field} }}
@elseif($row->type == 'file' && !empty($data->{$row->field}) ) @include('voyager::multilingual.input-hidden-bread-browse') - @if(json_decode($data->{$row->field})) + @if(json_decode($data->{$row->field}) !== null) @foreach(json_decode($data->{$row->field}) as $file) {{ $file->original_name ?: '' }} @@ -170,7 +199,7 @@ @endif @elseif($row->type == 'rich_text_box') @include('voyager::multilingual.input-hidden-bread-browse') -
{{ mb_strlen( strip_tags($data->{$row->field}, '') ) > 200 ? mb_substr(strip_tags($data->{$row->field}, ''), 0, 200) . ' ...' : strip_tags($data->{$row->field}, '') }}
+
{{ mb_strlen( strip_tags($data->{$row->field}, '') ) > 200 ? mb_substr(strip_tags($data->{$row->field}, ''), 0, 200) . ' ...' : strip_tags($data->{$row->field}, '') }}
@elseif($row->type == 'coordinates') @include('voyager::partials.coordinates-static-image') @elseif($row->type == 'multiple_images') @@ -181,6 +210,40 @@ @endforeach @endif + @elseif($row->type == 'media_picker') + @php + if (is_array($data->{$row->field})) { + $files = $data->{$row->field}; + } else { + $files = json_decode($data->{$row->field}); + } + @endphp + @if ($files) + @if (property_exists($row->details, 'show_as_images') && $row->details->show_as_images) + @foreach (array_slice($files, 0, 3) as $file) + + @endforeach + @else +
    + @foreach (array_slice($files, 0, 3) as $file) +
  • {{ $file }}
  • + @endforeach +
+ @endif + @if (count($files) > 3) + {{ __('voyager::media.files_more', ['count' => (count($files) - 3)]) }} + @endif + @elseif (is_array($files) && count($files) == 0) + {{ trans_choice('voyager::media.files', 0) }} + @elseif ($data->{$row->field} != '') + @if (property_exists($row->details, 'show_as_images') && $row->details->show_as_images) + + @else + {{ $data->{$row->field} }} + @endif + @else + {{ trans_choice('voyager::media.files', 0) }} + @endif @else @include('voyager::multilingual.input-hidden-bread-browse') {{ $data->{$row->field} }} @@ -188,16 +251,11 @@
- @foreach(Voyager::actions() as $action) - @include('voyager::bread.partials.actions', ['action' => $action]) + @foreach($actions as $action) + @if (!method_exists($action, 'massAction')) + @include('voyager::bread.partials.actions', ['action' => $action]) + @endif @endforeach - @if ($data->role_id !== 1) - @can('read', $data) - - - - @endcan - @endif