Merge branch 'master' of https://github.com/bagisto/bagisto into development

This commit is contained in:
Prashant Singh 2019-02-04 15:29:33 +05:30
commit ad1b2c5f7c
5 changed files with 35 additions and 8 deletions

View File

@ -20,10 +20,20 @@ class OrderDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('orders')
->select('id', 'base_sub_total', 'base_grand_total', 'created_at', 'channel_name', 'status')
->addSelect(DB::raw('CONCAT(customer_first_name, " ", customer_last_name) as full_name'));
->leftJoin('order_address as order_address_shipping', function($leftJoin) {
$leftJoin->on('order_address_shipping.order_id', '=', 'orders.id')
->where('order_address_shipping.address_type', 'shipping');
})
->leftJoin('order_address as order_address_billing', function($leftJoin) {
$leftJoin->on('order_address_billing.order_id', '=', 'orders.id')
->where('order_address_billing.address_type', 'billing');
})
->addSelect('orders.id', 'base_sub_total', 'base_grand_total', 'orders.created_at', 'channel_name', 'status')
->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);
}
@ -96,12 +106,20 @@ class OrderDataGrid extends DataGrid
]);
$this->addColumn([
'index' => 'full_name',
'index' => 'billed_to',
'label' => trans('admin::app.datagrid.billed-to'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
]);
$this->addColumn([
'index' => 'shipped_to',
'label' => trans('admin::app.datagrid.shipped-to'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
]);
}
public function prepareActions() {

View File

@ -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,

View File

@ -130,6 +130,7 @@ return [
'order-date' => 'Order Date',
'channel-name' => 'Channel Name',
'billed-to' => 'Billed To',
'shipped-to' => 'Shipped To',
'order-id' => 'Order Id',
'invoice-date' => 'Invoice Date',
'total-qty' => 'Total Qty',

View File

@ -814,6 +814,7 @@ class Cart {
}
}
}
return true;
}
}
@ -825,7 +826,8 @@ class Cart {
*/
public function calculateItemsTax()
{
$cart = $this->getCart();
if (! $cart = $this->getCart())
return false;
if (! $shippingAddress = $cart->shipping_address)
return;

View File

@ -45,6 +45,8 @@ class SessionController extends Controller
if (auth()->guard('admin')->check()) {
return redirect()->route('admin.dashboard.index');
} else {
session()->put('url.intended', url()->previous());
return view($this->_config['view']);
}