Now the schedule and directions are working for dropdown.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Mar 2017 15:03:25 +0000 (11:03 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 16 Mar 2017 15:03:25 +0000 (11:03 -0400)
mapLink and the directions are now work.

models/front/apis/schedule.php
views/front/apis/schedule.html

index 2c2ea87..4a1521a 100644 (file)
@@ -49,7 +49,7 @@ class GlmMembersFront_apis_schedule
      */
     public function modelAction($actionData = false)
     {
-        echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+        //echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
         //echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
         $view     = 'schedule';
         $settings = array();
@@ -67,7 +67,7 @@ class GlmMembersFront_apis_schedule
         if ( isset( $actionData['request']['in_dropdown'] ) && $inDropDown ) {
             $urlParams[] = 'dropdown=1';
         }
-        if ( isset( $_REQUEST['mapLink'] ) && $inDropDown ) {
+        if ( isset( $_REQUEST['mapLink'] ) && !$inDropDown ) {
             $urlParams[] = 'mapLink=' . $_REQUEST['mapLink'];
         }
         if ( isset( $_REQUEST['dockId'] ) && !$inDropDown ) {
index 3c4e53b..fff3689 100644 (file)
@@ -1,3 +1,72 @@
+<script>
+{if !$inDropDown}
+    function get_schedule( scheduleId )
+    {
+        {literal}
+        $.get(
+            {/literal}'{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=schedule&schedule_id=' + scheduleId{literal}
+            ).done(
+                function(data){
+                    $('#edit-divy').html(data);
+                }
+            );
+        {/literal}
+    }
+{/if}
+jQuery(document).ready(function(){
+    {if $inDropDown}
+        // For the drop down docks schedules
+        var dropdown_dockForm = $("#dockForm");
+        var dropdown_formDockId = $("#formDockId");
+        var dropdown_formSchedId = $("#formSchedId");
+        var dropdown_dock1Sel = $('#dd-sched-1');
+        dropdown_dock1Sel.change(function(){
+            dropdown_formSchedId.val(1);
+            dropdown_formDockId.val(dropdown_dock1Sel.val());
+            dropdown_dockForm.submit();
+        });
+        var dropdown_dock2Sel = $('#dd-sched-2');
+        dropdown_dock2Sel.change(function(){
+            dropdown_formSchedId.val(2);
+            dropdown_formDockId.val(dropdown_dock2Sel.val());
+            dropdown_dockForm.submit();
+        });
+        var dropdown_dock3Sel = $('#dd-sched-3');
+        dropdown_dock3Sel.change(function(){
+            dropdown_formSchedId.val(3);
+            dropdown_formDockId.val(dropdown_dock3Sel.val());
+            dropdown_dockForm.submit();
+        });
+        var dropdown_dock4Sel = $('#dd-sched-4');
+        dropdown_dock4Sel.change(function(){
+            dropdown_formSchedId.val(4);
+            dropdown_formDockId.val(dropdown_dock4Sel.val());
+            dropdown_dockForm.submit();
+        });
+        var dropdown_mapLink1 = $('#dropdown-google-map-link1');
+        dropdown_mapLink1.click(function(){
+            window.location = '{$schedulePage}/?mapLink=1';
+            return false;
+        });
+        var dropdown_mapLink2 = $('#dropdown-google-map-link2');
+        dropdown_mapLink2.click(function(){
+            window.location = '{$schedulePage}/?mapLink=2';
+            return false;
+        });
+        var dropdown_mapLink3 = $('#dropdown-google-map-link3');
+        dropdown_mapLink3.click(function(){
+            window.location = '{$schedulePage}/?mapLink=3';
+            return false;
+        });
+        var dropdown_mapLink4 = $('#dropdown-google-map-link4');
+        dropdown_mapLink4.click(function(){
+            window.location = '{$schedulePage}/?mapLink=4';
+            return false;
+        });
+    {/if}
+});
+</script>
+
 <div id="inside_schedule_wrapper">
     {if $inDropDown}
         <form
@@ -7,77 +76,9 @@
             method="get">
             <input type="hidden" id="formDockId" name="dockId">
             <input type="hidden" id="formSchedId" name="scheduleId">
-{/if}
+    {/if}
     {$content}
     {if $inDropDown}
         </form>
     {/if}
 </div>
-
-<script>
-jQuery(document).ready(function(){
-        {if !$inDropDown}
-            function get_schedule( scheduleId )
-            {
-                {literal}
-                $.get(
-                    {/literal}'{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=schedule&schedule_id=' + scheduleId{literal}
-                    ).done(
-                        function(data){
-                            $('#edit-divy').html(data);
-                        }
-                    );
-                {/literal}
-            }
-        {else}
-            // For the drop down docks schedules
-            var dropdown_dockForm = $("#dockForm");
-            var dropdown_formDockId = $("#formDockId");
-            var dropdown_formSchedId = $("#formSchedId");
-            var dropdown_dock1Sel = $('#dd-sched-1');
-            dropdown_dock1Sel.change(function(){
-                dropdown_formSchedId.val(1);
-                dropdown_formDockId.val(dropdown_dock1Sel.val());
-                dropdown_dockForm.submit();
-            });
-            var dropdown_dock2Sel = $('#dd-sched-2');
-            dropdown_dock2Sel.change(function(){
-                dropdown_formSchedId.val(2);
-                dropdown_formDockId.val(dropdown_dock2Sel.val());
-                dropdown_dockForm.submit();
-            });
-            var dropdown_dock3Sel = $('#dd-sched-3');
-            dropdown_dock3Sel.change(function(){
-                dropdown_formSchedId.val(3);
-                dropdown_formDockId.val(dropdown_dock3Sel.val());
-                dropdown_dockForm.submit();
-            });
-            var dropdown_dock4Sel = $('#dd-sched-4');
-            dropdown_dock4Sel.change(function(){
-                dropdown_formSchedId.val(4);
-                dropdown_formDockId.val(dropdown_dock4Sel.val());
-                dropdown_dockForm.submit();
-            });
-            var dropdown_mapLink1 = $('#dropdown-google-map-link1');
-            dropdown_mapLink1.click(function(){
-                window.location = '{$schedulePage}/?mapLink=1';
-                return false;
-            });
-            var dropdown_mapLink2 = $('#dropdown-google-map-link2');
-            dropdown_mapLink2.click(function(){
-                window.location = '{$schedulePage}/?mapLink=2';
-                return false;
-            });
-            var dropdown_mapLink3 = $('#dropdown-google-map-link3');
-            dropdown_mapLink3.click(function(){
-                window.location = '{$schedulePage}/?mapLink=3';
-                return false;
-            });
-            var dropdown_mapLink4 = $('#dropdown-google-map-link4');
-            dropdown_mapLink4.click(function(){
-                window.location = '{$schedulePage}/?mapLink=4';
-                return false;
-            });
-        {/if}
-});
-</script>