Fix Typo
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class FamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'families';
|
||||
|
||||
public function query(Family $model)
|
||||
{
|
||||
$model = $model::withCount(['genres','species','varieties']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('genres_count')->title('Nb genres')->searchable(false)->addClass('text-right'),
|
||||
Column::make('species_count')->title('Nb espèces')->searchable(false)->addClass('text-right'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Genre;
|
||||
|
||||
class GenresDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'genres';
|
||||
|
||||
public function query(Genre $model)
|
||||
{
|
||||
$model = $model::with('family')->withCount('species')->withCount('varieties');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('family_name', function(Genre $genre) {
|
||||
return $genre->family ? $genre->family->name : '';
|
||||
})
|
||||
->rawColumns(['genre_name', 'action'])
|
||||
;
|
||||
return Parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('family.name')->data('family_name')->title('Famille'),
|
||||
Column::make('species_count')->title('Nb Espèces')->searchable(false)->addClass('text-right'),
|
||||
Column::make('varieties_count')->title('Nb Variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Specie;
|
||||
|
||||
class SpeciesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'species';
|
||||
|
||||
public function query(Specie $model)
|
||||
{
|
||||
$model = $model::withCount('varieties')->with('genre');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('genre_name', function(Specie $specie) {
|
||||
return $specie->genre ? $specie->genre->name : '';
|
||||
})
|
||||
->rawColumns(['genre_name', 'action'])
|
||||
;
|
||||
return Parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
||||
Column::make('latin'),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Botanic;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Botanic\Variety;
|
||||
|
||||
class VarietiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'varieties';
|
||||
|
||||
public function query(Variety $model)
|
||||
{
|
||||
// $model = $model::with('specie')->withCount('Articles')->select('botanic_varieties.*');
|
||||
$model = $model::joinRelations('Specie')->select('botanic_varieties.*','botanic_species.name as specie_name')->with('Specie')->withCount('Articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('Specie.name')->data('specie_name')->title('Espèce'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables;
|
||||
|
||||
use Yajra\DataTables\Html\Button;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use Yajra\DataTables\Html\Editor\Editor;
|
||||
use Yajra\DataTables\Html\Editor\Fields;
|
||||
use Yajra\DataTables\Services\DataTable;
|
||||
|
||||
class ParentDataTable extends DataTable
|
||||
{
|
||||
public $rowReorder = true;
|
||||
public $rowReorderSelector; // ['selector' => 'tr']
|
||||
public $colReorder = false;
|
||||
public $fixedColumns = false;
|
||||
public $scrollX = false;
|
||||
public $scrollCollapse = true;
|
||||
public $sortedColumn = 0;
|
||||
public $sortedOrder = 'asc';
|
||||
public $stateSave = false;
|
||||
|
||||
/**
|
||||
* Build DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function dataTable($query)
|
||||
{
|
||||
return $this->modifier(datatables()->eloquent($query));
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
return $this->addButtons($datatables->setRowId('{{$id}}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add buttons DataTable class.
|
||||
*
|
||||
* @param mixed $query Results from query() method.
|
||||
* @return \Yajra\DataTables\DataTableAbstract
|
||||
*/
|
||||
public function addButtons($datatables)
|
||||
{
|
||||
return $datatables->addColumn('action', $this->getHtmlButtons());
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
|
||||
// $buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||
// $buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-leaf-alt"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-pencil-alt"></i></button>';
|
||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
||||
return $buttons;
|
||||
// return view('components.datatables.buttons.row_action');
|
||||
}
|
||||
|
||||
public function makeColumnButtons()
|
||||
{
|
||||
return Column::computed('action')
|
||||
->title('')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->searchable(false)
|
||||
->width("74")
|
||||
->addClass('text-center text-nowrap');
|
||||
}
|
||||
|
||||
public static function isFilteredByField($field)
|
||||
{
|
||||
return (request()->has('filters.' . $field)) ? request()->input('filters.'. $field) : (request()->has($field) ? request()->input($field) : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get query source of dataTable.
|
||||
*
|
||||
* @param \App\Family $model
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function buildQuery($model)
|
||||
{
|
||||
return $model->newQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function html()
|
||||
{
|
||||
return $this->buildHtml(strtolower($this->model_name) . '-table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional method if you want to use html builder.
|
||||
*
|
||||
* @return \Yajra\DataTables\Html\Builder
|
||||
*/
|
||||
public function buildHtml($table_id = false, $selector = false)
|
||||
{
|
||||
$table_id = $table_id ? $table_id : strtolower($this->model_name) . '-table';
|
||||
$selector = $selector ? $selector : '#' . $this->model_name . '-filters';
|
||||
return $this->builder()
|
||||
->setTableId($table_id)
|
||||
->parameters($this->getParameters())
|
||||
->columns($this->getColumns())
|
||||
->ajax([
|
||||
'data' => 'function(d) { d.filters = $("' . $selector . '").serializeJSON(); }',
|
||||
'url' => isset($this->url) ? $this->url : ''
|
||||
])
|
||||
->dom($this->getDom())
|
||||
->orderBy($this->sortedColumn,$this->sortedOrder)
|
||||
->buttons($this->getButtons());
|
||||
}
|
||||
|
||||
public function getButtons() {
|
||||
return [
|
||||
Button::make('export'),
|
||||
Button::make('print'),
|
||||
Button::make('colvis'),
|
||||
Button::make('columnsToggle')
|
||||
];
|
||||
}
|
||||
|
||||
public function getParameters()
|
||||
{
|
||||
$data = [
|
||||
'pageLength' => 5,
|
||||
'scrollX' => $this->scrollX,
|
||||
'scrollCollapse' => $this->scrollCollapse,
|
||||
'searchDelay' => 500,
|
||||
'colReorder' => $this->colReorder,
|
||||
'fixedColumns' => $this->fixedColumns,
|
||||
// 'autoWidth' => false,
|
||||
'stateSave' => $this->stateSave
|
||||
];
|
||||
if ($this->rowReorder) {
|
||||
$data['rowReorder'] = ['selector' => $this->rowReorderSelector];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDom()
|
||||
{
|
||||
$dom = '';
|
||||
// $dom .= $this->getDatatablesHeaderDefault();
|
||||
$dom .= "rt";
|
||||
$dom .= $this->getDatatablesFooterDefault();
|
||||
return $dom;
|
||||
}
|
||||
|
||||
public function getDatatablesHeader() {
|
||||
return view('components.datatables.header');
|
||||
}
|
||||
|
||||
public function getDatatablesHeaderDefault() {
|
||||
// return "<div class'row'><div class='col'></div></div>";
|
||||
/*
|
||||
|
||||
$dom = 't<"row datatable-pager light"<"col-md-12"'
|
||||
. '<"datatable-more-export-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-more-export-favorites-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-more-export-basket-buttons filter-buttons pull-left">'
|
||||
. '<"datatable-download-buttons filter-buttons pull-left">'
|
||||
. '>>'
|
||||
. '<"dt-toolbar-footer"<"col"i><"col pull-right datatable-pager light nopadding-right"p>>';
|
||||
|
||||
*/
|
||||
|
||||
$dom = "<'row dt-toolbar-header'<'col-lg-4'l><'col-lg-4'B><'col-lg-4 text-right add'f>>";
|
||||
return $dom;
|
||||
// return 't<"row datatable-pager light"<"col-md-12"<"datatable-more-export-buttons filter-buttons pull-left"><"datatable-more-export-favorites-buttons filter-buttons pull-left"><"datatable-more-export-basket-buttons filter-buttons pull-left"><"datatable-download-buttons filter-buttons pull-left">>><"dt-toolbar-footer"<"col-md-6"i><"col-md-6 pull-right datatable-pager light nopadding-right"p>>';
|
||||
|
||||
}
|
||||
|
||||
public function getDatatablesFooterDefault() {
|
||||
return "<'row pt-3 dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function filename()
|
||||
{
|
||||
return self::buildFilename($this->model_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get filename for export.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function buildFilename($name)
|
||||
{
|
||||
return $name . '_' . date('YmdHis');
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleFamily;
|
||||
|
||||
class ArticleFamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'article_families';
|
||||
|
||||
public function query(ArticleFamily $model)
|
||||
{
|
||||
$model = $model::withCount('Articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'articles';
|
||||
|
||||
public function query(Article $model)
|
||||
{
|
||||
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
||||
$model = $model::with('article_family')->select('shop_articles.*');
|
||||
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article_family.name')->title('Famille')->orderable(false),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'categories';
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::withCount('articles');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customers';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status.name'),
|
||||
Column::make('customer.name'),
|
||||
Column::make('total'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Package;
|
||||
|
||||
class PackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'packages';
|
||||
|
||||
public function query(Package $model)
|
||||
{
|
||||
$model = $model::with(['article_family'])->select('shop_packages.*');
|
||||
$model = self::filterByFamily($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByFamily($model, $family_id = false)
|
||||
{
|
||||
$family_id = $family_id ? $family_id : self::isFilteredByField('family_id');
|
||||
return $family_id ? $model->byArticleFamily($family_id) : $model;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article_family.name')->title('Famille d\'articles'),
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceGenericCategory;
|
||||
|
||||
class PriceGenericCategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_generic_categories';
|
||||
|
||||
public function query(PriceGenericCategory $model)
|
||||
{
|
||||
$model = $model->withCount('price_generics');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('price_generics_count')->title('Nb Tarifs')->class('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceGeneric;
|
||||
|
||||
class PriceGenericsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_generics';
|
||||
|
||||
public function query(PriceGeneric $model)
|
||||
{
|
||||
$model = $model::with(['category','priceByUnit'])->withCount('prices');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('category.name')->title('Catégorie'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('price_by_unit.price')->title('Prix HT')->class('text-right'),
|
||||
Column::make('price_by_unit.price_taxed')->title('Prix TTC')->class('text-right'),
|
||||
Column::make('prices_count')->title('Nb tarifs')->class('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagGroup;
|
||||
|
||||
class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tag_groups';
|
||||
|
||||
public function query(TagGroup $model)
|
||||
{
|
||||
$model = $model::withCount('tags');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('tags_count')->title('Nb de tags')->searchable(false)->addClass('text-right'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tags';
|
||||
public $rowReorder = ['selector' => 'tr'];
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
$model = $model::with('group')->select(['tags.*']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('group.name')->title('Groupe'),
|
||||
Column::make('sort_order')->title('Ordre'),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Unity;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'unities';
|
||||
|
||||
public function query(Unity $model)
|
||||
{
|
||||
$model = $model::with(['package.article_family'])->select('shop_unities.*');
|
||||
$model = self::filterByFamily($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByFamily($model, $family_id = false)
|
||||
{
|
||||
$family_id = $family_id ? $family_id : self::isFilteredByField('family_id');
|
||||
return $family_id ? $model->byArticleFamily($family_id) : $model;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('package.article_family.name')->title('Famille'),
|
||||
Column::make('package.value')->title('Package'),
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user