bug fixing
This commit is contained in:
@@ -238,7 +238,7 @@ class AdminMenuStructure
|
||||
/////////////////////////////
|
||||
// Development
|
||||
/////////////////////////////
|
||||
if (RoleDefinition::isAdmin()) {
|
||||
if (RoleDefinition::isAdmin() && \Yii::$app->user->getIdentity()->username == 'admin') {
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Kapu Ki', 'url' => ['/door-log/out']];
|
||||
$items[] = ['label' => 'Kapu Be', 'url' => ['/door-log/in']];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use common\models\EventType;
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
@@ -8,12 +9,28 @@ use yii\widgets\ActiveForm;
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<style>
|
||||
select.form-control, option{
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
|
||||
function setThemeColor(elem){
|
||||
elem.className = 'form-control event-theme-active-' +elem.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="event-type-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||
<?= $form->field($model, 'theme')->dropDownList(\common\models\EventType::themes()) ?>
|
||||
<?= $form->field($model, 'theme')->dropDownList(EventType::themes(),
|
||||
['onchange' => "setThemeColor(this);"]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-type', 'Create') : Yii::t('event-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
@@ -22,3 +39,16 @@ use yii\widgets\ActiveForm;
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
let themeDropDown = document.getElementById("eventtype-theme");
|
||||
let themeOptions = themeDropDown.getElementsByTagName("option");
|
||||
for (let item of themeOptions) {
|
||||
item.classList.add("event-theme-active-"+item.value)
|
||||
}
|
||||
|
||||
setThemeColor(themeDropDown);
|
||||
console.info("selected: "+ themeDropDown.value);
|
||||
|
||||
</script>
|
||||
|
||||
@@ -89,3 +89,35 @@ a.desc:after {
|
||||
padding: 10px 20px;
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
.event-theme-active-0 {
|
||||
background-color: #ECB809 !important;
|
||||
}
|
||||
.event-theme-active-1 {
|
||||
background-color: #AE173B !important;
|
||||
}
|
||||
.event-theme-active-2 {
|
||||
background-color: #DF429B !important;
|
||||
}
|
||||
.event-theme-active-3 {
|
||||
background-color: #B929B1 !important;
|
||||
}
|
||||
.event-theme-active-4 {
|
||||
background-color: #3EBFAE !important;
|
||||
}
|
||||
.event-theme-active-5 {
|
||||
background-color: #6594D1 !important;
|
||||
}
|
||||
.event-theme-active-6 {
|
||||
background-color: #F1591A !important;
|
||||
}
|
||||
.event-theme-active-7 {
|
||||
background-color: #30B211 !important;
|
||||
}
|
||||
.event-theme-active-8 {
|
||||
background-color: #E82A36 !important;
|
||||
}
|
||||
.event-theme-active-9 {
|
||||
background-color: #98701E !important;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user