pmtpenza

Untitled

Jul 30th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4. use kartik\grid\GridView;
  5. use backend\models\Client;
  6.  
  7. /* @var $this yii\web\View */
  8. /* @var $searchModel backend\models\DealsSearch */
  9. /* @var $dataProvider yii\data\ActiveDataProvider */
  10.  
  11. $this->title = 'Сделки';
  12. $this->params['breadcrumbs'][] = $this->title;
  13. ?>
  14. <div class="deals-index">
  15.  
  16. <p>
  17. <?= Html::a('Создать сделку', ['create'], ['class' => 'btn btn-success']) ?>
  18. </p>
  19.  
  20. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  21.  
  22. <?= GridView::widget([
  23. 'rowOptions' => function ($model, $key, $index, $grid)
  24. {
  25. if($model->statussdel->id == 1) {
  26. return ['style' => 'background-color:#00a65a9e;'];
  27. }
  28. if($model->statussdel->id == 2) {
  29. return ['style' => 'background-color:#dd4b39b3;'];
  30. }
  31.  
  32. },
  33. 'dataProvider' => $dataProvider,
  34. 'filterModel' => $searchModel,
  35. 'columns' => [
  36.  
  37. 'id',
  38. [
  39. 'attribute' => 'client_id',
  40. 'value' => function ($model)
  41. {
  42. return $model->client ? $model->client->company . ' , ' . $model->client->firstname . ' ' . $model->client->lastname : '' ;
  43. }
  44.  
  45. ],
  46. //'budget',
  47. [
  48. 'attribute' => 'budget',
  49. 'format' => ['decimal', 2],
  50. 'value' => 'budget',
  51. ],
  52.  
  53.  
  54. //'tz',
  55. [
  56. 'attribute' => 'user_id',
  57. 'format' => 'raw',
  58. 'value' => 'manadger.username',
  59. ],
  60. 'date',
  61. 'finch_date',
  62. //'due_date',
  63. //'notes',
  64. //'doc',
  65. //'payment',
  66.  
  67. //'paymentdate',
  68. [
  69. 'attribute' => 'staussdelki_id',
  70. 'format' => 'raw',
  71. 'value' => 'statussdel.staussdelkiname',
  72. ],
  73. [
  74. 'attribute' => 'sum',
  75. 'format' => ['decimal', 2],
  76. 'value' => function($model) {
  77. return $model->payment * 0.1;
  78. }
  79. ],
  80.  
  81. ['class' => 'yii\grid\ActionColumn'],
  82. ],
  83. ]); ?>
  84.  
  85.  
  86. </div>
Advertisement
Add Comment
Please, Sign In to add comment