From 884b8b409993f23b0472050fe6a605d4580dd95e Mon Sep 17 00:00:00 2001 From: Mouhamed Lamine Date: Tue, 3 Jul 2018 15:20:30 +0800 Subject: [PATCH] Error handling done for the whole process --- .../pages/admin/booking/supplierBooking.vue | 10 +-- .../admin/booking/uploadChinaBankslip.vue | 15 ++-- resources/assets/js/pages/home.vue | 81 ++++++++++--------- vendor/composer/autoload_static.php | 15 ---- 4 files changed, 54 insertions(+), 67 deletions(-) diff --git a/resources/assets/js/pages/admin/booking/supplierBooking.vue b/resources/assets/js/pages/admin/booking/supplierBooking.vue index 3b19e32b..f83004c3 100644 --- a/resources/assets/js/pages/admin/booking/supplierBooking.vue +++ b/resources/assets/js/pages/admin/booking/supplierBooking.vue @@ -353,16 +353,16 @@ console.log(error) // TODO : Show error message - this.$message({ + }) + + } else { + this.loading_btn = false + this.$message({ showClose: true, message: 'Please fill the supplier form', type: 'error', duration: 10000 }) - }) - - } else { - this.loading_btn = false } }) diff --git a/resources/assets/js/pages/admin/booking/uploadChinaBankslip.vue b/resources/assets/js/pages/admin/booking/uploadChinaBankslip.vue index 53d56e5c..05af926c 100644 --- a/resources/assets/js/pages/admin/booking/uploadChinaBankslip.vue +++ b/resources/assets/js/pages/admin/booking/uploadChinaBankslip.vue @@ -358,23 +358,20 @@ }) }) .catch((error) => { - this.loading = false - this.$message({ - showClose: true, - message: 'Please upload your bankin slip first.', - type: 'warning', - duration: 10000 - }) console.log(error) this.loading_btn = false }) } else { this.loading_btn = false + this.$message({ + showClose: true, + message: 'Please upload your bankin slip first.', + type: 'warning', + duration: 10000 + }) } }) - - }, handleRemove(file, fileList) { console.log(file, fileList); diff --git a/resources/assets/js/pages/home.vue b/resources/assets/js/pages/home.vue index e6162221..337f18bd 100644 --- a/resources/assets/js/pages/home.vue +++ b/resources/assets/js/pages/home.vue @@ -453,52 +453,57 @@ export default { console.log(error) }) } else { - + this.loading = false + this.$message({ + showClose: true, + message: 'Please fill the booking form in full.', + type: 'error', + duration: 10000 + }) } }) }, createBooking: function () { this.loading = true, this.dialogFormVisible1 = true + /*this.$refs[formName].validate((valid) => { + if (valid) {*/ + let newBooking = { + account_name: this.bookingForm.account_name, + account_num: this.bookingForm.account_num, + bank_name: this.bookingForm.bank_name, + bank_branch: this.bookingForm.bank_branch, + amount: this.booking.amount, + term: this.term + } - let newBooking = { - account_name: this.bookingForm.account_name, - account_num: this.bookingForm.account_num, - bank_name: this.bookingForm.bank_name, - bank_branch: this.bookingForm.bank_branch, - amount: this.booking.amount, - term: this.term - } + console.log(newBooking) + axios.post('api/booking', newBooking) + .then((response) => { + this.loading = false + // push with return id + this.$router.push({ + name: 'booking.user.upload', + params: {id: response.data.id } + }) - console.log(newBooking) - axios.post('api/booking', newBooking) - .then((response) => { - this.loading = false - // push with return id - this.$router.push({ - name: 'booking.user.upload', - params: {id: response.data.id } - }) - - // pass variable to another router - }) - .catch((error) => { - this.loading = false - this.$message({ - showClose: true, - message: 'Internal server issues. Please contact support', - type: 'error', - duration: 10000 - }) - console.log(error) - this.loading = false - this.$message({ - showClose: true, - message: 'Please fill the booking form in full.', - type: 'warning', - duration: 10000 - }) - }) + // pass variable to another router + }) + .catch((error) => { + console.log(error) + this.loading = false + this.$message({ + showClose: true, + message: 'Internal server issues. Please contact support', + type: 'error', + duration: 10000 + }) + + }) + /*} else { + this.loading = false + } + })*/ }, BookingStatus (status, booking_id) { console.log(status) diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index ad6fd533..86bf9da8 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,11 +4,7 @@ namespace Composer\Autoload; -<<<<<<< HEAD class ComposerStaticInite450fcd5b0627496bb38e1386c9a81ad -======= -class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a ->>>>>>> 0afeb0d1ea15af7104fb7bc36d66737aefb8c84e { public static $files = array ( '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php', @@ -16,10 +12,6 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', -<<<<<<< HEAD -======= - 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', ->>>>>>> 0afeb0d1ea15af7104fb7bc36d66737aefb8c84e '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', @@ -4775,17 +4767,10 @@ class ComposerStaticInit50cdbea3724e5f1d6267359fe107641a public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { -<<<<<<< HEAD $loader->prefixLengthsPsr4 = ComposerStaticInite450fcd5b0627496bb38e1386c9a81ad::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInite450fcd5b0627496bb38e1386c9a81ad::$prefixDirsPsr4; $loader->prefixesPsr0 = ComposerStaticInite450fcd5b0627496bb38e1386c9a81ad::$prefixesPsr0; $loader->classMap = ComposerStaticInite450fcd5b0627496bb38e1386c9a81ad::$classMap; -======= - $loader->prefixLengthsPsr4 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$prefixesPsr0; - $loader->classMap = ComposerStaticInit50cdbea3724e5f1d6267359fe107641a::$classMap; ->>>>>>> 0afeb0d1ea15af7104fb7bc36d66737aefb8c84e }, null, ClassLoader::class); }