<?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(),
        ];
    }
}
