From dbb5f2559409d02d40b432ab2c422a60688f1954 Mon Sep 17 00:00:00 2001 From: Jitendra Singh Date: Thu, 27 Feb 2020 19:55:34 +0530 Subject: [PATCH] Inventory check implemented for table booking --- .../Database/Seeders/AttributeTableSeeder.php | 676 ++++++++++++++++-- ...eate_booking_product_table_slots_table.php | 1 - .../BookingProduct/src/Helpers/Booking.php | 10 +- .../src/Helpers/EventTicket.php | 12 +- .../BookingProduct/src/Helpers/RentalSlot.php | 32 - .../BookingProduct/src/Helpers/TableSlot.php | 39 + .../src/Models/BookingProductTableSlot.php | 1 - .../src/Resources/lang/en/app.php | 3 +- .../accordians/booking/table.blade.php | 8 +- .../products/view/booking/table.blade.php | 6 - 10 files changed, 652 insertions(+), 136 deletions(-) diff --git a/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php b/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php index 829ce982f..c2c8e3c69 100755 --- a/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php +++ b/packages/Webkul/Attribute/src/Database/Seeders/AttributeTableSeeder.php @@ -12,89 +12,615 @@ class AttributeTableSeeder extends Seeder public function run() { DB::table('attributes')->delete(); + DB::table('attribute_translations')->delete(); $now = Carbon::now(); DB::table('attributes')->insert([ - ['id' => '1','code' => 'sku','admin_name' => 'SKU','type' => 'text','validation' => NULL,'position' => '1','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '2','code' => 'name','admin_name' => 'Name','type' => 'text','validation' => NULL,'position' => '2','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '3','code' => 'url_key','admin_name' => 'URL Key','type' => 'text','validation' => NULL,'position' => '3','is_required' => '1','is_unique' => '1','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '4','code' => 'tax_category_id','admin_name' => 'Tax Category','type' => 'select','validation' => NULL,'position' => '4','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '5','code' => 'new','admin_name' => 'New','type' => 'boolean','validation' => NULL,'position' => '5','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '6','code' => 'featured','admin_name' => 'Featured','type' => 'boolean','validation' => NULL,'position' => '6','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '7','code' => 'visible_individually','admin_name' => 'Visible Individually','type' => 'boolean','validation' => NULL,'position' => '7','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','created_at' => $now, - 'use_in_flat' => '1','updated_at' => $now], - ['id' => '8','code' => 'status','admin_name' => 'Status','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '9','code' => 'short_description','admin_name' => 'Short Description','type' => 'textarea','validation' => NULL,'position' => '9','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0', - 'is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '10','code' => 'description','admin_name' => 'Description','type' => 'textarea','validation' => NULL,'position' => '10','is_required' => '1','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '11','code' => 'price','admin_name' => 'Price','type' => 'price','validation' => 'decimal','position' => '11','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '12','code' => 'cost','admin_name' => 'Cost','type' => 'price','validation' => 'decimal','position' => '12','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '13','code' => 'special_price','admin_name' => 'Special Price','type' => 'price','validation' => 'decimal','position' => '13','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '14','code' => 'special_price_from','admin_name' => 'Special Price From','type' => 'date','validation' => NULL,'position' => '14','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '15','code' => 'special_price_to','admin_name' => 'Special Price To','type' => 'date','validation' => NULL,'position' => '15','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0', - 'use_in_flat' => '1','is_visible_on_front' => '0','created_at' => $now,'updated_at' => $now], - ['id' => '16','code' => 'meta_title','admin_name' => 'Meta Title','type' => 'textarea','validation' => NULL,'position' => '16','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '17','code' => 'meta_keywords','admin_name' => 'Meta Keywords','type' => 'textarea','validation' => NULL,'position' => '17','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '18','code' => 'meta_description','admin_name' => 'Meta Description','type' => 'textarea','validation' => NULL,'position' => '18','is_required' => '0','is_unique' => '0','value_per_locale' => '1','value_per_channel' => '1','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0','use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '19','code' => 'width','admin_name' => 'Width','type' => 'text','validation' => 'decimal','position' => '19','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '20','code' => 'height','admin_name' => 'Height','type' => 'text','validation' => 'decimal','position' => '20','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '21','code' => 'depth','admin_name' => 'Depth','type' => 'text','validation' => 'decimal','position' => '21','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '22','code' => 'weight','admin_name' => 'Weight','type' => 'text','validation' => 'decimal','position' => '22','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '23','code' => 'color','admin_name' => 'Color','type' => 'select','validation' => NULL,'position' => '23','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '24','code' => 'size','admin_name' => 'Size','type' => 'select','validation' => NULL,'position' => '24','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '1','is_user_defined' => '1','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '25','code' => 'brand','admin_name' => 'Brand','type' => 'select','validation' => NULL,'position' => '25','is_required' => '0','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '1','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '1', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], - ['id' => '26','code' => 'guest_checkout','admin_name' => 'Guest Checkout','type' => 'boolean','validation' => NULL,'position' => '8','is_required' => '1','is_unique' => '0','value_per_locale' => '0','value_per_channel' => '0','is_filterable' => '0','is_configurable' => '0','is_user_defined' => '0','is_visible_on_front' => '0', - 'use_in_flat' => '1','created_at' => $now,'updated_at' => $now], + [ + 'id' => '1', + 'code' => 'sku', + 'admin_name' => 'SKU', + 'type' => 'text', + 'validation' => NULL, + 'position' => '1', + 'is_required' => '1', + 'is_unique' => '1', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '2', + 'code' => 'name', + 'admin_name' => 'Name', + 'type' => 'text', + 'validation' => NULL, + 'position' => '2', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '3', + 'code' => 'url_key', + 'admin_name' => 'URL Key', + 'type' => 'text', + 'validation' => NULL, + 'position' => '3', + 'is_required' => '1', + 'is_unique' => '1', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '4', + 'code' => 'tax_category_id', + 'admin_name' => 'Tax Category', + 'type' => 'select', + 'validation' => NULL, + 'position' => '4', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '5', + 'code' => 'new', + 'admin_name' => 'New', + 'type' => 'boolean', + 'validation' => NULL, + 'position' => '5', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '6', + 'code' => 'featured', + 'admin_name' => 'Featured', + 'type' => 'boolean', + 'validation' => NULL, + 'position' => '6', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '7', + 'code' => 'visible_individually', + 'admin_name' => 'Visible Individually', + 'type' => 'boolean', + 'validation' => NULL, + 'position' => '7', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'created_at' => $now, + 'use_in_flat' => '1', + 'updated_at' => $now, + ], [ + 'id' => '8', + 'code' => 'status', + 'admin_name' => 'Status', + 'type' => 'boolean', + 'validation' => NULL, + 'position' => '8', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '9', + 'code' => 'short_description', + 'admin_name' => 'Short Description', + 'type' => 'textarea', + 'validation' => NULL, + 'position' => '9', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '10', + 'code' => 'description', + 'admin_name' => 'Description', + 'type' => 'textarea', + 'validation' => NULL, + 'position' => '10', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '11', + 'code' => 'price', + 'admin_name' => 'Price', + 'type' => 'price', + 'validation' => 'decimal', + 'position' => '11', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '1', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '12', + 'code' => 'cost', + 'admin_name' => 'Cost', + 'type' => 'price', + 'validation' => 'decimal', + 'position' => '12', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '13', + 'code' => 'special_price', + 'admin_name' => 'Special Price', + 'type' => 'price', + 'validation' => 'decimal', + 'position' => '13', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '14', + 'code' => 'special_price_from', + 'admin_name' => 'Special Price From', + 'type' => 'date', + 'validation' => NULL, + 'position' => '14', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '15', + 'code' => 'special_price_to', + 'admin_name' => 'Special Price To', + 'type' => 'date', + 'validation' => NULL, + 'position' => '15', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'use_in_flat' => '1', + 'is_visible_on_front' => '0', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '16', + 'code' => 'meta_title', + 'admin_name' => 'Meta Title', + 'type' => 'textarea', + 'validation' => NULL, + 'position' => '16', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '17', + 'code' => 'meta_keywords', + 'admin_name' => 'Meta Keywords', + 'type' => 'textarea', + 'validation' => NULL, + 'position' => '17', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '18', + 'code' => 'meta_description', + 'admin_name' => 'Meta Description', + 'type' => 'textarea', + 'validation' => NULL, + 'position' => '18', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '1', + 'value_per_channel' => '1', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '19', + 'code' => 'width', + 'admin_name' => 'Width', + 'type' => 'text', + 'validation' => 'decimal', + 'position' => '19', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '20', + 'code' => 'height', + 'admin_name' => 'Height', + 'type' => 'text', + 'validation' => 'decimal', + 'position' => '20', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '21', + 'code' => 'depth', + 'admin_name' => 'Depth', + 'type' => 'text', + 'validation' => 'decimal', + 'position' => '21', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '22', + 'code' => 'weight', + 'admin_name' => 'Weight', + 'type' => 'text', + 'validation' => 'decimal', + 'position' => '22', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '23', + 'code' => 'color', + 'admin_name' => 'Color', + 'type' => 'select', + 'validation' => NULL, + 'position' => '23', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '1', + 'is_configurable' => '1', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '24', + 'code' => 'size', + 'admin_name' => 'Size', + 'type' => 'select', + 'validation' => NULL, + 'position' => '24', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '1', + 'is_configurable' => '1', + 'is_user_defined' => '1', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '25', + 'code' => 'brand', + 'admin_name' => 'Brand', + 'type' => 'select', + 'validation' => NULL, + 'position' => '25', + 'is_required' => '0', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '1', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '1', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ], [ + 'id' => '26', + 'code' => 'guest_checkout', + 'admin_name' => 'Guest Checkout', + 'type' => 'boolean', + 'validation' => NULL, + 'position' => '8', + 'is_required' => '1', + 'is_unique' => '0', + 'value_per_locale' => '0', + 'value_per_channel' => '0', + 'is_filterable' => '0', + 'is_configurable' => '0', + 'is_user_defined' => '0', + 'is_visible_on_front' => '0', + 'use_in_flat' => '1', + 'created_at' => $now, + 'updated_at' => $now, + ] ]); - DB::table('attribute_translations')->insert([ - ['id' => '1','locale' => 'en','name' => 'SKU','attribute_id' => '1'], - ['id' => '2','locale' => 'en','name' => 'Name','attribute_id' => '2'], - ['id' => '3','locale' => 'en','name' => 'URL Key','attribute_id' => '3'], - ['id' => '4','locale' => 'en','name' => 'Tax Category','attribute_id' => '4'], - ['id' => '5','locale' => 'en','name' => 'New','attribute_id' => '5'], - ['id' => '6','locale' => 'en','name' => 'Featured','attribute_id' => '6'], - ['id' => '7','locale' => 'en','name' => 'Visible Individually','attribute_id' => '7'], - ['id' => '8','locale' => 'en','name' => 'Status','attribute_id' => '8'], - ['id' => '9','locale' => 'en','name' => 'Short Description','attribute_id' => '9'], - ['id' => '10','locale' => 'en','name' => 'Description','attribute_id' => '10'], - ['id' => '11','locale' => 'en','name' => 'Price','attribute_id' => '11'], - ['id' => '12','locale' => 'en','name' => 'Cost','attribute_id' => '12'], - ['id' => '13','locale' => 'en','name' => 'Special Price','attribute_id' => '13'], - ['id' => '14','locale' => 'en','name' => 'Special Price From','attribute_id' => '14'], - ['id' => '15','locale' => 'en','name' => 'Special Price To','attribute_id' => '15'], - ['id' => '16','locale' => 'en','name' => 'Meta Description','attribute_id' => '16'], - ['id' => '17','locale' => 'en','name' => 'Meta Keywords','attribute_id' => '17'], - ['id' => '18','locale' => 'en','name' => 'Meta Description','attribute_id' => '18'], - ['id' => '19','locale' => 'en','name' => 'Width','attribute_id' => '19'], - ['id' => '20','locale' => 'en','name' => 'Height','attribute_id' => '20'], - ['id' => '21','locale' => 'en','name' => 'Depth','attribute_id' => '21'], - ['id' => '22','locale' => 'en','name' => 'Weight','attribute_id' => '22'], - ['id' => '23','locale' => 'en','name' => 'Color','attribute_id' => '23'], - ['id' => '24','locale' => 'en','name' => 'Size','attribute_id' => '24'], - ['id' => '25','locale' => 'en','name' => 'Brand','attribute_id' => '25'], - ['id' => '26','locale' => 'en','name' => 'Allow Guest Checkout','attribute_id' => '26'] + [ + 'id' => '1', + 'locale' => 'en', + 'name' => 'SKU', + 'attribute_id' => '1', + ], [ + 'id' => '2', + 'locale' => 'en', + 'name' => 'Name', + 'attribute_id' => '2', + ], [ + 'id' => '3', + 'locale' => 'en', + 'name' => 'URL Key', + 'attribute_id' => '3', + ], [ + 'id' => '4', + 'locale' => 'en', + 'name' => 'Tax Category', + 'attribute_id' => '4', + ], [ + 'id' => '5', + 'locale' => 'en', + 'name' => 'New', + 'attribute_id' => '5', + ], [ + 'id' => '6', + 'locale' => 'en', + 'name' => 'Featured', + 'attribute_id' => '6', + ], [ + 'id' => '7', + 'locale' => 'en', + 'name' => 'Visible Individually', + 'attribute_id' => '7', + ], [ + 'id' => '8', + 'locale' => 'en', + 'name' => 'Status', + 'attribute_id' => '8', + ], [ + 'id' => '9', + 'locale' => 'en', + 'name' => 'Short Description', + 'attribute_id' => '9', + ], [ + 'id' => '10', + 'locale' => 'en', + 'name' => 'Description', + 'attribute_id' => '10', + ], [ + 'id' => '11', + 'locale' => 'en', + 'name' => 'Price', + 'attribute_id' => '11', + ], [ + 'id' => '12', + 'locale' => 'en', + 'name' => 'Cost', + 'attribute_id' => '12', + ], [ + 'id' => '13', + 'locale' => 'en', + 'name' => 'Special Price', + 'attribute_id' => '13', + ], [ + 'id' => '14', + 'locale' => 'en', + 'name' => 'Special Price From', + 'attribute_id' => '14', + ], [ + 'id' => '15', + 'locale' => 'en', + 'name' => 'Special Price To', + 'attribute_id' => '15', + ], [ + 'id' => '16', + 'locale' => 'en', + 'name' => 'Meta Description', + 'attribute_id' => '16', + ], [ + 'id' => '17', + 'locale' => 'en', + 'name' => 'Meta Keywords', + 'attribute_id' => '17', + ], [ + 'id' => '18', + 'locale' => 'en', + 'name' => 'Meta Description', + 'attribute_id' => '18', + ], [ + 'id' => '19', + 'locale' => 'en', + 'name' => 'Width', + 'attribute_id' => '19', + ], [ + 'id' => '20', + 'locale' => 'en', + 'name' => 'Height', + 'attribute_id' => '20', + ], [ + 'id' => '21', + 'locale' => 'en', + 'name' => 'Depth', + 'attribute_id' => '21', + ], [ + 'id' => '22', + 'locale' => 'en', + 'name' => 'Weight', + 'attribute_id' => '22', + ], [ + 'id' => '23', + 'locale' => 'en', + 'name' => 'Color', + 'attribute_id' => '23', + ], [ + 'id' => '24', + 'locale' => 'en', + 'name' => 'Size', + 'attribute_id' => '24', + ], [ + 'id' => '25', + 'locale' => 'en', + 'name' => 'Brand', + 'attribute_id' => '25', + ], [ + 'id' => '26', + 'locale' => 'en', + 'name' => 'Allow Guest Checkout', + 'attribute_id' => '26', + ] ]); } } \ No newline at end of file diff --git a/packages/Webkul/BookingProduct/src/Database/Migrations/2019_07_05_154502_create_booking_product_table_slots_table.php b/packages/Webkul/BookingProduct/src/Database/Migrations/2019_07_05_154502_create_booking_product_table_slots_table.php index 696688547..9613558de 100644 --- a/packages/Webkul/BookingProduct/src/Database/Migrations/2019_07_05_154502_create_booking_product_table_slots_table.php +++ b/packages/Webkul/BookingProduct/src/Database/Migrations/2019_07_05_154502_create_booking_product_table_slots_table.php @@ -17,7 +17,6 @@ class CreateBookingProductTableSlotsTable extends Migration $table->increments('id'); $table->string('price_type'); $table->integer('guest_limit')->default(0); - $table->integer('guest_capacity')->default(0); $table->integer('duration'); $table->integer('break_time'); $table->integer('prevent_scheduling_before'); diff --git a/packages/Webkul/BookingProduct/src/Helpers/Booking.php b/packages/Webkul/BookingProduct/src/Helpers/Booking.php index 6094f41cc..32df0c388 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/Booking.php +++ b/packages/Webkul/BookingProduct/src/Helpers/Booking.php @@ -331,14 +331,14 @@ class Booking } /** - * @param CartItem $cartItem + * @param CartItem|array $cartItem * @return bool */ public function isItemHaveQuantity($cartItem) { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem->product_id); + $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']); - if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem->quantity) { + if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity']) { return false; } @@ -352,9 +352,7 @@ class Booking public function isSlotAvailable($cartProducts) { foreach ($cartProducts as $cartProduct) { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartProduct['product_id']); - - if ($bookingProduct->qty - $this->getBookedQuantity($cartProduct) < $cartProduct['quantity']) { + if (! $this->isItemHaveQuantity($cartProduct)) { return false; } } diff --git a/packages/Webkul/BookingProduct/src/Helpers/EventTicket.php b/packages/Webkul/BookingProduct/src/Helpers/EventTicket.php index a40a3724b..4d81389bd 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/EventTicket.php +++ b/packages/Webkul/BookingProduct/src/Helpers/EventTicket.php @@ -62,16 +62,16 @@ class EventTicket extends Booking } /** - * @param CartItem $cartItem + * @param CartItem|array $cartItem * @return bool */ public function isItemHaveQuantity($cartItem) { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem->product_id); + $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']); $ticket = $bookingProduct->event_tickets()->find($cartItem['additional']['booking']['ticket_id']); - if ($ticket->qty - $this->getBookedQuantity($cartItem) < $cartItem->quantity) { + if ($ticket->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity']) { return false; } @@ -85,11 +85,7 @@ class EventTicket extends Booking public function isSlotAvailable($cartProducts) { foreach ($cartProducts as $cartProduct) { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartProduct['product_id']); - - $ticket = $bookingProduct->event_tickets()->find($cartProduct['additional']['booking']['ticket_id']); - - if ($ticket->qty - $this->getBookedQuantity($cartProduct) < $cartProduct['quantity']) { + if (! $this->isItemHaveQuantity($cartProduct)) { return false; } } diff --git a/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php b/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php index a14c5bcd2..79e68919c 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php +++ b/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php @@ -95,38 +95,6 @@ class RentalSlot extends Booking return $slots; } - /** - * @param CartItem $cartItem - * @return bool - */ - public function isItemHaveQuantity($cartItem) - { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem->product_id); - - if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem->quantity) { - return false; - } - - return true; - } - - /** - * @param array $cartProducts - * @return bool - */ - public function isSlotAvailable($cartProducts) - { - foreach ($cartProducts as $cartProduct) { - $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartProduct['product_id']); - - if ($bookingProduct->qty - $this->getBookedQuantity($cartProduct) < $cartProduct['quantity']) { - return false; - } - } - - return true; - } - /** * @param array $data * @return integer diff --git a/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php b/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php index 3fc5ebb56..ed89fc43f 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php +++ b/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php @@ -10,4 +10,43 @@ namespace Webkul\BookingProduct\Helpers; */ class TableSlot extends Booking { + /** + * @param CartItem|array $cartItem + * @return bool + */ + public function isItemHaveQuantity($cartItem) + { + $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']); + + $bookedQty = $this->getBookedQuantity($cartItem); + + $requestedQty = $cartItem['quantity']; + + if ($bookingProduct->table_slot->price_type == 'table') { + $requestedQty *= $bookingProduct->table_slot->guest_limit; + + $bookedQty *= $bookingProduct->table_slot->guest_limit; + } + + if ($bookingProduct->qty - $bookedQty < $requestedQty) { + return false; + } + + return true; + } + + /** + * @param array $cartProducts + * @return bool + */ + public function isSlotAvailable($cartProducts) + { + foreach ($cartProducts as $cartProduct) { + if (! $this->isItemHaveQuantity($cartProduct)) { + return false; + } + } + + return true; + } } \ No newline at end of file diff --git a/packages/Webkul/BookingProduct/src/Models/BookingProductTableSlot.php b/packages/Webkul/BookingProduct/src/Models/BookingProductTableSlot.php index 7644d5cfc..710a7bf03 100644 --- a/packages/Webkul/BookingProduct/src/Models/BookingProductTableSlot.php +++ b/packages/Webkul/BookingProduct/src/Models/BookingProductTableSlot.php @@ -14,7 +14,6 @@ class BookingProductTableSlot extends Model implements BookingProductTableSlotCo protected $fillable = [ 'price_type', 'guest_limit', - 'guest_capacity', 'duration', 'break_time', 'prevent_scheduling_before', diff --git a/packages/Webkul/BookingProduct/src/Resources/lang/en/app.php b/packages/Webkul/BookingProduct/src/Resources/lang/en/app.php index 9a35ff4a2..390400383 100644 --- a/packages/Webkul/BookingProduct/src/Resources/lang/en/app.php +++ b/packages/Webkul/BookingProduct/src/Resources/lang/en/app.php @@ -52,7 +52,7 @@ return [ 'guest' => 'Guest', 'table' => 'Table', 'prevent-scheduling-before' => 'Prevent Scheduling Before', - 'guest-limit' => 'Guest Limit', + 'guest-limit' => 'Guest Limit Per Table', 'guest-capacity' => 'Guest Capacity', 'type' => 'Type', 'many-bookings-for-one-day' => 'Many Bookings for One Day', @@ -95,7 +95,6 @@ return [ 'from' => 'From', 'to' => 'To', 'book-a-table' => 'Book a Table', - 'number-of-tables' => 'Number of Tables', 'special-notes' => 'Special Request/Notes', 'event-on' => 'Event On', 'book-your-ticket' => 'Book Your Ticket', diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/table.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/table.blade.php index 31cc65a07..947cad191 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/table.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/table.blade.php @@ -28,12 +28,12 @@ @{{ errors.first('booking[guest_limit]') }} -
+
- + - @{{ errors.first('booking[guest_capacity]') }} + @{{ errors.first('booking[qty]') }}
@@ -102,8 +102,6 @@ guest_limit: 2, - guest_capacity: 100, - duration: 45, break_time: 15, diff --git a/packages/Webkul/BookingProduct/src/Resources/views/shop/products/view/booking/table.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/shop/products/view/booking/table.blade.php index 2c1dd395d..24610ca50 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/shop/products/view/booking/table.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/shop/products/view/booking/table.blade.php @@ -57,12 +57,6 @@ 'title' => __('bookingproduct::app.shop.products.book-a-table') ]) -
- - - @{{ errors.first('booking[qty]') }} -
-