- Fehler beim Erstellen von Tags behoben - Deaktivierte Fahrzeuge werden im Formular für Einsätze nicht mehr angezeigt
214 lines
4.7 KiB
PHP
Executable File
214 lines
4.7 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\Post;
|
|
use App\Models\Tag;
|
|
use App\Helpers\StringHelper;
|
|
|
|
class OperationController extends PostController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware(['auth' => 'operationPermissions'])->except('index', 'show');
|
|
|
|
// Model
|
|
$this->modelType = StringHelper::toURL(__('models.operation'));
|
|
$this->modelData = [
|
|
'departments' => [
|
|
'type' => 'inputSelect',
|
|
'name' => 'tags',
|
|
'label' => __('models.department'),
|
|
'foreign' => [
|
|
'class' => Tag::class,
|
|
'model' => 'tags',
|
|
'column' => 'name',
|
|
'order' => [
|
|
'column' => 'order',
|
|
'direction' => 'ASC'
|
|
],
|
|
'conditions' => [
|
|
[
|
|
'column' => 'type',
|
|
'value' => 'abteilung',
|
|
],
|
|
],
|
|
]
|
|
],
|
|
'opertationtypes' => [
|
|
'type' => 'inputSelect',
|
|
'name' => 'tags',
|
|
'label' => __('models.operationtype'),
|
|
'foreign' => [
|
|
'class' => Tag::class,
|
|
'model' => 'tags',
|
|
'column' => 'name',
|
|
'order' => [
|
|
'column' => 'name',
|
|
'direction' => 'ASC'
|
|
],
|
|
'conditions' => [
|
|
[
|
|
'column' => 'type',
|
|
'value' => 'einsatzart',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'vehicles' => [
|
|
'type' => 'checkboxSelection',
|
|
'name' => 'posts',
|
|
'label' => __('models.vehicles in use'),
|
|
'foreign' => [
|
|
'class' => Post::class,
|
|
'model' => 'posts',
|
|
'column' => 'name',
|
|
'label' => 'funkrufname - kurzbezeichnung',
|
|
'order' => [
|
|
'column' => 'label',
|
|
'direction' => 'ASC'
|
|
],
|
|
'conditions' => [
|
|
[
|
|
'column' => 'type',
|
|
'value' => 'fahrzeug',
|
|
],
|
|
[
|
|
'column' => 'published',
|
|
'value' => '1,'
|
|
]
|
|
],
|
|
]
|
|
],
|
|
'datetime' => [
|
|
'type' => 'inputDateTimePicker',
|
|
'datepicker' => [
|
|
'label' => __('general.date'),
|
|
'placeholder' => __('general.date_format'),
|
|
'format' => __('general.date_format_short'),
|
|
'format_picker' => __('general.date_format'),
|
|
'multidate' => false,
|
|
'language' => config('app.locale'),
|
|
'weekStart' => 1,
|
|
'validation' => [
|
|
'rules' => 'required',
|
|
]
|
|
],
|
|
'time' => [
|
|
'label' => __('general.time'),
|
|
'placeholder' => __('general.time_format'),
|
|
'format' => __('general.time_format_short'),
|
|
'validation' => [
|
|
'rules' => 'required',
|
|
]
|
|
],
|
|
],
|
|
'title' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.title'),
|
|
'placeholder' => __('models.title'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content' => [
|
|
'type' => 'inputTextarea',
|
|
'label' => __('models.text'),
|
|
'placeholder' => __('models.text'),
|
|
'toolbar' => [
|
|
[
|
|
'insertfile',
|
|
'undo',
|
|
'redo',
|
|
],
|
|
[
|
|
'bold',
|
|
'italic',
|
|
'strikethrough'
|
|
]
|
|
],
|
|
'plugins' =>
|
|
[
|
|
'paste',
|
|
],
|
|
'validation' => [
|
|
'rules' => 'required',
|
|
]
|
|
],
|
|
];
|
|
|
|
// URL options
|
|
$this->url = 'operation';
|
|
$this->route = StringHelper::toURL(__('models.operation'));
|
|
$this->adminIndexOptions = [
|
|
'orderBy' => 'datetime',
|
|
'orderDirection' => 'DESC',
|
|
'paginate' => 10,
|
|
'listdata' => [
|
|
'title' => [],
|
|
'departments' => [],
|
|
'user' => [
|
|
'label' => __('general.author'),
|
|
'foreign' => [
|
|
'model' => 'audits',
|
|
'column' => 'name',
|
|
'index' => 'last'
|
|
],
|
|
],
|
|
'datetime' => [],
|
|
'published' => [
|
|
'label' => __('admin.published'),
|
|
]
|
|
]
|
|
];
|
|
|
|
$this->indexOptions = [
|
|
'orderBy' => 'datetime',
|
|
'orderDirection' => 'DESC',
|
|
'paginate' => 9,
|
|
'view' => 'inc.views.cardPreviewContainer2',
|
|
'filter' => [
|
|
'departments'=> [
|
|
'type' => 'select',
|
|
],
|
|
'year' => [
|
|
'type' => 'select',
|
|
'label' => __('general.year'),
|
|
'name' => strtolower(__('general.year'))
|
|
],
|
|
'month' => [
|
|
'type' => 'select',
|
|
'label' => __('general.month'),
|
|
'name' => strtolower(__('general.month'))
|
|
],
|
|
]
|
|
];
|
|
|
|
$this->detailsOptions = [
|
|
'view' => 'inc.views.details',
|
|
'newest' => [
|
|
'limit' => 3,
|
|
'label' => __('models.current operations')
|
|
],
|
|
'similar' => [
|
|
'tag' =>'opertationtypes',
|
|
'limit' => 3,
|
|
'label' => __('models.similar operations')
|
|
],
|
|
'further' => [
|
|
'limit' => 3,
|
|
'label' => __('models.older operations')
|
|
],
|
|
];
|
|
|
|
// Publishing
|
|
$this->publishOptions = [
|
|
'date' => 'now'
|
|
];
|
|
|
|
parent::__construct();
|
|
}
|
|
}
|