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');
|
||||
|
Reference in New Issue
Block a user