Пример #1
0
<?php

use yii\helpers\Html;
use common\helpers\Custom;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Manufacturers';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="manufacturer-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Create Manufacturer', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'address:ntext', 'contact_number', 'created_date', ['attribute' => 'status', 'value' => function ($model) {
    return Custom::getStatusArray()[$model->status];
}], ['class' => 'yii\\grid\\ActionColumn']], 'showFooter' => true, 'layout' => '{summary}{items}{pager}', 'filterPosition' => 'footer']);
?>

</div>
Пример #2
0
use yii\helpers\Html;
use common\helpers\Custom;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Manufacturer */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Manufacturers', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="manufacturer-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'address:ntext', 'contact_number', 'created_date', 'updated_date', ['attribute' => 'status', 'value' => Custom::getStatusArray()[$model->status]]]]);
?>

</div>
Пример #3
0
?>

    <?php 
echo $form->field($model, 'display_name')->textInput(['maxlength' => true]);
?>

    <?php 
$data_parent_categories = ArrayHelper::map(Category::find()->parentCategoryForDropdown()->asArray()->all(), 'id', 'display_name');
echo $form->field($model, 'parent_catrgory_id')->dropDownList($data_parent_categories, ['prompt' => 'Select']);
?>

    <?php 
if (!empty($model->id)) {
    ?>
        <?php 
    echo $form->field($model, 'status')->dropDownList(Custom::getStatusArray());
    ?>
    <?php 
}
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Пример #4
0
?>
<div class="category-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
$parent_category_name = NULL;
if (!empty($model->parent_catrgory_id)) {
    $parent_category = Category::find()->parentCategoryById($model->parent_catrgory_id)->one();
    $parent_category_name = $parent_category->display_name;
}
?>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'display_name', ['attribute' => 'parent_catrgory_id', 'value' => $parent_category_name], 'created_date', 'updated_date', ['attribute' => 'status', 'value' => Custom::getStatusArray()[$model->status]]]]);
?>

</div>