[open-ils-commits] r11200 - in trunk/Open-ILS/web: js/ui/default/conify/global/config templates/default/conify/global/config

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Nov 14 16:15:44 EST 2008


Author: erickson
Date: 2008-11-14 16:15:40 -0500 (Fri, 14 Nov 2008)
New Revision: 11200

Modified:
   trunk/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js
   trunk/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2
Log:
plugged in context org picker and plumbing for create dialog

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js	2008-11-14 20:58:51 UTC (rev 11199)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/billing_type.js	2008-11-14 21:15:40 UTC (rev 11200)
@@ -7,6 +7,26 @@
 var btContextOrg;
 var btList;
 
+/** really need to put this in a shared location... */
+function getOrgInfo(rowIndex, item) {
+    if(!item) return '';
+    var orgId = this.grid.store.getValue(item, this.field);
+    return fieldmapper.aou.findOrgUnit(orgId).shortname();
+}
+
+function btInit() {
+    buildBTGrid();
+    var connect = function() {
+        dojo.connect(btContextOrgSelect, 'onChange',
+            function() {
+                btContextOrg = this.getValue();
+                buildBTGrid();
+            }
+        );
+    };
+    new openils.User().buildPermOrgSelector('VIEW_BILLING_TYPE', btContextOrgSelect, null, connect);
+}
+
 function buildBTGrid() {
     if(btContextOrg == null)
        btContextOrg = openils.User.user.ws_ou();
@@ -25,6 +45,29 @@
     );
 }
 
-openils.Util.addOnLoad(buildBTGrid);
+function btCreate(args) {
+    if(!args.name || args.owner == null) 
+        return;
+    if(args.default_price == '' || isNaN(args.default_price))
+        args.default_price = null;
 
+    var btype = new cbt();
+    btype.name(args.name);
+    btype.owner(args.owner);
+    btype.default_price(args.default_price);
 
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', 'open-ils.permacrud.create.cbt'],
+        {   async: true,
+            params: [openils.User.authtoken, btype],
+            oncomplete: function(r) {
+                if(new String(openils.Util.readResponse(r)) != '0')
+                    buildBTGrid();
+            }
+        }
+    );
+}
+
+openils.Util.addOnLoad(btInit);
+
+

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2	2008-11-14 20:58:51 UTC (rev 11199)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/billing_type.tt2	2008-11-14 21:15:40 UTC (rev 11200)
@@ -2,45 +2,57 @@
 <script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/billing_type.js'> </script>
 <h1>Billing Types</h1><br/>
 
+
 <div dojoType="dijit.form.DropDownButton">
     <span>New Billing Type</span>
     <div dojoType="dijit.TooltipDialog" execute="btCreate(arguments[0]);">
+        <script type='dojo/connect' event='onOpen'>
+            new openils.User().buildPermOrgSelector('CREATE_BILLING_TYPE', btOwningOrg);
+        </script>
         <table class='dijitTooltipTable'>
             <tr>
                 <td><label for="name">Name: </label></td>
-                <td><input dojoType="dijit.form.TextBox" name="name"></td>
+                <td><input dojoType="dijit.form.TextBox" name="name"/></td>
             </tr>
             <tr>
                 <td><label for="name">Owning Location: </label></td>
-                <td><input dojoType="openils.widget.OrgUnitFilteringSelect" name="name"></td>
+                <td>
+                    <input dojoType="openils.widget.OrgUnitFilteringSelect" name="owner" 
+                        jsId='btOwningOrg' searchAttr='shortname' labelAttr='shortname'/>
+                </td>
             </tr>
             <tr>
                 <td><label for="name">Default Price: </label></td>
-                <td><input dojoType="dijit.form.CurrencyTextBox" name="default_price" required='false'></td>
+                <td><input dojoType="dijit.form.CurrencyTextBox" name="default_price" required='false'/></td>
             </tr>
             <tr>
                 <td colspan='2' align='center'>
-                    <button dojoType=dijit.form.Button type="submit">Create</button>
+                    <button dojoType='dijit.form.Button' type="submit">Create</button>
                 </td>
             </tr>
         </table>
     </div>
 </div> 
 
+<span>Context Org Unit</span>
+<select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='btContextOrgSelect' 
+    searchAttr='shortname' labelAttr='shortname'> </select>
+
 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
         <table jsId="btGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'>
             <thead>
                 <tr>
                     <th field="id">ID</th>
-                    <th field="name" width='300px;'>Name</th>
-                    <th field="owner">Owning Location</th>
+                    <th field="name" width='250px;'>Name</th>
+                    <th field="owner" width='250px;' get='getOrgInfo'>Owning Location</th>
                     <th field="default_price">Default Price</th>
                 </tr>
             </thead>
         </table>    
     </div>
 </div>
+
 [% END %]
 
 



More information about the open-ils-commits mailing list