From ec1f66f7e478b79eea082a82a41a575cdea6de39 Mon Sep 17 00:00:00 2001
From: Shivendra <shivendra.gupta423@webkul.in>
Date: Thu, 30 Jan 2025 16:51:57 +0530
Subject: [PATCH 1/2] Fixed issue #10512

---
 packages/Webkul/Admin/src/Config/system.php   |  2 +-
 .../src/Http/Requests/ConfigurationForm.php   | 25 ++++++++++++++++++-
 .../Core/src/SystemConfig/ItemField.php       |  2 +-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/packages/Webkul/Admin/src/Config/system.php b/packages/Webkul/Admin/src/Config/system.php
index c86fcd62346..71a67150372 100644
--- a/packages/Webkul/Admin/src/Config/system.php
+++ b/packages/Webkul/Admin/src/Config/system.php
@@ -1221,11 +1221,11 @@
                 'title'         => 'admin::app.configuration.index.sales.shipping-setting.origin.vat-number',
                 'type'          => 'text',
                 'channel_based' => true,
-                'validation'    => 'phone',
             ], [
                 'name'          => 'contact',
                 'title'         => 'admin::app.configuration.index.sales.shipping-setting.origin.contact-number',
                 'type'          => 'text',
+                'validation'    => 'phone',
                 'channel_based' => true,
             ], [
                 'name'          => 'bank_details',
diff --git a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
index b4c230ce4a9..36340f0ef51 100644
--- a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
+++ b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
@@ -2,6 +2,9 @@
 
 namespace Webkul\Admin\Http\Requests;
 
+use Webkul\Core\Rules\Decimal;
+use Webkul\Core\Rules\PostCode;
+use Webkul\Core\Rules\PhoneNumber;
 use Illuminate\Foundation\Http\FormRequest;
 
 class ConfigurationForm extends FormRequest
@@ -33,11 +36,31 @@ public function rules()
                 if (! $this->has("{$key}.delete")) {
                     $validation = isset($field['validation']) && $field['validation'] ? $field['validation'] : 'nullable';
 
-                    return [$key => $validation];
+                    return [$key => $this->getValidationRules($field['validation'] ?? 'nullable')];
                 }
 
                 return [];
             })->toArray();
         })->toArray();
     }
+
+    /**
+     * Transform validation rules into an array and map custom validation rules
+     *
+     * @param string|array $validation
+     * @return array
+     */
+    protected function getValidationRules($validation)
+    {
+        $validations = is_array($validation) ? $validation : explode('|', $validation);
+
+        return array_map(function ($rule) {
+            return match ($rule) {
+                'phone'    => new PhoneNumber(),
+                'postcode' => new PostCode(),
+                'decimal'  => new Decimal(),
+                default => $rule,
+            };
+        }, $validations);
+    }
 }
diff --git a/packages/Webkul/Core/src/SystemConfig/ItemField.php b/packages/Webkul/Core/src/SystemConfig/ItemField.php
index 327ed9b8e81..85efef4a1e7 100644
--- a/packages/Webkul/Core/src/SystemConfig/ItemField.php
+++ b/packages/Webkul/Core/src/SystemConfig/ItemField.php
@@ -12,7 +12,7 @@ class ItemField
      * @var array
      */
     protected $veeValidateMappings = [
-        'min'=> 'min_value',
+        'min' => 'min_value',
     ];
 
     /**

From c07c435e3421ea2ee9a149fd65f331ca7668cf40 Mon Sep 17 00:00:00 2001
From: Shivendra <shivendra.gupta423@webkul.in>
Date: Thu, 30 Jan 2025 17:08:39 +0530
Subject: [PATCH 2/2] fix issue

---
 packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
index 36340f0ef51..b992c28cad4 100644
--- a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
+++ b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php
@@ -34,8 +34,6 @@ public function rules()
 
                 // Check delete key exist in the request
                 if (! $this->has("{$key}.delete")) {
-                    $validation = isset($field['validation']) && $field['validation'] ? $field['validation'] : 'nullable';
-
                     return [$key => $this->getValidationRules($field['validation'] ?? 'nullable')];
                 }