fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15654]


From: saul . huanay
Subject: [Fmsystem-commits] [15654]
Date: Tue, 13 Sep 2016 00:28:25 +0000 (UTC)

Revision: 15654
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15654
Author:   psaul
Date:     2016-09-13 00:28:24 +0000 (Tue, 13 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/inc/class.uiapplication.inc.php
    branches/dev-syncromind-2/rental/inc/class.uicomposite.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-11 
20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/phpgwapi/js/jquery/common.js      2016-09-13 
00:28:24 UTC (rev 15654)
@@ -1782,13 +1782,13 @@
 
        var k = col.key;
 
-       var is_create = true;
+       var needFree = true;
        if (data[k])
        {
                text = data[k]['status'];
                if (text == "Ikke ledig")
                {
-                       is_create = false;
+                       needFree = false;
                }
        }
        else
@@ -1805,10 +1805,10 @@
                                
$(this).parent().parent().find('tr').removeClass("trselected")
                                $(this).parent().addClass("trselected");
                                $('#schedule_toolbar button').attr('disabled', 
false);
-                               var b_is_create = eval(is_create);
-                               if (!b_is_create)
+                               var b_needFree = eval(needFree);
+                               if (!b_needFree)
                                {
-                                       $('#schedule_toolbar 
button.create_type').attr('disabled', true);
+                                       $('#schedule_toolbar 
button.need-free').attr('disabled', true);
                                }
                                schedule.rental.data = data;
                                schedule.rental.col = col;

Modified: branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-09-13 00:28:24 UTC (rev 15654)
@@ -80,12 +80,14 @@
 
                        if (isset($filters['availability_date_from']) && 
$filters['availability_date_from'] != '')
                        {
-                               $availability_date_from = 
strtotime($filters['availability_date_from']);
+                               //$availability_date_from = 
strtotime($filters['availability_date_from']);
+                               $availability_date_from =  
phpgwapi_datetime::date_to_timestamp($filters['availability_date_from']);
                        }
 
                        if (isset($filters['availability_date_to']) && 
$filters['availability_date_to'] != '')
                        {
-                               $availability_date_to = 
strtotime($filters['availability_date_to']);
+                               //$availability_date_to = 
strtotime($filters['availability_date_to']);
+                               $availability_date_to =  
phpgwapi_datetime::date_to_timestamp($filters['availability_date_to']);
                        }
 
                        switch ($filters['has_contract'])

Modified: branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php    
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php    
2016-09-13 00:28:24 UTC (rev 15654)
@@ -345,7 +345,10 @@
 
                        // Composite
                        $composite_id = (int)phpgw::get_var('id');
-                       $date = new DateTime(phpgw::get_var('date'));
+
+                       $date = ($application->assign_date_start) ? 
date("Y-m-d", $application->assign_date_start) : "";
+                       $date = new DateTime($date);
+
                        if ($date->format('w') != 1) {
                                $date->modify('last monday');
                        }
@@ -462,11 +465,21 @@
                                                'responsibility_id' => 
$create_type[0]
                                        )),
                                        'attributes' => array(
-                                               'class' => 'create_type'
+                                               'class' => 'need-free'
                                        ),
                                        'parameters' => $parameters
                                );
                        }
+                       
+                       $toolbar[] = array (
+                               'name' => 'reserve',
+                               'text' => 'Reserve',
+                               'callFunction' => 'reserveComposite',
+                               'attributes' => array(
+                                       'class' => 'need-free'
+                               ),
+                               'parameters' => $parameters
+                       );
 
                        $schedule['composite_id'] = $composite_id;
                        $schedule['date'] = $date;

Modified: branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-09-13 00:28:24 UTC (rev 15654)
@@ -1279,52 +1279,14 @@
 
                        foreach ($composites_data as $composite)
                        {
-                               $composite_obj = 
rental_socomposite::get_instance()->get_single($composite['id']);
-                               $contracts = $composite_obj->get_contracts();
+                               $composites[$n]['id'] = $composite['id'];
+                               $composites[$n]['name'] = $composite['name'];
+                               $composites[$n]['object_number'] = 
$composite['location_code'];
 
-                               if (count($contracts) > 0)
+                               foreach ($days as $day)
                                {
-                                       foreach ($contracts as $contract)
-                                       {
-                                               $contract = 
$contract->serialize();
-
-                                               if ($composites[$n-1]['id'] != 
$composite['id'])
-                                               {
-                                                       $composites[$n]['id'] = 
$composite['id'];
-                                               }
-                                               
-                                               $composites[$n]['name'] = 
$composite['name'];
-                                               
$composites[$n]['object_number'] = $composite['location_code'];
-
-                                               $contract_date_start = new 
DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_start'])));
-                                               $contract_date_end = new 
DateTime(date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($contract['date_end'])));
-
-                                               foreach ($days as $day)
-                                               {
-                                                       if ($day >= 
$contract_date_start && ($day <= $contract_date_end || $contract['date_end'] == 
''))
-                                                       {
-                                                               
$composites[$n]['contract_id'] = $contract['id'];
-                                                               
$composites[$n]['old_contract_id'] = $contract['old_contract_id'];
-                                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ikke ledig';
-                                                       }
-                                                       else
-                                                       {
-                                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ledig';
-                                                       }
-                                               }
-                                       }
+                                       $composites[$n][date_format($day, 
'D')]['status'] = $composite['status'];
                                }
