mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
Various tweaks
This commit is contained in:
@ -73,6 +73,14 @@ function checkListsControllerFactory(isEdit) {
|
||||
}
|
||||
}
|
||||
|
||||
function moveUpField(index) {
|
||||
$scope.model.fields.splice(index - 1, 0, $scope.model.fields.splice(index, 1)[0]);
|
||||
}
|
||||
|
||||
function moveDownField(index) {
|
||||
$scope.model.fields.splice(index + 1, 0, $scope.model.fields.splice(index, 1)[0]);
|
||||
}
|
||||
|
||||
function save() {
|
||||
if (isEdit) {
|
||||
CheckLists.update({id: $scope.model._id}, $scope.model, function() {
|
||||
@ -87,6 +95,8 @@ function checkListsControllerFactory(isEdit) {
|
||||
|
||||
$scope.addField = addField;
|
||||
$scope.removeField = removeField;
|
||||
$scope.moveUpField = moveUpField;
|
||||
$scope.moveDownField = moveDownField;
|
||||
$scope.save = save;
|
||||
$scope.isEdit = isEdit;
|
||||
|
||||
|
@ -257,4 +257,13 @@ angular.module('biomed')
|
||||
$location.path("/deviceTypes/");
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function() {
|
||||
$scope.model.images = Object.keys(images);
|
||||
$scope.model.deleted = true;
|
||||
|
||||
DeviceTypes.update({id: $scope.model._id}, $scope.model, function(result) {
|
||||
$location.path("/deviceTypes/");
|
||||
});
|
||||
};
|
||||
})
|
||||
|
@ -104,6 +104,20 @@ function devicesControllerFactory(isEdit) {
|
||||
});
|
||||
}
|
||||
|
||||
function destroy() {
|
||||
$scope.model.deleted = true;
|
||||
Devices.update({id: $scope.model._id}, $scope.model, function() {
|
||||
$location.path("/clients/" + $scope.model.client);
|
||||
});
|
||||
}
|
||||
|
||||
function restore() {
|
||||
$scope.model.deleted = false;
|
||||
Devices.update({id: $scope.model._id}, $scope.model, function() {
|
||||
$location.path("/clients/" + $scope.model.client);
|
||||
});
|
||||
}
|
||||
|
||||
var hashids = new Hashids("biomed");
|
||||
var search = $location.search();
|
||||
|
||||
@ -121,6 +135,8 @@ function devicesControllerFactory(isEdit) {
|
||||
|
||||
$scope.create = create;
|
||||
$scope.update = update;
|
||||
$scope.destroy = destroy;
|
||||
$scope.restore = restore;
|
||||
|
||||
deviceTypePickerFactory('category', 'Device Type');
|
||||
deviceTypePickerFactory('make', 'Make');
|
||||
|
@ -57,7 +57,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button ng-click="removeField($index)" ng-disabled="model.fields.length <= 1" class="btn" type="button">Remove Field</button>
|
||||
<button ng-click="removeField($index)" ng-disabled="model.fields.length <= 1" class="btn" type="button">Remove</button>
|
||||
<button ng-click="moveUpField($index)" ng-disabled="model.fields.length <= 1 || $index == 0" class="btn" type="button">Move Up</button>
|
||||
<button ng-click="moveDownField($index)" ng-disabled="model.fields.length <= 1 || $index == model.fields.length - 1" class="btn" type="button">Move Down</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -299,8 +299,8 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 7%">Control #</th>
|
||||
<th style="width: 6%">Category</th>
|
||||
<th style="width: 5%">Make</th>
|
||||
<th style="width: 6%">Device</th>
|
||||
<th style="width: 5%">Manufacturer</th>
|
||||
<th style="width: 5%">Model</th>
|
||||
<th style="width: 5%">Serial No.</th>
|
||||
<th style="width: 8%">Purchase Date</th>
|
||||
|
@ -101,6 +101,7 @@
|
||||
<div class="section-label"> </div>
|
||||
<div class="section-container">
|
||||
<button ng-click="save()" ng-disabled="form.$invalid" type="button" class="btn btn-primary">Save</button>
|
||||
<button ng-click="delete()" ng-disabled="form.$invalid" ng-show="accountHasPermission('system.admin')" type="button" class="btn btn-danger">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -20,8 +20,8 @@
|
||||
<table class="biomed-table" infinite-scroll="addItems()" can-load="canLoad" threshold="300">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 33%" ng-class="selectedCls('category')" ng-click="changeSorting('category')">Device Type</th>
|
||||
<th style="width: 33%" ng-class="selectedCls('make')" ng-click="changeSorting('make')">Make</th>
|
||||
<th style="width: 33%" ng-class="selectedCls('category')" ng-click="changeSorting('category')">Device</th>
|
||||
<th style="width: 33%" ng-class="selectedCls('make')" ng-click="changeSorting('make')">Manufacturer</th>
|
||||
<th style="width: 33%" ng-class="selectedCls('model')" ng-click="changeSorting('model')">Model</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
@ -12,13 +12,13 @@
|
||||
<div class="section-container">
|
||||
<div class="form-editor">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Category</label>
|
||||
<label class="control-label">Device</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" ng-model="deviceTypes.category.picker" ui-select2="deviceTypes.category.opts" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Make</label>
|
||||
<label class="control-label">Manufacturer</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" ng-model="deviceTypes.make.picker" ui-select2="deviceTypes.make.opts" />
|
||||
</div>
|
||||
|
@ -15,13 +15,13 @@
|
||||
<div class="section-container">
|
||||
<div class="form-editor">
|
||||
<div class="control-group">
|
||||
<label class="control-label">Category</label>
|
||||
<label class="control-label">Device</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" ng-model="deviceTypes.category.picker" ui-select2="deviceTypes.category.opts" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label">Make</label>
|
||||
<label class="control-label">Manufacturer</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" ng-model="deviceTypes.make.picker" ui-select2="deviceTypes.make.opts" />
|
||||
</div>
|
||||
@ -167,6 +167,7 @@
|
||||
<div class="section-label"> </div>
|
||||
<div class="section-container">
|
||||
<button ng-click="update()" ng-disabled="form.$invalid || !model.deviceType" type="button" class="btn btn-primary">Save</button>
|
||||
<button ng-click="destroy()" ng-show="accountHasPermission('system.admin')" type="button" class="btn btn-danger">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user