Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠️ [v2.0] : Fixed Issue #1786 #1908

Merged
merged 5 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$validations = implode('|', array_filter($validations));
}
@endphp

<x-admin::form.control-group class="mb-2.5 w-full">
<x-admin::form.control-group.label
for="{{ $attribute->code }}"
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Core/src/Contracts/Validations/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function passes($attribute, $value)
*/
public function message()
{
return trans('This value must be valid.');
return trans('core::app.validations.code');
}
}
2 changes: 1 addition & 1 deletion packages/Webkul/Core/src/Contracts/Validations/Decimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function passes($attribute, $value)
*/
public function message()
{
return trans('core::validation.decimal');
return trans('core::app.validations.decimal');
}
}
2 changes: 0 additions & 2 deletions packages/Webkul/Core/src/Providers/CoreServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function boot()

$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'core');

$this->loadViewsFrom(__DIR__.'/../Resources/views', 'core');

$this->publishes([
dirname(__DIR__).'/Config/concord.php' => config_path('concord.php'),
dirname(__DIR__).'/Config/cors.php' => config_path('cors.php'),
Expand Down
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/ar/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'validations' => [
'code' => 'يجب أن يكون الحقل رمزًا صالحًا.',
'decimal' => 'يجب أن يكون الحقل رقمًا عشريًا.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/en/app.php
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.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/es/app.php
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.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'validations' => [
'code' => 'این فیلد باید یک کد معتبر باشد.',
'decimal' => 'این فیلد باید یک عدد اعشاری باشد.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/pt_BR/app.php
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.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/tr/app.php
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.',
],
];
8 changes: 8 additions & 0 deletions packages/Webkul/Core/src/Resources/lang/vi/app.php
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.',
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public function run($parameters = [])
], [
'code' => 'price',
'name' => trans('installer::app.seeders.attributes.products.price', [], $defaultLocale),
'type' => 'text',
'type' => 'price',
'entity_type' => 'products',
'lookup_type' => null,
'validation' => 'decimal',
Expand Down
Loading