1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-06 01:08:21 +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 # 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 export reservations
- Fix a bug: unable to receive mails in development - 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) * 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 // default admin profile
let getGender; let getGender;
$scope.admin = { $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 * Shows the birth day datepicker
* @param $event {Object} jQuery event object * @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" %>', templateUrl: '<%= asset_path "admin/admins/new.html" %>',
controller: 'NewAdminController' controller: 'NewAdminController'
} }
},
resolve: {
phoneRequiredPromise: ['Setting', function (Setting) { return Setting.get({ name: 'phone_required' }).$promise; }]
} }
}) })
.state('app.admin.managers_new', { .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="form-group" ng-class="{'has-error': adminForm['admin[profile_attributes][phone]'].$dirty && adminForm['admin[profile_attributes][phone]'].$invalid}">
<div class="input-group"> <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" <input ng-model="admin.profile_attributes.phone"
type="text" type="text"
name="admin[profile_attributes][phone]" name="admin[profile_attributes][phone]"
class="form-control" id="user_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> </div>
</div> </div>