1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

[admin form] show if phone is required

This commit is contained in:
Sylvain 2020-07-21 18:04:20 +02:00
parent 62e6764d8e
commit d9be51b01b
4 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,6 @@
# Changelog Fab-manager
- Display an asterisk on the phone input field, in the admin creation form, if the phone is configured as required
- Fix a bug: unable to export reservations
- Fix a bug: unable to receive mails in development

View File

@ -1070,7 +1070,8 @@ Application.Controllers.controller('ImportMembersResultController', ['$scope', '
/**
* Controller used in the admin's creation page (admin view)
*/
Application.Controllers.controller('NewAdminController', ['$state', '$scope', 'Admin', 'growl', '_t', function ($state, $scope, Admin, growl, _t) {
Application.Controllers.controller('NewAdminController', ['$state', '$scope', 'Admin', 'growl', '_t', 'phoneRequiredPromise',
function ($state, $scope, Admin, growl, _t, phoneRequiredPromise) {
// default admin profile
let getGender;
$scope.admin = {
@ -1090,6 +1091,9 @@ Application.Controllers.controller('NewAdminController', ['$state', '$scope', 'A
}
};
// is the phone number required in _admin_form?
$scope.phoneRequired = (phoneRequiredPromise.setting.value === 'true');
/**
* Shows the birth day datepicker
* @param $event {Object} jQuery event object

View File

@ -947,6 +947,9 @@ angular.module('application.router', ['ui.router'])
templateUrl: '<%= asset_path "admin/admins/new.html" %>',
controller: 'NewAdminController'
}
},
resolve: {
phoneRequiredPromise: ['Setting', function (Setting) { return Setting.get({ name: 'phone_required' }).$promise; }]
}
})
.state('app.admin.managers_new', {

View File

@ -110,12 +110,13 @@
<div class="form-group" ng-class="{'has-error': adminForm['admin[profile_attributes][phone]'].$dirty && adminForm['admin[profile_attributes][phone]'].$invalid}">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-phone"></i> </span>
<span class="input-group-addon"><i class="fa fa-phone"></i> <span class="exponent" ng-show="phoneRequired"><i class="fa fa-asterisk" aria-hidden="true"></i></span></span>
<input ng-model="admin.profile_attributes.phone"
type="text"
name="admin[profile_attributes][phone]"
class="form-control" id="user_phone"
placeholder="{{ 'app.admin.admins_new.phone_number' | translate }}">
placeholder="{{ 'app.admin.admins_new.phone_number' | translate }}"
ng-required="phoneRequired">
</div>
</div>
</div>