Fixes for deliveries vs sale_channels
This commit is contained in:
@@ -20,7 +20,7 @@ class ArticleNaturesDataTable extends DataTable
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->addClass('text-right')->searchable(false),
|
||||
Column::make('articles_count')->title('#Art')->addClass('text-right')->searchable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class ArticlesDataTable extends DataTable
|
||||
->editColumn('tags2', function (Article $article) {
|
||||
$html = '';
|
||||
foreach ($article->tags as $tag) {
|
||||
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
|
||||
$html .= '<span class="btn btn-xs btn-success pb-2">' . $tag->slug . '</span> ';
|
||||
}
|
||||
return $html;
|
||||
})
|
||||
|
||||
@@ -12,15 +12,42 @@ class CategoriesDataTable extends DataTable
|
||||
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::withCount('articles');
|
||||
$model = $model::with(['tags.articles'])->withCount(['articles', 'tags']);
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('visible', function (Category $category) {
|
||||
return view("components.form.toggle", [
|
||||
'value' => $category->visible,
|
||||
'on' => __('visible'),
|
||||
'off' => __('invisible'),
|
||||
'meta' => 'data-id=' . $category->id,
|
||||
'size' => 'sm',
|
||||
]);
|
||||
})
|
||||
->editColumn('articles_tagged_count', function (Category $category) {
|
||||
$count = 0;
|
||||
foreach ($category->tags as $tag) {
|
||||
$nb = collect($tag->articles)->count();
|
||||
$count += $nb;
|
||||
}
|
||||
return $count;
|
||||
})
|
||||
->rawColumns(['visible', 'action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('visible')->title('visible')->width(60)->title(''),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb Articles')->class('text-right')->searchable(false),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('tags_count')->title('#Tags')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('articles_tagged_count')->title('#ArtTag')->class('text-right')->searchable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
28
app/Datatables/Shop/CustomerDeliveriesDataTable.php
Normal file
28
app/Datatables/Shop/CustomerDeliveriesDataTable.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
|
||||
class CustomerDeliveriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customer_deliveries';
|
||||
|
||||
public function query(Customer $model)
|
||||
{
|
||||
return $this->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'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,7 @@ class CustomersDataTable extends DataTable
|
||||
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'),
|
||||
Column::make('last_name')->title('Nom'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ class OffersDataTable extends DataTable
|
||||
{
|
||||
return [
|
||||
Column::make('status_id')->title('')->width(40),
|
||||
Column::make('article.name')->title('Article'),
|
||||
Column::make('article.article_nature.name')->title('Nature'),
|
||||
Column::make('article.name')->title('Article'),
|
||||
Column::make('variation.name')->title('Déclinaison'),
|
||||
Column::make('tariff.name')->title('Tarif'),
|
||||
Column::make('stock_current')->title('Appro im'),
|
||||
|
||||
@@ -18,7 +18,7 @@ class PriceListsDataTable extends DataTable
|
||||
|
||||
public function query(PriceList $model)
|
||||
{
|
||||
$model = $model->with(['sale_channel','price_list_values']);
|
||||
$model = $model->with(['sale_channel', 'price_list_values']);
|
||||
$model = self::filterByTariff($model);
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class PriceListsDataTable extends DataTable
|
||||
->editColumn('tariff_id', function (PriceList $price_list) {
|
||||
return view('Admin.Shop.PriceLists.partials.table-prices', ['prices' => $price_list['price_list_values']]);
|
||||
})
|
||||
->rawColumns(['tariff_id','action']);
|
||||
->rawColumns(['tariff_id', 'action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('tags_count')->title('Nb de tags')->searchable(false)->addClass('text-right'),
|
||||
Column::make('tags_count')->title('#Tags')->searchable(false)->addClass('text-right')->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ class TagsDataTable extends DataTable
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('group.name')->title('Groupe'),
|
||||
Column::make('group.name')->title('Groupe')->width(200),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false),
|
||||
Column::make('species_count')->title('#Esp')->class('text-right')->searchable(false),
|
||||
Column::make('varieties_count')->title('#Var')->class('text-right')->searchable(false),
|
||||
Column::make('shelves_count')->title('#Ray')->class('text-right')->searchable(false),
|
||||
Column::make('articles_count')->title('#Art')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('species_count')->title('#Esp')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('varieties_count')->title('#Var')->class('text-right')->searchable(false)->width(60),
|
||||
Column::make('shelves_count')->title('#Ray')->class('text-right')->searchable(false)->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -30,10 +30,9 @@ class TariffsDataTable extends DataTable
|
||||
}
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['sale_channels2', 'action'])
|
||||
;
|
||||
->rawColumns(['sale_channels2', 'action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ class VariationsDataTable extends DataTable
|
||||
|
||||
public function query(Variation $model)
|
||||
{
|
||||
$model = $model->with(['package','unity'])->withCount('offers');
|
||||
$model = $model->with(['package', 'unity'])->withCount('offers');
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,9 @@ class VariationsDataTable extends DataTable
|
||||
->editColumn('unity_value', function (Variation $variation) {
|
||||
return $variation->unity ? $variation->unity->value : '';
|
||||
})
|
||||
->rawColumns(['description','action'])
|
||||
;
|
||||
->rawColumns(['description', 'action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user