From 0fb14afc084e7646073a243ddb283499069b150c Mon Sep 17 00:00:00 2001 From: raishvaria Date: Mon, 2 Dec 2019 11:48:48 +0530 Subject: [PATCH 1/2] fix app_url and quantity validation issue --- resources/assets/js/views/estimates/Item.vue | 2 +- resources/assets/js/views/invoices/Item.vue | 2 +- resources/assets/js/views/wizard/Database.vue | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/views/estimates/Item.vue b/resources/assets/js/views/estimates/Item.vue index 5454831b..eea77b32 100644 --- a/resources/assets/js/views/estimates/Item.vue +++ b/resources/assets/js/views/estimates/Item.vue @@ -36,7 +36,7 @@ {{ $tc('validation.required') }} - + {{ $tc('validation.invalid_url') }} @@ -184,7 +184,9 @@ export default { }, app_url: { required, - url + isUrl (val) { + return this.$utils.checkValidUrl(val) + } } } }, From aef6da8b7ba9fe9d34fe970acc2fde4b3347f64d Mon Sep 17 00:00:00 2001 From: raishvaria Date: Mon, 2 Dec 2019 11:49:41 +0530 Subject: [PATCH 2/2] add utilities --- resources/assets/js/helpers/utilities.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/resources/assets/js/helpers/utilities.js b/resources/assets/js/helpers/utilities.js index 409b756f..442af4c4 100644 --- a/resources/assets/js/helpers/utilities.js +++ b/resources/assets/js/helpers/utilities.js @@ -87,5 +87,16 @@ export default { } catch (e) { console.log(e) } + }, + + checkValidUrl (url) { + let pattern = new RegExp('^(https?:\\/\\/)?' + // protocol + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name + '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path + '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string + '(\\#[-a-z\\d_]*)?$', 'i') // fragment locator + + return !!pattern.test(url) } }