Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yiihelpersHtml;
- use yiihelpersArrayHelper;
- use yiigridGridView;
- use appmodelsServicecategory;
- /* @var $this yiiwebView */
- /* @var $searchModel appmodelsBookingSerach */
- /* @var $dataProvider yiidataActiveDataProvider */
- $this->title = 'Bookings';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="list-booking">
- <h1 class=""><?= Html::encode($this->title) ?></h1>
- <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
- <p class="form-inline text-right">
- <label>Client:</label>
- <?= Html::dropDownList('client', null, ArrayHelper::map($clients, 'id', 'fullname'), ['prompt' => 'Please Select', 'class' => 'form-control']) ?>
- <?= Html::a('+ New Booking', ['booking/create/'], ['class' => 'btn btn-primary client-create']) ?>
- </p>
- <?=
- GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'columns' => [
- ['class' => 'yiigridSerialColumn'],
- 'id',
- ['label' => 'Client', 'value' => 'user.client.view', 'format' => 'raw'],
- 'postCode',
- 'start',
- 'end',
- ['label' => 'Service Category', 'attribute' => 'category.name', 'filter' => ArrayHelper::map(Servicecategory::find()->where(['status' => true])->asArray()->all(), 'id', 'name')],
- //'numberOfDays',
- //'date',
- //'followUpEmail:email',
- // 'followUpEmailSent:ckeckbox',
- //'Status',
- ['attribute' => 'status', 'value' => 'Status', 'filter' => array_filter(appmodelsBooking::$statuses)],
- ['class' => 'yiigridCheckboxColumn',
- 'header' => 'follow Up',
- 'checkboxOptions' => function($model, $key, $index) {
- $url = yiihelpersUrl::to(['booking/followup/' . $model->id]);
- return ['onclick' => 'js:followUp(this, "' . $url . '")', 'checked' => false, 'id' => 'followup'];
- }
- ],
- ['class' => 'yiigridActionColumn',
- 'headerOptions' => ['style' => 'width:15%'],
- 'template' => '{view} {approval} {update} {delete} ',
- 'buttons' => [
- 'view' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['/booking/review/' . $model->id], [
- 'title' => Yii::t('app', 'Review'),
- ]);
- },
- 'approval' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-ok"></span>', ['/booking/approval/' . $model->id], [
- 'title' => Yii::t('app', 'Additional Details'),
- 'class' => 'error',
- ]);
- },
- ],
- ],
- ],
- ]);
- ?>
- </div>
- <?php
- $script = <<< JS
- $('.client-create').on('click', function () {
- select = $(this).prev();
- if(select.val()){
- location.href = $(this).attr('href')+"/"+select.val();
- } else {
- $(this).parent().addClass('has-error');
- }
- return false;
- });
- JS;
- $this->registerJs($script);
- $this->registerJs("
- function followUp(e, url){
- $('#modal').modal('show').find('#modalContent').load(url);
- }", yiiwebView::POS_END);
- ?>
Add Comment
Please, Sign In to add comment