card serch
This commit is contained in:
parent
c7f56937df
commit
4b498c7fc6
@ -15,17 +15,21 @@ use kernel\widgets\IconBtn\IconBtnDeleteWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnEditWidget;
|
||||
use kernel\widgets\IconBtn\IconBtnViewWidget;
|
||||
|
||||
$view->setTitle("Список card");
|
||||
$view->setTitle("Список карт");
|
||||
$view->setMeta([
|
||||
'description' => 'Список card системы'
|
||||
'description' => 'Список карт системы'
|
||||
]);
|
||||
|
||||
$get = (new \kernel\Request())->get();
|
||||
|
||||
//Для использования таблицы с моделью, необходимо создать таблицу в базе данных
|
||||
$table = new ListEloquentTable(new EloquentDataProvider(Card::query()->orderBy("id", "DESC"), [
|
||||
'currentPage' => $page_number,
|
||||
'perPage' => 8,
|
||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||
'baseUrl' => "/admin/card",
|
||||
'searchPrefix' => "",
|
||||
'searchParams' => $get,
|
||||
'fillable' => [
|
||||
'user_id',
|
||||
'balance',
|
||||
@ -49,7 +53,8 @@ $table->columns([
|
||||
],
|
||||
"username" => [
|
||||
"filter" => [
|
||||
"class" => \Itguild\Tables\Filter\InputTextFilter::class
|
||||
"class" => \Itguild\Tables\Filter\InputTextFilter::class,
|
||||
'value' => $get['username'] ?? ''
|
||||
]
|
||||
],
|
||||
'card_file_id' => [
|
||||
@ -61,35 +66,23 @@ $table->columns([
|
||||
'status' => [
|
||||
'value' => function ($data) {
|
||||
return Card::getStatus()[$data];
|
||||
}
|
||||
},
|
||||
'filter' => [
|
||||
'class' => \kernel\filters\BootstrapSelectFilter::class,
|
||||
'params' => [
|
||||
'options' => Card::getStatus(),
|
||||
'prompt' => 'Не выбрано'
|
||||
],
|
||||
'value' => $get['status'] ?? '',
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
//$table = new \Itguild\Tables\ListJsonTable(json_encode(
|
||||
// [
|
||||
// 'meta' => [
|
||||
// 'total' => 0,
|
||||
// 'totalWithFilters' => 0,
|
||||
// 'columns' => [
|
||||
// 'title',
|
||||
// 'slug',
|
||||
// 'status',
|
||||
// ],
|
||||
// 'perPage' => 5,
|
||||
// 'currentPage' => 1,
|
||||
// 'baseUrl' => '/admin/some',
|
||||
// 'params' => [
|
||||
// 'class' => 'table table-bordered',
|
||||
// 'border' => 2
|
||||
// ]
|
||||
// ],
|
||||
// 'filters' => [],
|
||||
// 'data' => [],
|
||||
// ]
|
||||
//));
|
||||
|
||||
$table->beforePrint(function () {
|
||||
return IconBtnCreateWidget::create(['url' => '/admin/card/create'])->run();
|
||||
$table->beforePrint(function () use ($table) {
|
||||
$count = $table->getCollection()->count();
|
||||
$html = IconBtnCreateWidget::create(['url' => '/admin/card/create'])->run();
|
||||
$html .= "<div>Всего записей: $count</div>";
|
||||
return $html;
|
||||
});
|
||||
|
||||
$table->addAction(function($row) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user