1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-02 13:24:20 +01:00
fab-manager/app/assets/templates/admin/trainings/_form.html.erb

142 lines
6.6 KiB
Plaintext
Raw Normal View History

2016-07-13 18:15:14 +02:00
<form role="form"
name="trainingForm"
class="form-horizontal"
ng-attr-action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
unsaved-warning-form
novalidate>
<input name="_method" type="hidden" ng-value="method">
<section class="panel panel-default bg-light m-lg">
<div class="panel-body m-r">
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
<div class="form-group m-b-lg" ng-class="{'has-error': trainingForm['training[name]'].$dirty && trainingForm['training[name]'].$invalid}">
2017-10-10 17:16:43 +02:00
<label for="name" class="col-sm-2 control-label">{{ 'trainings_form.name' | translate }} *</label>
2016-07-13 18:15:14 +02:00
<div class="col-sm-4">
<input name="training[name]"
ng-model="training.name"
type="text"
class="form-control"
id="training_name"
2017-10-10 17:16:43 +02:00
placeholder="{{'trainings_form.name' | translate}}"
2016-07-13 18:15:14 +02:00
required/>
2017-10-10 17:16:43 +02:00
<span class="help-block" ng-show="trainingForm['training[name]'].$dirty && trainingForm['training[name]'].$error.required" translate>{{ 'trainings_form.name_is_required' }}</span>
2016-07-13 18:15:14 +02:00
</div>
</div>
<div class="form-group m-b-lg">
2017-10-10 17:16:43 +02:00
<label for="training_image" class="col-sm-2 control-label">{{ 'trainings_form.illustration' | translate }} *</label>
2016-07-13 18:15:14 +02:00
<div class="col-sm-10">
<div class="fileinput" data-provides="fileinput" ng-class="fileinputClass(training.training_image)">
<div class="fileinput-new thumbnail" style="width: 334px; height: 250px;">
<img src="data:image/png;base64," data-src="holder.js/100%x100%/text:&#xf03e;/font:FontAwesome/icon" bs-holder ng-if="!training.training_image">
</div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 334px;">
<img ng-src="{{ training.training_image }}" alt="" />
</div>
<div>
<span class="btn btn-default btn-file">
2017-10-10 17:16:43 +02:00
<span class="fileinput-new">{{ 'trainings_form.add_an_illustration' | translate }} <i class="fa fa-upload fa-fw"></i></span>
2016-07-13 18:15:14 +02:00
<span class="fileinput-exists" translate>{{ 'change' }}</span>
<input type="file"
ng-model="training.training_image"
name="training[training_image_attributes][attachment]"
accept="image/*"
required
bs-jasny-fileinput>
</span>
<a href="#" class="btn btn-danger fileinput-exists" data-dismiss="fileinput" translate>{{ 'delete' }}</a>
</div>
</div>
</div>
</div>
<div class="form-group m-b-xl" ng-class="{'has-error': trainingForm['training[description]'].$dirty && trainingForm['training[description]'].$invalid}">
2017-10-10 17:16:43 +02:00
<label for="training_description" class="col-sm-2 control-label">{{ 'trainings_form.description' | translate }} *</label>
2016-07-13 18:15:14 +02:00
<div class="col-sm-10">
<input type="hidden" name="training[description]" ng-value="training.description" />
<summernote ng-model="training.description" id="training_description" placeholder="" config="summernoteOpts" name="training[description]" required></summernote>
2017-10-10 17:16:43 +02:00
<span class="help-block" ng-show="trainingForm['training[description]'].$dirty && trainingForm['training[description]'].$error.required" translate>{{ 'trainings_form.description_is_required' }}</span>
2016-07-13 18:15:14 +02:00
</div>
</div>
<div class="form-group m-b-lg" ng-class="{'has-error': trainingForm['training[machine_ids]'].$dirty && trainingForm['training[machine_ids]'].$invalid}">
2017-10-10 17:16:43 +02:00
<label for="training_machines" class="col-sm-2 control-label">{{ 'trainings_form.associated_machines' | translate }}</label>
2016-07-13 18:15:14 +02:00
<div class="col-sm-4">
<ui-select multiple ng-model="training.machine_ids" class="form-control" id="training_machines">
<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 ui-disable-choice="m.disabled" repeat="m.id as m in (machines | filter: $select.search)">
2016-07-13 18:15:14 +02:00
<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}">
2017-10-10 17:16:43 +02:00
<label for="training_nb_total_places" class="col-sm-2 control-label">{{ 'trainings_form.number_of_tickets' | translate }}</label>
2016-07-13 18:15:14 +02:00
<div class="col-sm-4">
<input ng-model="training.nb_total_places"
type="number"
min="0"
name="training[nb_total_places]"
class="form-control"
id="training_nb_total_places">
</div>
</div>
<div class="form-group">
<label for="training[public_page]" class="control-label col-sm-2" translate>
2017-10-10 17:16:43 +02:00
{{ 'trainings_form.public_page' }}
</label>
<div class="col-sm-10">
<input bs-switch
ng-model="training.public_page"
name="training[public_page]"
type="checkbox"
class="form-control"
switch-on-text="{{ 'yes' | translate }}"
switch-off-text="{{ 'no' | translate }}"
2017-10-10 17:16:43 +02:00
switch-active="{{!training.disabled}}"
switch-animate="true"/>
<input type="hidden" name="training[public_page]" value="{{training.public_page}}">
</div>
</div>
2017-10-10 17:16:43 +02:00
<div class="form-group">
2017-10-11 12:10:05 +02:00
<label for="training[disabled]" class="control-label col-sm-2" translate>
2017-10-10 17:16:43 +02:00
{{ 'trainings_form.disable_training' }}
</label>
<div class="col-sm-10">
<input bs-switch
ng-model="training.disabled"
name="training[disabled]"
type="checkbox"
class="form-control"
switch-on-text="{{ 'yes' | translate }}"
switch-off-text="{{ 'no' | translate }}"
ng-change="onDisableToggled()"
switch-animate="true"/>
<input type="hidden" name="training[disabled]" value="{{training.disabled}}">
</div>
</div>
2016-07-13 18:15:14 +02:00
</div> <!-- ./panel-body -->
<div class="panel-footer no-padder">
<input type="submit"
2017-10-10 17:16:43 +02:00
value="{{ 'trainings_form.validate_your_training' | translate }}"
2016-07-13 18:15:14 +02:00
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="trainingForm.$invalid"/>
</div>
</section>
</form>