Skip to content

Commit

Permalink
Merge branch 'fix-issue' into 'master'
Browse files Browse the repository at this point in the history
fix app_url and quantity validation issue

See merge request mohit.panjvani/crater-web!97
  • Loading branch information
mohitpanjwani committed Dec 2, 2019
2 parents dad71b0 + aef6da8 commit 7b50148
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
11 changes: 11 additions & 0 deletions resources/assets/js/helpers/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion resources/assets/js/views/estimates/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<base-input
v-model="item.quantity"
:invalid="$v.item.quantity.$error"
type="number"
type="text"
small
@keyup="updateItem"
@input="$v.item.quantity.$touch()"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/views/invoices/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<base-input
v-model="item.quantity"
:invalid="$v.item.quantity.$error"
type="number"
type="text"
small
@keyup="updateItem"
@input="$v.item.quantity.$touch()"
Expand Down
6 changes: 4 additions & 2 deletions resources/assets/js/views/wizard/Database.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<span v-if="!$v.databaseData.app_url.required" class="text-danger">
{{ $tc('validation.required') }}
</span>
<span v-if="!$v.databaseData.app_url.url" class="text-danger">
<span v-if="!$v.databaseData.app_url.isUrl" class="text-danger">
{{ $tc('validation.invalid_url') }}
</span>
</div>
Expand Down Expand Up @@ -184,7 +184,9 @@ export default {
},
app_url: {
required,
url
isUrl (val) {
return this.$utils.checkValidUrl(val)
}
}
}
},
Expand Down

0 comments on commit 7b50148

Please sign in to comment.