Skip to content

Commit f86a465

Browse files
Merge pull request #2077 from amit-webkul/lead
Fixing lead validations #2064.
2 parents 234cae7 + 1c0d26d commit f86a465

File tree

6 files changed

+17
-30
lines changed

6 files changed

+17
-30
lines changed

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

+1-11
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' ? { required: true } : {}),
37-
};
38-
},
39-
},
4030
});
4131
</script>
4232
@endPushOnce

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

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +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 = [];
3+
$validations = [];
74
8-
if ($attribute->is_required) {
9-
array_push($validations, 'required');
10-
}
5+
if ($attribute->is_required) {
6+
$validations[] = 'required';
7+
}
118
12-
if ($attribute->type == 'price') {
13-
array_push($validations, 'decimal');
14-
}
9+
if ($attribute->type == 'price') {
10+
$validations[] = 'decimal';
11+
}
1512
16-
array_push($validations, $attribute->validation);
13+
$validations[] = $attribute->validation;
1714
18-
$validations = implode('|', array_filter($validations));
19-
}
15+
$validations = implode('|', array_filter($validations));
2016
@endphp
2117

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

packages/Webkul/Admin/src/Resources/views/leads/common/contact.blade.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
::src="src"
2020
name="person[id]"
2121
::params="params"
22-
@on-selected="addPerson"
23-
:placeholder="trans('admin::app.leads.common.contact.name')"
22+
rules="required"
2423
::value="{id: person.id, name: person.name}"
24+
:placeholder="trans('admin::app.leads.common.contact.name')"
25+
@on-selected="addPerson"
2526
:can-add-new="true"
2627
/>
2728

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

+1-1
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/Admin/src/Resources/views/settings/web-forms/create.blade.php

+2-2
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">

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

+1-1
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)