minor fixes

This commit is contained in:
ludo
2023-12-09 21:02:28 +01:00
parent b5da5fc881
commit 2a429e4163
49 changed files with 448 additions and 266 deletions

View File

@@ -13,10 +13,18 @@ class CustomersDataTable extends DataTable
public function query(Customer $model)
{
$model = $model->with('addresses');
$model = self::filterBySaleChannel($model);
return $this->buildQuery($model);
}
public static function filterBySaleChannel($model, $sale_channel_id = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
}
protected function getColumns()
{
return [

View File

@@ -13,10 +13,18 @@ class DeliveriesDataTable extends DataTable
public function query(Delivery $model)
{
$model = $model->with('sale_channel');
$model = self::filterBySaleChannel($model);
return $this->buildQuery($model);
}
public static function filterBySaleChannel($model, $sale_channel_id = false)
{
$sale_channel_id = $sale_channel_id ? $sale_channel_id : self::isFilteredByField('sale_channel_id');
return $sale_channel_id ? $model->bySaleChannel($sale_channel_id) : $model;
}
public function modifier($datatables)
{
$datatables
@@ -26,7 +34,7 @@ class DeliveriesDataTable extends DataTable
'on' => __('active'),
'off' => __('inactive'),
'meta' => 'data-id='.$delivery->id,
'size' => 'sm',
'size' => 'xs',
]);
})
->editColumn('is_public', function (Delivery $delivery) {

View File

@@ -12,7 +12,7 @@ class SaleChannelsDataTable extends DataTable
public function query(SaleChannel $model)
{
$model = $model->withCount(['deliveries', 'tariffs']);
$model = $model->withCount(['customers', 'deliveries', 'tariffs']);
return $this->buildQuery($model);
}
@@ -22,6 +22,7 @@ class SaleChannelsDataTable extends DataTable
return [
Column::make('code')->title('Code abrégé')->width(100),
Column::make('name')->title('Nom'),
Column::make('customers_count')->title('#Clients')->searchable(false)->class('text-right'),
Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'),
Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'),
$this->makeColumnButtons(),