From 2c20d1ce06dd7636e0fae03f1da9faefd494e830 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 10 Mar 2016 13:08:00 -0500 Subject: [PATCH] LP#1554714 Migrate eg-date-input to ui-datepicker-popup Also add support for uib-timepicker as an option secondary component of the input. Refactor existing use of eg-date-input to use -style declaration to better differentiate between a normal and the more complete/stylized date input div. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/base_js.tt2 | 1 + .../staff/circ/checkin/t_checkin.tt2 | 3 +- .../staff/circ/patron/t_bill_history.tt2 | 33 +++++++---- .../staff/circ/patron/t_checkout.tt2 | 3 +- .../templates/staff/circ/patron/t_edit.tt2 | 18 +++--- .../circ/patron/t_edit_due_date_dialog.tt2 | 6 +- .../staff/circ/patron/t_messages.tt2 | 19 ++++--- .../circ/patron/t_renew_with_date_dialog.tt2 | 3 +- .../templates/staff/circ/renew/t_renew.tt2 | 2 +- .../staff/circ/share/t_backdate_dialog.tt2 | 3 +- .../staff/circ/share/t_hold_dates.tt2 | 18 +++--- .../share/t_mark_claims_returned_dialog.tt2 | 5 +- .../src/templates/staff/share/t_datetime.tt2 | 38 +++++++++++++ .../web/js/ui/default/staff/services/ui.js | 55 +++++++------------ 14 files changed, 123 insertions(+), 84 deletions(-) create mode 100644 Open-ILS/src/templates/staff/share/t_datetime.tt2 diff --git a/Open-ILS/src/templates/staff/base_js.tt2 b/Open-ILS/src/templates/staff/base_js.tt2 index 4e5ab8f593..54e6e7fcb2 100644 --- a/Open-ILS/src/templates/staff/base_js.tt2 +++ b/Open-ILS/src/templates/staff/base_js.tt2 @@ -59,6 +59,7 @@ '[% l('This page may have unsaved data.\n\nAre you sure you want to leave this page?') %]'; s.EG_UNLOAD_PAGE_PROMPT_MSG = '[% l('This page may have unsaved data.') %]'; + s.EG_DATE_INPUT_CLOSE_TEXT = '[% l('Close') %]'; }]); diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 index ba3b332c0c..f6b81f2b24 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 @@ -80,8 +80,7 @@
[% l('Effective Date') %]
-
+
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 index aef6084274..d9c454397d 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_bill_history.tt2 @@ -15,17 +15,28 @@
-
-
[% l('Selected Billed:') %]
-
{{totals.selected_billed() | currency}}
-
[% l('Selected Paid:') %]
-
{{totals.selected_paid() | currency}}
-
-
-
[% l('Start Date:') %]
-
-
[% l('End Date:') %]
-
+
+
+ + + {{totals.selected_billed() | currency}} +
+
+ + {{totals.selected_paid() | currency}} +
+
+ +
+
+ +
+
+
+ +
+

[% INCLUDE 'staff/circ/patron/t_bill_history_xacts.tt2' %] diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index 28bba44456..fb590a638c 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -50,8 +50,7 @@ --> -
+
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 index 77e5c7f8c2..5d94abe62b 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_edit.tt2 @@ -260,15 +260,11 @@ within the "form" by name for validation.
[% draw_field_label('au', 'dob') %]
- - class="form-control" ng-model="patron.dob"/> + ng-blur="handle_field_changed(patron, 'dob')"> +
[% draw_example_text('au', 'dob') %] @@ -438,9 +434,11 @@ within the "form" by name for validation.
[% draw_field_label('au', 'expire_date') %]
- + ng-model="patron.expire_date"> +
diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 index b145d0e601..edcbda49c3 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_hold_dates.tt2 @@ -22,8 +22,9 @@
- + +
@@ -35,8 +36,9 @@
- + +
@@ -48,8 +50,9 @@
- + +
@@ -61,8 +64,9 @@
- +
diff --git a/Open-ILS/src/templates/staff/circ/share/t_mark_claims_returned_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_mark_claims_returned_dialog.tt2 index 858e242f94..d2828a06ab 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_mark_claims_returned_dialog.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_mark_claims_returned_dialog.tt2 @@ -14,8 +14,9 @@
- + +
diff --git a/Open-ILS/src/templates/staff/share/t_datetime.tt2 b/Open-ILS/src/templates/staff/share/t_datetime.tt2 new file mode 100644 index 0000000000..3f2bd01765 --- /dev/null +++ b/Open-ILS/src/templates/staff/share/t_datetime.tt2 @@ -0,0 +1,38 @@ +
+
+ +
+ + + + +
+
+ +
+ + + + +
+
+ diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 3808a67e50..b774050931 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -456,45 +456,30 @@ function($window , egStrings) { }) /* -http://stackoverflow.com/questions/18061757/angular-js-and-html5-date-input-value-how-to-get-firefox-to-show-a-readable-d - -This directive allows us to use html5 input type="date" (for Chrome) and -gracefully fall back to a regular ISO text input for Firefox. -It also allows us to abstract away some browser finickiness. +* Handy wrapper directive for uib-datapicker-popup */ .directive( - 'egDateInput', - function(dateFilter) { + 'egDateInput', ['egStrings', + function(egStrings) { return { + scope : { + closeText : '@', + ngModel : '=', + ngChange : '=', + ngDisabled : '=', + ngRequired : '=', + hideDatePicker : '=' + }, require: 'ngModel', - template: '', + templateUrl: './share/t_datetime', replace: true, - link: function(scope, elm, attrs, ngModelCtrl) { - - // since this is a date-only selector, set the time - // portion to 00:00:00, which should better match the - // user's expectations. Note this allows us to retain - // the timezone. - function strip_time(date) { - if (!date) date = new Date(); - date.setHours(0); - date.setMinutes(0); - date.setSeconds(0); - date.setMilliseconds(0); - return date; - } + link : function(scope, elm, attrs) { + if (!scope.closeText) + scope.closeText = egStrings.EG_DATE_INPUT_CLOSE_TEXT; - ngModelCtrl.$formatters.unshift(function (modelValue) { - // apply strip_time here in case the user never - // modifies the date value. - if (!modelValue) return ''; - return dateFilter(strip_time(modelValue), 'yyyy-MM-dd'); - }); - - ngModelCtrl.$parsers.unshift(function(viewValue) { - if (!viewValue) return null; - return strip_time(new Date(viewValue)); - }); - }, + if ('showTimePicker' in attrs) + scope.showTimePicker = true; + } }; -}) + } +]) -- 2.43.2