Merge branch 'master' of https://github.com/bagisto/bagisto into sarga-v1

This commit is contained in:
merdan 2022-03-10 16:09:23 +05:00
commit a3de765254
19 changed files with 317 additions and 33 deletions

View File

@ -0,0 +1,11 @@
<?php
return [
[
'key' => 'sales.bookings',
'name' => 'bookingproduct::app.admin.sales.bookings.title',
'route' => 'admin.sales.bookings.index',
'sort' => 6,
'icon-class' => '',
]
];

View File

@ -0,0 +1,132 @@
<?php
namespace Webkul\BookingProduct\DataGrids\Admin;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;
use Webkul\Ui\DataGrid\DataGrid;
class BookingDataGrid extends DataGrid
{
/**
* Index.
*
* @var string
*/
protected $index = 'order_id';
/**
* Sort order.
*
* @var string
*/
protected $sortOrder = 'desc';
/**
* Prepare query builder.
*
* @return void
*/
public function prepareQueryBuilder()
{
$dbPrefix = DB::getTablePrefix();
$queryBuilder = DB::table('bookings')
->leftJoin('orders', 'bookings.order_id', '=', 'orders.id')
->select('bookings.id as id', 'orders.increment_id as order_id', 'bookings.from as from', 'bookings.to as to', 'bookings.qty as qty', 'orders.created_at as created_at');
$this->addFilter('id', 'bookings.id');
$this->addFilter('order_id', 'orders.increment_id');
$this->addFilter('qty', 'bookings.qty');
$this->addFilter('created_at', 'orders.created_at');
$this->setQueryBuilder($queryBuilder);
}
/**
* Add columns.
*
* @return void
*/
public function addColumns()
{
$this->addColumn([
'index' => 'id',
'label' => trans('admin::app.datagrid.id'),
'type' => 'string',
'searchable' => false,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'order_id',
'label' => trans('admin::app.datagrid.order-id'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'qty',
'label' => trans('admin::app.datagrid.qty'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
$this->addColumn([
'index' => 'from',
'label' => trans('bookingproduct::app.admin.datagrid.from'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => false,
'closure' => function ($value) {
$from = Carbon::createFromTimestamp($value->from);
return $from->format('d F, Y H:iA');
}
]);
$this->addColumn([
'index' => 'to',
'label' => trans('bookingproduct::app.admin.datagrid.to'),
'type' => 'string',
'searchable' => true,
'sortable' => true,
'filterable' => false,
'closure' => function ($value) {
$to = Carbon::createFromTimestamp($value->to);
return $to->format('d F, Y H:iA');
}
]);
$this->addColumn([
'index' => 'created_at',
'label' => trans('admin::app.datagrid.created-date'),
'type' => 'datetime',
'searchable' => true,
'sortable' => true,
'filterable' => true,
]);
}
/**
* Prepare actions.
*
* @return void
*/
public function prepareActions()
{
$this->addAction([
'title' => trans('admin::app.datagrid.view'),
'method' => 'GET',
'route' => 'admin.sales.orders.view',
'icon' => 'icon eye-icon',
]);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Webkul\BookingProduct\Http\Controllers\Admin;
use Webkul\BookingProduct\Http\Controllers\Controller;
use Webkul\BookingProduct\DataGrids\Admin\BookingDataGrid;
class BookingController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
protected $_config;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->_config = request('_config');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\View\View
*/
public function index()
{
if (request()->ajax()) {
return app(BookingDataGrid::class)->toJson();
}
return view($this->_config['view']);
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Webkul\BookingProduct\Http\Controllers\Shop;
namespace Webkul\BookingProduct\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;

View File

@ -2,6 +2,7 @@
namespace Webkul\BookingProduct\Http\Controllers\Shop;
use Webkul\BookingProduct\Http\Controllers\Controller;
use Webkul\BookingProduct\Repositories\BookingProductRepository;
use Webkul\BookingProduct\Helpers\DefaultSlot as DefaultSlotHelper;
use Webkul\BookingProduct\Helpers\AppointmentSlot as AppointmentSlotHelper;
@ -17,7 +18,7 @@ class BookingProductController extends Controller
protected $bookingHelpers = [];
/**
* Create a new helper instance.
* Create a new controller instance.
*
* @param \Webkul\BookingProduct\Repositories\BookingProductRepository $bookingProductRepository
* @param \Webkul\BookingProduct\Helpers\DefaultSlot $defaultSlotHelper

View File

@ -0,0 +1,15 @@
<?php
/**
* Sales routes.
*/
Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => config('app.admin_url')], function () {
Route::prefix('sales')->group(function () {
/**
* Booking routes.
*/
Route::get('/bookings', [Webkul\BookingProduct\Http\Controllers\Admin\BookingController::class, 'index'])->defaults('_config', [
'view' => 'bookingproduct::admin.sales.bookings.index',
])->name('admin.sales.bookings.index');
});
});

View File

@ -13,8 +13,8 @@ class Booking extends Model implements BookingContract
protected $fillable = [
'qty',
'available_from',
'available_to',
'from',
'to',
'order_item_id',
'booking_product_event_ticket_id',
'product_id',

View File

@ -13,6 +13,8 @@ class BookingProductServiceProvider extends ServiceProvider
*/
public function boot(): void
{
$this->loadRoutesFrom(__DIR__ . '/../Http/admin-routes.php');
$this->loadRoutesFrom(__DIR__ . '/../Http/front-routes.php');
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
@ -36,5 +38,9 @@ class BookingProductServiceProvider extends ServiceProvider
public function register(): void
{
$this->mergeConfigFrom(dirname(__DIR__) . '/Config/product_types.php', 'product_types');
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php', 'menu.admin'
);
}
}

View File

@ -66,6 +66,17 @@ return [
'close' => 'غلق',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'معلومات الحجز',
]
],
'datagrid' => [
'from' => 'من عند',
'to' => 'إلى',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'Close',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'Bookings',
]
],
'datagrid' => [
'from' => 'From',
'to' => 'To'
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'Cerrado',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'Información sobre Reservas',
]
],
'datagrid' => [
'from' => 'Desde',
'to' => 'A',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'بستن',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'اطلاعات رزرو',
]
],
'datagrid' => [
'from' => 'از جانب',
'to' => 'به',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'Chiuso',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'Informazioni Prenotazione',
]
],
'datagrid' => [
'from' => 'Da',
'to' => 'A',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'Dichtbij',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'Boekingsinformatie',
]
],
'datagrid' => [
'from' => 'Van',
'to' => 'To',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => 'Fechar',
'time-error' => 'The to time must be greater than the from time.'
]
],
'sales' => [
'bookings' => [
'title' => 'Informações de reserva',
]
],
'datagrid' => [
'from' => 'A partir de',
'to' => 'Para',
]
],

