44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Datatables\Shop;
|
|
|
|
use App\Datatables\ParentDataTable as DataTable;
|
|
use App\Models\Shop\InvoicePayment;
|
|
use App\Repositories\Shop\InvoicePayments;
|
|
use Yajra\DataTables\Html\Column;
|
|
|
|
class InvoicesDataTable extends DataTable
|
|
{
|
|
public $model_name = 'InvoicePayments';
|
|
|
|
public function query(InvoicePayment $model)
|
|
{
|
|
return $this->buildQuery($model);
|
|
}
|
|
|
|
public function modifier($datatables)
|
|
{
|
|
$datatables
|
|
->editColumn('payment_type', function (InvoicePayment $payment) {
|
|
return InvoicePayments::getPaymentType($payment->payment_type);
|
|
})
|
|
->editColumn('date', function (InvoicePayment $payment) {
|
|
return $payment->date;
|
|
})
|
|
->rawColumns(['action']);
|
|
|
|
return parent::modifier($datatables);
|
|
}
|
|
|
|
protected function getColumns()
|
|
{
|
|
return [
|
|
Column::make('payment_type')->title('Type')->width(80),
|
|
Column::make('status')->width(60),
|
|
Column::make('amount')->title('Montant')->width(100),
|
|
Column::make('reference')->title('Référence'),
|
|
$this->makeColumnButtons(),
|
|
];
|
|
}
|
|
}
|