This commit is contained in:
jitendra 2019-11-07 17:39:59 +05:30
parent 65d4e8698a
commit 257392cd2a
9 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,3 @@
<date>
<input type="text" name="{{ $attribute->code }}" class="control" {{ $attribute->is_required ? "v-validate='required'" : '' }} value="{{ old($attribute->code) ?: $product[$attribute->code] }}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;"/>
<input type="text" name="{{ $attribute->code }}" class="control" v-validate="{{ $attribute->is_required ? 'required' : '' }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;"/>
</date>

View File

@ -1,3 +1,3 @@
<datetime>
<input type="text" name="{{ $attribute->code }}" class="control" {{ $attribute->is_required ? "v-validate='required'" : '' }} value="{{ old($attribute->code) ?: $product[$attribute->code]}}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;">
<input type="text" name="{{ $attribute->code }}" class="control" v-validate="{{ $attribute->is_required ? 'required' : '' }}" value="{{ old($attribute->code) ?: $product[$attribute->code]}}" data-vv-as="&quot;{{ $attribute->admin_name }}&quot;">
</datetime>

View File

@ -115,6 +115,8 @@ class CartRuleController extends Controller
$this->validate(request(), [
'name' => 'required|string|unique:cart_rules,name',
'description' => 'string',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'customer_groups' => 'required|array',
'channels' => 'required|array',
'status' => 'required|boolean',
@ -339,6 +341,8 @@ class CartRuleController extends Controller
$this->validate(request(), [
'name' => 'required|string|unique:cart_rules,name,'.$id,
'description' => 'string',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'customer_groups' => 'required|array',
'channels' => 'required|array',
'status' => 'required|boolean',

View File

@ -121,6 +121,8 @@ class CatalogRuleController extends Controller
$this->validate(request(), [
'name' => 'required|string|unique:catalog_rules,name',
'description' => 'string',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'starts_from' => 'present|nullable|date',
'ends_till' => 'present|nullable|date',
'customer_groups' => 'required',
@ -273,8 +275,8 @@ class CatalogRuleController extends Controller
$this->validate(request(), [
'name' => 'required|string|unique:catalog_rules,name,'.$id,
// 'name' => 'required|string',
'starts_from' => 'present|nullable|date',
'ends_till' => 'present|nullable|date',
'starts_from' => 'nullable|date',
'ends_till' => 'nullable|date|after_or_equal:starts_from',
'description' => 'string',
'customer_groups' => 'required',
'channels' => 'required',

View File

@ -73,6 +73,8 @@ class ProductForm extends FormRequest
$this->rules = array_merge($product->getTypeInstance()->getTypeValidationRules(), [
'sku' => ['required', 'unique:products,sku,' . $this->id, new \Webkul\Core\Contracts\Validations\Slug],
'images.*' => 'mimes:jpeg,jpg,bmp,png',
'special_price_from' => 'nullable|date',
'special_price_to' => 'nullable|date|after_or_equal:special_price_from'
]);
foreach ($product->getEditableAttributes() as $attribute) {
@ -81,7 +83,10 @@ class ProductForm extends FormRequest
$validations = [];
array_push($validations, $attribute->is_required ? 'required' : 'nullable');
if (! isset($this->rules[$attribute->code]))
array_push($validations, $attribute->is_required ? 'required' : 'nullable');
else
$validations = $this->rules[$attribute->code];
if ($attribute->type == 'text' && $attribute->validation) {
array_push($validations,

View File

@ -162,9 +162,12 @@ abstract class AbstractType
if ($attribute->type == 'boolean')
$data[$attribute->code] = isset($data[$attribute->code]) && $data[$attribute->code] ? 1 : 0;
if (! isset($data[$attribute->code]) || (in_array($attribute->type, ['date', 'datetime']) && ! $data[$attribute->code]))
if (! isset($data[$attribute->code]))
continue;
if ($attribute->type == 'date' && $data[$attribute->code] == '')
$data[$attribute->code] = null;
if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox')
$data[$attribute->code] = implode(",", $data[$attribute->code]);

0
packages/Webkul/Ui/publishable/assets/css/ui.css vendored Executable file → Normal file
View File

0
packages/Webkul/Ui/publishable/assets/js/ui.js vendored Executable file → Normal file
View File

View File