Issue #2918 fixed (Added calendar view)

This commit is contained in:
jitendra 2022-03-10 19:02:50 +05:30
parent d1c0139da0
commit 6f16bd69e8
24 changed files with 477 additions and 16 deletions

View File

@ -14,6 +14,12 @@
"laravel-mix": "^5.0.0",
"laravel-mix-merge-manifest": "^0.1.2",
"sass": "^1.25.0",
"sass-loader": "^8.0.2"
"sass-loader": "^8.0.2",
"vue": "^2.6.12",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {
"vue-cal": "^3.10.1"
}
}

View File

@ -0,0 +1 @@
.switch-view-container{margin-left:-5px;margin-right:6px;vertical-align:top;display:inline-block}.switch-view-container .icon-container{height:36px;cursor:pointer;display:inline-block;padding:6px 10px 10px;border:1px solid #c7c7c7}.switch-view-container .icon-container:first-child{left:5px;position:relative;border-radius:3px 0 0 3px}.switch-view-container .icon-container:last-child{border-radius:0 3px 3px 0}.switch-view-container .icon-container.active{cursor:not-allowed;border-color:#0041ff;background-color:#0041ff}.switch-view-container .icon-container .icon{vertical-align:middle;width:22px;height:22px}.rtl .switch-view-container{margin-left:unset}.rtl .switch-view-container .icon-container.active{margin-left:-9px}.calendar-icon{background-image:url(../images/calendar-icon.svg)}.calendar-white-icon{background-image:url(../images/calendar-white-icon.svg)}.table-icon{background-image:url(../images/table-icon.svg)}.table-white-icon{background-image:url(../images/table-white-icon.svg)}

View File

@ -0,0 +1,41 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="4" width="20" height="17" rx="2" stroke="#8184AB" stroke-width="2"/>
<path d="M7 2V6" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M17 2V6" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<mask id="path-4-inside-1_705_8554" fill="white">
<rect x="9" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-4-inside-1_705_8554)"/>
<mask id="path-5-inside-2_705_8554" fill="white">
<rect x="13" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-5-inside-2_705_8554)"/>
<mask id="path-6-inside-3_705_8554" fill="white">
<rect x="17" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-6-inside-3_705_8554)"/>
<mask id="path-7-inside-4_705_8554" fill="white">
<rect x="5" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-7-inside-4_705_8554)"/>
<mask id="path-8-inside-5_705_8554" fill="white">
<rect x="9" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-8-inside-5_705_8554)"/>
<mask id="path-9-inside-6_705_8554" fill="white">
<rect x="13" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-9-inside-6_705_8554)"/>
<mask id="path-10-inside-7_705_8554" fill="white">
<rect x="17" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-10-inside-7_705_8554)"/>
<mask id="path-11-inside-8_705_8554" fill="white">
<rect x="5" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="16" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-11-inside-8_705_8554)"/>
<mask id="path-12-inside-9_705_8554" fill="white">
<rect x="9" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="16" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-12-inside-9_705_8554)"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,41 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="4" width="20" height="17" rx="2" stroke="#FFFFFF" stroke-width="2"/>
<path d="M7 2V6" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M17 2V6" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<mask id="path-4-inside-1_705_8554" fill="white">
<rect x="9" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-4-inside-1_705_8554)"/>
<mask id="path-5-inside-2_705_8554" fill="white">
<rect x="13" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-5-inside-2_705_8554)"/>
<mask id="path-6-inside-3_705_8554" fill="white">
<rect x="17" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-6-inside-3_705_8554)"/>
<mask id="path-7-inside-4_705_8554" fill="white">
<rect x="5" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-7-inside-4_705_8554)"/>
<mask id="path-8-inside-5_705_8554" fill="white">
<rect x="9" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-8-inside-5_705_8554)"/>
<mask id="path-9-inside-6_705_8554" fill="white">
<rect x="13" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-9-inside-6_705_8554)"/>
<mask id="path-10-inside-7_705_8554" fill="white">
<rect x="17" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-10-inside-7_705_8554)"/>
<mask id="path-11-inside-8_705_8554" fill="white">
<rect x="5" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="16" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-11-inside-8_705_8554)"/>
<mask id="path-12-inside-9_705_8554" fill="white">
<rect x="9" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="16" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-12-inside-9_705_8554)"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="18" height="18" rx="2" stroke="#8184AB" stroke-width="2"/>
<path d="M3 8H21" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M9 8L9 20" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M15 8L15 20" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="18" height="18" rx="2" stroke="#FFFFFF" stroke-width="2"/>
<path d="M3 8H21" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M9 8L9 20" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M15 8L15 20" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
/*!
* Vue.js v2.6.14
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/

View File

@ -1,4 +1,6 @@
{
"/css/default-booking.css": "/css/default-booking.css?id=76de1f2b8e064c1e9043",
"/css/velocity-booking.css": "/css/velocity-booking.css?id=847aebb5031ed219528e"
"/css/velocity-booking.css": "/css/velocity-booking.css?id=847aebb5031ed219528e",
"/js/admin-booking.js": "/js/admin-booking.js?id=550f81bdc01469b71c46",
"/css/admin-booking.css": "/css/admin-booking.css?id=116a36ee774bf3b8a0aa"
}

View File

@ -85,9 +85,7 @@ class BookingDataGrid extends DataGrid
'sortable' => true,
'filterable' => false,
'closure' => function ($value) {
$from = Carbon::createFromTimestamp($value->from);
return $from->format('d F, Y H:iA');
return Carbon::createFromTimestamp($value->from)->format('d F, Y H:iA');
}
]);
@ -99,9 +97,7 @@ class BookingDataGrid extends DataGrid
'sortable' => true,
'filterable' => false,
'closure' => function ($value) {
$to = Carbon::createFromTimestamp($value->to);
return $to->format('d F, Y H:iA');
return Carbon::createFromTimestamp($value->to)->format('d F, Y H:iA');
}
]);

View File

@ -2,8 +2,10 @@
namespace Webkul\BookingProduct\Http\Controllers\Admin;
use Carbon\Carbon;
use Webkul\BookingProduct\Http\Controllers\Controller;
use Webkul\BookingProduct\DataGrids\Admin\BookingDataGrid;
use Webkul\BookingProduct\Repositories\BookingRepository;
class BookingController extends Controller
{
@ -14,13 +16,22 @@ class BookingController extends Controller
*/
protected $_config;
/**
* BookingRepository object
*
* @var \Webkul\BookingProduct\Repositories\BookingRepository
*/
protected $bookingRepository;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
public function __construct(BookingRepository $bookingRepository)
{
$this->bookingRepository = $bookingRepository;
$this->_config = request('_config');
}
@ -31,10 +42,39 @@ class BookingController extends Controller
*/
public function index()
{
if (request()->ajax()) {
return app(BookingDataGrid::class)->toJson();
}
return view($this->_config['view']);
}
/**
* Returns a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function get()
{
if (request('view_type')) {
$startDate = request()->get('startDate')
? Carbon::createFromTimeString(request()->get('startDate') . " 00:00:01")
: Carbon::now()->startOfWeek()->format('Y-m-d H:i:s');
$endDate = request()->get('endDate')
? Carbon::createFromTimeString(request()->get('endDate') . " 23:59:59")
: Carbon::now()->endOfWeek()->format('Y-m-d H:i:s');
$bookings = $this->bookingRepository->getBookings([strtotime($startDate), strtotime($endDate)])
->map(function ($booking) {
$booking['start'] = Carbon::createFromTimestamp($booking->start)->format('Y-m-d H:i:s');
$booking['end'] = Carbon::createFromTimestamp($booking->end)->format('Y-m-d H:i:s');
return $booking;
});
return response()->json([
'bookings' => $bookings,
]);
} else {
return app(BookingDataGrid::class)->toJson();
}
}
}

View File

@ -11,5 +11,7 @@ Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => conf
Route::get('/bookings', [Webkul\BookingProduct\Http\Controllers\Admin\BookingController::class, 'index'])->defaults('_config', [
'view' => 'bookingproduct::admin.sales.bookings.index',
])->name('admin.sales.bookings.index');
Route::get('/bookings/get', [Webkul\BookingProduct\Http\Controllers\Admin\BookingController::class, 'get'])->name('admin.sales.bookings.get');
});
});

View File

@ -67,4 +67,23 @@ class BookingRepository extends Repository
Event::dispatch('marketplace.booking.save.after', $booking);
}
}
/**
* @param string $dateRange
* @return mixed
*/
public function getBookings($dateRange)
{
return $this->select(
'bookings.id',
'bookings.order_id',
'order_items.name as title',
'bookings.from as start',
'bookings.to as end',
)
->leftJoin('order_items', 'bookings.order_item_id', '=', 'order_items.id')
->whereBetween('bookings.from', $dateRange)
->distinct()
->get();
}
}

