backend: add colors to event_type index.php; fix timetable dates

This commit is contained in:
Roland Schneider 2021-10-07 07:59:05 +02:00
parent d26581e338
commit 89b3ab4ce5
5 changed files with 28 additions and 15 deletions

View File

@ -30,8 +30,15 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'theme',
'label' => 'Színtéma',
'value' => function ($model, $key, $index, $column){
return isset($model['theme']) ? "Színtéma " . ($model['theme']+1) : "";
$result = "";
if ( isset( $model['theme'] )){
$box = "<span style='margin-right: 0.3rem; height: 1rem; width: 1rem; display: inline-block;' class='event-theme-active-".$model['theme']."'></span>";
$name = "Színtéma " . ($model['theme']+1);
$result = $box . $name;
}
return $result;
},
'format' => 'raw'
],
['class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}'

View File

@ -13,4 +13,11 @@ class AppDateTimeHelper
return $unixTime;
}
public static function convertUnixTimeToDateTime($unixTime){
$result = new \DateTime();
$result->setTimestamp($unixTime);
$result->setTimeZone(new \DateTimeZone("UTC"));
return $result;
}
}

View File

@ -73,7 +73,7 @@ class EventSearch extends Event
$query->innerJoin('trainer', 'event.id_trainer = trainer.id');
$query->innerJoin('room', 'event.id_room = room.id');
$query->innerJoin('event_type', 'event_type.id = event.id_event_type');
$query->leftJoin('event_registration', 'event_registration.id_event = event.id');
$query->leftJoin('event_registration', 'event_registration.id_event = event.id and event_registration.canceled_at is null and event_registration.deleted_at is null ');
$query->groupBy(
[
'event_id',

View File

@ -16,7 +16,7 @@ if ( $permissions->allowCreate ){
$indexTableTemplateButtons[] = '{update}';
}
$indexTableTemplateButtons[] = '{reserve-card}';
$indexTableTemplateButtons[] = '{equipment-types-assignment}';
//$indexTableTemplateButtons[] = '{equipment-types-assignment}';
?>
@ -155,14 +155,14 @@ $indexTableTemplateButtons[] = '{equipment-types-assignment}';
];
return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
},
'equipment-types-assignment' => function ($url, $model, $key) {
$options = [
'title' => Yii::t('yii', 'Equipment Types'),
'aria-label' => Yii::t('yii', 'Equipment Types'),
'data-pjax' => '0',
];
return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, $options);
}
// 'equipment-types-assignment' => function ($url, $model, $key) {
// $options = [
// 'title' => Yii::t('yii', 'Equipment Types'),
// 'aria-label' => Yii::t('yii', 'Equipment Types'),
// 'data-pjax' => '0',
// ];
// return Html::a('<span class="glyphicon glyphicon-wrench"></span>', $url, $options);
// }
]
],

View File

@ -1,5 +1,6 @@
<?php
namespace common\modules\event\widgets\event;
use common\helpers\AppDateTimeHelper;
use common\models\Event;
use DateTime;
use yii\bootstrap\Widget;
@ -20,10 +21,8 @@ class EventView extends Widget
public function init(){
parent::init();
if ( isset($this->event )){
$this->start = new DateTime();
$this->start->setTimestamp($this->event->start);
$this->end = new DateTime();
$this->end->setTimestamp($this->event->end);
$this->start = AppDateTimeHelper::convertUnixTimeToDateTime($this->event->start);
$this->end = AppDateTimeHelper::convertUnixTimeToDateTime($this->event->end);
}
}