Show error message if user add failed.
This commit is contained in:
parent
b5a263ab90
commit
cceb87bc53
1 changed files with 8 additions and 6 deletions
|
@ -298,12 +298,12 @@ class UserNew extends App.ControllerModal
|
||||||
headPrefix: 'New'
|
headPrefix: 'New'
|
||||||
|
|
||||||
content: ->
|
content: ->
|
||||||
controller = new App.ControllerForm(
|
@controller = new App.ControllerForm(
|
||||||
model: App.User
|
model: App.User
|
||||||
screen: 'edit'
|
screen: 'edit'
|
||||||
autofocus: true
|
autofocus: true
|
||||||
)
|
)
|
||||||
controller.form
|
@controller.form
|
||||||
|
|
||||||
onSubmit: (e) =>
|
onSubmit: (e) =>
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
|
@ -324,7 +324,7 @@ class UserNew extends App.ControllerModal
|
||||||
errors = user.validate()
|
errors = user.validate()
|
||||||
if errors
|
if errors
|
||||||
@log 'error', errors
|
@log 'error', errors
|
||||||
@formValidate( form: e.target, errors: errors )
|
@formValidate(form: e.target, errors: errors)
|
||||||
return
|
return
|
||||||
|
|
||||||
# save user
|
# save user
|
||||||
|
@ -334,13 +334,15 @@ class UserNew extends App.ControllerModal
|
||||||
|
|
||||||
# force to reload object
|
# force to reload object
|
||||||
callbackReload = (user) ->
|
callbackReload = (user) ->
|
||||||
ui.parent.el.find('[name=customer_id]').val( user.id ).trigger('change')
|
ui.parent.el.find('[name=customer_id]').val(user.id).trigger('change')
|
||||||
ui.parent.close()
|
ui.parent.close()
|
||||||
|
|
||||||
# start customer info controller
|
# start customer info controller
|
||||||
ui.close()
|
ui.close()
|
||||||
App.User.full(@id, callbackReload , true)
|
App.User.full(@id, callbackReload , true)
|
||||||
|
|
||||||
fail: ->
|
fail: (settings, details) ->
|
||||||
ui.close()
|
ui.log 'errors', details
|
||||||
|
ui.formEnable(e)
|
||||||
|
ui.controller.showAlert(details.error_human || details.error || 'Unable to create object!')
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue