@php
$formScope = $formScope ?? '';
@endphp
@foreach ($customAttributes as $attribute)
@php
if (isset($customValidations[$attribute->code])) {
$validations = implode('|', $customValidations[$attribute->code]);
} else {
$validations = [];
if ($attribute->code != 'sku') {
if ($attribute->is_required) {
array_push($validations, 'required');
}
if ($attribute->type == 'price') {
array_push($validations, 'decimal');
}
array_push($validations, $attribute->validation);
$validations = implode('|', array_filter($validations));
} else {
$validations = "{ ";
if ($attribute->is_required) {
$validations .= "required: true, ";
}
$validations .= "regex: /^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/ }";
}
}
@endphp
@if (view()->exists($typeView = 'admin::common.custom-attributes.edit.' . $attribute->type))
type == 'multiselect') :class="[errors.has('{{ $formScope . $attribute->code }}[]') ? 'has-error' : '']"
@else :class="[errors.has('{{ $formScope . $attribute->code }}') ? 'has-error' : '']" @endif
>
@include ($typeView, ['value' => isset($entity) ? $entity[$attribute->code] : null])
type == 'multiselect') v-if="errors.has('{{ $formScope . $attribute->code }}[]')"
@else v-if="errors.has('{{ $formScope . $attribute->code }}')" @endif
>
@if ($attribute->type == 'multiselect')
@{{ errors.first('{!! $formScope . $attribute->code !!}[]') }}
@else
@{{ errors.first('{!! $formScope . $attribute->code !!}') }}
@endif
@endif
@endforeach