fixes
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\CustomerAddress;
|
||||
use App\Repositories\Shop\CustomerAddresses;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerAddressesDataTable extends DataTable
|
||||
@@ -29,10 +30,20 @@ class CustomerAddressesDataTable extends DataTable
|
||||
return $customerId ? $model->byCustomer($customerId) : $model;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables->editColumn('type', function (CustomerAddress $address) {
|
||||
return CustomerAddresses::getIconByType($address->type);
|
||||
})->rawColumns(['type', 'action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('type')->title('')->width(30),
|
||||
Column::make('address')->title('Adresse'),
|
||||
Column::make('zipcode')->title('Code postal'),
|
||||
Column::make('city')->title('Ville'),
|
||||
|
||||
80
app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php
Normal file
80
app/Datatables/Admin/Shop/CustomerInvoicesDataTable.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Repositories\Shop\InvoicePayments;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class CustomerInvoicesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'invoices';
|
||||
|
||||
public $sortedColumn = 1;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Invoices.index');
|
||||
}
|
||||
|
||||
public function query(Invoice $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId)->with(['address']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = view('components.form.button', [
|
||||
'dataId' => '{{$uuid}}',
|
||||
'class' => 'btn-sm btn-secondary btn-invoice mr-2',
|
||||
'icon' => 'fa-file-pdf',
|
||||
'title' => 'Télécharger la facture',
|
||||
'url' => route('Shop.Invoices.pdf').'/{{$uuid}}',
|
||||
]);
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->editColumn('payment_type', function (Invoice $invoice) {
|
||||
return InvoicePayments::getPaymentType($invoice->payment_type);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('payment_type')->title('Règlement'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
69
app/Datatables/Admin/Shop/CustomerOrdersDataTable.php
Normal file
69
app/Datatables/Admin/Shop/CustomerOrdersDataTable.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Shop\Customers;
|
||||
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 $url = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Shop.Orders.index');
|
||||
}
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
$customerId = Customers::getId();
|
||||
$model = $model->byCustomer($customerId);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
|
||||
$buttons .= self::getButtonShow('uuid', 'Voir la facture');
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Order $order) {
|
||||
return Orders::getStatus($order->status);
|
||||
})
|
||||
->editColumn('created_at', function (Order $order) {
|
||||
return $order->created_at->isoFormat('DD/MM/YY HH:mm');
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('ref')->title('Ref'),
|
||||
Column::make('total_shipped')->title('Montant')->class('text-right'),
|
||||
Column::make('status')->title('Statut'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
36
app/Datatables/Admin/Shop/PriceListValuesDataTable.php
Normal file
36
app/Datatables/Admin/Shop/PriceListValuesDataTable.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Shop;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\PriceListValue;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class PriceListValuesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'price_list_values';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = route('Admin.Shop.PriceListValues.index');
|
||||
}
|
||||
|
||||
public function query(PriceListValue $model)
|
||||
{
|
||||
$model = $model->with(['price_list']);
|
||||
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('price_list.name')->data('price_list')->title('etat'),
|
||||
Column::make('code')->title('Code'),
|
||||
Column::make('quantity')->title('Quantité'),
|
||||
Column::make('price')->title('Prix HT'),
|
||||
Column::make('price_taxed')->title('Prix TTC'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user