add shipping rules
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleNature;
|
||||
use App\Repositories\Shop\ArticleNatures;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ArticleNaturesDataTable extends DataTable
|
||||
{
|
||||
@@ -14,16 +14,18 @@ class ArticleNaturesDataTable extends DataTable
|
||||
public function query(ArticleNature $model)
|
||||
{
|
||||
$model = $model::withCount('Articles');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('product_type', function (ArticleNature $nature) {
|
||||
return ArticleNatures::getProductTypeName($nature->product_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
->editColumn('product_type', function (ArticleNature $nature) {
|
||||
return ArticleNatures::getProductTypeName($nature->product_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Article;
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ArticlesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'articles';
|
||||
|
||||
public $sortedColumn = 2;
|
||||
|
||||
public function query(Article $model)
|
||||
@@ -20,70 +20,77 @@ class ArticlesDataTable extends DataTable
|
||||
$model = self::filterByArticleNature($model);
|
||||
$model = self::filterByCategory($model);
|
||||
$model = self::filterByTag($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||
{
|
||||
$article_nature_id = $article_nature_id ? $article_nature_id : self::isFilteredByField('article_nature_id');
|
||||
|
||||
return $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
}
|
||||
|
||||
public static function filterByCategory($model, $category_id = false)
|
||||
{
|
||||
$category_id = $category_id ? $category_id : self::isFilteredByField('category_id');
|
||||
|
||||
return $category_id ? $model->byCategory($category_id) : $model;
|
||||
}
|
||||
|
||||
public static function filterByTag($model, $tag_id = false)
|
||||
{
|
||||
$tag_id = $tag_id ? $tag_id : self::isFilteredByField('tag_id');
|
||||
|
||||
return $tag_id ? $model->byTag($tag_id) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('visible', function (Article $article) {
|
||||
return view("components.form.toggle", [
|
||||
'name' => 'visible',
|
||||
'value' => $article->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id=' . $article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Article $article) {
|
||||
return view("components.form.toggle", [
|
||||
'name' => 'homepage',
|
||||
'value' => $article->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id=' . $article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->editColumn('thumb', function (Article $article) {
|
||||
$image = Articles::getFullImageByArticle($article);
|
||||
return Articles::getThumb($image, false);
|
||||
})
|
||||
->editColumn('article_nature.name', function (Article $article) {
|
||||
return $article->article_nature ? $article->article_nature->name : '';
|
||||
})
|
||||
->editColumn('tags2', function (Article $article) {
|
||||
$html = '';
|
||||
foreach ($article->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
return $html;
|
||||
})
|
||||
->editColumn('images_count2', function (Article $article) {
|
||||
return Articles::countFullImagesByArticle($article);
|
||||
})
|
||||
->rawColumns(['tags2', 'thumb', 'action']);
|
||||
->editColumn('visible', function (Article $article) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $article->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Article $article) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'homepage',
|
||||
'value' => $article->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$article->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->editColumn('thumb', function (Article $article) {
|
||||
$image = Articles::getFullImageByArticle($article);
|
||||
|
||||
return Articles::getThumb($image, false);
|
||||
})
|
||||
->editColumn('article_nature.name', function (Article $article) {
|
||||
return $article->article_nature ? $article->article_nature->name : '';
|
||||
})
|
||||
->editColumn('tags2', function (Article $article) {
|
||||
$html = '';
|
||||
foreach ($article->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->editColumn('images_count2', function (Article $article) {
|
||||
return Articles::countFullImagesByArticle($article);
|
||||
})
|
||||
->rawColumns(['tags2', 'thumb', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Category;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CategoriesDataTable extends DataTable
|
||||
{
|
||||
@@ -13,46 +13,49 @@ class CategoriesDataTable extends DataTable
|
||||
public function query(Category $model)
|
||||
{
|
||||
$model = $model::notRoot()->with(['tags.articles'])->withCount(['articles', 'tags']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('name', function (Category $category) {
|
||||
return $category->name;
|
||||
})
|
||||
->editColumn('visible', function (Category $category) {
|
||||
return view("components.form.toggle", [
|
||||
'name' => 'visible',
|
||||
'value' => $category->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id=' . $category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Category $category) {
|
||||
return view("components.form.toggle", [
|
||||
'name' => 'homepage',
|
||||
'value' => $category->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id=' . $category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->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']);
|
||||
->editColumn('name', function (Category $category) {
|
||||
return $category->name;
|
||||
})
|
||||
->editColumn('visible', function (Category $category) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $category->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->editColumn('homepage', function (Category $category) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'homepage',
|
||||
'value' => $category->homepage,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$category->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'homepage',
|
||||
]);
|
||||
})
|
||||
->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);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\CustomerAddress;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerAddressesDataTable extends DataTable
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerDeliveriesDataTable extends DataTable
|
||||
{
|
||||
|
||||
@@ -2,25 +2,27 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Orders;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerOrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$customer_id = Auth::id();
|
||||
$model = $model->byCustomer($customer_id)->with(['delivery']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -37,6 +39,7 @@ class CustomerOrdersDataTable extends DataTable
|
||||
return InvoicePayments::getPaymentType($order->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Customer;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomersDataTable extends DataTable
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class CustomersDataTable extends DataTable
|
||||
public function query(Customer $model)
|
||||
{
|
||||
$model = $model->with('addresses');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Delivery;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveriesDataTable extends DataTable
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class DeliveriesDataTable extends DataTable
|
||||
public function query(Delivery $model)
|
||||
{
|
||||
$model = $model->with('sale_channel');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -20,18 +21,19 @@ class DeliveriesDataTable extends DataTable
|
||||
{
|
||||
$datatables
|
||||
->editColumn('active', function (Delivery $delivery) {
|
||||
return view("components.form.toggle", [
|
||||
return view('components.form.toggle', [
|
||||
'value' => $delivery->active,
|
||||
'on' => __('active'),
|
||||
'off' => __('inactive'),
|
||||
'meta' => 'data-id=' . $delivery->id,
|
||||
'meta' => 'data-id='.$delivery->id,
|
||||
'size' => 'sm',
|
||||
]);
|
||||
})
|
||||
->editColumn('address', function (Delivery $delivery) {
|
||||
return $delivery->address . ' ' . $delivery->zipcode . ' ' . $delivery->city;
|
||||
return $delivery->address.' '.$delivery->zipcode.' '.$delivery->city;
|
||||
})
|
||||
->rawColumns(['active', 'address', 'action']);
|
||||
->rawColumns(['active', 'address', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
27
app/Datatables/Shop/DeliveryPackagesDataTable.php
Normal file
27
app/Datatables/Shop/DeliveryPackagesDataTable.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryPackage;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryPackagesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_packages';
|
||||
|
||||
public function query(DeliveryPackage $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('weight')->title('Poids'),
|
||||
Column::make('weight_flyer')->title('Flyer'),
|
||||
Column::make('weight_packaging')->title('Packaging'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
29
app/Datatables/Shop/DeliveryTypeCalculationsDataTable.php
Normal file
29
app/Datatables/Shop/DeliveryTypeCalculationsDataTable.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryTypeCalculation;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryTypeCalculationsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_type_calculations';
|
||||
|
||||
public function query(DeliveryTypeCalculation $model)
|
||||
{
|
||||
$model = $model->with('delivery_type');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('delivery_type.name')->title('Nom'),
|
||||
Column::make('weight')->title('Poids en g')->addClass('text-right'),
|
||||
Column::make('price')->title('Prix')->addClass('text-right'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Datatables/Shop/DeliveryTypesDataTable.php
Normal file
25
app/Datatables/Shop/DeliveryTypesDataTable.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\DeliveryType;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class DeliveryTypesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'delivery_types';
|
||||
|
||||
public function query(DeliveryType $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name')->title('Nom'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Homepage;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class HomepagesDataTable extends DataTable
|
||||
{
|
||||
@@ -18,6 +18,7 @@ class HomepagesDataTable extends DataTable
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables->rawColumns(['text', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
@@ -14,6 +14,7 @@ class InvoicesDataTable extends DataTable
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$model = $model->with('customer');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -27,9 +28,10 @@ class InvoicesDataTable extends DataTable
|
||||
return $invoice->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Invoice $invoice) {
|
||||
return ($invoice->customer ?? false) ? $invoice->customer->last_name . ' ' . $invoice->customer->first_name : '';
|
||||
return ($invoice->customer ?? false) ? $invoice->customer->last_name.' '.$invoice->customer->first_name : '';
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Merchandise;
|
||||
use App\Repositories\Shop\Merchandises;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class MerchandisesDataTable extends DataTable
|
||||
{
|
||||
@@ -15,10 +15,10 @@ class MerchandisesDataTable extends DataTable
|
||||
public function query(Merchandise $model)
|
||||
{
|
||||
$model = $model::with(['image', 'tags'])->withCount(['Articles', 'tags', 'images']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
@@ -30,13 +30,14 @@ class MerchandisesDataTable extends DataTable
|
||||
foreach ($merchandise->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -2,33 +2,37 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Offer;
|
||||
use App\Repositories\Shop\Offers;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class OffersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'offers';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public function query(Offer $model)
|
||||
{
|
||||
$model = $model->with(['article.article_nature', 'variation', 'tariff'])->select($model->getTable() . '.*');
|
||||
$model = $model->with(['article.article_nature', 'variation', 'tariff'])->select($model->getTable().'.*');
|
||||
$model = self::filterByArticleNature($model);
|
||||
$model = self::filterByPackage($model);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||
{
|
||||
$article_nature_id = $article_nature_id ? $article_nature_id : self::isFilteredByField('article_nature_id');
|
||||
|
||||
return $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
}
|
||||
|
||||
public static function filterByPackage($model, $package_id = false)
|
||||
{
|
||||
$package_id = $package_id ? $package_id : self::isFilteredByField('package_id');
|
||||
|
||||
return $package_id ? $model->byPackage($package_id) : $model;
|
||||
}
|
||||
|
||||
@@ -36,10 +40,10 @@ class OffersDataTable extends DataTable
|
||||
{
|
||||
$datatables
|
||||
->editColumn('thumb', function (Offer $offer) {
|
||||
return '<img src="' . Offers::getThumbSrc($offer) . '">';
|
||||
return '<img src="'.Offers::getThumbSrc($offer).'">';
|
||||
})
|
||||
->editColumn('status_id', function (Offer $offer) {
|
||||
return view("components.form.toggle", [
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'status_id',
|
||||
'value' => $offer->status_id,
|
||||
'on' => __('active'),
|
||||
@@ -49,9 +53,10 @@ class OffersDataTable extends DataTable
|
||||
]);
|
||||
})
|
||||
->editColumn('stock_delayed', function (Offer $offer) {
|
||||
return $offer->stock_delayed . ' - ' . $offer->delay_type;
|
||||
return $offer->stock_delayed.' - '.$offer->delay_type;
|
||||
})
|
||||
->rawColumns(['active', 'thumb', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,23 +2,26 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Orders;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$model = $model->with(['customer', 'delivery']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -32,12 +35,13 @@ class OrdersDataTable extends DataTable
|
||||
return $order->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Order $order) {
|
||||
return $order->customer->last_name . ' ' . $order->customer->first_name;
|
||||
return $order->customer->last_name.' '.$order->customer->first_name;
|
||||
})
|
||||
->editColumn('payment_type', function (Order $order) {
|
||||
return InvoicePayments::getPaymentType($order->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Package;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PackagesDataTable extends DataTable
|
||||
{
|
||||
@@ -12,7 +12,8 @@ class PackagesDataTable extends DataTable
|
||||
|
||||
public function query(Package $model)
|
||||
{
|
||||
$model = $model->withCount(['variations','offers']);
|
||||
$model = $model->withCount(['variations', 'offers']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceGenericCategory;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PriceGenericCategoriesDataTable extends DataTable
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class PriceGenericCategoriesDataTable extends DataTable
|
||||
public function query(PriceGenericCategory $model)
|
||||
{
|
||||
$model = $model->withCount('price_generics');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceList;
|
||||
use App\Repositories\Shop\PriceLists;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PriceListsDataTable extends DataTable
|
||||
{
|
||||
@@ -20,12 +20,14 @@ class PriceListsDataTable extends DataTable
|
||||
{
|
||||
$model = $model->with(['sale_channel', 'price_list_values']);
|
||||
$model = self::filterByTariff($model);
|
||||
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
@@ -39,6 +41,7 @@ class PriceListsDataTable extends DataTable
|
||||
return view('Admin.Shop.PriceLists.partials.table-prices', ['prices' => $price_list['price_list_values']]);
|
||||
})
|
||||
->rawColumns(['tariff_id', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Producer;
|
||||
use App\Repositories\Shop\Producers;
|
||||
use App\Repositories\Shop\Tags;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class ProducersDataTable extends DataTable
|
||||
{
|
||||
@@ -15,10 +15,10 @@ class ProducersDataTable extends DataTable
|
||||
public function query(Producer $model)
|
||||
{
|
||||
$model = $model::with(['image', 'tags'])->withCount(['Merchandises', 'tags', 'images']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
@@ -30,13 +30,14 @@ class ProducersDataTable extends DataTable
|
||||
foreach ($producer->tags as $tag) {
|
||||
$html .= Tags::getTagHtml($tag);
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['thumb', 'tags2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\SaleChannel;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class SaleChannelsDataTable extends DataTable
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class SaleChannelsDataTable extends DataTable
|
||||
public function query(SaleChannel $model)
|
||||
{
|
||||
$model = $model->withCount(['deliveries', 'tariffs']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,36 +2,39 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagGroup;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TagGroupsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tag_groups';
|
||||
|
||||
public $sortedColumn = 2;
|
||||
|
||||
public function query(TagGroup $model)
|
||||
{
|
||||
$model = $model::with('article_family')->withCount('tags');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('visible', function (TagGroup $tag_group) {
|
||||
return view("components.form.toggle", [
|
||||
'name' => 'visible',
|
||||
'value' => $tag_group->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id=' . $tag_group->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->rawColumns(['visible', 'action']);
|
||||
->editColumn('visible', function (TagGroup $tag_group) {
|
||||
return view('components.form.toggle', [
|
||||
'name' => 'visible',
|
||||
'value' => $tag_group->visible,
|
||||
'on' => __('oui'),
|
||||
'off' => __('non'),
|
||||
'meta' => 'data-id='.$tag_group->id,
|
||||
'size' => 'sm',
|
||||
'class' => 'visible',
|
||||
]);
|
||||
})
|
||||
->rawColumns(['visible', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'tags';
|
||||
|
||||
public $rowReorder = ['selector' => 'tr'];
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
$model = $model::with('tag_group')->withCount(['articles', 'shelves', 'species', 'varieties']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -24,6 +26,7 @@ class TagsDataTable extends DataTable
|
||||
return $tag->name;
|
||||
})
|
||||
->rawColumns(['active', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tariff;
|
||||
use App\Repositories\Shop\Tariffs;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class TariffsDataTable extends DataTable
|
||||
{
|
||||
@@ -14,6 +14,7 @@ class TariffsDataTable extends DataTable
|
||||
public function query(Tariff $model)
|
||||
{
|
||||
$model = $model->with(['sale_channels'])->withCount(['price_lists', 'offers']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -26,11 +27,13 @@ class TariffsDataTable extends DataTable
|
||||
->editColumn('sale_channels2', function (Tariff $tariff) {
|
||||
$html = '';
|
||||
foreach ($tariff->sale_channels as $sale_channel) {
|
||||
$html .= $sale_channel->code . ', ';
|
||||
$html .= $sale_channel->code.', ';
|
||||
}
|
||||
|
||||
return $html;
|
||||
})
|
||||
->rawColumns(['sale_channels2', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Unity;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class UnitiesDataTable extends DataTable
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Datatables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Variation;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class VariationsDataTable extends DataTable
|
||||
{
|
||||
@@ -13,6 +13,7 @@ class VariationsDataTable extends DataTable
|
||||
public function query(Variation $model)
|
||||
{
|
||||
$model = $model->with(['package', 'unity'])->withCount('offers');
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ class VariationsDataTable extends DataTable
|
||||
return $variation->unity ? $variation->unity->value : '';
|
||||
})
|
||||
->rawColumns(['description', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user