jqh пре 5 година
родитељ
комит
09039569e0
2 измењених фајлова са 8 додато и 7 уклоњено
  1. 1 4
      resources/views/form/steps.blade.php
  2. 7 3
      src/Form/StepBuilder.php

+ 1 - 4
resources/views/form/steps.blade.php

@@ -139,8 +139,7 @@ LA.ready(function () {
         toggle_btn();
     });
 
-    var next = box.find('.sw-btn-next');
-    next.click(function (e) {
+    var next = box.find('.sw-btn-next').click(function (e) {
         e.preventDefault();
 
         if ($(this).hasClass('disabled') || isSubmitting) {
@@ -185,7 +184,6 @@ LA.ready(function () {
                 if (state) {
                     return false;
                 }
-
             }
         });
     }
@@ -214,7 +212,6 @@ LA.ready(function () {
         if (smartWizard.current_index == (last + 1)) {
             box.find('.sw-btn-group').remove()
         }
-
     }
 
     toggle_btn();

+ 7 - 3
src/Form/StepBuilder.php

@@ -249,11 +249,15 @@ class StepBuilder
         }
 
         $current = $input[static::CURRENT_VALIDATION_STEP] ?? null;
-        if ($current !== null && $current !== '') {
-            $this->select((int) ($input[static::CURRENT_VALIDATION_STEP] + 1));
+        $allStep = $input[static::ALL_STEPS] ?? null;
+
+        unset($input[static::CURRENT_VALIDATION_STEP],  $input[static::ALL_STEPS]);
+
+        if ($current !== null && $current !== '' && ! empty($input)) {
+            $this->select((int) ($current + 1));
         }
 
-        if (! empty($input[static::ALL_STEPS])) {
+        if (! empty($allStep) && ! empty($input)) {
             $this->select($this->count() - 1);
         }
     }