Example #1
0
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Journal'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['columns' => [['content' => 'Transaction', 'options' => ['colspan' => 6, 'class' => 'text-center', 'style' => 'background-color: #fdfdfd']], ['content' => 'Account', 'options' => ['colspan' => 3, 'class' => 'text-center', 'style' => 'background-color: #fdfdfd']], ['content' => '<div class="row-fluid" style="width:260px"><div class="col-xs-6" style="padding:0 2px 0 2px;">Debet</div><div class="col-xs-6" style="padding:0 2px 0 2px;">Credit</div></div>', 'options' => ['colspan' => 1, 'class' => 'text-centers', 'style' => 'background-color: #fdfdfd;text-align:right;']]], 'options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'mergeColumns' => ['time', 'title', 'subject', 'tags', 'transactionRemarks'], 'type' => 'firstrow', 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'transaction.time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'title', 'value' => 'transaction.title'], ['attribute' => 'subject', 'value' => 'transaction.subject'], ['attribute' => 'tags', 'value' => 'transaction.tags'], ['attribute' => 'transactionRemarks', 'value' => 'transaction.remarks'], ['attribute' => 'accountName', 'value' => function ($data) {
    return ($data->account->code < 0 ? "" : $data->account->code . " - ") . $data->account->name;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => ArrayHelper::map($tra->accounts(), "name", "name"), 'options' => ['placeholder' => Yii::t('app', 'Select an account...')], 'pluginOptions' => ['allowClear' => true]]], 'remarks:ntext', ['attribute' => 'quantity', 'value' => function ($data) {
    $module = Yii::$app->getModule('cap');
    return number_format($data->qty, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}], ['attribute' => 'amount', 'format' => 'html', 'value' => function ($data) use($module) {
    $html = '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($data->debet, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    $html .= '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($data->credit, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    return '<div class="row-fluid" style="width:260px">' . $html . '</div>';
}, 'headerOptions' => ['class' => 'kv-align-bottom', 'style' => 'text-align:center;'], 'hAlign' => 'right', 'vAlign' => 'top', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
    $db = 0;
    $cr = 0;
    foreach ($data as $d) {
        $ds = explode('</div>', $d);
        $db += floatval(str_replace($module->currency["thousand_separator"], "", substr($ds[0], strrpos($ds[0], " >") + 2)));
        $cr += floatval(str_replace($module->currency["thousand_separator"], "", substr($ds[1], strrpos($ds[1], " >") + 2)));
    }
    $html = '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($db, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    $html .= '<div class="col-xs-6" style="padding:0 2px 0 2px;" >' . number_format($cr, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]) . '</div>';
    return '<div class="row-fluid" style="width:260px">' . $html . '</div>';
}]]]);
Example #2
0
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Product'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'term', 'format' => 'html', 'value' => function ($data) use($module) {
    $images = json_decode($data->images);
    return (isset($images[0]) ? Html::img(str_replace($module->uploadURL . "/", $module->uploadURL . "/.thumbs/", $images[0]), ['class' => 'pull-left', 'style' => 'margin:0 10px 10px 0']) : "") . " " . Html::encode($data->sku . " " . $data->title);
}], 'description', ['attribute' => 'price', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->price, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('yes');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], ['attribute' => 'discount', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->discount, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => true, 'pageSummaryFunc' => 'avg'], 'tags', ['attribute' => 'authorName', 'value' => 'author.username'], ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15, 'opens' => 'left'], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'isfeatured', 'value' => function ($data) {
    return $data->itemAlias('isfeatured', $data->isfeatured ? 1 : 0);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('isfeatured'), 'options' => ['placeholder' => Yii::t('app', 'Is Featured?')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #3
0
/* @var $this yii\web\View */
/* @var $searchModel amilna\yes\models\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Categories');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'YES'), 'url' => ['/yes/default']];
$this->params['breadcrumbs'][] = $this->title;
$module = Yii::$app->getModule('yes');
?>
<div class="category-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Category')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Category'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'title', ['attribute' => 'parent_id', 'value' => 'parent.title', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => ArrayHelper::map($searchModel->parents(), "id", "title"), 'options' => ['placeholder' => Yii::t('app', 'Select a parent category...')], 'pluginOptions' => ['allowClear' => true]]], 'description:ntext', ['attribute' => 'image', 'format' => 'html', 'value' => function ($data) use($module) {
    return $data->image != null ? Html::img(str_replace("/" . $module->uploadDir . "/", "/" . $module->uploadDir . "/.thumbs/", $data->image), ['class' => 'pull-left', 'style' => 'margin:0 10px 10px 0']) : '';
}], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #4
0
use amilna\yap\GridView;
/* @var $this yii\web\View */
/* @var $searchModel amilna\yes\models\ShippingSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Shippings');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'YES'), 'url' => ['/yes/default']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="shipping-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Shipping'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'code', 'city', 'area', ['attribute' => 'data', 'format' => 'html', 'value' => function ($data) {
    $model = json_decode($data->data);
    $html = Yii::t("app", "Providers");
    foreach ($model as $m) {
        $html .= "<h5>" . Html::encode($m->provider) . " <small>" . $data->toMoney(empty($m->cost) ? 0 : Html::encode($m->cost)) . ", " . Html::encode($m->remarks) . "</small></h5>";
    }
    return $html;
}], ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]]]]]);
?>

</div>
Example #5
0
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Coupon'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:100px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'code', 'description', ['attribute' => 'price', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->price, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('yes');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], 'discount', ['attribute' => 'time_from', 'value' => 'time_from', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'time_to', 'value' => 'time_to', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'qty', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->qty, 0, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('yes');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 0, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], ['attribute' => 'status', 'format' => 'html', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($model) {
    $labels = ["warning", "success", "info", "primary", "danger"];
    $html = "<span class='label label-" . $labels[$model->status] . "'>" . Html::encode($model->itemAlias('status', $model->status)) . "</span>";
    return $html;
}], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>
Example #6
0
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Order'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'reference', 'format' => 'html', 'value' => function ($model) {
    return Html::encode($model->reference);
}], ['attribute' => 'customerName', 'format' => 'html', 'value' => function ($model) {
    if ($model->customer) {
        $html = Html::encode($model->customer->name);
        $html .= "<h5>" . Yii::t("app", "Email") . " <small>" . Html::encode($model->customer->email) . "</small></h5>";
        $html .= "<h5>" . Yii::t("app", "Phones") . " <small>" . Html::encode($model->customer->phones) . "</small></h5>";
    } else {
        $html = "";
    }
    return $html;
}], ['attribute' => 'data', 'format' => 'html', 'value' => function ($model) {
    $module = Yii::$app->getModule('yes');
    $data = json_decode($model->data);
    //$customer = $data->customer;
    $shipping = isset($data->shipping) ? json_decode($data->shipping) : false;
    $cart = isset($data->cart) && $data->cart != "null" ? json_decode($data->cart) : [];
    //$payment = isset($data->payment)?Payment::findOne($data->payment):false;
    $cm = "";
    foreach ($cart as $c) {
        $cm .= ($cm == "" ? "" : ", ") . Html::encode($c->title) . " (" . $c->quantity . ")";
    }
    $html = Yii::t("app", "Order Details:");
    $html .= "<h5>" . Yii::t("app", "Cart") . " <small>" . $cm . "</small></h5>";
    if ($shipping) {
        $html .= "<h5>" . Yii::t("app", "Shipping Cost") . " <small><i>" . Html::encode($shipping->provider . ' ' . $shipping->code) . '</i> ' . Yii::t("app", "destination ") . Html::encode($shipping->city . ' (' . $shipping->area . ")") . "</small></h5>";
    }
    return $html;
}], ['attribute' => 'total', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->total, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('yes');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], ['attribute' => 'status', 'format' => 'html', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($model) {
    $labels = ["warning", "success", "info", "primary", "danger"];
    $html = "<span class='label label-" . $labels[$model->status] . "'>" . Html::encode($model->itemAlias('status', $model->status)) . "</span>";
    return $html;
}], 'complete_reference', ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ["view", "reference" => $model->reference], ["title" => Yii::t("yii", "View")]);
}]]]]);
Example #7
0
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Order'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => true, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'reference', 'format' => 'html', 'value' => function ($model) {
    return count($model->confirmations) > 0 ? Html::a($model->reference . '<i class="badge pull-left">' . count($model->confirmations) . '</i>', ['//yes/confirmation', 'ConfirmationSearch[orderReference]' => $model->reference]) : Html::encode($model->reference);
}], ['attribute' => 'customerAdminName', 'format' => 'html', 'value' => function ($model) {
    if ($model->customer) {
        $html = Html::encode($model->customer->name);
        $html .= "<h5>" . Yii::t("app", "Email") . " <small>" . Html::encode($model->customer->email) . "</small></h5>";
        $html .= "<h5>" . Yii::t("app", "Phones") . " <small>" . Html::encode($model->customer->phones) . "</small></h5>";
    } else {
        $html = "";
    }
    return $html;
}], ['attribute' => 'data', 'format' => 'html', 'value' => function ($model) {
    $module = Yii::$app->getModule('yes');
    $data = json_decode($model->data);
    //$customer = $data->customer;
    $shipping = isset($data->shipping) ? json_decode($data->shipping) : false;
    $cart = isset($data->cart) && $data->cart != "null" ? json_decode($data->cart) : [];
    //$payment = isset($data->payment)?Payment::findOne($data->payment):false;
    $cm = "";
    foreach ($cart as $c) {
        $cm .= ($cm == "" ? "" : ", ") . Html::encode($c->title) . " (" . $c->quantity . ")";
    }
    $html = Yii::t("app", "Order Details:");
    $html .= "<h5>" . Yii::t("app", "Cart") . " <small>" . $cm . "</small></h5>";
    if ($shipping) {
        $html .= "<h5>" . Yii::t("app", "Shipping Cost") . " <small><i>" . Html::encode($shipping->provider . ' ' . $shipping->code) . '</i> ' . Yii::t("app", "destination ") . Html::encode($shipping->city . ' (' . $shipping->area . ")") . "</small></h5>";
    }
    return $html;
}], ['attribute' => 'total', 'value' => function ($data) {
    $module = Yii::$app->getModule('yes');
    return number_format($data->total, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('yes');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'status', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Status'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false, 'afterInput' => function ($form, $widget) use($model, $index) {
        echo '<div class="form-group">';
        echo Html::textArea(substr($model->className(), strrpos($model->className(), "\\") + 1) . "[" . $index . "][complete_reference]", $model->complete_reference, ["class" => "form-control", "placeholder" => Yii::t("app", "Complete Reference")]);
        echo '</div>';
    }, 'pluginEvents' => ['editableSuccess' => "function(event, val, form, data) { \n\t\t\t\t\t\t\t\t\t\t\t\t\tvar model = JSON.parse(data.data);\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (m in model)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('tr[data-key='+data.id+'] td').each(function(n,d){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (n == m) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(d).html(model[m]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}"]];
}, 'hAlign' => 'right'], 'complete_reference', ['class' => 'kartik\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ["view", "reference" => $model->reference], ["title" => Yii::t("yii", "View")]);
}]]]]);
Example #8
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="group-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Group')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Group'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'title', 'description:ntext', ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'ownerUsername', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('owner'), 'options' => ['placeholder' => Yii::t('app', 'Filter by owner...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('owner', $data->owner_id);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Owner Username'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('owner'), 'options' => ['placeholder' => Yii::t('app', 'Select owner...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false, 'pluginEvents' => ['editableSuccess' => "function(event, val, form, data) { \n\t\t\t\t\t\t\t\t\t\t\t\t\tif (data.output != '" . $model->itemAlias('owner', $model->owner_id) . "')\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}"]];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'status', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Status'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Set status...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false];
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>
Example #9
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Customer')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Customer'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', 'email:email', ['attribute' => 'phones', 'value' => function ($data) {
    return Html::encode(str_replace(",", ", ", $data->phones));
}], 'addresses:ntext', ['attribute' => 'last_time', 'value' => 'last_time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15, 'opens' => 'left'], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'last_action', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('last_action'), 'options' => ['placeholder' => Yii::t('app', 'Last action...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('last_action', $data->last_action);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Last action'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('last_action'), 'options' => ['placeholder' => Yii::t('app', 'Last action...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false, 'afterInput' => function ($form, $widget) use($model, $index) {
        echo '<div class="form-group">';
        echo Html::textArea(substr($model->className(), strrpos($model->className(), "\\") + 1) . "[" . $index . "][remarks]", $model->remarks, ["class" => "form-control", "placeholder" => Yii::t("app", "Remarks")]);
        echo '</div>';
    }, 'pluginEvents' => ['editableSuccess' => "function(event, val, form, data) { \n\t\t\t\t\t\t\t\t\t\t\t\t\tvar model = JSON.parse(data.data);\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor (m in model)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$('tr[data-key='+data.id+'] td').each(function(n,d){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (n == m) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\$(d).html(model[m]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}"]];
}, 'hAlign' => 'right'], 'remarks', ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #10
0
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="post-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Post')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Post'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => true, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['admin'], ['data-pjax' => true, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'term', 'value' => 'title'], 'description', 'tags', ['attribute' => 'authorName', 'value' => 'author.username'], ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15, 'opens' => 'left'], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'isfeatured', 'value' => function ($data) {
    return $data->itemAlias('isfeatured', $data->isfeatured ? 1 : 0);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('isfeatured'), 'options' => ['placeholder' => Yii::t('app', 'Is Featured?')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) {
    return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ["view", "id" => $model->id, "title" => $model->title], ["title" => Yii::t("yii", "View")]);
}]]]]);
?>

</div>
Example #11
0
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Confirmation')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Confirmation'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'orderReference', 'format' => 'html', 'value' => function ($data) {
    if ($data->order) {
        return Html::a($data->order->reference, ['//yes/order/view', "reference" => $data->order->reference]);
    } else {
        return "";
    }
}], ['attribute' => 'paymentTerminal', 'format' => 'html', 'value' => function ($data) {
    return Html::encode($data->payment->terminal . " " . $data->payment->account);
}], 'terminal', 'account', 'name', ['attribute' => 'amount', 'value' => function ($data) use($module) {
    return number_format($data->amount, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) use($module) {
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'pageSummaryFunc' => 'sum'], 'remarks:ntext', ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #12
0

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Transaction'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['columns' => [], 'options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'mergeColumns' => ['type', 'subject', 'title', 'tags'], 'type' => 'firstrow', 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'type', 'value' => function ($data) {
    return $data->itemAlias('type', $data->type);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('type'), 'options' => ['placeholder' => Yii::t('app', 'Select a transaction type...')], 'pluginOptions' => ['allowClear' => true]]], 'subject', 'title', 'tags', ['attribute' => 'time', 'value' => 'time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15, 'opens' => 'left'], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], 'reference', 'remarks:ntext', ['attribute' => 'total', 'value' => function ($data) {
    $module = Yii::$app->getModule('cap');
    return number_format($data->total, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}], ['attribute' => 'cashFlow', 'value' => function ($data) {
    $module = Yii::$app->getModule('cap');
    return number_format($data->cashFlow, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}, 'mergeHeader' => true, 'headerOptions' => ['class' => 'kv-align-middle', 'style' => 'text-align:center;'], 'vAlign' => 'top', 'hAlign' => 'right', 'pageSummary' => function ($summary, $data, $widget) {
    $module = Yii::$app->getModule('cap');
    $r = 0;
    foreach ($data as $d) {
        $r += floatval(str_replace($module->currency["thousand_separator"], "", $d));
    }
    return number_format($r, 2, $module->currency["decimal_separator"], $module->currency["thousand_separator"]);
}], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>
	   
    
Example #13
0
/* @var $searchModel amilna\blog\models\FileSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Files');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Blog'), 'url' => ['/blog/default']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="file-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'File')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'File'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => true, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['admin'], ['data-pjax' => true, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'title', 'description', 'tags', ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status ? 1 : 0);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Select a status type...')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'file', 'format' => 'raw', 'value' => function ($data) {
    return Html::a(basename($data->file), $data->file, ["class" => "btn btn-xs btn-success btn-block", "title" => Yii::t("app", "Click to download!"), "target" => "blank"]);
}], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #14
0
use amilna\yap\GridView;
/* @var $this yii\web\View */
/* @var $searchModel amilna\yes\models\PaymentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Payments');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'YES'), 'url' => ['/yes/default']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="payment-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Payment')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Payment'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'terminal', 'account', 'name', ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]]], 'data:ntext', ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>
Example #15
0
// echo $this->render('_search', ['model' => $searchModel]);
?>
    

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Version'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'mergeColumns' => ['time', 'routeUser'], 'type' => 'firstrow', 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'time', 'value' => 'route.time', 'filterType' => GridView::FILTER_DATE_RANGE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'YYYY-MM-DD HH:mm:ss', 'todayHighlight' => true, 'timePicker' => true, 'timePickerIncrement' => 15], 'pluginEvents' => ["apply.daterangepicker" => 'function() {									
									$(this).change();
								}']]], ['attribute' => 'routeUser', 'value' => 'route.user.username'], ['attribute' => 'recordModel', 'format' => 'raw', 'value' => function ($data) {
    $version = $data->getVersion();
    $rtml = $version ? Html::encode(str_replace([",", "/"], [", ", "/ "], json_encode($version->attributes))) : "";
    $attr = json_decode($data->record_attributes);
    if (is_array($attr) || is_object($attr)) {
        foreach ($attr as $a => $v) {
            $r = Html::encode(str_replace([",", "/"], [", ", "/ "], json_encode([$a => $v])));
            $rtml = str_replace(substr($r, 1, -1), str_replace(["{", "}"], ["<i class='text-danger'>", "</i>"], $r), $rtml);
        }
    }
    $html = Html::tag("b", $data->record->model, ["class" => "text-primary"]) . "&nbsp;&nbsp;" . Html::tag("span", $data->record->record_id, ["class" => "label label-primary"]);
    $html .= "<p><small>" . Yii::t("app", "Route") . "</small>: <i class='text-success'>" . $data->route->route . "</i><br>" . "<small>" . Yii::t("app", "Attributes") . "</small>: " . $rtml . "</p>";
    return $html;
}], ['attribute' => 'status', 'format' => 'raw', 'value' => function ($data) {
    if ($data->status) {
        return Html::tag("span", $data->itemAlias('status', $data->status ? 1 : 0), ["class" => "btn btn-xs btn-" . ($data->status ? 'success' : 'danger') . " btn-block"]);
    } else {
        return Html::a($data->itemAlias('status', $data->status ? 1 : 0), ["//versioning/version/apply", "id" => $data->id], ["class" => "btn btn-xs btn-" . ($data->status ? 'success' : 'danger') . " btn-block", "title" => Yii::t("app", "Click to apply this version!"), "data" => ["confirm" => Yii::t("app", "Are you sure to apply this version?"), "method" => "post"]]);
    }
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Filter by status...')], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{delete}']]]);
?>

</div>
Example #16
0
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Record'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => false, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'tableOptions' => ["style" => "margin-bottom:50px;"], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => false, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'recordModel', 'format' => 'raw', 'value' => function ($data) {
    $version = $data->getVersion();
    $rtml = $version ? Html::encode(str_replace([",", "/"], [", ", "/ "], json_encode($version->attributes))) : "";
    $html = Html::tag("span", $data->model, ["class" => "text-primary"]) . "&nbsp;&nbsp;" . Html::tag("span", $data->record_id, ["class" => "label label-primary"]);
    $xtml = "<p><small>" . Yii::t("app", "Attributes") . "</small>: " . $rtml . "</p>";
    return $html;
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'owner_id', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('owner'), 'options' => ['placeholder' => Yii::t('app', 'Filter by owner...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('owner', $data->owner_id);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Owner Username'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('owner'), 'options' => ['placeholder' => Yii::t('app', 'Select owner...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false, 'pluginEvents' => ['editableSuccess' => "function(event, val, form, data) { \n\t\t\t\t\t\t\t\t\t\t\t\t\tif (data.output != '" . $model->itemAlias('owner', $model->owner_id) . "')\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t}"]];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'groupTitle', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('groups'), 'options' => ['placeholder' => Yii::t('app', 'Filter by group...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('groups', $data->group_id);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Group Title'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('groups'), 'options' => ['placeholder' => Yii::t('app', 'Select group...')], 'pluginOptions' => ['allowClear' => true]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false];
}], ['class' => 'kartik\\grid\\EditableColumn', 'attribute' => 'filter_viewers', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('filter_viewers'), 'options' => ['placeholder' => Yii::t('app', 'Filter viewers...')], 'pluginOptions' => ['allowClear' => true]], 'value' => function ($data) {
    return $data->itemAlias('filter_viewers', $data->filter_viewers ? 1 : 0);
}, 'editableOptions' => function ($model, $key, $index) {
    return ['header' => Yii::t('app', 'Filter Viewers'), 'size' => 'sm', 'inputType' => \kartik\editable\Editable::INPUT_SELECT2, 'options' => ['data' => $model->itemAlias('filter_viewers'), 'options' => ['placeholder' => Yii::t('app', 'Set filter viewers status...')], 'pluginOptions' => ['allowClear' => false]], 'placement' => 'left', 'showButtons' => false, 'resetButton' => false];
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{delete}']]]);
?>

</div>
Example #17
0
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Blog'), 'url' => ['/blog/default']];
$this->params['breadcrumbs'][] = $this->title;
$module = Yii::$app->getModule('blog');
?>
<div class="gallery-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create {modelClass}', ['modelClass' => Yii::t('app', 'Gallery')]), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'containerOptions' => ['style' => 'overflow: auto'], 'caption' => Yii::t('app', 'Gallery'), 'headerRowOptions' => ['class' => 'kartik-sheet-style', 'style' => 'background-color: #fdfdfd'], 'filterRowOptions' => ['class' => 'kartik-sheet-style skip-export', 'style' => 'background-color: #fdfdfd'], 'pjax' => true, 'bordered' => true, 'striped' => true, 'condensed' => true, 'responsive' => true, 'hover' => true, 'showPageSummary' => true, 'pageSummaryRowOptions' => ['class' => 'kv-page-summary', 'style' => 'background-color: #fdfdfd'], 'panel' => ['type' => GridView::TYPE_DEFAULT, 'heading' => false], 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['admin'], ['data-pjax' => true, 'class' => 'btn btn-default', 'title' => Yii::t('app', 'Reset Grid')])], '{export}', '{toggleData}'], 'beforeHeader' => [['options' => ['class' => 'skip-export']]], 'floatHeader' => true, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'title', 'format' => 'html', 'value' => function ($data) use($module) {
    return Html::img(str_replace($module->uploadURL . "/", $module->uploadURL . "/.thumbs/", $data->image), ['class' => 'pull-left', 'style' => 'margin:0 10px 10px 0']) . " " . Html::encode($data->title);
}], 'description', 'tags', ['attribute' => 'type', 'value' => function ($data) {
    return $data->itemAlias('type', $data->type);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('type'), 'options' => ['placeholder' => Yii::t('app', 'Select a status type...')], 'pluginOptions' => ['allowClear' => true]]], ['attribute' => 'status', 'value' => function ($data) {
    return $data->itemAlias('status', $data->status ? 1 : 0);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => $searchModel->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Select a status type...')], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn']]]);
?>

</div>