1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/app/assets/templates/machines/_form.html.erb

141 lines
6.9 KiB
Plaintext
Raw Normal View History

2016-07-13 18:15:14 +02:00
<form role="form"
name="machineForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
unsaved-warning-form
novalidate>
2015-05-05 03:10:25 +02:00
<input name="_method" type="hidden" ng-value="method">
2016-03-23 18:39:41 +01:00
<section class="panel panel-default bg-light m-lg">
<div class="panel-body m-r">
2015-05-05 03:10:25 +02:00
2016-03-23 18:39:41 +01:00
<uib-alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</uib-alert>
2015-05-05 03:10:25 +02:00
<div class="form-group m-b-lg" ng-class="{'has-error': machineForm['machine[name]'].$dirty && machineForm['machine[name]'].$invalid}">
2017-10-11 12:10:05 +02:00
<label for="name" class="col-sm-2 control-label">{{ 'machine_form.name' | translate }} *</label>
2015-05-05 03:10:25 +02:00
<div class="col-sm-4">
2016-07-13 18:15:14 +02:00
<input ng-model="machine.name"
type="text"
name="machine[name]"
class="form-control"
id="machine_name"
2017-10-11 12:10:05 +02:00
placeholder="{{'machine_form.name' | translate}}"
2016-07-13 18:15:14 +02:00
required>
2017-10-11 12:10:05 +02:00
<span class="help-block" ng-show="machineForm['machine[name]'].$dirty && machineForm['machine[name]'].$error.required" translate>{{ 'machine_form.name_is_required' }}</span>
2015-05-05 03:10:25 +02:00
</div>
</div>
<div class="form-group m-b-lg">
2017-10-11 12:10:05 +02:00
<label for="machine_image" class="col-sm-2 control-label">{{ 'machine_form.illustration' | translate }} *</label>
2015-05-05 03:10:25 +02:00
<div class="col-sm-10">
<div class="fileinput" data-provides="fileinput" ng-class="fileinputClass(machine.machine_image)">
2016-03-23 18:39:41 +01:00
<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="!machine.machine_image">
</div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 334px;">
<img ng-src="{{ machine.machine_image }}" alt="" />
</div>
<div>
<span class="btn btn-default btn-file">
2017-10-11 12:10:05 +02:00
<span class="fileinput-new">{{ 'machine_form.add_an_illustration' | translate }} <i class="fa fa-upload fa-fw"></i></span>
2016-03-23 18:39:41 +01:00
<span class="fileinput-exists" translate>{{ 'change' }}</span>
<input type="file"
ng-model="machine.machine_image"
2016-03-23 18:39:41 +01:00
name="machine[machine_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>
2015-05-05 03:10:25 +02:00
</div>
</div>
</div>
<div class="form-group m-b-xl" ng-class="{'has-error': machineForm['machine[description]'].$dirty && machineForm['machine[description]'].$invalid}">
2017-10-11 12:10:05 +02:00
<label for="description" class="col-sm-2 control-label">{{ 'machine_form.description' | translate }} *</label>
2015-05-05 03:10:25 +02:00
<div class="col-sm-10">
2016-07-13 18:15:14 +02:00
<input type="hidden"
name="machine[description]"
ng-value="machine.description" />
<summernote ng-model="machine.description"
id="machine_description"
placeholder=""
config="summernoteOpts"
name="machine[description]"
required>
</summernote>
2017-10-11 12:10:05 +02:00
<span class="help-block" ng-show="machineForm['machine[description]'].$dirty && machineForm['machine[description]'].$error.required" translate>{{ 'machine_form.description_is_required' }}</span>
2015-05-05 03:10:25 +02:00
</div>
</div>
<div class="form-group m-b-xl" ng-class="{'has-error': machineForm['machine[spec]'].$dirty && machineForm['machine[spec]'].$invalid}">
2017-10-11 12:10:05 +02:00
<label for="spec" class="col-sm-2 control-label">{{ 'machine_form.technical_specifications' | translate }} *</label>
2015-05-05 03:10:25 +02:00
<div class="col-sm-10">
2016-07-13 18:15:14 +02:00
<input type="hidden"
name="machine[spec]"
ng-value="machine.spec" />
<summernote ng-model="machine.spec"
id="machine_spec"
placeholder=""
config="summernoteOpts"
name="machine[spec]"
required>
</summernote>
2017-10-11 12:10:05 +02:00
<span class="help-block" ng-show="machineForm['machine[spec]'].$dirty && machineForm['machine[spec]'].$error.required" translate>{{ 'machine_form.technical_specifications_are_required' }}</span>
2015-05-05 03:10:25 +02:00
</div>
</div>
<div class="form-group m-b-xl">
2019-04-18 11:35:09 +02:00
<label class="col-sm-2 control-label" translate>{{ 'machine_form.attached_files_pdf' }}</label>
2015-05-05 03:10:25 +02:00
<div class="col-sm-10">
<div ng-repeat="file in machine.machine_files_attributes" ng-show="!file._destroy">
<input type="hidden" ng-model="file.id" name="machine[machine_files_attributes][][id]" ng-value="file.id" />
<input type="hidden" ng-model="file._destroy" name="machine[machine_files_attributes][][_destroy]" ng-value="file._destroy"/>
<div class="fileinput input-group" data-provides="fileinput" ng-class="fileinputClass(file.attachment)">
<div class="form-control" data-trigger="fileinput">
<i class="glyphicon glyphicon-file fileinput-exists"></i> <span class="fileinput-filename">{{file.attachment}}</span>
</div>
2017-10-11 12:10:05 +02:00
<span class="input-group-addon btn btn-default btn-file"><span class="fileinput-new" translate>{{ 'machine_form.attach_a_file' }}</span>
2016-03-23 18:39:41 +01:00
<span class="fileinput-exists" translate>{{ 'change' }}</span><input type="file" name="machine[machine_files_attributes][][attachment]" accept=".pdf"></span>
2015-05-05 03:10:25 +02:00
<a class="input-group-addon btn btn-danger fileinput-exists" data-dismiss="fileinput" ng-click="deleteFile(file)"><i class="fa fa-trash-o"></i></a>
</div>
</div>
2017-10-11 12:10:05 +02:00
<a class="btn btn-default" ng-click="addFile()" role="button"> {{ 'machine_form.add_an_attachment' | translate }} <i class="fa fa-file-o fa-fw"></i></a>
</div>
</div>
<div class="form-group">
<label for="machine[disabled]" class="control-label col-sm-2" translate>
{{ 'machine_form.disable_machine' }}
</label>
<div class="col-sm-10">
<input bs-switch
ng-model="machine.disabled"
name="machine[disabled]"
type="checkbox"
class="form-control"
switch-on-text="{{ 'yes' | translate }}"
switch-off-text="{{ 'no' | translate }}"
switch-animate="true"/>
<input type="hidden" name="machine[disabled]" value="{{machine.disabled}}">
2015-05-05 03:10:25 +02:00
</div>
</div>
</div> <!-- ./panel-body -->
<div class="panel-footer no-padder">
2016-07-13 18:15:14 +02:00
<input type="submit"
2017-10-11 12:10:05 +02:00
value="{{ 'machine_form.validate_your_machine' | 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="machineForm.$invalid"/>
2015-05-05 03:10:25 +02:00
</div>
</section>
</form>