Skip to content

Commit 21a66ec

Browse files
committed
Refactor attribute validation logic and fix typo in quote item label
1 parent 3e34f4d commit 21a66ec

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
$validations = [];
77
88
if ($attribute->is_required) {
9-
array_push($validations, 'required');
9+
$validations[] = 'required';
1010
}
1111
12-
if ($attribute->type == 'price') {
13-
array_push($validations, 'decimal');
12+
if (
13+
! empty($attribute->validation)
14+
&& ! in_array($attribute->validation, $validations)
15+
) {
16+
$validations[] = $attribute->validation;
1417
}
1518
16-
array_push($validations, $attribute->validation);
17-
1819
$validations = implode('|', array_filter($validations));
1920
}
2021
@endphp

packages/Webkul/Admin/src/Resources/views/quotes/create.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class="!px-2 ltr:text-right rtl:text-left"
344344
{!! view_render_event('admin.contacts.quotes.create.table.before') !!}
345345
</div>
346346
347-
<!-- Add New Qoute Item -->
347+
<!-- Add New Quote Item -->
348348
<span
349349
class="text-md cursor-pointer self-start font-semibold text-brandColor hover:underline dark:text-brandColor"
350350
@click="addProduct"

packages/Webkul/Installer/src/Database/Seeders/Attribute/AttributeSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function run($parameters = [])
6060
'type' => 'price',
6161
'entity_type' => 'leads',
6262
'lookup_type' => null,
63-
'validation' => null,
63+
'validation' => 'decimal',
6464
'sort_order' => '3',
6565
'is_required' => '1',
6666
'is_unique' => '0',

0 commit comments

Comments
 (0)