implemented the ability to mark a set of lineitems as 'ready for selector', and ...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Oct 2009 20:17:08 +0000 (20:17 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 16 Oct 2009 20:17:08 +0000 (20:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14472 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/css/theme/default/acq.css
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/templates/default/acq/common/li_table.tt2
Open-ILS/web/templates/default/acq/picklist/view.tt2

index 488d738..d59e28e 100644 (file)
 .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;}
index 940dcf6..43ec2e8 100644 (file)
@@ -32,6 +32,8 @@ function AcqLiTable() {
 
     var self = this;
     this.liCache = {};
+    this.plCache = {};
+    this.poCache = {};
     this.toggleState = false;
     this.tbody = dojo.byId('acq-lit-tbody');
     this.selectors = [];
@@ -62,6 +64,14 @@ function AcqLiTable() {
         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();}
 
@@ -183,9 +193,36 @@ function AcqLiTable() {
         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);
@@ -194,6 +231,7 @@ function AcqLiTable() {
 
         // 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 @@ function AcqLiTable() {
                 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 @@ function AcqLiTable() {
         }
     }
 
+    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) {
index 291669c..5971e92 100644 (file)
@@ -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'>
                                 <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>
         </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>
index 3de671e..d857100 100644 (file)
@@ -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'>