experiment: duedate/duetime picker during checkout. Not sure when/how the middle...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Oct 2009 04:10:58 +0000 (04:10 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 20 Oct 2009 04:10:58 +0000 (04:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14503 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/circ/checkout.js
Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul

index bb46b4c..5ad3b59 100644 (file)
 <!ENTITY staff.circ.renew_overlay.renew_export.label "Export">
 <!ENTITY staff.circ.renew_overlay.trim_list.label "Trim List (20 rows)">
 <!ENTITY staff.circ.renew_overlay.strict_barcode.label "Strict Barcode">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.label "Normal">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.accesskey "u">
+<!ENTITY staff.circ.checkout_overlay.duedate.label "Specific Due Date">
+<!ENTITY staff.circ.checkout_overlay.duedate.accesskey "u">
 <!ENTITY staff.circ.checkout_overlay.barcode.accesskey "C">
 <!ENTITY staff.circ.checkout_overlay.export.accesskey "">
 <!ENTITY staff.circ.checkout_overlay.export.label "Export">
index 5c39fe2..20100f3 100644 (file)
@@ -114,21 +114,17 @@ circ.checkout.prototype = {
                                                        }
                                                }
                                        ],
-                                       'checkout_duedate_menu' : [
+                                       'checkout_duedate_datepicker' : [
                                                ['change'],
                                                function(ev) { 
                                                        try {
-                                                               obj.check_date(ev.target);
-                                                               ev.target.parentNode.setAttribute('style','');
+                                                               if (obj.check_date(ev.target)) {
+                                                                   ev.target.parentNode.setAttribute('style','');
+                                } else {
+                                    ev.target.parentNode.setAttribute('style','background-color: red');
+                                }
                                                        } catch(E) {
-                                                               ev.target.parentNode.setAttribute('style','background-color: red');
-                                                               alert(E + '\n' + document.getElementById('circStrings').getString('staff.circ.checkout.date.exception'));
-                                                               try {
-                                                                       ev.target.inputField.select();
-                                                                       ev.target.inputField.focus();
-                                                               } catch(EX) { /* this should work, let me try on other platforms */ 
-                                                                       obj.error.sdump('D_ERROR','menulist.inputField: ' + EX);
-                                                               }
+                                alert('Error in checkout.js, checkout_duedate_datepicker @change: ' + E);
                                                        }
                                                }
                                        ],
@@ -333,23 +329,17 @@ circ.checkout.prototype = {
        },
 
        'check_date' : function(node) {
+        var obj = this;
                JSAN.use('util.date');
                try {
-                       if (node.value == 'Normal') { return true; }
-                       var pattern = node.value.match(/Today \+ (\d+) days/);
-                       if (pattern) {
-                               var today = new Date();
-                               var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*pattern[1] );
-                               node.value = util.date.formatted_date(todayPlus,"%F");
-                       }
-                       if (! util.date.check('YYYY-MM-DD',node.value) ) { 
-                               throw(document.getElementById('circStrings').getString('staff.circ.invalid_date'));
-                       }
+            obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','false');
+            obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
+            obj.controller.view.cmd_checkout_submit.setAttribute('disabled','false');
+            obj.controller.view.cmd_checkout_submit.disabled = false;
                        if (util.date.check_past('YYYY-MM-DD',node.value) ) {
-                               throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
-                       }
-                       if ( util.date.formatted_date(new Date(),'%F') == node.value) {
-                               throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
+                               obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','true');
+                               obj.controller.view.cmd_checkout_submit.setAttribute('disabled','true');
+                return false;
                        }
                        return true;
                } catch(E) {
@@ -568,10 +558,19 @@ circ.checkout.prototype = {
        'checkout' : function(params) {
                var obj = this;
 
-               try { obj.check_date(obj.controller.view.checkout_duedate_menu); } catch(E) { return; }
-               if (obj.controller.view.checkout_duedate_menu.value != 'Normal') {
-                       params.due_date = obj.controller.view.checkout_duedate_menu.value;
-               }
+        if (document.getElementById('checkout_duedate_checkbox').checked) {
+            if (! obj.check_date(obj.controller.view.checkout_duedate_datepicker)) return;
+            var tp = document.getElementById('checkout_duedate_timepicker');
+            var dp = obj.controller.view.checkout_duedate_datepicker;
+            var tp_date = tp.dateValue;
+            var dp_date = dp.dateValue;
+            tp_date.setFullYear( dp_date.getFullYear() );
+            tp_date.setMonth( dp_date.getMonth() );
+            tp_date.setDate( dp_date.getDate() );
+
+            JSAN.use('util.date');
+            params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
+        }
 
                if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }
 
index 449e866..c1df24c 100644 (file)
                accesskey="&staff.patron_display.checkout.submit.accesskey;"/>
        <spacer flex="1"/>
        <hbox id="duedate_hbox">
-               <label value="&staff.circ.checkout_overlay.duedate_menu.label;" accesskey="&staff.circ.checkout_overlay.duedate_menu.accesskey;" control="checkout_duedate_menu"/>
-               <menulist id="checkout_duedate_menu" editable="true">
-                       <menupopup>
-                               <menuitem label="&common.date_helper.normal;" selected="true"/>
-                               <menuitem label="&common.date_helper.3_days;" />
-                               <menuitem label="&common.date_helper.7_days;" />
-                               <menuitem label="&common.date_helper.14_days;" />
-                               <menuitem label="&common.date_helper.30_days;" />
-                       </menupopup>
-               </menulist>
+               <checkbox id="checkout_duedate_checkbox" label="&staff.circ.checkout_overlay.duedate.label;" accesskey="&staff.circ.checkout_overlay.duedate.accesskey;" oncommand="if (this.checked) { this.nextSibling.focus(); } else { document.getElementById('checkout_barcode_entry_textbox').focus(); }"/>
+               <datepicker id="checkout_duedate_datepicker" type="popup" />
+               <timepicker id="checkout_duedate_timepicker" type="popup" />
        </hbox>
 </hbox>