Skip to content

Commit 1c0d26d

Browse files
committed
Fix more validation issues.
1 parent ae8df52 commit 1c0d26d

File tree

3 files changed

+15
-30
lines changed

3 files changed

+15
-30
lines changed

packages/Webkul/Admin/src/Resources/views/components/attributes/edit/price.blade.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
::id="attribute.code"
1818
::value="value"
1919
::name="attribute.code"
20-
::rules="getValidation"
20+
::rules="validations"
2121
::label="attribute.name"
2222
/>
2323
</script>
@@ -27,16 +27,6 @@
2727
template: '#v-price-component-template',
2828
2929
props: ['validations', 'attribute', 'value'],
30-
31-
computed: {
32-
getValidation() {
33-
return {
34-
decimal: true,
35-
min_value: 0,
36-
...((this.validations === 'required' || this.validations === 'required|decimal') ? { required: true } : {}),
37-
};
38-
},
39-
},
4030
});
4131
</script>
4232
@endPushOnce

packages/Webkul/Admin/src/Resources/views/components/attributes/index.blade.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
@foreach ($customAttributes as $attribute)
22
@php
3-
if (isset($customValidations[$attribute->code])) {
4-
$validations = implode('|', $customValidations[$attribute->code]);
5-
} else {
6-
$validations = [];
7-
8-
if ($attribute->is_required) {
9-
$validations[] = 'required';
10-
}
11-
12-
if (
13-
! empty($attribute->validation)
14-
&& ! in_array($attribute->validation, $validations)
15-
) {
16-
$validations[] = $attribute->validation;
17-
}
18-
19-
$validations = implode('|', array_filter($validations));
3+
$validations = [];
4+
5+
if ($attribute->is_required) {
6+
$validations[] = 'required';
7+
}
8+
9+
if ($attribute->type == 'price') {
10+
$validations[] = 'decimal';
2011
}
12+
13+
$validations[] = $attribute->validation;
14+
15+
$validations = implode('|', array_filter($validations));
2116
@endphp
2217

2318
<x-admin::form.control-group class="mb-2.5 w-full">

packages/Webkul/Admin/src/Resources/views/settings/web-forms/create.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class="rounded-l-none"
107107
108108
<!-- Create Leads -->
109109
<x-admin::form.control-group>
110-
<x-admin::form.control-group.label class="required">
110+
<x-admin::form.control-group.label>
111111
@lang('admin::app.settings.webforms.create.create-lead')
112112
</x-admin::form.control-group.label>
113113
@@ -125,7 +125,7 @@ class="peer sr-only"
125125
</label>
126126
</x-admin::form.control-group>
127127
128-
<!-- Customize Webform -->
128+
<!-- Customize Web-form -->
129129
<div class="mb-4 flex items-center justify-between gap-4">
130130
<div class="flex flex-col gap-1">
131131
<p class="text-base font-semibold text-gray-800 dark:text-white">

0 commit comments

Comments
 (0)