[open-ils-commits] r14472 - in trunk/Open-ILS/web: css/theme/default js/ui/default/acq/common templates/default/acq/common templates/default/acq/picklist (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 16 16:17:13 EDT 2009


Author: erickson
Date: 2009-10-16 16:17:08 -0400 (Fri, 16 Oct 2009)
New Revision: 14472

Modified:
   trunk/Open-ILS/web/css/theme/default/acq.css
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
   trunk/Open-ILS/web/templates/default/acq/picklist/view.tt2
Log:
implemented the ability to mark a set of lineitems as 'ready for selector', and 'ready for order'.  in the main lineitem list page (for selection lists and POs), each lineitem state now has an associated row color.  The colors should change, but you get the idea.  fixed some page titles

Modified: trunk/Open-ILS/web/css/theme/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/theme/default/acq.css	2009-10-16 15:43:19 UTC (rev 14471)
+++ trunk/Open-ILS/web/css/theme/default/acq.css	2009-10-16 20:17:08 UTC (rev 14472)
@@ -28,6 +28,14 @@
 .oils-acq-lineitem-delete-link { font-size: 85%; }
 #oils-acq-picklist-header-subtable tr { border: none; }
 
+/* When viewing a list of lineitems, these colors indicate what state the lineitem is in */
+.oils-acq-li-state-new td { background-color: #FFFFEE; }
+.oils-acq-li-state-selector-ready td { background-color: #FFEEEE; }
+.oils-acq-li-state-order-ready td { background-color: #EEEEEE; }
+.oils-acq-li-state-pending-order td { background-color: #EEEEDD; }
+.oils-acq-li-state-on-order td { background-color: #EEDDDD; }
+.oils-acq-li-state-received td { background-color: #DDDDDD; }
+
 /* po display */
 #oils-acq-po-table thead tr { border: 1px solid #A1A1A1; }
 #oils-acq-po-header {border: 1px solid #85C777;}

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-10-16 15:43:19 UTC (rev 14471)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-10-16 20:17:08 UTC (rev 14472)
@@ -32,6 +32,8 @@
 
     var self = this;
     this.liCache = {};
+    this.plCache = {};
+    this.poCache = {};
     this.toggleState = false;
     this.tbody = dojo.byId('acq-lit-tbody');
     this.selectors = [];
@@ -62,7 +64,15 @@
         self._savePl(acqLitSavePlDialog.getValues());
     }
 
+    acqLitCancelLiStateButton.onClick = function() {
+        acqLitChangeLiStateDialog.hide();
+    }
+    acqLitSaveLiStateButton.onClick = function() {
+        acqLitChangeLiStateDialog.hide();
+        self._updateLiState(acqLitChangeLiStateDialog.getValues(), acqLitChangeLiStateDialog.attr('state'));
+    }
 
+
     //dojo.byId('acq-lit-notes-new-button').onclick = function(){acqLitCreateLiNoteDialog.show();}
 
     dojo.byId('acq-lit-select-toggle').onclick = function(){self.toggleSelect()};
@@ -183,17 +193,45 @@
         dojo.query('[name=notes_count]', row)[0].innerHTML = li.lineitem_notes().length;
         dojo.query('[name=noteslink]', row)[0].onclick = function() {self.drawLiNotes(li)};
 
+        // show which PO this lineitem is a member of
         if(li.purchase_order() && !this.isPO) {
-            openils.Util.show(nodeByName('po', row), 'inline');
-            nodeByName('po_link', row).setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order());
+            var po = 
+                this.poCache[li.purchase_order()] =
+                this.poCache[li.purchase_order()] ||
+                fieldmapper.standardRequest(
+                    ['open-ils.acq', 'open-ils.acq.purchase_order.retrieve'],
+                    {params: [this.authtoken, li.purchase_order()]});
+            if(po) {
+                openils.Util.show(nodeByName('po', row), 'inline');
+                var link = nodeByName('po_link', row);
+                link.setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order());
+                link.innerHTML = 'PO: ' + po.name(); // TODO i18n
+            }
         }
 
+        // show which picklist this lineitem is a member of
+        if(li.picklist() && this.isPO) {
+            var pl = 
+                this.plCache[li.picklist()] = 
+                this.plCache[li.picklist()] || 
+                fieldmapper.standardRequest(
+                    ['open-ils.acq', 'open-ils.acq.picklist.retrieve'],
+                    {params: [this.authtoken, li.picklist()]});
+            if(pl) {
+                openils.Util.show(nodeByName('pl', row), 'inline');
+                var link = nodeByName('pl_link', row);
+                link.setAttribute('href', oilsBasePath + '/acq/picklist/view/' + li.picklist());
+                link.innerHTML = 'PL: '+pl.name(); // TODO i18n
+            }
+        }
+
         var countNode = nodeByName('count', row);
         countNode.innerHTML = li.item_count() || 0;
         countNode.id = 'acq-lit-copy-count-label-' + li.id();
 
         // lineitem state
         nodeByName('li_state', row).innerHTML = li.state(); // TODO i18n state labels
+        openils.Util.addCSSClass(row, 'oils-acq-li-state-' + li.state());
 
         // lineitem price
         var priceInput = dojo.query('[name=price]', row)[0];
@@ -876,6 +914,12 @@
                 acqLitSavePlDialog.show();
                 break;
 
+            case 'selector_ready':
+            case 'order_ready':
+                acqLitChangeLiStateDialog.attr('state', action.replace('_', '-'));
+                acqLitChangeLiStateDialog.show();
+                break;
+
             case 'print_po':
                 this.printPO();
                 break;
@@ -1123,10 +1167,21 @@
         }
     }
 
+    this._updateLiState = function(values, state) {
+        var self = this;
+        var selected = this.getSelected( (values.which == 'all') );
+        if(!selected.length) return;
+        dojo.forEach(selected, function(li) {li.state(state);});
+        self._updateLiList(null, selected, 0, 
+            // TODO consider inline updates for efficiency
+            function() { location.href = location.href }
+        );
+    }
+
     this._updateLiList = function(pl, list, idx, oncomplete) {
         if(idx >= list.length) return oncomplete();
         var li = list[idx];
-        li.picklist(pl);
+        if(pl != null) li.picklist(pl);
         litGenericProgress.update({maximum: list.length, progress: idx});
         new openils.acq.Lineitem({lineitem:li}).update(
             function(r) {

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-10-16 15:43:19 UTC (rev 14471)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-10-16 20:17:08 UTC (rev 14472)
@@ -66,6 +66,7 @@
                                     <td rowspan='2' style='width:43px;'><img style='width:40px;height:65px;' name='jacket'></img></td>
                                     <td style='width:70%;font-weight:bold;'>
                                         <a attr='title' href='javascript:void(0);'></a>
+                                        <span name='pl' class='hidden'>(<a name='pl_link' href='javascript:void(0);'></a>)</span>
                                         <span name='po' class='hidden'>(<a name='po_link' href='javascript:void(0);'>PO</a>)</span>
                                     </td>
                                     <td rowspan='2' style='text-align:right'>
@@ -141,7 +142,6 @@
                                 <button jsId='acqLitCreateLiNoteSubmit' dojoType='dijit.form.Button' type="submit">Create</button>
                             </div>
                         </div>
-
                         <div dojoType='dijit.form.Button' id='acq-lit-notes-save-button'>Save Changes</div>
                     </td>
                 </tr>
@@ -386,6 +386,26 @@
         </table>
     </div>
 
+    <div dojoType="dijit.Dialog" jsId='acqLitChangeLiStateDialog'>
+        <table class='dijitTooltipTable'>
+            <tr>
+                <td>
+                    <input dojoType="dijit.form.RadioButton" name="which" type='radio' checked='checked' value='selected'/>
+                    <label for="name">Mark selected</label>
+                    <input dojoType="dijit.form.RadioButton" name="which" type='radio' value='all'/>
+                    <label for="name">Mark all</label>
+                </td>
+            </tr>
+            <tr>
+                <td colspan='2' align='center'>
+                    <button dojoType='dijit.form.Button' type="submit" jsId='acqLitCancelLiStateButton'>Cancel</button>
+                    <button dojoType='dijit.form.Button' type="submit" jsId='acqLitSaveLiStateButton'>Go</button>
+                </td>
+            </tr>
+        </table>
+    </div>
+
+
     <div class='hidden'>
         <div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'/>
     </div>

Modified: trunk/Open-ILS/web/templates/default/acq/picklist/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/picklist/view.tt2	2009-10-16 15:43:19 UTC (rev 14471)
+++ trunk/Open-ILS/web/templates/default/acq/picklist/view.tt2	2009-10-16 20:17:08 UTC (rev 14472)
@@ -1,4 +1,5 @@
 [% WRAPPER 'default/base.tt2' %]
+[% ctx.page_title = 'Selection List' %]
 <script src='[% ctx.media_prefix %]/js/ui/default/acq/picklist/view.js'> </script>
 <div dojoType="dijit.layout.ContentPane" style="height:100%">
     <div class='container'>



More information about the open-ils-commits mailing list