-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EMERAL-122] Add staff when user already exists #178
Conversation
@ouranos |
Please re-open on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple minor suggestions
(success) -> | ||
toastr.success("mnoe_admin_panel.dashboard.staffs.add_staff.modal.toastr_success", {extraData: {staff_name: "#{vm.user.name} #{vm.user.surname}"}}) | ||
vm.staffAlreadyExists = success.data.length > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use !_.isEmpty(success.data)
@@ -16,24 +16,33 @@ <h3 class="modal-title" translate>mnoe_admin_panel.dashboard.staffs.add_staff.mo | |||
|
|||
<div class="row top-buffer-1"> | |||
<div class="col-sm-6"> | |||
<input type="email" class="form-control input-sm" id="user-email" ng-model="vm.user.email" placeholder="{{'mnoe_admin_panel.dashboard.staffs.add_staff.modal.placeholder.email' | translate}}" aria-label="{{'mnoe_admin_panel.dashboard.staffs.add_staff.modal.placeholder.email' | translate}}" required> | |||
<input type="email" class="form-control input-sm" id="user-email" ng-model="vm.user.email" ng-change="vm.staffAlreadyExists = false" placeholder="{{'mnoe_admin_panel.dashboard.staffs.add_staff.modal.placeholder.email' | translate}}" aria-label="{{'mnoe_admin_panel.dashboard.staffs.add_staff.modal.placeholder.email' | translate}}" required> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to avoid making an assignment in the template (ng-change="vm.staffAlreadyExists = false"
), prefer adding an vm.onEmailChange
method
012e245
to
473e0e4
Compare
=> We first check that no user has this email. If there is, we update the role, otherwise, same behaviour as before.