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