Quantity box checks added for booking product
This commit is contained in:
parent
4cd1971a12
commit
131e3f1e18
|
|
@ -179,21 +179,21 @@ class DashboardController extends Controller
|
|||
public function getTopSellingCategories()
|
||||
{
|
||||
return $this->orderItemRepository->getModel()
|
||||
->leftJoin('products', 'order_items.product_id', 'products.id')
|
||||
->leftJoin('product_categories', 'products.id', 'product_categories.product_id')
|
||||
->leftJoin('categories', 'product_categories.category_id', 'categories.id')
|
||||
->leftJoin('category_translations', 'categories.id', 'category_translations.category_id')
|
||||
->where('category_translations.locale', app()->getLocale())
|
||||
->where('order_items.created_at', '>=', $this->startDate)
|
||||
->where('order_items.created_at', '<=', $this->endDate)
|
||||
->addSelect(DB::raw('SUM(qty_invoiced - qty_refunded) as total_qty_invoiced'))
|
||||
->addSelect(DB::raw('COUNT(' . DB::getTablePrefix() . 'products.id) as total_products'))
|
||||
->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name')
|
||||
->groupBy('categories.id')
|
||||
->havingRaw('SUM(qty_invoiced - qty_refunded) > 0')
|
||||
->orderBy('total_qty_invoiced', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
->leftJoin('products', 'order_items.product_id', 'products.id')
|
||||
->leftJoin('product_categories', 'products.id', 'product_categories.product_id')
|
||||
->leftJoin('categories', 'product_categories.category_id', 'categories.id')
|
||||
->leftJoin('category_translations', 'categories.id', 'category_translations.category_id')
|
||||
->where('category_translations.locale', app()->getLocale())
|
||||
->where('order_items.created_at', '>=', $this->startDate)
|
||||
->where('order_items.created_at', '<=', $this->endDate)
|
||||
->addSelect(DB::raw('SUM(qty_invoiced - qty_refunded) as total_qty_invoiced'))
|
||||
->addSelect(DB::raw('COUNT(' . DB::getTablePrefix() . 'products.id) as total_products'))
|
||||
->addSelect('order_items.id', 'categories.id as category_id', 'category_translations.name')
|
||||
->groupBy('categories.id')
|
||||
->havingRaw('SUM(qty_invoiced - qty_refunded) > 0')
|
||||
->orderBy('total_qty_invoiced', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,13 +204,13 @@ class DashboardController extends Controller
|
|||
public function getStockThreshold()
|
||||
{
|
||||
return $this->productInventoryRepository->getModel()
|
||||
->leftJoin('products', 'product_inventories.product_id', 'products.id')
|
||||
->select(DB::raw('SUM(qty) as total_qty'))
|
||||
->addSelect('product_inventories.product_id')
|
||||
->groupBy('product_id')
|
||||
->orderBy('total_qty', 'ASC')
|
||||
->limit(5)
|
||||
->get();
|
||||
->leftJoin('products', 'product_inventories.product_id', 'products.id')
|
||||
->select(DB::raw('SUM(qty) as total_qty'))
|
||||
->addSelect('product_inventories.product_id')
|
||||
->groupBy('product_id')
|
||||
->orderBy('total_qty', 'ASC')
|
||||
->limit(5)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -220,15 +220,15 @@ class DashboardController extends Controller
|
|||
public function getTopSellingProducts()
|
||||
{
|
||||
return $this->orderItemRepository->getModel()
|
||||
->select(DB::raw('SUM(qty_ordered) as total_qty_ordered'))
|
||||
->addSelect('id', 'product_id', 'product_type', 'name')
|
||||
->where('order_items.created_at', '>=', $this->startDate)
|
||||
->where('order_items.created_at', '<=', $this->endDate)
|
||||
->whereNull('parent_id')
|
||||
->groupBy('product_id')
|
||||
->orderBy('total_qty_ordered', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
->select(DB::raw('SUM(qty_ordered) as total_qty_ordered'))
|
||||
->addSelect('id', 'product_id', 'product_type', 'name')
|
||||
->where('order_items.created_at', '>=', $this->startDate)
|
||||
->where('order_items.created_at', '<=', $this->endDate)
|
||||
->whereNull('parent_id')
|
||||
->groupBy('product_id')
|
||||
->orderBy('total_qty_ordered', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,15 +239,15 @@ class DashboardController extends Controller
|
|||
public function getCustomerWithMostSales()
|
||||
{
|
||||
return $this->orderRepository->getModel()
|
||||
->select(DB::raw('SUM(base_grand_total) as total_base_grand_total'))
|
||||
->addSelect(DB::raw('COUNT(id) as total_orders'))
|
||||
->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name')
|
||||
->where('orders.created_at', '>=', $this->startDate)
|
||||
->where('orders.created_at', '<=', $this->endDate)
|
||||
->groupBy('customer_email')
|
||||
->orderBy('total_base_grand_total', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
->select(DB::raw('SUM(base_grand_total) as total_base_grand_total'))
|
||||
->addSelect(DB::raw('COUNT(id) as total_orders'))
|
||||
->addSelect('id', 'customer_id', 'customer_email', 'customer_first_name', 'customer_last_name')
|
||||
->where('orders.created_at', '>=', $this->startDate)
|
||||
->where('orders.created_at', '<=', $this->endDate)
|
||||
->groupBy('customer_email')
|
||||
->orderBy('total_base_grand_total', 'DESC')
|
||||
->limit(5)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -258,12 +258,12 @@ class DashboardController extends Controller
|
|||
public function setStartEndDate()
|
||||
{
|
||||
$this->startDate = request()->get('start')
|
||||
? Carbon::createFromTimeString(request()->get('start') . " 00:00:01")
|
||||
: Carbon::createFromTimeString(Carbon::now()->subDays(30)->format('Y-m-d') . " 00:00:01");
|
||||
? Carbon::createFromTimeString(request()->get('start') . " 00:00:01")
|
||||
: Carbon::createFromTimeString(Carbon::now()->subDays(30)->format('Y-m-d') . " 00:00:01");
|
||||
|
||||
$this->endDate = request()->get('end')
|
||||
? Carbon::createFromTimeString(request()->get('end') . " 23:59:59")
|
||||
: Carbon::now();
|
||||
? Carbon::createFromTimeString(request()->get('end') . " 23:59:59")
|
||||
: Carbon::now();
|
||||
|
||||
if ($this->endDate > Carbon::now()) {
|
||||
$this->endDate = Carbon::now();
|
||||
|
|
|
|||
|
|
@ -89,10 +89,9 @@
|
|||
}
|
||||
|
||||
.book-slots {
|
||||
padding-top: 25px;
|
||||
// padding-top: 25px;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
border-top: solid 1px #e8e8e8;
|
||||
|
||||
h3 {
|
||||
font-weight: 600;
|
||||
|
|
@ -156,6 +155,10 @@
|
|||
display: inline-block;
|
||||
padding: 16px 0;
|
||||
border-bottom: solid 1px #e8e8e8;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.ticket-info {
|
||||
width: 50%;
|
||||
|
|
|
|||
|
|
@ -13,21 +13,14 @@
|
|||
<script type="text/x-template" id="booking-information-template">
|
||||
<div class="booking-information">
|
||||
|
||||
<div class="booking-info-row">
|
||||
<span class="icon bp-location-icon"></span>
|
||||
<span class="title">{{ __('bookingproduct::app.shop.products.location') }}</span>
|
||||
<span class="value">New Ashok Nagar</span>
|
||||
<a href="" target="_blank">View on Map</a>
|
||||
</div>
|
||||
|
||||
<div class="booking-info-row">
|
||||
<span class="icon bp-phone-icon"></span>
|
||||
<span class="title">
|
||||
{{ __('bookingproduct::app.shop.products.contact') }} :
|
||||
|
||||
<a href="">{{ __('bookingproduct::app.shop.products.email') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
@if ($bookingProduct->location != '')
|
||||
<div class="booking-info-row">
|
||||
<span class="icon bp-location-icon"></span>
|
||||
<span class="title">{{ __('bookingproduct::app.shop.products.location') }}</span>
|
||||
<span class="value">{{ $bookingProduct->location }}</span>
|
||||
<a href="https://maps.google.com/maps?q={{ $bookingProduct->location }}" target="_blank">View on Map</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@include ('bookingproduct::shop.products.view.booking.' . $bookingProduct->type, ['bookingProduct' => $bookingProduct])
|
||||
|
||||
|
|
@ -36,7 +29,6 @@
|
|||
|
||||
<script>
|
||||
Vue.component('booking-information', {
|
||||
|
||||
template: '#booking-information-template',
|
||||
|
||||
inject: ['$validator'],
|
||||
|
|
@ -45,11 +37,7 @@
|
|||
return {
|
||||
showDaysAvailability: false
|
||||
}
|
||||
},
|
||||
|
||||
created: function() {
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,22 +41,6 @@
|
|||
<p>@{{ ticket.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ticket-total">
|
||||
<!--<div class="total-tickets">
|
||||
{{ __('bookingproduct::app.shop.products.total-tickets') }} - 1
|
||||
</div>-->
|
||||
|
||||
<div class="ticket-base-price">
|
||||
{{ __('bookingproduct::app.shop.products.base-price') }} - $100
|
||||
|
||||
<p>{{ __('bookingproduct::app.shop.products.base-price-info') }}</p>
|
||||
</div>
|
||||
|
||||
<!--<div class="ticket-total-price">
|
||||
{{ __('bookingproduct::app.shop.products.total-price') }} - $100
|
||||
</div>-->
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
<script>
|
||||
|
||||
Vue.component('book-slots', {
|
||||
|
||||
template: '#book-slots-template',
|
||||
|
||||
inject: ['$validator'],
|
||||
|
|
|
|||
|
|
@ -124,6 +124,22 @@ class Booking extends Virtual
|
|||
return $bookingProducts[$productId] = $this->bookingProductRepository->findOneByField('product_id', $productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if this product can have inventory
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function showQuantityBox()
|
||||
{
|
||||
$bookingProduct = $this->getBookingProduct($this->product->id);
|
||||
|
||||
if (in_array($bookingProduct->type, ['default', 'rental', 'table'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CartItem $cartItem
|
||||
* @return bool
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
@extends('shop::layouts.master')
|
||||
|
||||
@section('page_title')
|
||||
{{ $category->meta_title ?? $category->name }}
|
||||
{{ trim($category->meta_title) != "" ? $category->meta_title : $category->name }}
|
||||
@stop
|
||||
|
||||
@section('seo')
|
||||
<meta name="description" content="{{ $category->meta_description }}"/>
|
||||
<meta name="description" content="{{ trim($category->meta_description) != "" ? $category->meta_description : \Illuminate\Support\Str::limit(strip_tags($category->description), 120, '') }}"/>
|
||||
<meta name="keywords" content="{{ $category->meta_keywords }}"/>
|
||||
@stop
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue