Disable submit button
This commit is contained in:
@ -789,6 +789,9 @@
|
|||||||
|
|
||||||
$('#add_form').submit(event => {
|
$('#add_form').submit(event => {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
const button = $(event.currentTarget).find(".ui.button[type='submit']")
|
||||||
|
button.prop('disabled', true)
|
||||||
|
button.css('cursor', 'wait')
|
||||||
const body = new FormData(event.currentTarget)
|
const body = new FormData(event.currentTarget)
|
||||||
const uri = '{{$urls->api}}/ventas/add'
|
const uri = '{{$urls->api}}/ventas/add'
|
||||||
return fetchAPI(uri, {method: 'post', body}).then(response => {
|
return fetchAPI(uri, {method: 'post', body}).then(response => {
|
||||||
@ -800,6 +803,8 @@
|
|||||||
window.location = '{{$urls->base}}/venta/' + data.venta_id
|
window.location = '{{$urls->base}}/venta/' + data.venta_id
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
button.prop('disabled', false)
|
||||||
|
button.css('cursor', 'pointer')
|
||||||
showErrors(data.errors)
|
showErrors(data.errors)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user