Feuerwehr-eppingen/resources/views/inc/admin/detailsModel.blade.php

335 lines
11 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div id="crudModal" class="" data-action="details">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
{{ __("admin.:model details", ['model' => __("models.".$modeltype)]) }}
</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#general-details" aria-controls="general-details" aria-selected="true">
{{ __("admin.general") }}
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#files-details" aria-controls="files-details" aria-selected="false">
{{ __("admin.files") }} (@if(isset($model->dcuments)) {{ count($model->documents) }} @else 0 @endif )
</a>
</li>
@if(isset($model->audits))
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#versions-details" aria-controls="versions-details" aria-selected="false">
{{ __("admin.versions") }} ({{ count($model->audits) }})
</a>
</li>
@endif
@if($model->isPost == Post::class)
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#publish-details" aria-controls="publish-details" aria-selected="false">
{{ __("admin.publications") }}
</a>
</li>
@endif
</ul>
<div class="tab-content">
<div id="general-details" class="tab-pane fade show active">
<table class="table">
<tbody>
@foreach($data as $key => $options)
@if($options['type'] != 'inputPassword')
<tr>
<td class="model-key">
@if(key_exists('label', $options))
{!! $options['label'] !!}
@elseif($options['type'] == 'inputDateTimePicker')
{!! $options['datepicker']['label'] !!}/{!! $options['time']['label'] !!}
@else
{!! $key !!}
@endif
</td>
<td>
@if(key_exists('foreign', $options))
@php
$foreignModel = $options['foreign']['model'];
if(key_exists('label', $options['foreign']))
{
$foreignKey = 'label';
}
else
{
$foreignKey = $options['foreign']['column'];
}
if(key_exists('conditions', $options['foreign']))
{
$foreignWhereColumn = $options['foreign']['conditions'][0]['column'];
$foreignWhereValue = $options['foreign']['conditions'][0]['value'];
}
@endphp
@if(isset($model->$foreignModel->$foreignKey))
{{ $model->$foreignModel->$foreignKey }}
@elseif(isset($model->$foreignModel))
@php
$count = 0;
if(isset($foreignWhereColumn))
{
foreach($model->$foreignModel as $foreign)
{
if($foreign->$foreignWhereColumn == $foreignWhereValue)
{
$count++;
}
}
}
else
{
$count = count($model->$foreignModel);
}
@endphp
@if($count > 1)
<ul>
@foreach($model->$foreignModel as $foreign)
@if(isset($type))
@if($foreign->$foreignWhereColumn == $foreignWhereValue)
<li>
{!! $foreign->$foreignKey !!}
</li>
@endif
@else
<li>
@foreach($options['foreign']['models'] as $fm)
@if($fm->id == $foreign->id)
{{ $fm->label }}
@endif
@endforeach
</li>
@endif
@endforeach
</ul>
@else
@foreach($model->$foreignModel as $foreign)
@if(isset($foreignWhereColumn))
@if($foreign->$foreignWhereColumn == $foreignWhereValue)
{!! $foreign->$foreignKey !!}
@endif
@else
{!! $foreign->$foreignKey !!}
@endif
@endforeach
@endif
@endif
@else
@php
$keys = explode(".", $key);
$keyname = $keys[count($keys) - 1];
if($options['type'] == 'inputDateTimePicker')
{
if(key_exists('format', $options['datepicker']) && key_exists('format', $options['time']))
{
$value = \Carbon\Carbon::parse($model->$keyname)->format($options['datepicker']['format'].' '.$options['time']['format']);
}
else
{
$value = $model->$keyname;
}
}
else
{
$value = $model->$keyname;
}
@endphp
{!! $value !!}
@endif
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
<div id="files-details" class="tab-pane fade">
@include('inc.layout.fileView', [
'documents' => $model->documents
])
</div>
@if(isset($model->audits))
<div id="versions-details" class="tab-pane fade">
<div class="panel-group" id="accordion">
@foreach($model->audits->reverse() as $audit)
<div class="card">
<div class="card-header">
<h5 class="panel-title">
<a
data-toggle="collapse"
href="#collapse{{ $loop->index }}"
data-target="#collapse{{ $loop->index }}"
aria-expanded="@if($loop->first)true @else false @endif"
aria-controls="collapse{{ $loop->index }}">
<div class="row">
<div class="col-sm-1">
{{ $loop->count - $loop->index }}
</div>
<div class="col-sm-3">
@if($audit->event == 'updated')
{{ __("admin.edited") }}
@elseif($audit->event == 'deleted')
{{ __("admin.deleted") }}
@elseif($audit->event == 'restored')
{{ __("admin.restored") }}
@elseif($audit->event == 'created')
{{ __("admin.created") }}
@else
{{ $audit->event }}
@endif
</div>
<div class="col-sm-3">
@if(isset($audit->user->name))
{{ $audit->user->name }}
@endif
</div>
<div class="col-sm-5">
@include('inc.datetime.datetime', ['timestamp' => $audit->created_at])
</div>
</div>
</a>
</h5>
</div>
<div id="collapse{{ $loop->index }}" class="collapse @if($loop->first) show @endif" data-parent="#accordion">
<div class="card-body">
@if(count($audit->old_values) == count($audit->new_values))
@foreach($audit->old_values as $key => $value)
@if($key != 'user_id')
<table class="table">
<thead>
<tr>
<th>
@if(key_exists($key, $data))
@if(key_exists('label', $data[$key]))
{{ $data[$key]['label'] }}
@else
{{ $key }}
@endif
@else
{{ $key }}
@endif
({{ __("general.new") }})
</th>
<th>
@if(key_exists($key, $data))
@if(key_exists('label', $data[$key]))
{{ $data[$key]['label'] }}
@else
{{ $key }}
@endif
@else
{{ $key }}
@endif
({{ __("general.old") }})
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@if(is_array($audit->new_values[$key]))
{!! $audit->new_values[$key]['date'] !!}
@else
{!! $audit->new_values[$key] !!}
@endif
</td>
<td>
{!! $value !!}
</td>
</tr>
</tbody>
</table>
@endif
@endforeach
@endif
</div>
</div>
</div>
@endforeach
</div>
</div>
@endif
@if($model->isPost)
<div id="publish-details" class="tab-pane fade">
<table class="table">
<tbody>
<tr>
<td>
{{ __("admin.website") }}
</td>
<td>
@if($model->published == true)
<a href="{{ URL::Post($model) }}" target="_blank">{{ ucfirst(__("general.yes")) }}</a>
@else
{{ ucfirst(__("general.no")) }}
@endif
</td>
</tr>
<tr>
<td>
Facebook
</td>
<td>
@if($model->publication('facebook')->isPublished())
<a href="{{ URL::Facebook($model) }}" target="_blank">{{ Date::daysSincePublicationString($model->publication('facebook')->published_at) }}</a>
@elseif($model->publication('facebook')->isPending())
{{ Date::daysToPublicationString($model->publication('facebook')->date_to_publish) }}
@else
{{ ucfirst(__("general.no")) }}
@endif
</td>
</tr>
<tr>
<td>
Twitter
</td>
<td>
@if($model->publication('twitter')->isPublished())
<a href="{{ URL::Twitter($model) }}" target="_blank">{{ Date::daysSincePublicationString($model->publication('twitter')->published_at) }}</a>
@elseif($model->publication('twitter')->isPending())
{{ Date::daysToPublicationString($model->publication('twitter')->date_to_publish) }}
@else
{{ ucfirst(__("general.no")) }}
@endif
</td>
</tr>
<tr>
<td>
Stadtanzeiger
</td>
<td>
@if($model->publication('stadtanzeiger')->isPublished())
{{ Date::daysSincePublicationString($model->publication('stadtanzeiger')->published_at) }}
@elseif($model->publication('stadtanzeiger')->isPending())
{{ Date::daysToPublicationString($model->publication('stadtanzeiger')->date_to_publish) }}
@else
{{ ucfirst(__("general.no")) }}
@endif
</td>
</tr>
</tbody>
</table>
</div>
@endif
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" data-dismiss="modal">
<span class='fa fa-times'></span>{{ __("admin.close") }}
</button>
</div>
</div>
</div>
</div>