View File

@ -66,6 +66,17 @@ return [
'close' => '关门',
'time-error' => '这个时间必须大于开始时间.'
]
],
'sales' => [
'bookings' => [
'title' => '预订信息',
]
],
'datagrid' => [
'from' => '从',
'to' => '到',
]
],

View File

@ -0,0 +1,19 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('bookingproduct::app.admin.sales.bookings.title') }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('bookingproduct::app.admin.sales.bookings.title') }}</h1>
</div>
</div>
<div class="page-content">
<datagrid-plus src="{{ route('admin.sales.bookings.index') }}"></datagrid-plus>
</div>
</div>
@stop

View File

@ -29,12 +29,6 @@
</div>
<div class="right-vc-header col-sm-6 col-xs-12">
<a href="{{ auth()->guard('customer')->check() ? route('velocity.customer.product.compare') : route('velocity.product.compare') }}" class="compare-btn unset">
<i class="material-icons">compare_arrows</i>
</a>
<a href="{{ route('customer.wishlist.index') }}" class="wishlist-btn unset">
<i class="material-icons">favorite_border</i>
</a>
<a class="unset cursor-pointer">
<i class="material-icons">search</i>
</a>
@ -163,11 +157,7 @@
</a>
</template>
<template v-slot:top-header>
@include('velocity::shop.layouts.particals.compare', ['isText' => false])
@include('velocity::shop.layouts.particals.wishlist', ['isText' => false])
</template>
<template v-slot:search-bar>
<div class="row">

View File

@ -76,24 +76,6 @@
<a href="{{ route('customer.orders.index') }}" class="unset">{{ __('velocity::app.shop.general.orders') }}</a>
</li>
@php
$showCompare = core()->getConfigData('general.content.shop.compare_option') == "1" ? true : false;
$showWishlist = core()->getConfigData('general.content.shop.wishlist_option') == "1" ? true : false;
@endphp
@if ($showWishlist)
<li>
<a href="{{ route('customer.wishlist.index') }}" class="unset">{{ __('shop::app.header.wishlist') }}</a>
</li>
@endif
@if ($showCompare)
<li>
<a href="{{ route('velocity.customer.product.compare') }}" class="unset">{{ __('velocity::app.customer.compare.text') }}</a>
</li>
@endif
<li>
<form id="customerLogout" action="{{ route('customer.session.destroy') }}" method="POST">
@csrf