Esempio n. 1
0
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaActividades(), 'id', 'actividad'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Actividad'], 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['formOptions' => ['action' => Url::to([''])], 'header' => 'Actividad', 'size' => 'md', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => \yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaActividades(), 'id', 'actividad')]];
}], ['readonly' => function ($model, $key, $index, $widget) {
    return $model->user->id != Yii::$app->user->identity->id;
    // do not allow editing of inactive records
}, 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'lugar', 'label' => 'Dirección', 'width' => '140px', 'value' => function ($model, $key, $index, $widget) {
    return $model->lugar;
}, 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['agenda/change', 'id' => $model->agendaid])], 'header' => 'Lugar', 'size' => 'md'];
}], ['readonly' => function ($model, $key, $index, $widget) {
    return $model->user->id != Yii::$app->user->identity->id;
    // do not allow editing of inactive records
}, 'class' => 'kartik\\grid\\EditableColumn', 'width' => '80px', 'attribute' => 'estado', 'label' => 'Estado', 'value' => function ($model, $key, $index, $widget) {
    return $model->estado;
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => \yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaEstado(), 'id', 'estado'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'Estado'], 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['formOptions' => ['action' => Url::to(['agenda/change', 'id' => $model->agendaid])], 'header' => 'Estado', 'size' => 'md', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => \yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaEstado(), 'id', 'estado')]];
}], ['readonly' => function ($model, $key, $index, $widget) {
    return $model->user->id != Yii::$app->user->identity->id;
    // do not allow editing of inactive records
}, 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'empresa', 'label' => 'Empresa', 'width' => '140px', 'value' => function ($model, $key, $index, $widget) {
    return $model->empresa;
}, 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['agenda/change', 'id' => $model->agendaid])], 'header' => 'Empresan', 'size' => 'md'];
}], ['readonly' => function ($model, $key, $index, $widget) {
    return $model->user->id != Yii::$app->user->identity->id;
    // do not allow editing of inactive records
}, 'class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'contacto', 'label' => 'Contacto', 'width' => '140px', 'value' => function ($model, $key, $index, $widget) {
    return $model->contacto;
}, 'editableOptions' => function ($model, $key, $index, $widget) {
    return ['inputType' => \kartik\editable\Editable::INPUT_TEXT, 'formOptions' => ['action' => Url::to(['agenda/change', 'id' => $model->agendaid])], 'header' => 'Contacto', 'size' => 'md'];
}], ['readonly' => function ($model, $key, $index, $widget) {
Esempio n. 2
0
    <div class="row">
        <div class="col-xs-3">
            <?php 
$lista = ArrayHelper::map(User::find()->asArray()->orderBy('nombre')->all(), 'id', 'nombre');
$model->user_id = Yii::$app->user->identity->id;
// Para preseleccionar el dato
echo $form->field($model, 'user_id')->dropDownList($lista)->label('Asignado');
?>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-3">
            <?php 
echo $form->field($model, 'estado')->dropDownList(\yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaEstado(), 'id', 'estado'));
?>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-3">
            <?php 
echo $form->field($model, 'actividad')->dropDownList(\yii\helpers\ArrayHelper::map(\backend\models\Agenda::listaActividades(), 'id', 'actividad'), ['prompt' => '[Seleccionar]']);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-3">
            <?php 
echo $form->field($model, 'asunto')->textarea(['maxlength' => true]);
?>