started on a copy location order interface
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 02:58:06 +0000 (02:58 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 02:58:06 +0000 (02:58 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14615 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js [new file with mode: 0644]
Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 [new file with mode: 0644]

diff --git a/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js b/Open-ILS/web/js/ui/default/conify/global/asset/copy_location_order.js
new file mode 100644 (file)
index 0000000..d23d541
--- /dev/null
@@ -0,0 +1,57 @@
+dojo.require('dijit.layout.ContentPane');
+dojo.require('openils.widget.OrgUnitFilteringSelect');
+dojo.require('fieldmapper.OrgUtils');
+dojo.require('openils.User');
+dojo.require('openils.Util');
+dojo.require('openils.widget.AutoGrid');
+dojo.require('openils.PermaCrud');
+
+var user;
+var pcrud;
+var orders;
+var locations;
+var tbody;
+var template;
+
+function init() {
+
+     user = new openils.User();
+     pcrud = new openils.PermaCrud({authtoken : user.authtoken});
+     tbody = dojo.byId('acpl-tbody');
+     template = tbody.removeChild(dojo.byId('acpl-tr'));
+     
+
+     user.buildPermOrgSelector(
+        'ADMIN_COPY_LOCATION_ORDER', 
+        contextOrgSelector, 
+        null, 
+        function() {
+              dojo.connect(contextOrgSelector, 'onChange', filterGrid);
+        }
+    );
+
+    filterGrid(user.user.ws_ou());
+}
+
+function filterGrid(org) {
+    orders = pcrud.search('acplo', {org : org}, {order_by : {acplo : 'position'}});
+    locations = pcrud.search('acpl', {owning_lib : org}); //TODO
+    alert(locations.length);
+
+    while(tbody.childNodes[0]) 
+        tbody.removeChild(tbody.childNodes[0]);
+
+    dojo.forEach(locations, 
+        function(loc) {
+            var row = template.cloneNode(true);
+            dojo.query('[name=name]', row)[0].innerHTML = loc.name();
+            dojo.query('[name=owning_lib]', row)[0].innerHTML = 
+                fieldmapper.aou.findOrgUnit(loc.owning_lib()).shortname();
+            tbody.appendChild(row);
+            console.log(row);
+        }
+    );
+}
+
+openils.Util.addOnLoad(init);
+
diff --git a/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2 b/Open-ILS/web/templates/default/conify/global/asset/copy_location_order.tt2
new file mode 100644 (file)
index 0000000..6e914ba
--- /dev/null
@@ -0,0 +1,36 @@
+[% WRAPPER default/base.tt2 %]
+[% ctx.page_title = 'Copy Location Order' %]
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/asset/copy_location_order.js'> </script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
+    <div>Copy Location Order</div>
+    <div>
+        <!--
+        <button dojoType='dijit.form.Button' onClick='acplGrid.showCreateDialog()'>New Location Order</button>
+        <button dojoType='dijit.form.Button' onClick='acplGrid.deleteSelected()'>Delete Selected</button>
+        -->
+    </div>
+</div>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <span>Context Org Unit</span>
+    <select dojoType="openils.widget.OrgUnitFilteringSelect"
+            jsId='contextOrgSelector'
+            searchAttr='shortname'
+            labelAttr='shortname'>
+    </select>
+</div>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <table>
+        <thead><tr><th>Name</th><th>Owning Lib</th></thead>
+        <tbody id='acpl-tbody'>
+            <tr id='acpl-tr'>
+                <td><span name='name'/></td>
+                <td><span name='owning_lib'/></td>
+            </tr>
+        </tbody>
+    </table>
+</div>
+
+[% END %]