patron holds / add notification
authorBill Erickson <berick@esilibrary.com>
Tue, 8 Jul 2014 14:47:01 +0000 (10:47 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 8 Jul 2014 14:47:01 +0000 (10:47 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/share/t_hold_notification_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_notification_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_notification_dialog.tt2
new file mode 100644 (file)
index 0000000..01b5b48
--- /dev/null
@@ -0,0 +1,33 @@
+<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 Record of Hold Notification') %]</h4>
+    </div>
+    <div class="modal-body">
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-method">[% l('Notification Method') %]</label>
+        </div>
+        <div class="col-md-9">
+          <input type="text" class="form-control" focus-me='focusNote' required
+            id="note-method" ng-model="args.method" placeholder="[% l('Notification Method...') %]"/>
+        </div>
+      </div>
+      <div class="form-group row">
+        <div class="col-md-3">
+          <label for="note-note">[% l('Note') %]</label>
+        </div>
+        <div class="col-md-9">
+          <textarea class="form-control" required
+            id="note-note" ng-model="args.note" placeholder="[% l('Note') %]">
+          </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 5b67f83..347c687 100644 (file)
@@ -432,6 +432,35 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog , egAlertDialog)
                     });
                 }
 
+                $scope.new_notification = function() {
+                    return $modal.open({
+                        templateUrl : './circ/share/t_hold_notification_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.ahn();
+                        note.hold($scope.hold.id());
+                        note.method(args.method);
+                        note.note(args.note);
+                        note.notify_staff(egCore.auth.user().id());
+                        note.notify_time('now');
+                        return egCore.pcrud.create(note).then(function() {
+                            $scope.hold.notifications().push(note);
+                        });
+                    });
+                }
+
                 $scope.$watch('holdId', function(newVal, oldVal) {
                     if (newVal != oldVal) draw();
                 });