View File

@ -0,0 +1,41 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="4" width="20" height="17" rx="2" stroke="#8184AB" stroke-width="2"/>
<path d="M7 2V6" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M17 2V6" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<mask id="path-4-inside-1_705_8554" fill="white">
<rect x="9" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-4-inside-1_705_8554)"/>
<mask id="path-5-inside-2_705_8554" fill="white">
<rect x="13" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-5-inside-2_705_8554)"/>
<mask id="path-6-inside-3_705_8554" fill="white">
<rect x="17" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="8" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-6-inside-3_705_8554)"/>
<mask id="path-7-inside-4_705_8554" fill="white">
<rect x="5" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-7-inside-4_705_8554)"/>
<mask id="path-8-inside-5_705_8554" fill="white">
<rect x="9" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-8-inside-5_705_8554)"/>
<mask id="path-9-inside-6_705_8554" fill="white">
<rect x="13" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-9-inside-6_705_8554)"/>
<mask id="path-10-inside-7_705_8554" fill="white">
<rect x="17" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="12" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-10-inside-7_705_8554)"/>
<mask id="path-11-inside-8_705_8554" fill="white">
<rect x="5" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="16" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-11-inside-8_705_8554)"/>
<mask id="path-12-inside-9_705_8554" fill="white">
<rect x="9" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="16" width="3" height="3" rx="1" fill="#8184AB" stroke="#8184AB" stroke-width="3" mask="url(#path-12-inside-9_705_8554)"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,41 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2" y="4" width="20" height="17" rx="2" stroke="#FFFFFF" stroke-width="2"/>
<path d="M7 2V6" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M17 2V6" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<mask id="path-4-inside-1_705_8554" fill="white">
<rect x="9" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-4-inside-1_705_8554)"/>
<mask id="path-5-inside-2_705_8554" fill="white">
<rect x="13" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-5-inside-2_705_8554)"/>
<mask id="path-6-inside-3_705_8554" fill="white">
<rect x="17" y="8" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="8" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-6-inside-3_705_8554)"/>
<mask id="path-7-inside-4_705_8554" fill="white">
<rect x="5" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-7-inside-4_705_8554)"/>
<mask id="path-8-inside-5_705_8554" fill="white">
<rect x="9" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-8-inside-5_705_8554)"/>
<mask id="path-9-inside-6_705_8554" fill="white">
<rect x="13" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="13" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-9-inside-6_705_8554)"/>
<mask id="path-10-inside-7_705_8554" fill="white">
<rect x="17" y="12" width="3" height="3" rx="1"/>
</mask>
<rect x="17" y="12" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-10-inside-7_705_8554)"/>
<mask id="path-11-inside-8_705_8554" fill="white">
<rect x="5" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="5" y="16" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-11-inside-8_705_8554)"/>
<mask id="path-12-inside-9_705_8554" fill="white">
<rect x="9" y="16" width="3" height="3" rx="1"/>
</mask>
<rect x="9" y="16" width="3" height="3" rx="1" fill="#FFFFFF" stroke="#FFFFFF" stroke-width="3" mask="url(#path-12-inside-9_705_8554)"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="18" height="18" rx="2" stroke="#8184AB" stroke-width="2"/>
<path d="M3 8H21" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M9 8L9 20" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
<path d="M15 8L15 20" stroke="#8184AB" stroke-width="2" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

