Exemplo n.º 1
0
use ext\Helper;
use yii\rbac\Item;
use yii\grid\SerialColumn;
$this->title = Yii::t('app', '报价清单');
$this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
$this->params['breadcrumbs'][] = Yii::t('app', '列表');
$id = 'medicine-grid';
?>
<div class="row">
    <div class="col-md-12 portlet light">
        <?php 
echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'Medicine'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () {
    return Html::tag('a', '添加清单', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']);
}, 'Delete' => function () {
    return Html::tag('a', '删除清单', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']);
}], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '品名'], ['attribute' => 'sid', 'label' => '类名', 'content' => function ($model, $key, $index) {
    return $model['serviceCategory']['name'];
}], ['attribute' => 'fid', 'label' => '规格', 'content' => function ($model, $key, $index) {
    return $model['specifications']['name'];
}], ['attribute' => 'cid', 'label' => '城市', 'content' => function ($model, $key, $index) {
    return $model['city']['name'];
}], ['attribute' => 'sexual_taste', 'label' => '性味'], ['attribute' => 'price', 'label' => '价格'], ['attribute' => 'amount', 'label' => '数量'], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$medicineStatus, 'content' => function ($model, $key, $index, $column) {
    if ($model['status'] == Dict::MEDICINE_STATUS_PENDING) {
        return '<span class="label label-sm label-danger">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_PENDING] . '</span>';
    } else {
        if ($model['status'] == Dict::MEDICINE_STATUS_COMPLETE) {
            return '<span class="label label-sm label-success">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_COMPLETE] . '</span>';
        } else {
            return '<span class="label label-sm label-default">' . Dict::$medicineStatus[Dict::MEDICINE_STATUS_CANCEL] . '</span>';
        }
    }
Exemplo n.º 2
0
use yii\helpers\Html;
use ext\grid\GridView;
use ext\grid\ActionColumn;
use ext\grid\CheckboxColumn;
use ext\Helper;
use yii\grid\SerialColumn;
$this->title = Yii::t('app', '用户');
$this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
$this->params['breadcrumbs'][] = Yii::t('app', '用户列表');
$id = 'user-grid';
?>
<div class="row">
    <div class="col-md-12 portlet light">
        <?php 
echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'City'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () {
    return Html::tag('a', '添加用户', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']);
}, 'Delete' => function () {
    return Html::tag('a', '删除用户', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']);
}], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'username', 'label' => '用户名'], ['attribute' => 'email', 'label' => '邮箱'], ['attribute' => 'zipcode', 'label' => '邮编'], ['attribute' => 'phone', 'label' => '电话号码'], ['attribute' => 'city', 'label' => '城市'], ['attribute' => 'state', 'label' => '国家'], ['attribute' => 'street', 'label' => '街道地址'], ['attribute' => 'created_at', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$userStatus, 'content' => function ($model, $key, $index, $column) {
    if ($model['status'] == Dict::USER_STATUS_FREEZE) {
        return '<span class="label label-sm label-danger">' . Dict::$userStatus[Dict::USER_STATUS_FREEZE] . '</span>';
    } else {
        return '<span class="label label-sm label-success">' . Dict::$userStatus[Dict::USER_STATUS_NORMAL] . '</span>';
    }
}], ['class' => ActionColumn::className(), 'template' => '{view} {update}']]]);
?>
    </div>
</div>


Exemplo n.º 3
0
<?php

use yii\helpers\Url;
use yii\helpers\Html;
use ext\grid\GridView;
use ext\grid\ActionColumn;
use ext\grid\CheckboxColumn;
use ext\Helper;
use yii\grid\SerialColumn;
$this->title = Yii::t('app', '城市');
$this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
$this->params['breadcrumbs'][] = Yii::t('app', '城市列表');
$id = 'City-grid';
?>
<div class="row">
    <div class="col-md-12 portlet light">
        <?php 
echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'City'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create}{Delete}', 'actions' => ['Create' => function () {
    return Html::tag('a', '添加城市', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']);
}, 'Delete' => function () {
    return Html::tag('a', '删除城市', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除 <b>${num}</b> 记录? 删除后不可恢复!']);
}], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '城市名称'], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'update_time', 'label' => '修改时间', 'format' => 'datetime'], ['class' => ActionColumn::className(), 'template' => '{update}', 'buttons' => ['update' => function ($url, $model, $key) {
    $options = ['title' => Yii::t('yii', 'update'), 'href' => $url, 'data-action' => 'get.modal'];
    return Html::tag('a', '<i class="fa fa-pencil"></i>', $options);
}]]]]);
?>
    </div>
</div>


Exemplo n.º 4
0
use ext\grid\CheckboxColumn;
use ext\Helper;
use yii\grid\SerialColumn;
$this->title = Yii::t('app', '热卖商品');
$this->params['breadcrumbs'][] = ['label' => $this->title, 'url' => ['index']];
$this->params['breadcrumbs'][] = Yii::t('app', '列表');
$id = 'hotsale-grid';
?>
<div class="row">
    <div class="col-md-12 portlet light">
        <?php 
echo GridView::widget(['id' => $id, 'title' => Yii::t('app', 'Hotsale'), 'moreActionsTemplate' => '{export}', 'actionsTemplate' => '{Create} {Disable} {Delete}', 'actions' => ['Create' => function () {
    return Html::tag('a', '添加商品', ['class' => 'btn btn-primary', 'href' => Url::toRoute('create'), 'data-action' => 'get.modal']);
}, 'Delete' => function () {
    return Html::tag('a', '删除商品', ['class' => 'btn btn-default', 'href' => Url::toRoute('multi-delete'), 'data-action' => 'confirm.multi.grid-view.modal', 'data-message' => '确认删除<b>${num}</b>记录? 删除后不可恢复!']);
}], 'dataProvider' => $dataProvider, 'filterModel' => $filterModel, 'columns' => [['class' => SerialColumn::className()], ['class' => CheckboxColumn::className()], ['attribute' => 'id', 'label' => '编号'], ['attribute' => 'name', 'label' => '品名'], ['attribute' => 'sexual_taste', 'label' => '性味'], ['attribute' => 'price', 'label' => '价格'], ['attribute' => 'create_time', 'label' => '创建时间', 'format' => 'datetime'], ['attribute' => 'status', 'label' => '状态', 'filter' => Dict::$hotsale, 'content' => function ($model, $key, $index, $column) {
    if ($model['status'] == Dict::HOTSALE_STATUS_PENDING) {
        return '<span class="label label-sm label-danger">' . Dict::$hotsale[Dict::HOTSALE_STATUS_PENDING] . '</span>';
    } else {
        if ($model['status'] == Dict::HOTSALE_STATUS_COMPLETE) {
            return '<span class="label label-sm label-success">' . Dict::$hotsale[Dict::HOTSALE_STATUS_COMPLETE] . '</span>';
        } else {
            return '<span class="label label-sm label-default">' . Dict::$hotsale[Dict::HOTSALE_STATUS_CANCEL] . '</span>';
        }
    }
}], ['class' => ActionColumn::className(), 'template' => '{view} {update}']]]);
?>
    </div>
</div>