patron holds / add hold note
authorBill Erickson <berick@esilibrary.com>
Mon, 7 Jul 2014 20:51:58 +0000 (16:51 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 7 Jul 2014 20:51:58 +0000 (16:51 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/share/t_hold_note_dialog.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_note_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_note_dialog.tt2
new file mode 100644 (file)
index 0000000..92113da
--- /dev/null
@@ -0,0 +1,51 @@
+<form ng-submit="ok(args)" role="form">
+    <div class="modal-header">
+      <button type="button" class="close" ng-click="cancel()" 
+        aria-hidden="true">&times;</button>
+      <h4 class="modal-title">[% l('Create a new note') %]</h4>
+    </div>
+    <div class="modal-body">
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-pub">[% l('Patron Visible?') %]</label>
+        </div>
+        <div class="col-md-9">
+          <input type="checkbox" class="checkbox" 
+            id="note-pub" ng-model="args.pub"/>
+        </div>
+      </div>
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-slip">[% l('Print on Slip?') %]</label>
+        </div>
+        <div class="col-md-9">
+          <input type="checkbox" class="checkbox" 
+            id="note-slip" ng-model="args.slip"/>
+        </div>
+      </div>
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-title">[% l('Title') %]</label>
+        </div>
+        <div class="col-md-9">
+          <input type="text" class="form-control" focus-me='focusNote' required
+            id="note-title" ng-model="args.title" placeholder="[% l('Title...') %]"/>
+        </div>
+      </div>
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-body">[% l('Note Body') %]</label>
+        </div>
+        <div class="col-md-9">
+          <textarea class="form-control" required
+            id="note-body" ng-model="args.body" placeholder="[% l('Note Body...') %]">
+          </textarea>
+        </div>
+      </div>
+    </div>
+    <div class="modal-footer">
+      <input type="submit" class="btn btn-primary" value="[% l('OK') %]"/>
+      <button class="btn btn-warning" ng-click="cancel($event)">[% l('Cancel') %]</button>
+    </div>
+  </div> <!-- modal-content -->
+</form>
index 022da4f..f6063b0 100644 (file)
@@ -343,8 +343,8 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog , egAlertDialog)
             showPatron : '='
         },
         controller : [
-                    '$scope','egCore','egHolds','egCirc',
-            function($scope , egCore , egHolds , egCirc) {
+                    '$scope','$modal','egCore','egHolds','egCirc',
+            function($scope , $modal , egCore , egHolds , egCirc) {
 
                 function draw() {
                     if (!$scope.holdId) return;
@@ -390,12 +390,36 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog , egAlertDialog)
                     });
                 }
 
-                /*
                 $scope.new_note = function() {
-                    $modal.open({
-                        templateUrl : './circ/patron 
+                    return $modal.open({
+                        templateUrl : './circ/share/t_hold_note_dialog',
+                        controller : 
+                            ['$scope', '$modalInstance',
+                            function($scope, $modalInstance) {
+                                $scope.args = {};
+                                $scope.ok = function() {
+                                    $modalInstance.close($scope.args)
+                                },
+                                $scope.cancel = function($event) {
+                                    $modalInstance.dismiss();
+                                    $event.preventDefault();
+                                }
+                            }
+                        ]
+                    }).result.then(function(args) {
+                        var note = new egCore.idl.ahrn();
+                        note.hold($scope.hold.id());
+                        // use t/f instead of bools here so template is happy
+                        note.staff('t'); 
+                        note.slip(args.slip ? 't' : 'f');
+                        note.pub(args.pub ? 't' : 'f');
+                        note.title(args.title);
+                        note.body(args.body);
+                        return egCore.pcrud.create(note).then(function() {
+                            $scope.hold.notes().push(note);
+                        });
+                    });
                 }
-                */
 
                 $scope.$watch('holdId', function(newVal, oldVal) {
                     if (newVal != oldVal) draw();