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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 16 17:52:53 EDT 2009


Author: erickson
Date: 2009-04-16 17:52:49 -0400 (Thu, 16 Apr 2009)
New Revision: 12901

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
implemented lineitem and lineitem_detail receive

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-04-16 21:52:12 UTC (rev 12900)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-04-16 21:52:49 UTC (rev 12901)
@@ -156,15 +156,25 @@
 
         dojo.query('[attr=title]', row)[0].onclick = function() {self.drawInfo(li.id())};
         dojo.query('[name=copieslink]', row)[0].onclick = function() {self.drawCopies(li.id())};
-        dojo.query('[name=count]', row)[0].innerHTML = li.item_count();
+        dojo.query('[name=count]', row)[0].innerHTML = li.item_count() || 0;
         dojo.query('[name=notes_count]', row)[0].innerHTML = li.lineitem_notes().length;
         dojo.query('[name=noteslink]', row)[0].onclick = function() {self.drawLiNotes(li)};
 
-        var priceInput = dojo.query('[name=estimated_price]', row)[0];
+        var priceInput = dojo.query('[name=price]', row)[0];
         var priceData = liWrapper.getPrice();
         priceInput.value = (priceData) ? priceData.price : '';
         priceInput.onchange = function() { self.updateLiPrice(priceInput, li) };
 
+        var recv_link = dojo.query('[name=receive_link]', row)[0];
+        if(li.state() == 'received') {
+            openils.Util.hide(recv_link)
+        } else {
+            recv_link.onclick = function() {
+                self.receiveLi(li);
+                openils.Util.hide(recv_link)
+            }
+        }
+
         self.tbody.appendChild(row);
         self.selectors.push(dojo.query('[name=selectbox]', row)[0]);
     };
@@ -534,6 +544,16 @@
             }
         );
 
+        var recv_link = dojo.query('[name=receive]', row)[0];
+        if(copy.recv_time()) {
+            openils.Util.hide(recv_link);
+        } else {
+            recv_link.onclick = function() {
+                self.receiveLid(copy);
+                openils.Util.hide(recv_link);
+            }
+        }
+
         if(this.isPO) {
             openils.Util.hide(dojo.query('[name=delete]', row)[0].parentNode);
         } else {
@@ -684,6 +704,36 @@
         );
     }
 
+    this.receiveLi = function(li) {
+        if(!this.isPO) return;
+        progressDialogInd.show();
+        fieldmapper.standardRequest(
+            ['open-ils.acq', 'open-ils.acq.lineitem.receive'],
+            {   async: true,
+                params: [this.authtoken, li.id()],
+                onresponse : function(r) {
+                    var resp = openils.Util.readResponse(r);
+                    progressDialogInd.hide();
+                },
+            }
+        );
+    }
+
+    this.receiveLid = function(li) {
+        if(!this.isPO) return;
+        progressDialogInd.show();
+        fieldmapper.standardRequest(
+            ['open-ils.acq', 'open-ils.acq.lineitem_detail.receive'],
+            {   async: true,
+                params: [this.authtoken, li.id()],
+                onresponse : function(r) {
+                    var resp = openils.Util.readResponse(r);
+                    progressDialogInd.hide();
+                },
+            }
+        );
+    }
+
     this.rollbackPoReceive = function() {
         if(!this.isPO) return;
         if(!confirm(localeStrings.ROLLBACK_PO_RECEIVE_CONFIRM)) return;

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-16 21:52:12 UTC (rev 12900)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-16 21:52:49 UTC (rev 12901)
@@ -46,7 +46,8 @@
                 <tr>
                     <td><span><a id='acq-lit-select-toggle' href='javascript:void(0);'>&#x2713</a></span></td>
                     <td>Line Items</td>
-                    <td>Estimated Price</td>
+                    <td></td>
+                    <td>Price</td>
                     <td>Items</td>
                     <td>Notes</td>
                 </tr>
@@ -54,7 +55,7 @@
             <tbody id='acq-lit-tbody'>
                 <tr id='acq-lit-row' class='acq-lit-row'>
                     <td name='selector'><input type='checkbox' name='selectbox'/></td>
-                    <td style='width:100%;'>
+                    <td style='width:75%;'>
                         <table style='width:100%;'>
                             <tbody>
                                 <tr>
@@ -71,19 +72,16 @@
                                         <span attr='edition'></span>
                                         <span attr='pubdate'></span>
                                         <span attr='publisher'></span>
-                                        <span name='source_label'/>
+                                        <span name='source_label'></span>
                                     </td>
                                 </tr>
                             </tbody>
                         </table>
                     </td>
+                    <td><a name='receive_link' href='javascript:void(0);'>Mark&nbsp;Received</a></td>
+                    <td><input type='text' size='8' name='price'/></td>
+                    <td><a name='copieslink' href='javascript:void(0);'>Copies(<span name='count'>0</span>)</a></td>
                     <td>
-                        <input type='text' size='8' name='estimated_price'/>
-                    </td>
-                    <td>
-                        <a name='copieslink' href='javascript:void(0);'>Copies(<span name='count'>0</span>)</a>
-                    </td>
-                    <td>
                         <a name='noteslink' href='javascript:void(0);' 
                             style='margin-right:15px;'>Notes(<span name='notes_count'>0</span>)</a>
                     </td>
@@ -226,7 +224,7 @@
                     <td>Callnumber</td>
                     <td>Barcode</td>
                     <td>Notes</td>
-                    <td/>
+                    <td colspan='0'>
                 </tr>
             </tbody>
             <tbody id='acq-lit-li-details-tbody' class='oils-generic-table'>
@@ -238,6 +236,7 @@
                     <td><div name='cn_label'/></td>
                     <td><div name='barcode'/></td>
                     <td><div name='note'/></td>
+                    <td><a href='javascript:void(0);' name='receive'>Mark&nbsp;Received</a></td>
                     <td><div name='delete' dojoType='dijit.form.Button' style='color:red;'>X</div></td>
                 </tr>
             </tbody>



More information about the open-ils-commits mailing list