implemented lineitem and lineitem_detail receive
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Apr 2009 21:52:49 +0000 (21:52 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Apr 2009 21:52:49 +0000 (21:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12901 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/templates/default/acq/common/li_table.tt2

index e5e488c..05d8852 100644 (file)
@@ -156,15 +156,25 @@ function AcqLiTable() {
 
         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 @@ function AcqLiTable() {
             }
         );
 
+        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 @@ function AcqLiTable() {
         );
     }
 
+    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;
index e788124..e24f8e4 100644 (file)
@@ -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>
                                         <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>
-                        <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='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>
                         <a name='noteslink' href='javascript:void(0);' 
                             style='margin-right:15px;'>Notes(<span name='notes_count'>0</span>)</a>
                     <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'>
                     <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>