View File

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="3" y="3" width="18" height="18" rx="2" stroke="#FFFFFF" stroke-width="2"/>
<path d="M3 8H21" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M9 8L9 20" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
<path d="M15 8L15 20" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 424 B

View File

@ -0,0 +1,5 @@
import VueCal from 'vue-cal';
import 'vue-cal/dist/vuecal.css'
Vue.component('vue-cal', VueCal);

View File

@ -0,0 +1,64 @@
.switch-view-container {
margin-left: -5px;
margin-right: 6px;
vertical-align: top;
display: inline-block;
.icon-container {
height: 36px;
cursor: pointer;
display: inline-block;
padding: 6px 10px 10px 10px;
border: 1px solid #C7C7C7;
&:first-child {
left: 5px;
position: relative;
border-radius: 3px 0px 0px 3px;
}
&:last-child {
border-radius: 0px 3px 3px 0px;
}
&.active {
cursor: not-allowed;
border-color: #0041ff;
background-color: #0041ff;
}
.icon {
vertical-align: middle;
width: 22px;
height: 22px;
}
}
}
.rtl {
.switch-view-container {
margin-left: unset;
.icon-container {
&.active {
margin-left: -9px;
}
}
}
}
.calendar-icon {
background-image: url("../images/calendar-icon.svg");
}
.calendar-white-icon {
background-image: url("../images/calendar-white-icon.svg");
}
.table-icon {
background-image: url("../images/table-icon.svg");
}
.table-white-icon {
background-image: url("../images/table-white-icon.svg");
}

