fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15705]


From: saul . huanay
Subject: [Fmsystem-commits] [15705]
Date: Wed, 21 Sep 2016 00:23:31 +0000 (UTC)

Revision: 15705
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15705
Author:   psaul
Date:     2016-09-21 00:23:30 +0000 (Wed, 21 Sep 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
    branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
    branches/dev-syncromind-2/rental/js/rental/application.edit.js
    branches/dev-syncromind-2/rental/js/rental/schedule.js
    branches/dev-syncromind-2/rental/templates/base/application.xsl
    branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl

Modified: branches/dev-syncromind-2/phpgwapi/js/jquery/common.js
===================================================================
--- branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-09-20 
10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-09-21 
00:23:30 UTC (rev 15705)
@@ -1445,7 +1445,7 @@
 
                        if (t)
                        {
-                               var toolbar = schedule.createToolbar();
+                               var toolbar = eval(t + "()");
                                container_toolbar.appendChild(toolbar);
 //                             container.insertBefore(toolbar, xtable);
                        }
@@ -1893,6 +1893,41 @@
        return data_return;
 }
 
+function rentalScheduleComposites (data, col, date)
+{
+       var text = "";
+       var classes = "";
+       var trAttributes = [];
+       var trFunction = [];
+
+       var k = col.key;
+       
+       text = data[k];
+
+       trAttributes.push( {attribute: 'data-id', value: data['id']} );
+       trFunction.push(
+               {
+                       event: 'click',
+                       callFunction: function () {
+                               
$(this).parent().parent().find('tr').removeClass("trselected")
+                               $(this).parent().addClass("trselected");
+                               $('#composites_toolbar 
button').attr('disabled', false);
+                               composites.rental.data = data;
+                               composites.rental.col = col;
+                       }
+               }
+       );
+
+       var data_return = {
+               text: text,
+               classes: classes,
+               trAttributes: trAttributes,
+               trFunction: trFunction
+       }
+
+       return data_return;
+}
+
 function restartColors()
 {
        colors = [

Modified: branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-09-20 10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-09-21 00:23:30 UTC (rev 15705)
@@ -116,8 +116,8 @@
                                case "has_no_contract":
                                        $filter_clauses[] = "
                                (
-                                       rental_contract_composite.contract_id 
IS NULL OR
-                                       
rental_application_composite.application_id IS NULL OR
+                                       -- 
rental_contract_composite.contract_id IS NULL OR
+                                       -- 
rental_application_composite.application_id IS NULL OR
                                        NOT rental_composite.id IN
                                        (
                                                SELECT rental_composite.id FROM 
rental_composite 

Modified: branches/dev-syncromind-2/rental/js/rental/application.edit.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/application.edit.js      
2016-09-20 10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/rental/js/rental/application.edit.js      
2016-09-21 00:23:30 UTC (rev 15705)
@@ -3,6 +3,8 @@
 var strURL = phpGWLink('index.php', oArgs, true);
 JqueryPortico.autocompleteHelper(strURL, 'ecodimb_name', 'ecodimb_id', 
'ecodimb_container', 'descr');
 
+composites = new Array();
+
 $(document).ready(function ()
 {
        $.formUtils.addValidator({
@@ -50,15 +52,145 @@
        });
 }
 
+function removeComposite (data, button)
+{
+       button.disabled = true;
+       data = jQuery.parseJSON(data);
+       
+       var url = data['url'];
+       var application_id = $('#application_id').val();
+       var composite_id = composites.rental['data']['id'];
+
+       var params = {application_id: application_id, composite_id: 
composite_id};
+
+       $.post(url, params, function(m)
+       {
+               button.disabled = false;
+               $('#tempMessage').append("<li>" + m + "</li>");
+               schedule.updateSchedule(schedule.date);
+               renderComposites('schedule_composites_container');
+       });
+}
+
 renderComposites = function (container)
 {
-       var classTable = "pure-table rentalScheduleTable";
+       var classTable = "pure-table rentalCompositesTable";
 
        var columns = [];
        $.each(composites.columns, function(i, v)
        {
-               columns.push({key: v['key'], label: v['label'], type: 'td'});
+               columns.push({key: v['key'], label: v['label'], type: 'td', 
formatter: 'rentalScheduleComposites'});
        });
-       var r = [{n: 'ResultSet'}, {n: 'Result'}];
-       createTableSchedule(container, composites.datasourceUrl, columns);
+       var r = "";
+
+       createTableSchedule(container, composites.datasourceUrl, columns, r, 
classTable, '', false, "composites.createToolbar");
+}
+
+composites.createToolbar = function ()
+{
+       var toolbar = composites.toolbar;
+       var container = document.createElement('div');
+       container.setAttribute('id', 'composites_toolbar');
+       container.classList.add('schedule_toolbar');
+       var id = "$('.rentalCompositesTable .trselected').data('id')";
+       
+       $.each(toolbar, function(i, v)
+       {
+               var name = v['name'];
+               var text = v['text'];
+               var action = v['action'];
+               var callFunction = v['callFunction'];
+
+               var parameters = (v['parameters']) ? v['parameters'] : "";
+               var attributes = (v['attributes']) ? v['attributes'] : "";
+
+               var button = document.createElement('button');
+               button.innerHTML = text;
+               button.classList.add('toolbar_button');
+
+               if (parameters)
+               {
+                       button.disabled = true;
+               }
+
+               if (attributes)
+               {
+                       $.each(v['attributes'], function(i, v){
+                               if (i == 'class')
+                               {
+                                       button.classList.add(v);
+                               }
+                               else
+                               {
+                                       button.setAttribute(i, v);
+                               }
+                       });
+               }
+
+               if (action)
+               {
+                       if (name == 'download')
+                       {
+                               button.addEventListener('click', function(event)
+                               {
+                                       event.preventDefault();
+                                       var new_action = action;
+                                       $.each(composites.params, function(i, v)
+                                       {
+                                               new_action += '&' + i + '=' + v;
+                                       });
+                                       if (parameters)
+                                       {
+                                               for (var i = 0; i < 
parameters.length; i++)
+                                               {
+                                                       var val = 
eval(parameters[i]['source']);
+                                                       new_action += '&' + 
parameters[i]['name'] + '=' + eval(val);
+                                               }
+                                       }
+                                       var iframe = 
document.createElement('iframe');
+                                       iframe.style.height = "0px";
+                                       iframe.style.width = "0px";
+                                       iframe.src = new_action;
+                                       if(confirm("This will take some 
time..."))
+                                       {
+                                               document.body.appendChild( 
iframe );
+                                       }
+                               }, false);
+                       }
+                       else
+                       {
+                               button.addEventListener('click', function(event)
+                               {
+                                       event.preventDefault();
+                                       var new_action = action;
+                                       if (parameters)
+                                       {
+                                               for (var i = 0; i < 
parameters.parameter.length; i++)
+                                               {
+                                                       var val = 
eval(parameters.parameter[i]['source']);
+                                                       new_action += '&' + 
parameters.parameter[i]['name'] + '=' + eval(val);
+                                               }
+                                       }
+                                       if 
(button.classList.contains('create_type'))
+                                       {
+                                               var date = 
composites.rental['col']['date'];
+                                               date = date.getDate() + '-' + 
(date.getMonth() + 1) + '-' + date.getFullYear();
+                                               new_action += '&date=' + date;
+                                       }
+                                       window.open(new_action);
+                               }, false);
+                       }
+               }
+               else if (callFunction)
+               {
+                       button.addEventListener('click', function(event){
+                               event.preventDefault()
+                               
self[callFunction['name']](callFunction['args'], this);
+                       });
+               }
+
+               container.appendChild(button);
+       })
+
+       return container;
 }
\ No newline at end of file

Modified: branches/dev-syncromind-2/rental/js/rental/schedule.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/schedule.js      2016-09-20 
10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js      2016-09-21 
00:23:30 UTC (rev 15705)
@@ -76,7 +76,7 @@
 
        var params = (schedule.params) ? schedule.params : new Array();
        var pagination = true;
-       var toolbar = true;
+       var toolbar = "schedule.createToolbar";
 
        createTableSchedule(container, url, colDefs, r, classTable, params, 
pagination, toolbar);
 }
@@ -238,6 +238,7 @@
        var toolbar = schedule.toolbar;
        var container = document.createElement('div');
        container.setAttribute('id', 'schedule_toolbar');
+       container.classList.add('schedule_toolbar');
        var id = "$('.rentalScheduleTable .trselected').data('id')";
        $.each(toolbar, function(i, v)
        {
@@ -251,7 +252,7 @@
 
                var button = document.createElement('button');
                button.innerHTML = text;
-               button.classList.add('toolbar_button')
+               button.classList.add('toolbar_button');
 
                if (parameters)
                {

Modified: branches/dev-syncromind-2/rental/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/application.xsl     
2016-09-20 10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/rental/templates/base/application.xsl     
2016-09-21 00:23:30 UTC (rev 15705)
@@ -425,11 +425,19 @@
                                                                </div>
                                                        </div>
                                                        <div 
class="pure-control-group">
-                                                               <ul 
id="tempMessage">
-                                                                       
-                                                               </ul>
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'composites')" />
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       <div 
id="schedule_composites_container"></div>
+                                                               </div>
                                                        </div>
-                                                       <div 
id="schedule_composites_container"></div>
+                                                       <div 
class="pure-control-group">
+                                                               <label></label>
+                                                               <div 
class="pure-custom">
+                                                                       <ul 
id="tempMessage"></ul>
+                                                               </div>
+                                                       </div>
                                                        <xsl:call-template 
name="rental_schedule">
                                                                <xsl:with-param 
name="schedule" select ='./schedule'/>
                                                        </xsl:call-template>
@@ -506,9 +514,8 @@
                                                                                
$("#cal_container #datepicker").datepicker( "option", "maxDate", adstart_end );
                                                                                
schedule.updateSchedule(schedule.date);
                                                                        });
-                                                                       
-                                                                       
composites = new Array();
 
+                                                                       
composites.rental = {};
                                                                        
composites.datasourceUrl = '<xsl:value-of select="composites/datasource_url"/>';
                                                                        
composites.columns = <xsl:value-of select="composites/columns"/>;
                                                                        
composites.toolbar = <xsl:value-of select="composites/toolbar" />;

Modified: branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl 
2016-09-20 10:44:09 UTC (rev 15704)
+++ branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl 
2016-09-21 00:23:30 UTC (rev 15705)
@@ -3,7 +3,7 @@
 
        <style typ="text/css" rel="stylesheet">
                #schedule_container tbody tr th {background: #eee none repeat 
scroll 0 0;}
-               #schedule_toolbar {margin-bottom: 10px;}
+               .schedule_toolbar {margin-bottom: 10px;}
                #week-selector {list-style: outside none none;display: 
inline-block;vertical-align: middle;}
                #week-selector li {display: inline-block;vertical-align: 
middle;}
                #cal_container {margin: 0 20px;}




reply via email to

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