fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15629] booking: date handling


From: sigurdne
Subject: [Fmsystem-commits] [15629] booking: date handling
Date: Thu, 8 Sep 2016 14:51:10 +0000 (UTC)

Revision: 15629
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15629
Author:   sigurdne
Date:     2016-09-08 14:51:10 +0000 (Thu, 08 Sep 2016)
Log Message:
-----------
booking: date handling

Modified Paths:
--------------
    trunk/booking/js/booking/booking.js
    trunk/booking/js/booking/event.js
    trunk/booking/templates/base/booking_edit.xsl
    trunk/booking/templates/base/booking_new.xsl

Modified: trunk/booking/js/booking/booking.js
===================================================================
--- trunk/booking/js/booking/booking.js 2016-09-08 14:05:40 UTC (rev 15628)
+++ trunk/booking/js/booking/booking.js 2016-09-08 14:51:10 UTC (rev 15629)
@@ -2,7 +2,12 @@
 var organization_id_selection = "";
 $(document).ready(function ()
 {
+       $("#start_date").change(function ()
+       {
+               $("#end_date").val($("#start_date").val());
+       });
 
+
        $('#field_cost_comment').hide();
        $('#field_cost').on('input propertychange paste', function ()
        {
@@ -122,6 +127,50 @@
 if ($.formUtils)
 {
        $.formUtils.addValidator({
+               name: 'time_span',
+               validatorFunction: function (value, $el, config, languaje, 
$form)
+               {
+                       var v = false;
+                       var end_date = $("#end_date").val();
+                       var start_date = $("#start_date").val();
+                       if (end_date != "" && start_date != "")
+                       {
+                               v = true;
+                       }
+                       if (end_date == start_date)
+                       {
+                               v = false;
+                       }
+                       return v;
+
+               },
+               errorMessage: 'Invalid timespan',
+               errorMessageKey: ''
+       });
+
+       $.formUtils.addValidator({
+               name: 'time_span_edit',
+               validatorFunction: function (value, $el, config, languaje, 
$form)
+               {
+                       var v = false;
+                       var end_date = $("#field_from").val();
+                       var start_date = $("#field_to").val();
+                       if (end_date != "" && start_date != "")
+                       {
+                               v = true;
+                       }
+                       if (end_date == start_date)
+                       {
+                               v = false;
+                       }
+                       return v;
+
+               },
+               errorMessage: 'Invalid timespan',
+               errorMessageKey: ''
+       });
+
+       $.formUtils.addValidator({
                name: 'target_audience',
                validatorFunction: function (value, $el, config, languaje, 
$form)
                {

Modified: trunk/booking/js/booking/event.js
===================================================================
--- trunk/booking/js/booking/event.js   2016-09-08 14:05:40 UTC (rev 15628)
+++ trunk/booking/js/booking/event.js   2016-09-08 14:51:10 UTC (rev 15629)
@@ -1,6 +1,10 @@
 var building_id_selection = "";
 $(document).ready(function ()
 {
+       $("#start_date").change(function ()
+       {
+               $("#end_date").val($("#start_date").val());
+       });
 
        $('#field_cost_comment').hide();
        $('#field_cost').on('input propertychange paste', function ()

Modified: trunk/booking/templates/base/booking_edit.xsl
===================================================================
--- trunk/booking/templates/base/booking_edit.xsl       2016-09-08 14:05:40 UTC 
(rev 15628)
+++ trunk/booking/templates/base/booking_edit.xsl       2016-09-08 14:51:10 UTC 
(rev 15629)
@@ -157,10 +157,10 @@
                                                                </label>
                                                                <input 
class="datetime" id="field_from" name="from_" type="text" 
style="display:inline-block;">
                                                                        
<xsl:attribute name="data-validation">
-                                                                               
<xsl:text>required</xsl:text>
+                                                                               
<xsl:text>time_span_edit</xsl:text>
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="data-validation-error-msg">
-                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a from date')" />
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a valid from date')" />
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="value">
                                                                                
<xsl:value-of select="booking/from_"/>
@@ -173,10 +173,10 @@
                                                                </label>
                                                                <input 
class="datetime" id="field_to" name="to_" type="text" 
style="display:inline-block;">
                                                                        
<xsl:attribute name="data-validation">
-                                                                               
<xsl:text>required</xsl:text>
+                                                                               
<xsl:text>time_span_edit</xsl:text>
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="data-validation-error-msg">
-                                                                               
<xsl:value-of select="php:function('lang', 'Please enter an end date')" />
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter an valid end date')" />
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="value">
                                                                                
<xsl:value-of select="booking/to_"/>

Modified: trunk/booking/templates/base/booking_new.xsl
===================================================================
--- trunk/booking/templates/base/booking_new.xsl        2016-09-08 14:05:40 UTC 
(rev 15628)
+++ trunk/booking/templates/base/booking_new.xsl        2016-09-08 14:51:10 UTC 
(rev 15629)
@@ -133,10 +133,10 @@
                                                                </label>
                                                                <input 
class="datetime pure-input-2-3" id="start_date" name="from_" type="text" 
style="display:inline-block;">
                                                                        
<xsl:attribute name="data-validation">
-                                                                               
<xsl:text>required</xsl:text>
+                                                                               
<xsl:text>time_span</xsl:text>
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="data-validation-error-msg">
-                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a from date')" />
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a valid from date')" />
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="value">
                                                                                
<xsl:value-of select="booking/from_"/>
@@ -149,10 +149,10 @@
                                                                </label>
                                                                <input 
class="datetime pure-input-2-3" id="end_date" name="to_" type="text" 
style="display:inline-block;">
                                                                        
<xsl:attribute name="data-validation">
-                                                                               
<xsl:text>required</xsl:text>
+                                                                               
<xsl:text>time_span</xsl:text>
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="data-validation-error-msg">
-                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a end date')" />
+                                                                               
<xsl:value-of select="php:function('lang', 'Please enter a valid end date')" />
                                                                        
</xsl:attribute>
                                                                        
<xsl:attribute name="value">
                                                                                
<xsl:value-of select="booking/to_"/>




reply via email to

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