View File

@ -4,6 +4,20 @@
{{ __('bookingproduct::app.admin.sales.bookings.title') }}
@stop
@push('css')
<link rel="stylesheet" href="{{ asset('themes/default/assets/css/admin-booking.css') }}">
<style>
.grid-container .datagrid-filters .filter-right {
grid-template-columns: auto auto auto;
}
</style>
@endpush
@push('scripts')
<script type="text/javascript" src="{{ asset('themes/default/assets/js/admin-booking.js') }}"></script>
@endpush
@section('content')
<div class="content">
<div class="page-header">
@ -13,7 +27,24 @@
</div>
<div class="page-content">
<datagrid-plus src="{{ route('admin.sales.bookings.index') }}"></datagrid-plus>
@php
$viewType = request()->view_type ?? "table";
@endphp
@if ($viewType == "table")
<datagrid-plus src="{{ route('admin.sales.bookings.get') }}">
<template v-slot:extra-filters>
@include('bookingproduct::admin.sales.bookings.index.view-swither')
</template>
</datagrid-plus>
@else
@include('bookingproduct::admin.sales.bookings.index.calendar')
@endif
</div>
</div>
@stop
@stop

View File

@ -0,0 +1,77 @@
<div class="grid-container">
<calendar-filters></calendar-filters>
</div>
<calendar-component></calendar-component>
@push('scripts')
<script type="text/x-template" id="calendar-filters-tempalte">
<div class="form-group datagrid-filters" style="margin-bottom: 20px;">
<div></div>
<div class="filter-right" style="grid-template-columns: auto;">
@include('bookingproduct::admin.sales.bookings.index.view-swither')
</div>
</div>
</script>
<script type="text/x-template" id="calendar-component-tempalte">
<div class="calendar-container">
<vue-cal
hide-view-selector
:watchRealTime="true"
:twelveHour="true"
:disable-views="['years', 'year', 'month', 'day']"
style="height: calc(100vh - 240px);"
:events="events"
@ready="getBookings"
@view-change="getBookings"
:on-event-click="onEventClick"
/>
</div>
</script>
<script>
Vue.component('calendar-filters', {
template: '#calendar-filters-tempalte',
});
Vue.component('calendar-component', {
template: '#calendar-component-tempalte',
data: function () {
return {
events: []
}
},
methods: {
getBookings: function ({startDate, endDate}) {
this.$root.pageLoaded = false;
this.$http.get("{{ route('admin.sales.bookings.get', ['view_type' => 'calendar']) }}" + `&startDate=${new Date(startDate).toLocaleDateString("en-US")}&endDate=${new Date(endDate).toLocaleDateString("en-US")}`)
.then(response => {
this.$root.pageLoaded = true;
this.events = response.data.bookings;
})
.catch(error => {
this.$root.pageLoaded = true;
});
},
onEventClick : function (event) {
window.location.href = "{{ route('admin.sales.orders.view', 'order_id') }}/".replace('order_id', event.order_id)
}
}
});
</script>
@endpush

View File

@ -0,0 +1,19 @@
<div class="switch-view-container">
@if (request('view_type'))
<a href="{{ route('admin.sales.bookings.index') }}" class="icon-container">
<i class="icon table-icon"></i>
</a>
<a class="icon-container active">
<i class="icon calendar-white-icon"></i>
</a>
@else
<a class="icon-container active">
<i class="icon table-white-icon"></i>
</a>
<a href="{{ route('admin.sales.bookings.index', ['view_type' => 'calendar']) }}" class="icon-container">
<i class="icon calendar-icon"></i>
</a>
@endif
</div>

View File

@ -15,7 +15,9 @@ if (mix.inProduction()) {
mix.setPublicPath(publicPath).mergeManifest();
mix.disableNotifications();
mix.copyDirectory(__dirname + "/src/Resources/assets/images", publicPath + "/images")
mix.js(__dirname + "/src/Resources/assets/js/app.js", "js/admin-booking.js")
.copyDirectory(__dirname + "/src/Resources/assets/images", publicPath + "/images")
.sass(__dirname + "/src/Resources/assets/sass/admin.scss", "css/admin-booking.css")
.sass(__dirname + "/src/Resources/assets/sass/default.scss", "css/default-booking.css")
.sass(__dirname + "/src/Resources/assets/sass/velocity.scss", "css/velocity-booking.css")
.options({

View File

@ -462,6 +462,8 @@
</ul>
</div>
</div>
<slot name="extra-filters"></slot>
</div>
</div>
</div>