fixing the javascript objects for the summary widgets text and date search
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 19 Oct 2018 15:02:22 +0000 (11:02 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 19 Oct 2018 15:02:22 +0000 (11:02 -0400)
views/admin/newDashboard/components/dateSearch.html
views/admin/newDashboard/index.html

index 13b193a..4b44225 100644 (file)
@@ -1,19 +1,23 @@
 <div class="row date-search-container">
     <div class="date-search-title">Search By Date</div>
     <div class="s12 xl4 col glm-widget-search">
-        <input id="{$addon.slug}-fromDate" type="text" class="fromDate date-field" name="fromDate" placeholder="From Date">
+        <input id="{$addon.slug}-fromDate" type="text" class="fromDate date-field" name="{$component.fromDate}" placeholder="From Date">
     </div>
     <div class="s12 xl4 col glm-widget-search">
-        <input id="{$addon.slug}-toDate" type="text" class="toDate date-field" name="toDate" placeholder="To Date">
+        <input id="{$addon.slug}-toDate" type="text" class="toDate date-field" name="{$component.toDate}" placeholder="To Date">
     </div>
     <div class="s12 xl4 col glm-widget-search">
-        <button style="float: right;margin-top: 13px;"class="btn-small date-search-btn">Search</button>        
+        <button id="{$addon.slug}-search-button" style="float: right;margin-top: 13px;" class="btn-small date-search-btn">Search</button>        
     </div>
 </div>
 <script>
     jQuery(function($){
         dateSearch({
-            resultUrl : '{$component.resultUrl}'
+            resultUrl       : '{$component.resultUrl}',
+            toDate          : '{$component.toDate}',
+            fromDate        : '{$component.fromDate}',
+            searchBtn       : '{$addon.slug}-search-button',
+            defaultFromDate : '{$component.defaultFromDate}',
         })
     })
 </script>
\ No newline at end of file
index 265386d..678f334 100644 (file)
         jQuery(function($){
 
             var date = new Date();
-            var toDate = '', fromDate = '';
+            var toDate = '', fromDate = (dateSearchData.defaultFromDate) ? '&' + dateSearchData.fromDate + '=' + dateSearchData.defaultFromDate : '';
             $('.fromDate').datepicker({
                 format          : 'mm/dd/yyyy',
                 setDefaultDate  : true,
                 defaultDate     : date,
                 autoClose       : true,
                 onClose         : function(){
-                    fromDate = '&fromDate=' + $(this)[0].el.value;
+                    fromDate = '&' + dateSearchData.fromDate + '=' + $(this)[0].el.value; 
                 }
             });
             $('.toDate').datepicker({
                 format      : 'mm/dd/yyyy',
                 autoClose   : true,
                 onClose: function(){
-                    toDate = '&toDate=' + $(this)[0].el.value;
+                    toDate = '&' + dateSearchData.toDate + '=' + $(this)[0].el.value;
                 }
             });
-            $('.date-search-btn').on("click", function(){
+            console.log( dateSearchData.resultUrl + fromDate + toDate)
+            $('#' + dateSearchData.searchBtn).on("click", function(){
                 window.location = dateSearchData.resultUrl + fromDate + toDate;
             })
         });