From d72697057908bbbecc961cc9a0eae421ab688c7d Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Mon, 11 Jul 2016 14:52:53 -0400 Subject: [PATCH] child node creation Signed-off-by: Jason Etheridge --- .../staff/admin/actor/org_unit/t_main_tab.tt2 | 8 ++++++++ .../js/ui/default/staff/admin/actor/org_unit/app.js | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/admin/actor/org_unit/t_main_tab.tt2 b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_main_tab.tt2 index 1d2e805cba..ebb6e20948 100644 --- a/Open-ILS/src/templates/staff/admin/actor/org_unit/t_main_tab.tt2 +++ b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_main_tab.tt2 @@ -60,6 +60,14 @@ +
+
+ +
+
+ [% l('NOTE: The new org unit will not exist in the database until Update Org is applied.') %] +
+
diff --git a/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js b/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js index c5b34a78d4..f27f6713a6 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js @@ -31,8 +31,8 @@ angular.module('egOrgUnitApp', }) .controller('OrgUnitCtrl', - ['$scope','$q','$routeParams','$window','egCore','egOrg','ngToast', -function($scope , $q , $routeParams , $window , egCore , egOrg , ngToast ) { + ['$scope','$q','$routeParams','$window','egCore','egIDL','egOrg','ngToast', +function($scope , $q , $routeParams , $window , egCore , egIDL , egOrg , ngToast ) { $scope.reset = function() { $scope.org = angular.copy($scope.selectedNode); @@ -92,12 +92,15 @@ function($scope , $q , $routeParams , $window , egCore , egOrg , ngToast ) { // main tab behavior $scope.update = function() { - var new_org = egOrg.get($scope.org.id); + var new_org = $scope.org.id == -1 ? new egIDL.aou() : egOrg.get($scope.org.id); + new_org.id( $scope.org.id ); + new_org.parent_ou( $scope.org.parent_ou ); new_org.name( $scope.org.name ); new_org.shortname( $scope.org.shortname ); new_org.email( $scope.org.email ); new_org.phone( $scope.org.phone ); - egCore.pcrud.update(new_org).then( + new_org.ou_type( 2 ); // FIXME + egCore.pcrud[$scope.org.id == -1 ? 'create' : 'update'](new_org).then( function(res) { // success window.sessionStorage.removeItem('eg.env.aou.tree'); egCore.env.load(); @@ -129,5 +132,12 @@ function($scope , $q , $routeParams , $window , egCore , egOrg , ngToast ) { ); }; + $scope.new_child = function() { + $scope.org.parent_ou = $scope.org.id; + $scope.org.id = -1; + $scope.org.name = ''; + $scope.org.shortname = ''; + }; + }]) -- 2.11.0