From 5ec453c9fbeb1eeac0ee40d4db50ce01de2cca1e Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Thu, 7 May 2020 12:17:59 +0200 Subject: [PATCH 1/7] bugfix v-validate dates given by datepicker --- .../products/accordians/booking.blade.php | 18 +-- .../assets/js/components/datetime.vue | 136 ++++++++++++++---- public/mix-manifest.json | 4 + 3 files changed, 122 insertions(+), 36 deletions(-) create mode 100644 public/mix-manifest.json diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index a76ad3401..f201a7c94 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -28,20 +28,20 @@ - + @{{ errors.first('booking[type]') }} - +
- +
- + @{{ errors.first('booking[qty]') }}
@@ -52,7 +52,7 @@ - + @{{ errors.first('booking[available_every_week]') }} @@ -61,9 +61,9 @@ - + - + @{{ errors.first('booking[available_from]') }} @@ -71,9 +71,9 @@ - + - + @{{ errors.first('booking[available_to]') }} diff --git a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue index af9eb56cd..91f094fbb 100755 --- a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue +++ b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue @@ -7,37 +7,119 @@ \ No newline at end of file diff --git a/public/mix-manifest.json b/public/mix-manifest.json new file mode 100644 index 000000000..2d6011713 --- /dev/null +++ b/public/mix-manifest.json @@ -0,0 +1,4 @@ +{ + "/js/app.js": "/js/app.js", + "/css/app.css": "/css/app.css" +} From dd15b0a3a0656b209bf3524fe718aa1a1305f831 Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Fri, 8 May 2020 13:41:13 +0200 Subject: [PATCH 2/7] restart flickering test --- tests/functional/Customer/CustomerCest.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/functional/Customer/CustomerCest.php b/tests/functional/Customer/CustomerCest.php index 873761be9..cd5ac23ac 100644 --- a/tests/functional/Customer/CustomerCest.php +++ b/tests/functional/Customer/CustomerCest.php @@ -7,22 +7,18 @@ class CustomerCest { public $fields = []; - public function updateCustomerProfile(FunctionalTester $I) + public function updateCustomerProfile(FunctionalTester $I): void { $customer = $I->loginAsCustomer(); $I->amOnPage('/'); $I->click('Profile'); - $I->click('Edit'); - $I->selectOption('gender', 'Other'); - $I->click('Update Profile'); $I->dontSeeInSource('The old password does not match.'); - $I->seeInSource('Profile updated successfully.'); $I->seeRecord(Customer::class, [ @@ -31,7 +27,7 @@ class CustomerCest ]); } - public function updateCustomerAddress(FunctionalTester $I) + public function updateCustomerAddress(FunctionalTester $I): void { $I->wantTo('Instantiate a european faker factory to have the vat provider available'); $faker = Faker\Factory::create('at_AT'); @@ -43,9 +39,7 @@ class CustomerCest $I->amOnPage('/'); $I->click('Profile'); - $I->click('Address'); - $I->click('Add Address'); $this->fields = [ @@ -62,7 +56,7 @@ class CustomerCest ]; foreach ($this->fields as $key => $value) { - // the following fields are being rendered via javascript so we ignore them: + // the following fields are rendered via javascript so we ignore them: if (! in_array($key, [ 'country', 'state', @@ -108,8 +102,7 @@ class CustomerCest } /** - * @param \FunctionalTester $I - * @param array $fields + * @param FunctionalTester $I */ private function assertCustomerAddress(FunctionalTester $I): void { From dddef80f73367b1ada925c9db655111761ca6b25 Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Wed, 13 May 2020 08:34:33 +0200 Subject: [PATCH 3/7] remove validation function after_datetime --- .../products/accordians/booking.blade.php | 4 ++-- .../assets/js/components/datetime.vue | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index f201a7c94..bd33c0827 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -61,7 +61,7 @@ - + @{{ errors.first('booking[available_from]') }} @@ -71,7 +71,7 @@ - + @{{ errors.first('booking[available_to]') }} diff --git a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue index 91f094fbb..d5691abe9 100755 --- a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue +++ b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue @@ -84,24 +84,6 @@ return validateDate(value) } }) - - this.$validator.extend('after_datetime', { - getMessage(field, val) { - return field + ' must be later than ' + val + '.' - }, - validate(value, field) { - let afterDateValue = field.valueOf().toString() - if (validateDate(afterDateValue) === true) { - let newDate = new Date(value) - let afterDate = new Date(field.valueOf().toString()) - - if (newDate <= afterDate) { - return false - } - } - return true - } - }) }, mounted() { From b5372337c5e246e859f1fca0541b5f1e239dd1d6 Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Wed, 13 May 2020 08:36:38 +0200 Subject: [PATCH 4/7] undo formatting of time in validation after --- .../views/admin/catalog/products/accordians/booking.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index bd33c0827..4aa80faf9 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -61,7 +61,7 @@ - + @{{ errors.first('booking[available_from]') }} From f42974f9e8ef51a8e66108f8c8b536ae202d6d7a Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Fri, 22 May 2020 11:50:17 +0200 Subject: [PATCH 5/7] revert changes, add flag to config --- package.json | 2 +- .../products/accordians/booking.blade.php | 4 +- .../assets/js/components/datetime.vue | 67 +------------------ 3 files changed, 5 insertions(+), 68 deletions(-) diff --git a/package.json b/package.json index dc5c0e6c3..908049f86 100755 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "axios": "^0.18", "bootstrap": "^4.0.0", "cross-env": "^5.1", - "jquery": "^3.2", + "jquery": "^3.5.1", "laravel-mix": "^5.0.1", "lodash": "^4.17.4", "popper.js": "^1.12", diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index 4aa80faf9..14818eaa5 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -61,7 +61,7 @@ - + @{{ errors.first('booking[available_from]') }} @@ -71,7 +71,7 @@ - + @{{ errors.first('booking[available_to]') }} diff --git a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue index d5691abe9..db2bda678 100755 --- a/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue +++ b/packages/Webkul/Ui/src/Resources/assets/js/components/datetime.vue @@ -22,68 +22,7 @@ }, created() { - function splitDateTime(value) { - let dateTimeParts = value.split(' ') - let dateParts = dateTimeParts[0].split('-') - let timeParts = dateTimeParts[1].split(':') - return { - "year": dateParts[0], - "month": dateParts[1], - "day": dateParts[2], - "hour": timeParts[0], - "minute": timeParts[1], - } - } - - function validateDate(value) { - let valueDate = new Date(value) - if (valueDate.getTime() !== valueDate.getTime()) { - return false - } - - let inputValue = splitDateTime(value) - - if (inputValue.year.length !== 4 - || inputValue.month.length !== 2 - || inputValue.day.length !== 2 - || inputValue.hour.length !== 2 - || inputValue.minute.length !== 2 - ) { - return false - } - - if (inputValue.month.parseInt < 1 || inputValue.month.parseInt > 12) { - return false - } - - let daysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - if ((!(inputValue.year.parseInt % 4) && inputValue.year.parseInt % 100) || !(inputValue.year.parseInt % 400)) { - daysPerMonth[1] = 29 // it is a leap year - } - - if (inputValue.day > daysPerMonth[inputValue.month - 1]) { - return false - } - - if (inputValue.hour.parseInt < 0 || inputValue.hour.parseInt > 23) { - return false - } - - if (inputValue.minute.parseInt < 0 || inputValue.hour.parseInt > 59) { - return false - } - return true - } - - this.$validator.extend('date_format_rule', { - getMessage(field, val) { - return 'The date must be in the format yyyy-MM-dd HH:ii:ss.' - }, - validate(value, field) { - return validateDate(value) - } - }) }, mounted() { @@ -95,13 +34,11 @@ altFormat: "Y-m-d H:i:S", dateFormat: "Y-m-d H:i:S", enableTime: true, - enableSeconds: true, + time_24hr: true, onChange: function (selectedDates, dateStr, instance) { this_this.$emit('onChange', dateStr) }, }); - }, - - methods: {} + } }; \ No newline at end of file From 5363b5645f5d3c294f878a2daf741274d306a39b Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Fri, 22 May 2020 12:09:19 +0200 Subject: [PATCH 6/7] revert changes --- package.json | 2 +- .../products/accordians/booking.blade.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 908049f86..dc5c0e6c3 100755 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "axios": "^0.18", "bootstrap": "^4.0.0", "cross-env": "^5.1", - "jquery": "^3.5.1", + "jquery": "^3.2", "laravel-mix": "^5.0.1", "lodash": "^4.17.4", "popper.js": "^1.12", diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index 14818eaa5..6965cde5e 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -1,3 +1,25 @@ +@section('css') + +@stop + {!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.booking.before', ['product' => $product]) !!} From 8a51417425012f173587d24b6d171da02a300825 Mon Sep 17 00:00:00 2001 From: Annika Wolff Date: Fri, 22 May 2020 12:12:40 +0200 Subject: [PATCH 7/7] revert changes --- .../products/accordians/booking.blade.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php index 6965cde5e..3bca1b92f 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking.blade.php @@ -4,7 +4,7 @@ margin-top: -13px; left: 100%; } - + .has-control-group .control-group { width: 50%; float: left; @@ -50,20 +50,20 @@ - + @{{ errors.first('booking[type]') }} - +
- +
- + @{{ errors.first('booking[qty]') }}
@@ -74,7 +74,7 @@ - + @{{ errors.first('booking[available_every_week]') }} @@ -85,7 +85,7 @@ - + @{{ errors.first('booking[available_from]') }} @@ -95,7 +95,7 @@ - + @{{ errors.first('booking[available_to]') }}