From: Jason Etheridge Date: Wed, 11 May 2016 19:17:47 +0000 (-0400) Subject: Toward an Angular replacement for Org Units Conify X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=efa65bd5c7640758585070e66819f06e82522b78;p=evergreen%2Ftadl.git Toward an Angular replacement for Org Units Conify Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/templates/staff/admin/actor/org_unit/index.tt2 b/Open-ILS/src/templates/staff/admin/actor/org_unit/index.tt2 new file mode 100644 index 0000000000..8959e196a1 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/actor/org_unit/index.tt2 @@ -0,0 +1,15 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Organizational Units"); + ctx.page_app = "egOrgUnitApp"; +%] + +[% BLOCK APP_JS %] + + + +[% END %] + +
+ +[% END %] diff --git a/Open-ILS/src/templates/staff/admin/actor/org_unit/t_addresses_tab.tt2 b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_addresses_tab.tt2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Open-ILS/src/templates/staff/admin/actor/org_unit/t_hours_tab.tt2 b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_hours_tab.tt2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Open-ILS/src/templates/staff/admin/actor/org_unit/t_index.tt2 b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_index.tt2 new file mode 100644 index 0000000000..b45667f779 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_index.tt2 @@ -0,0 +1,51 @@ +
+
+ [% l('Organizational Unit') %] +
+
+ +
+
+ + {{node.shortname}} : {{node.name}} ({{node.children.length}}) + +
+ +
+ + {{selectedNode.name || ' '}} + + + +
+
+
+ [% INCLUDE 'staff/admin/actor/org_unit/t_main_tab.tt2' %] +
+
+ hours tab +
+
+ addr tab +
+
+
+ +
+
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 new file mode 100644 index 0000000000..11134b7d11 --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/actor/org_unit/t_main_tab.tt2 @@ -0,0 +1,46 @@ +
+ +
+
+
+ [% l('Name') %] +
+
+ +
+
+
+
+ [% l('Short Name') %] +
+
+ +
+
+
+
+ [% l('Email') %] +
+
+ +
+
+
+
+ [% l('Phone') %] +
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
diff --git a/Open-ILS/src/templates/staff/css/admin.css.tt2 b/Open-ILS/src/templates/staff/css/admin.css.tt2 index 0de1df91b1..80e9ccf0cd 100644 --- a/Open-ILS/src/templates/staff/css/admin.css.tt2 +++ b/Open-ILS/src/templates/staff/css/admin.css.tt2 @@ -28,3 +28,10 @@ #auto-print-container .row { margin-top: 20px; } + +#edit-org-container input.ng-invalid-required { + background-color: yellow; + color: red; +} + + 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 new file mode 100644 index 0000000000..bab6a63ee9 --- /dev/null +++ b/Open-ILS/web/js/ui/default/staff/admin/actor/org_unit/app.js @@ -0,0 +1,87 @@ +angular.module('egOrgUnitApp', + ['ngRoute', 'ui.bootstrap', 'treeControl', 'egCoreMod', 'egUiMod']) + +.config(function($routeProvider, $locationProvider, $compileProvider) { + $locationProvider.html5Mode(true); + $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); // grid export + + var resolver = {delay : + ['egStartup', function(egStartup) {return egStartup.go()}]} + + $routeProvider.when('/admin/actor/org_unit/:org_id', { + templateUrl: './admin/actor/org_unit/t_index', + controller: 'OrgUnitCtrl', + resolve : resolver + }); + + $routeProvider.when('/admin/actor/org_unit/', { + templateUrl: './admin/actor/org_unit/t_index', + controller: 'OrgUnitCtrl', + resolve : resolver + }); + + $routeProvider.otherwise({redirectTo : '/admin/actor/org_unit/'}); +}) + +.controller('OrgUnitCtrl', + ['$scope','$q','$routeParams','$window','egCore','egOrg', +function($scope , $q , $routeParams , $window , egCore , egOrg ) { + + $scope.update = function() { + var new_org = egOrg.get($scope.org.id); + 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( + function(res) { // success + console.log('handler1'); + window.handler1 = res; + }, + function(res) { // success + console.log('handler2'); + window.handler2 = res; + }, + function(res) { // error + console.log('handler3'); + window.handler3 = res; + } + ); + }; + + $scope.reset = function() { + $scope.org = angular.copy($scope.selectedNode); + }; + + $scope.reset(); + + // the org tree + + $scope.treedata = [ egCore.idl.toHash( egOrg.tree() ) ]; + $scope.expandedNodes = [ $scope.treedata[0] ]; + + $scope.showSelected = function(sel) { + $scope.selectedNode = sel; + $scope.org = angular.copy($scope.selectedNode); + }; + + // the tabs + $scope.org_tab = 'main'; + $scope.set_org_tab = function(tab) { + $scope.org_tab = tab; + + switch(tab) { + + case 'main': + break; + + case 'hours': + break; + + case 'addresses': + break; + } + } + +}]) +