disable fields when cannot edit

This commit is contained in:
Kyle Spearrin 2017-09-21 22:56:31 -04:00
parent 05c8a39e6d
commit 9bdd0d116a
1 changed files with 12 additions and 9 deletions

View File

@ -112,20 +112,23 @@
<textarea id="notes" name="Notes" class="form-control" ng-model="login.notes" <textarea id="notes" name="Notes" class="form-control" ng-model="login.notes"
ng-readonly="readOnly" api-field></textarea> ng-readonly="readOnly" api-field></textarea>
</div> </div>
<div ng-if="!readOnly || (login.fields && login.fields.length)">
<hr /> <hr />
<h4><i class="fa fa-list-ul"></i> Custom Fields</h4> <h4><i class="fa fa-list-ul"></i> Custom Fields</h4>
</div>
<div ng-repeat="field in login.fields"> <div ng-repeat="field in login.fields">
<div class="row"> <div class="row">
<div class="col-sm-3"> <div class="col-sm-3">
<div class="form-group"> <div class="form-group">
<label for="field_name{{$index}}">Name</label> <label for="field_name{{$index}}">Name</label>
<input type="text" id="field_name{{$index}}" name="Field.Name{{$index}}" class="form-control" ng-model="field.name" /> <input type="text" id="field_name{{$index}}" class="form-control" ng-model="field.name"
ng-readonly="readOnly" />
</div> </div>
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">
<div class="form-group"> <div class="form-group">
<label for="field_type{{$index}}">Type</label> <label for="field_type{{$index}}">Type</label>
<select id="field_type{{$index}}" name="Field.Type{{$index}}" class="form-control" ng-model="field.type"> <select id="field_type{{$index}}" class="form-control" ng-model="field.type" ng-disabled="readOnly">
<option value="0">Text</option> <option value="0">Text</option>
<option value="1">Hidden</option> <option value="1">Hidden</option>
<option value="2">Boolean</option> <option value="2">Boolean</option>
@ -141,7 +144,7 @@
<label for="field_value{{$index}}">Value</label> <label for="field_value{{$index}}">Value</label>
<div class="input-group" ng-if="field.type !== '2'"> <div class="input-group" ng-if="field.type !== '2'">
<input ng-attr-type="{{field.type === '0' ? 'text' : 'password'}}" id="field_value{{$index}}" <input ng-attr-type="{{field.type === '0' ? 'text' : 'password'}}" id="field_value{{$index}}"
name="Field.Value{{$index}}" class="form-control" ng-model="field.value" /> class="form-control" ng-model="field.value" ng-readonly="readOnly" />
<span class="input-group-btn" uib-tooltip="Copy Value" tooltip-placement="left"> <span class="input-group-btn" uib-tooltip="Copy Value" tooltip-placement="left">
<button class="btn btn-default btn-flat" type="button" ngclipboard <button class="btn btn-default btn-flat" type="button" ngclipboard
ngclipboard-success="clipboardSuccess(e)" ngclipboard-error="clipboardError(e, true)" ngclipboard-success="clipboardSuccess(e)" ngclipboard-error="clipboardError(e, true)"
@ -151,14 +154,14 @@
</span> </span>
</div> </div>
<div ng-if="field.type === '2'"> <div ng-if="field.type === '2'">
<input type="checkbox" id="field_value{{$index}}" name="Field.Value{{$index}}" ng-model="field.value" <input type="checkbox" id="field_value{{$index}}" ng-model="field.value"
data-ng-true-value="'true'" /> data-ng-true-value="'true'" ng-disabled="readOnly" />
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<br class="hidden-xs" /> <br class="hidden-xs" />
<a href="#" ng-click="removeField(field)" stop-click> <a href="#" ng-click="removeField(field)" stop-click ng-if="!readOnly">
<i class="fa fa-remove"></i> <i class="fa fa-remove"></i>
<span class="visible-xs-inline">Remove Custom Field</span> <span class="visible-xs-inline">Remove Custom Field</span>
</a> </a>
@ -166,7 +169,7 @@
</div> </div>
<hr class="visible-xs-block" /> <hr class="visible-xs-block" />
</div> </div>
<a href="#" ng-click="addField()" stop-click> <a href="#" ng-click="addField()" stop-click ng-if="!readOnly">
<i class="fa fa-plus-circle"></i> New Custom Field <i class="fa fa-plus-circle"></i> New Custom Field
</a> </a>
</div> </div>