leonsuke

Breadcrumb User

Aug 19th, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4.  
  5. use kartik\detail\DetailView;
  6.  
  7. use dlds\metronic\widgets\Panel;
  8.  
  9. /* @var $this yii\web\View */
  10. /* @var $model app\models\User */
  11.  
  12. $this->title = $model->full_name;
  13. $this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
  14. $this->params['breadcrumbs'][] = $this->title;
  15. ?>
  16. <div class="user-view">
  17. <!-- start user-view -->
  18.  
  19. <h1><?= Html::encode($this->title) ?></h1>
  20.  
  21. <p>
  22. <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  23.  
  24. <?= Html::a('Back to Previous Page', ['index'], ['class' => 'btn btn-warning']) ?>
  25. </p>
  26.  
  27. <?php Panel::begin(['icon' => 'fa fa-info', 'title' => 'User Information I', 'type' => 'panel-info']); ?>
  28. <?= DetailView::widget([
  29. 'model' => $model,
  30. 'attributes' => [
  31. [
  32. 'attribute' => 'status',
  33. 'format' => 'html',
  34. 'value' => $model->status ? '<span class="label label-success">Active</span>' : '<span class="label label-danger">No Active</span>',
  35. 'labelColOptions' => [ 'style'=>'width:30%; text-align:right;' ]
  36. ],
  37. 'full_name',
  38. 'email:email',
  39. 'username',
  40. ],
  41. ]) ?>
  42. <?php Panel::end(); ?>
  43. <?php Panel::begin(['icon' => 'fa fa-check-square-o', 'title' => 'User Information II', 'type' => 'panel-info']); ?>
  44. <?= DetailView::widget([
  45. 'model' => $model,
  46. 'attributes' => [
  47. [
  48. 'label' => 'Branch Name',
  49. 'attribute' => 'branch_id',
  50. 'value' => isset($model->branch) ? $model->branch->name : "-",
  51. 'labelColOptions' => ['style'=>'width: 30%; text-align: right;']
  52. ],
  53. [
  54. 'label' => 'Manager Name',
  55. 'attribute' => 'manager_id',
  56. 'value' => isset($model->manager) ? $model->manager->full_name : "-",
  57. 'labelColOptions' => ['style'=>'width: 30%; text-align: right;']
  58. ],
  59. [
  60. 'label' => 'Location Name',
  61. 'attribute' => 'location_id',
  62. 'value' => isset($model->location) ? $model->location->name : "-",
  63. 'labelColOptions' => ['style'=>'width: 30%; text-align: right;']
  64. ],
  65. ['attribute' => 'created_at', 'format' => [ 'date', 'php: d-M-Y H:i:s' ], 'labelColOptions' => ['style' => 'width: 30%; text-align: right;']],
  66. ['attribute' => 'updated_at', 'format' => [ 'date', 'php: d-M-Y H:i:s' ], 'labelColOptions' => ['style' => 'width: 30%; text-align: right;']],
  67. ],
  68. ]) ?>
  69. <?php Panel::end(); ?>
  70.  
  71. <!-- end user-view -->
  72. </div>
Advertisement
Add Comment
Please, Sign In to add comment