mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
add missing fields in training form
This commit is contained in:
parent
ca73e83f7e
commit
7deefd0e57
@ -5,7 +5,7 @@
|
||||
##
|
||||
# Controller used in the training creation page (admin)
|
||||
##
|
||||
Application.Controllers.controller "NewTrainingController", [ '$scope', ($scope) ->
|
||||
Application.Controllers.controller "NewTrainingController", [ '$scope', 'machinesPromise', ($scope, machinesPromise) ->
|
||||
|
||||
|
||||
|
||||
@ -17,6 +17,9 @@ Application.Controllers.controller "NewTrainingController", [ '$scope', ($scope)
|
||||
## API URL where the form will be posted
|
||||
$scope.actionUrl = '/api/trainings'
|
||||
|
||||
## list of machines
|
||||
$scope.machines = machinesPromise
|
||||
|
||||
##
|
||||
# For use with 'ng-class', returns the CSS class name for the uploads previews.
|
||||
# The preview may show a placeholder or the content of the file depending on the upload state.
|
||||
@ -34,7 +37,7 @@ Application.Controllers.controller "NewTrainingController", [ '$scope', ($scope)
|
||||
##
|
||||
# Controller used in the training edition page (admin)
|
||||
##
|
||||
Application.Controllers.controller "EditTrainingController", [ '$scope', '$stateParams', 'trainingPromise', ($scope, $stateParams, trainingPromise) ->
|
||||
Application.Controllers.controller "EditTrainingController", [ '$scope', '$stateParams', 'trainingPromise', 'machinesPromise', ($scope, $stateParams, trainingPromise, machinesPromise) ->
|
||||
|
||||
|
||||
|
||||
@ -49,6 +52,9 @@ Application.Controllers.controller "EditTrainingController", [ '$scope', '$state
|
||||
## Details of the training to edit (id in URL)
|
||||
$scope.training = trainingPromise
|
||||
|
||||
## list of machines
|
||||
$scope.machines = machinesPromise
|
||||
|
||||
##
|
||||
# For use with 'ng-class', returns the CSS class name for the uploads previews.
|
||||
# The preview may show a placeholder or the content of the file depending on the upload state.
|
||||
|
@ -530,6 +530,9 @@ angular.module('application.router', ['ui.router']).
|
||||
templateUrl: '<%= asset_path "admin/trainings/new.html" %>'
|
||||
controller: 'NewTrainingController'
|
||||
resolve:
|
||||
machinesPromise: ['Machine', (Machine)->
|
||||
Machine.query().$promise
|
||||
]
|
||||
translations: [ 'Translations', (Translations) ->
|
||||
Translations.query(['app.admin.trainings_new', 'app.shared.trainings']).$promise
|
||||
]
|
||||
@ -543,6 +546,9 @@ angular.module('application.router', ['ui.router']).
|
||||
trainingPromise: ['Training', '$stateParams', (Training, $stateParams)->
|
||||
Training.get(id: $stateParams.id).$promise
|
||||
]
|
||||
machinesPromise: ['Machine', (Machine)->
|
||||
Machine.query().$promise
|
||||
]
|
||||
translations: [ 'Translations', (Translations) ->
|
||||
Translations.query('app.shared.trainings').$promise
|
||||
]
|
||||
|
@ -51,6 +51,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-b-lg" ng-class="{'has-error': trainingForm['training[machine_ids]'].$dirty && trainingForm['training[machine_ids]'].$invalid}">
|
||||
<label for="name" class="col-sm-2 control-label">{{ 'associated_machines' | translate }}</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="hidden"
|
||||
value="{{training.machine_ids}}"
|
||||
name="training[machine_ids][]">
|
||||
<ui-select multiple ng-model="training.machine_ids" name="training[machine_ids][]" class="form-control">
|
||||
<ui-select-match>
|
||||
<span ng-bind="$item.name"></span>
|
||||
<input type="hidden" name="training[machine_ids][]" value="{{$item.id}}" />
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="m.id as m in (machines | filter: $select.search)">
|
||||
<span ng-bind-html="m.name | highlight: $select.search"></span>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group m-b-lg" ng-class="{'has-error': trainingForm['training[nb_total_places]'].$dirty && trainingForm['training[nb_total_places]'].$invalid}">
|
||||
<label for="name" class="col-sm-2 control-label">{{ 'number_of_tickets' | translate }}</label>
|
||||
<div class="col-sm-4">
|
||||
<input ng-model="training.nb_total_places"
|
||||
type="number"
|
||||
name="training[nb_total_places]"
|
||||
class="form-control"
|
||||
id="training_nb_total_places">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- ./panel-body -->
|
||||
|
||||
<div class="panel-footer no-padder">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="row no-gutter">
|
||||
<div class="col-xs-2 col-sm-2 col-md-1">
|
||||
<section class="heading-btn">
|
||||
<a ng-click="cancel()"><i class="fa fa-long-arrow-left"></i></a>
|
||||
<a ng-click="backPrevLocation($event)"><i class="fa fa-long-arrow-left"></i></a>
|
||||
</section>
|
||||
</div>
|
||||
<div class="col-xs-10 col-sm-10 col-md-8 b-l b-r-md">
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-md-3 b-t hide-b-md">
|
||||
<section class="heading-actions wrapper">
|
||||
<div class="btn btn-lg btn-block btn-default rounded m-t-xs" ng-click="cancel()" translate>{{ 'cancel' }}</div>
|
||||
<div class="btn btn-lg btn-block btn-default rounded m-t-xs" ng-click="backPrevLocation($event)" translate>{{ 'cancel' }}</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,8 +46,6 @@ en:
|
||||
|
||||
trainings:
|
||||
# track and monitor the trainings
|
||||
associated_machines: "Associated machines"
|
||||
number_of_tickets: "Number of tickets"
|
||||
training: "Training"
|
||||
year_NUMBER: "Year {{NUMBER}}" # angular interpolation
|
||||
month_of_NAME: "Month of {{NAME}}" # angular interpolation
|
||||
|
@ -46,8 +46,6 @@ fr:
|
||||
|
||||
trainings:
|
||||
# suivre et surveiller les formations
|
||||
associated_machines: "Machines associées"
|
||||
number_of_tickets: "Nombre de places"
|
||||
training: "Formation"
|
||||
year_NUMBER: "Année {{NUMBER}}" # angular interpolation
|
||||
month_of_NAME: "Mois de {{NAME}}" # angular interpolation
|
||||
|
@ -215,6 +215,8 @@ en:
|
||||
# training edition form
|
||||
add_a_new_training: "Add a new training"
|
||||
validate_your_training: "Validate your training"
|
||||
associated_machines: "Associated machines"
|
||||
number_of_tickets: "Number of tickets"
|
||||
|
||||
user_admin:
|
||||
# partial form to edit/create an user (admin view)
|
||||
|
@ -215,6 +215,8 @@ fr:
|
||||
# formulaire d'édition d'une formation
|
||||
add_a_new_training: "Ajouter une nouvelle formation"
|
||||
validate_your_training: "Valider votre formation"
|
||||
associated_machines: "Machines associées"
|
||||
number_of_tickets: "Nombre de places"
|
||||
|
||||
user_admin:
|
||||
# formulaire partiel d'édition/création utilisateur (vue admin)
|
||||
|
Loading…
Reference in New Issue
Block a user