-
-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1908 from amit-webkul/product-price-validation
🛠️ [v2.0] : Fixed Issue #1786
- Loading branch information
Showing
13 changed files
with
101 additions
and
14 deletions.
There are no files selected for viewing
49 changes: 41 additions & 8 deletions
49
packages/Webkul/Admin/src/Resources/views/components/attributes/edit/price.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,41 @@ | ||
<x-admin::form.control-group.control | ||
type="text" | ||
:id="$attribute->code" | ||
:name="$attribute->code" | ||
:value="old($attribute->code) ?? $value" | ||
:rules="$validations" | ||
:label="$attribute->name" | ||
/> | ||
@if (isset($attribute)) | ||
<v-price-component | ||
:attribute="{{ json_encode($attribute) }}" | ||
:validations="'{{ $validations }}'" | ||
:value="{{ json_encode(old($attribute->code) ?? $value) }}" | ||
> | ||
</v-price-component> | ||
@endif | ||
|
||
@pushOnce('scripts') | ||
<script | ||
type="text/x-template" | ||
id="v-price-component-template" | ||
> | ||
<x-admin::form.control-group.control | ||
type="text" | ||
::id="attribute.code" | ||
::value="value" | ||
::name="attribute.code" | ||
::rules="getValidation" | ||
::label="attribute.name" | ||
/> | ||
</script> | ||
|
||
<script type="module"> | ||
app.component('v-price-component', { | ||
template: '#v-price-component-template', | ||
props: ['validations', 'attribute', 'value'], | ||
computed: { | ||
getValidation() { | ||
return { | ||
numeric: true, | ||
...(this.validations === 'required' ? { required: true } : {}), | ||
}; | ||
}, | ||
}, | ||
}); | ||
</script> | ||
@endPushOnce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'يجب أن يكون الحقل رمزًا صالحًا.', | ||
'decimal' => 'يجب أن يكون الحقل رقمًا عشريًا.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'The field must be a valid code.', | ||
'decimal' => 'The field must be a decimal number.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'El campo debe ser un código válido.', | ||
'decimal' => 'El campo debe ser un número decimal.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'این فیلد باید یک کد معتبر باشد.', | ||
'decimal' => 'این فیلد باید یک عدد اعشاری باشد.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'O campo deve ser um código válido.', | ||
'decimal' => 'O campo deve ser um número decimal.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'Alan geçerli bir kod olmalıdır.', | ||
'decimal' => 'Alan ondalık bir sayı olmalıdır.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
return [ | ||
'validations' => [ | ||
'code' => 'Trường phải là một mã hợp lệ.', | ||
'decimal' => 'Trường phải là một số thập phân.', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters