webstaff: global services for managing MFHDs + create MFHD dialog
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 23 May 2017 21:58:44 +0000 (17:58 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 30 May 2017 16:06:49 +0000 (12:06 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/staff/share/t_mfhd_create_dialog.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/services/mfhd.js [new file with mode: 0644]

diff --git a/Open-ILS/src/templates/staff/share/t_mfhd_create_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_mfhd_create_dialog.tt2
new file mode 100644 (file)
index 0000000..c04d958
--- /dev/null
@@ -0,0 +1,25 @@
+<!--
+  MFHD creation dialog
+-->
+<div>
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title alert alert-info">Create new MFHD</h4> 
+  </div>
+  <div class="modal-body">
+    <label for="mfhd_lib_selector">
+      [% l('Select a library') %]
+    </label>
+    <eg-org-selector id="mfhd_lib_selector"
+      selected="mfhd_lib">
+    </eg-org-selector>
+  </div>
+  <div class="modal-footer">
+    [% dialog_footer %]
+    <input type="submit" class="btn btn-primary" 
+      ng-click="ok()" value="[% l('Create') %]"/>
+    <button class="btn btn-warning" 
+      ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
diff --git a/Open-ILS/web/js/ui/default/staff/services/mfhd.js b/Open-ILS/web/js/ui/default/staff/services/mfhd.js
new file mode 100644 (file)
index 0000000..488b7cf
--- /dev/null
@@ -0,0 +1,41 @@
+/**
+  * MFHD tools and directives.
+  */
+angular.module('egMfhdMod', ['egCoreMod', 'ui.bootstrap'])
+
+.factory('egMfhdCreateDialog',
+       ['$uibModal','egCore',
+function($uibModal , egCore) {
+    var service = {};
+
+    service.open = function(bibId, orgId) {
+        return $uibModal.open({
+            templateUrl: './share/t_mfhd_create_dialog',
+            controller: ['$scope', '$uibModalInstance',
+                function($scope, $uibModalInstance) {
+                    $scope.mfhd_lib = orgId ?
+                        egCore.org.get(orgId) :
+                        null;
+                    $scope.ok = function() {
+                        egCore.net.request(
+                            'open-ils.cat',
+                            'open-ils.cat.serial.record.xml.create',
+                            egCore.auth.token(),
+                            1, // source
+                            $scope.mfhd_lib.id(),
+                            bibId
+                        ).then(function() {
+                            $uibModalInstance.close()
+                        });
+                    }
+                    $scope.cancel = function() {
+                        $uibModalInstance.dismiss();
+                    }
+                }
+            ]
+        })
+    }
+
+    return service;
+}
+])