Add new version in repository
This commit is contained in:
@@ -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(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
27
app/Datatables/Shop/ArticleNaturesDataTable.php
Normal file
27
app/Datatables/Shop/ArticleNaturesDataTable.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleNature;
|
||||
|
||||
class ArticleNaturesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'article_natures';
|
||||
|
||||
public function query(ArticleNature $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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,24 +8,22 @@ use App\Models\Shop\Article;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'articles';
|
||||
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(),
|
||||
];
|
||||
|
||||
}
|
||||
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_nature')->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_nature.name')->title('Nature')->orderable(false),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,21 +8,20 @@ use App\Models\Shop\Category;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'categories';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,22 +8,21 @@ use App\Models\Shop\Customer;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customers';
|
||||
public $model_name = 'customers';
|
||||
|
||||
public function query(Customer $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(),
|
||||
];
|
||||
}
|
||||
public function query(Customer $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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,21 +8,20 @@ use App\Models\Shop\Invoice;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Invoices';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
28
app/Datatables/Shop/OffersDataTable.php
Normal file
28
app/Datatables/Shop/OffersDataTable.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\Offer;
|
||||
|
||||
class OffersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tariffs';
|
||||
|
||||
public function query(Offer $model)
|
||||
{
|
||||
$model = $model->with(['article','variation','tariff'])->select(['shop_offers.*']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('article.name')->title('Article'),
|
||||
Column::make('variation.name')->title('Déclinaison'),
|
||||
Column::make('tariff.name')->title('Tarif'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,18 @@ use App\Models\Shop\Order;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
public $model_name = 'orders';
|
||||
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
public function query(Product $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,28 +8,18 @@ use App\Models\Shop\Package;
|
||||
|
||||
class PackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'packages';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
public function query(Package $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,21 +8,20 @@ use App\Models\Shop\PriceGenericCategory;
|
||||
|
||||
class PriceGenericCategoriesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_generic_categories';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
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(),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
38
app/Datatables/Shop/PriceListsDataTable.php
Normal file
38
app/Datatables/Shop/PriceListsDataTable.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceList;
|
||||
|
||||
class PriceListsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_lists';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.PriceLists.index');
|
||||
}
|
||||
|
||||
public function query(PriceList $model)
|
||||
{
|
||||
$model = self::filterByTariff($model);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByTariff($model, $tariff_id = false)
|
||||
{
|
||||
$tariff_id = $tariff_id ? $tariff_id : self::isFilteredByField('tariff_id');
|
||||
return $tariff_id ? $model->byTariff($tariff_id) : $model;
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Datatables/Shop/SaleChannelsDataTable.php
Normal file
25
app/Datatables/Shop/SaleChannelsDataTable.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\SaleChannel;
|
||||
|
||||
class SaleChannelsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'sale_channels';
|
||||
|
||||
public function query(SaleChannel $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,21 +8,20 @@ use App\Models\Shop\TagGroup;
|
||||
|
||||
class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tag_groups';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,23 +8,22 @@ use App\Models\Shop\Tag;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tags';
|
||||
public $rowReorder = ['selector' => 'tr'];
|
||||
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(),
|
||||
];
|
||||
}
|
||||
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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
29
app/Datatables/Shop/TariffsDataTable.php
Normal file
29
app/Datatables/Shop/TariffsDataTable.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tariff;
|
||||
|
||||
class TariffsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tariffs';
|
||||
|
||||
public function query(Tariff $model)
|
||||
{
|
||||
$model = $model->with(['sale_channel'])->select(['shop_tariffs.*']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('sale_channel.name')->title('Canal de vente'),
|
||||
Column::make('code')->title('Code'),
|
||||
Column::make('ref')->title('Référence'),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,29 +8,18 @@ use App\Models\Shop\Unity;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'unities';
|
||||
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(),
|
||||
];
|
||||
}
|
||||
public function query(Unity $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('value')->title('Valeur'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
28
app/Datatables/Shop/VariationsDataTable.php
Normal file
28
app/Datatables/Shop/VariationsDataTable.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\Variation;
|
||||
|
||||
class VariationsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'variations';
|
||||
|
||||
public function query(Variation $model)
|
||||
{
|
||||
$model = $model->with(['package','unity']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('package.value')->title('Package'),
|
||||
Column::make('quantity')->title('Quantité')->class('text-right'),
|
||||
Column::make('unity.value')->title('Unité'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user