Fixed shipment grid shipped to column
This commit is contained in:
parent
49ddcd0256
commit
35ccc65342
|
|
@ -32,7 +32,8 @@ class OrderDataGrid extends DataGrid
|
|||
->addSelect(DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name) as billed_to'))
|
||||
->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
|
||||
|
||||
$this->addFilter('full_name', DB::raw('CONCAT(customer_first_name, " ", customer_last_name)'));
|
||||
$this->addFilter('billed_to', DB::raw('CONCAT(order_address_billing.first_name, " ", order_address_billing.last_name)'));
|
||||
$this->addFilter('shipped_to', DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name)'));
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,14 @@ class OrderShipmentsDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('shipments as ship')
|
||||
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
|
||||
$leftJoin->on('order_address_shipping.order_id', '=', 'ship.order_address_id')
|
||||
->where('order_address_shipping.address_type', 'shipping');
|
||||
})
|
||||
->leftJoin('orders as ors', 'ship.order_id', '=', 'ors.id')
|
||||
->leftJoin('inventory_sources as is', 'ship.inventory_source_id', '=', 'is.id')
|
||||
->select('ship.id as shipment_id', 'ship.order_id as shipment_order_id', 'ship.total_qty as shipment_total_qty', 'is.name as inventory_source_name', 'ors.created_at as orderdate', 'ship.created_at as shipment_created_at')
|
||||
->addSelect(DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name) as custname'));
|
||||
->addSelect(DB::raw('CONCAT(order_address_shipping.first_name, " ", order_address_shipping.last_name) as shipped_to'));
|
||||
|
||||
$this->addFilter('shipment_id', 'ship.id');
|
||||
$this->addFilter('shipment_order_id', 'ship.order_id');
|
||||
|
|
@ -31,7 +35,7 @@ class OrderShipmentsDataGrid extends DataGrid
|
|||
$this->addFilter('inventory_source_name', 'is.name');
|
||||
$this->addFilter('orderdate', 'ors.created_at');
|
||||
$this->addFilter('shipment_created_at', 'ship.created_at');
|
||||
$this->addFilter('custname', DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name)'));
|
||||
$this->addFilter('shipped_to', DB::raw('CONCAT(ors.customer_first_name, " ", ors.customer_last_name)'));
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -87,7 +91,7 @@ class OrderShipmentsDataGrid extends DataGrid
|
|||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'custname',
|
||||
'index' => 'shipped_to',
|
||||
'label' => trans('admin::app.datagrid.shipment-to'),
|
||||
'type' => 'string',
|
||||
'sortable' => true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue