Disable submit button
This commit is contained in:
@ -789,6 +789,9 @@
|
||||
|
||||
$('#add_form').submit(event => {
|
||||
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 uri = '{{$urls->api}}/ventas/add'
|
||||
return fetchAPI(uri, {method: 'post', body}).then(response => {
|
||||
@ -800,6 +803,8 @@
|
||||
window.location = '{{$urls->base}}/venta/' + data.venta_id
|
||||
return true
|
||||
}
|
||||
button.prop('disabled', false)
|
||||
button.css('cursor', 'pointer')
|
||||
showErrors(data.errors)
|
||||
return false
|
||||
})
|
||||
|
Reference in New Issue
Block a user