-                               else
-                               {
-                                       $composites[$n]['id'] = 
$composite['id'];
-                                       $composites[$n]['name'] = 
$composite['name'];
-                                       $composites[$n]['object_number'] = 
$composite['location_code'];
-
-                                       foreach ($days as $day)
-                                       {
-                                               
$composites[$n][date_format($day, 'D')]['status'] = 'Ledig';
-                                       }
-                               }
                                $n++;
                        }
 

Modified: branches/dev-syncromind-2/rental/js/rental/application.edit.js
===================================================================
--- branches/dev-syncromind-2/rental/js/rental/application.edit.js      
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/js/rental/application.edit.js      
2016-09-13 00:28:24 UTC (rev 15654)
@@ -29,3 +29,9 @@
 {
        $("#active_tab").val(tab);
 }
+
+function reserveComposite ()
+{
+       var text = "Composite " + schedule.rental['data']['id'] + ", 
application_id " + $('#application_id').val();
+       $('#tempMessage').append("<li>" + text + "</li>");
+}
\ 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-11 
20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/js/rental/schedule.js      2016-09-13 
00:28:24 UTC (rev 15654)
@@ -215,6 +215,7 @@
                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'] : "";
@@ -241,56 +242,66 @@
                                }
                        });
                }
-
-               if (name == 'download')
+               
+               if (action)
                {
-                       button.addEventListener('click', function()
+                       if (name == 'download')
                        {
-                               var new_action = action;
-                               $.each(schedule.params, function(i, v)
+                               button.addEventListener('click', function()
                                {
-                                       new_action += '&' + i + '=' + v;
-                               });
-                               if (parameters)
-                               {
-                                       for (var i = 0; i < parameters.length; 
i++)
+                                       var new_action = action;
+                                       $.each(schedule.params, function(i, v)
                                        {
-                                               var val = 
eval(parameters[i]['source']);
-                                               new_action += '&' + 
parameters[i]['name'] + '=' + eval(val);
+                                               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()
+                                       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
                        {
-                               var new_action = action;
-                               if (parameters)
+                               button.addEventListener('click', function()
                                {
-                                       for (var i = 0; i < 
parameters.parameter.length; i++)
+                                       var new_action = action;
+                                       if (parameters)
                                        {
-                                               var val = 
eval(parameters.parameter[i]['source']);
-                                               new_action += '&' + 
parameters.parameter[i]['name'] + '=' + eval(val);
+                                               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 = 
schedule.rental['col']['date'];
-                                       date = date.getDate() + '-' + 
(date.getMonth() + 1) + '-' + date.getFullYear();
-                                       new_action += '&date=' + date;
-                               }
-                window.open(new_action);
-                       }, false);
+                                       if 
(button.classList.contains('create_type'))
+                                       {
+                                               var date = 
schedule.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]();
+                       });
+               }
 
                container.appendChild(button);
        });

Modified: branches/dev-syncromind-2/rental/templates/base/application.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/application.xsl     
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/templates/base/application.xsl     
2016-09-13 00:28:24 UTC (rev 15654)
@@ -41,7 +41,7 @@
                                                                <label>
                                                                        
<xsl:value-of select="php:function('lang', 'id')"/>
                                                                </label>
-                                                               <input 
type="hidden" name="id" value="{application/id}"/>
+                                                               <input 
type="hidden" id="application_id" name="id" value="{application/id}"/>
                                                                <xsl:value-of 
select="application/id"/>
                                                        </div>
                                                </xsl:if>
@@ -424,9 +424,32 @@
                                                                        
</xsl:for-each>
                                                                </div>
                                                        </div>
+                                                       <div 
class="pure-control-group">
+                                                               <ul 
id="tempMessage">
+                                                                       
+                                                               </ul>
+                                                       </div>
                                                        <xsl:call-template 
name="rental_schedule">
                                                                <xsl:with-param 
name="schedule" select ='./schedule'/>
                                                        </xsl:call-template>
+                                                       <script 
type="text/javascript">
+                                                               
$(document).ready(function ()
+                                                               {
+                                                                       
$('#assign_date_start').datepicker("option", "onSelect", function (a, e) {
+                                                                               
console.log(a);
+                                                                               
//console.log(e);
+                                                                               
schedule.params.availability_date_from = a;
+                                                                               
schedule.renderSchedule('schedule_container', schedule.datasourceUrl, 
schedule.date, schedule.colFormatter, schedule.includeResource);
+                                                                       });
+
+                                                                       
$('#assign_date_end').datepicker("option", "onSelect", function (a, e) {
+                                                                               
console.log(a);
+                                                                               
//console.log(e);
+                                                                               
schedule.params.availability_date_to = a;
+                                                                               
schedule.renderSchedule('schedule_container', schedule.datasourceUrl, 
schedule.date, schedule.colFormatter, schedule.includeResource);
+                                                                       });
+                                                               });
+                                                       </script>
                                                </fieldset>
                                        </div>
                                </xsl:if>

Modified: branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl 
2016-09-11 20:30:50 UTC (rev 15653)
+++ branches/dev-syncromind-2/rental/templates/base/rental_schedule.xsl 
2016-09-13 00:28:24 UTC (rev 15654)
@@ -166,6 +166,8 @@
                        schedule.params.length = $('#cboNObjects').val();
                        schedule.params.search = $('#txtSearchSchedule').val();
                        schedule.params.start = 0;
+                       schedule.params.availability_date_from = "";
+                       schedule.params.availability_date_to = "";
 
                        schedule.setupWeekPicker('cal_container');
 




reply via email to

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