fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [13962] fixing forms


From: Saul
Subject: [Fmsystem-commits] [13962] fixing forms
Date: Fri, 18 Sep 2015 00:14:48 +0000

Revision: 13962
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13962
Author:   psaul
Date:     2015-09-18 00:14:48 +0000 (Fri, 18 Sep 2015)
Log Message:
-----------
fixing forms

Modified Paths:
--------------
    branches/dev-syncromind/booking/js/booking/allocation.js
    branches/dev-syncromind/booking/js/booking/application.js
    branches/dev-syncromind/booking/templates/base/application_edit.xsl

Modified: branches/dev-syncromind/booking/js/booking/allocation.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/allocation.js    2015-09-18 
00:12:54 UTC (rev 13961)
+++ branches/dev-syncromind/booking/js/booking/allocation.js    2015-09-18 
00:14:48 UTC (rev 13962)
@@ -32,11 +32,11 @@
     var container = $('#season_container');
     populateSelect(url, selection, container);    
 }
-function populateTableChkResources (building_id, initialSelection) {
-    var url = 
'index.php?menuaction=booking.uiresource.index&sort=name&filter_building_id=' + 
 building_id + '&phpgw_return_as=json&'
+function populateTableChkResources (building_id, selection) {
+    var url = 
'index.php?menuaction=booking.uiresource.index&sort=name&filter_building_id=' + 
 building_id + '&phpgw_return_as=json&';
     var container = 'resources_container';
-    var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'},{name: 'name', value: 'resources[]'}]}], 
value: 'id', checked: initialSelection},{key: 'name', label: lang['Name']}, 
{key: 'type', label: lang['Resource Type']}];
-    populateTableChk(url, container, colDefsResources)
+    var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'},{name: 'name', value: 'resources[]'}]}], 
value: 'id', checked: selection},{key: 'name', label: lang['Name']}, {key: 
'type', label: lang['Resource Type']}];
+    populateTableChk(url, container, colDefsResources);
 }
 
 function populateTableChk (url, container, colDefs) {    

Modified: branches/dev-syncromind/booking/js/booking/application.js
===================================================================
--- branches/dev-syncromind/booking/js/booking/application.js   2015-09-18 
00:12:54 UTC (rev 13961)
+++ branches/dev-syncromind/booking/js/booking/application.js   2015-09-18 
00:14:48 UTC (rev 13962)
@@ -1,15 +1,66 @@
+var building_id_selection = "";
+var regulations_select_all = "";
+$(document).ready(function() {
+    
JqueryPortico.autocompleteHelper('index.php?menuaction=bookingfrontend.uibuilding.index&phpgw_return_as=json&',
 
+                                                  'field_building_name', 
'field_building_id', 'building_container');
+});
+
+
+
+
 $(window).load(function(){
     building_id = $('#field_building_id').val();
-    var url = 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=building::'+building_id;
-    var colDefs = [{key: 'name', label: lang['Name'], formatter: genericLink}];
-    createTable('regulation_documents',url,colDefs);
+    regulations_select_all = initialAcceptAllTerms;
+    if (building_id) {
+        populateTableChkResources(building_id, initialSelection);
+        populateTableChkRegulations(building_id, initialDocumentSelection);
+        building_id_selection = building_id;
+    }
+    $("#field_building_name").on("autocompleteselect", function(event, ui){
+        var building_id = ui.item.value;
+        if (building_id != building_id_selection){
+            populateTableChkResources(building_id, initialSelection);
+            populateTableChkRegulations(building_id, initialDocumentSelection);
+            building_id_selection = building_id;
+        }
+    });
+    $('#resources_container').on('click', '.chkRegulations', function(){
+       if($(this).is(':checked')) {  
+            alert("Está activado, id: " + $(this).val());
+        }  
+    });
 });
 
 
 
+function populateTableChkResources (building_id, selection) {
+    var url = 
'index.php?menuaction=bookingfrontend.uiresource.index_json&sort=name&filter_building_id='
 +  building_id + '&phpgw_return_as=json&';
+    var container = 'resources_container';
+    var colDefsResources = [{label: '', object: [{type: 'input', attrs: 
[{name: 'type', value: 'checkbox'},{name: 'name', value: 'resources[]'},{name: 
'class', value: 'chkRegulations'}]}], value: 'id', checked: selection},{key: 
'name', label: lang['Name']}, {key: 'type', label: lang['Resource Type']}];
+    populateTableResources(url, container, colDefsResources);
+}
 
+function populateTableChkRegulations (building_id, selection) {
+    var url = 
'index.php?menuaction=booking.uidocument_view.regulations&sort=name&phpgw_return_as=json&owner[]=building::'+building_id;
+    var container = 'regulation_documents';
+    var colDefsRegulations = [{label: lang['Accepted'], object: [{type: 
'input', attrs: [{name: 'type', value: 'checkbox'},{name: 'name', value: 
'resources[]'}]}], value: 'id', checked: selection},{key: 'name',label: 
lang['Document'],formatter: genericLink}];
+    if (regulations_select_all){
+        
colDefsRegulations[0]['object'][0]['attrs'].push({name:'checked',value: 
'checked'});
+    }
+    populateTableRegulations(url, container, colDefsRegulations);
+}
 
+function populateTableResources (url, container, colDefs) {
+    createTable(container,url,colDefs,'results');
+}
 
+function populateTableRegulations (url, container, colDefs) {
+    createTable(container,url,colDefs);
+}
+
+
+
+
 /*
 YAHOO.booking.RegulationsTable = function() { 
        this.building_id = null;

Modified: branches/dev-syncromind/booking/templates/base/application_edit.xsl
===================================================================
--- branches/dev-syncromind/booking/templates/base/application_edit.xsl 
2015-09-18 00:12:54 UTC (rev 13961)
+++ branches/dev-syncromind/booking/templates/base/application_edit.xsl 
2015-09-18 00:14:48 UTC (rev 13962)
@@ -98,7 +98,7 @@
                                     <label>
                                         <h4><xsl:value-of 
select="php:function('lang', 'Resources')" /></h4>
                                     </label>
-                                    <xsl:value-of select="php:function('lang', 
'Select a building first')" />
+                                    <div id="resources_container" 
style="display:inline-block;"><xsl:value-of select="php:function('lang', 
'Select a building first')" /></div>                                    
                                 </div>
                             </div>
                             <div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
@@ -262,6 +262,9 @@
         <script type="text/javascript">
             
$('#field_customer_identifier_type,#field_customer_ssn,#field_customer_organization_number').removeClass('pure-input-1').addClass('pure-u-1
 pure-u-sm-1-2 pure-u-md-1');
             var lang = <xsl:value-of select="php:function('js_lang', 'From', 
'To', 'Resource Type', 'Name', 'Accepted', 'Document', 'You must accept to 
follow all terms and conditions of lease first.')"/>;
+            var initialDocumentSelection = <xsl:value-of 
select="application/accepted_documents_json"/>;
+            var initialAcceptAllTerms = true;
+            var initialSelection = <xsl:value-of 
select="application/resources_json"/>;
         </script>
        <!--/div-->
        <!--script type="text/javascript">




reply via email to

[Prev in Thread] Current Thread [Next in Thread]