Guest User

Untitled

a guest
May 23rd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. <?php
  2.  
  3. use yiihelpersHtml;
  4. use yiihelpersArrayHelper;
  5. use yiigridGridView;
  6. use appmodelsServicecategory;
  7.  
  8. /* @var $this yiiwebView */
  9. /* @var $searchModel appmodelsBookingSerach */
  10. /* @var $dataProvider yiidataActiveDataProvider */
  11.  
  12. $this->title = 'Bookings';
  13. $this->params['breadcrumbs'][] = $this->title;
  14. ?>
  15. <div class="list-booking">
  16.  
  17. <h1 class=""><?= Html::encode($this->title) ?></h1>
  18. <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  19.  
  20. <p class="form-inline text-right">
  21. <label>Client:</label>
  22. <?= Html::dropDownList('client', null, ArrayHelper::map($clients, 'id', 'fullname'), ['prompt' => 'Please Select', 'class' => 'form-control']) ?>
  23. <?= Html::a('+ New Booking', ['booking/create/'], ['class' => 'btn btn-primary client-create']) ?>
  24. </p>
  25.  
  26. <?=
  27. GridView::widget([
  28. 'dataProvider' => $dataProvider,
  29. 'filterModel' => $searchModel,
  30. 'columns' => [
  31. ['class' => 'yiigridSerialColumn'],
  32. 'id',
  33. ['label' => 'Client', 'value' => 'user.client.view', 'format' => 'raw'],
  34. 'postCode',
  35. 'start',
  36. 'end',
  37. ['label' => 'Service Category', 'attribute' => 'category.name', 'filter' => ArrayHelper::map(Servicecategory::find()->where(['status' => true])->asArray()->all(), 'id', 'name')],
  38. //'numberOfDays',
  39. //'date',
  40. //'followUpEmail:email',
  41. // 'followUpEmailSent:ckeckbox',
  42. //'Status',
  43. ['attribute' => 'status', 'value' => 'Status', 'filter' => array_filter(appmodelsBooking::$statuses)],
  44. ['class' => 'yiigridCheckboxColumn',
  45. 'header' => 'follow Up',
  46. 'checkboxOptions' => function($model, $key, $index) {
  47. $url = yiihelpersUrl::to(['booking/followup/' . $model->id]);
  48. return ['onclick' => 'js:followUp(this, "' . $url . '")', 'checked' => false, 'id' => 'followup'];
  49. }
  50. ],
  51. ['class' => 'yiigridActionColumn',
  52. 'headerOptions' => ['style' => 'width:15%'],
  53. 'template' => '{view} {approval} {update} {delete} ',
  54. 'buttons' => [
  55. 'view' => function ($url, $model) {
  56. return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['/booking/review/' . $model->id], [
  57. 'title' => Yii::t('app', 'Review'),
  58. ]);
  59. },
  60. 'approval' => function ($url, $model) {
  61. return Html::a('<span class="glyphicon glyphicon-ok"></span>', ['/booking/approval/' . $model->id], [
  62. 'title' => Yii::t('app', 'Additional Details'),
  63. 'class' => 'error',
  64. ]);
  65. },
  66. ],
  67. ],
  68. ],
  69. ]);
  70. ?>
  71. </div>
  72. <?php
  73. $script = <<< JS
  74. $('.client-create').on('click', function () {
  75. select = $(this).prev();
  76. if(select.val()){
  77. location.href = $(this).attr('href')+"/"+select.val();
  78. } else {
  79. $(this).parent().addClass('has-error');
  80. }
  81. return false;
  82. });
  83. JS;
  84. $this->registerJs($script);
  85.  
  86. $this->registerJs("
  87. function followUp(e, url){
  88.  
  89. $('#modal').modal('show').find('#modalContent').load(url);
  90.  
  91. }", yiiwebView::POS_END);
  92. ?>
Add Comment
Please, Sign In to add comment