Merge branch 'master' into order-status-issue
This commit is contained in:
commit
8bab27c81f
|
|
@ -371,6 +371,10 @@ Route::group(['middleware' => ['web', 'admin_locale']], function () {
|
||||||
'view' => 'admin::catalog.attributes.index',
|
'view' => 'admin::catalog.attributes.index',
|
||||||
])->name('admin.catalog.attributes.index');
|
])->name('admin.catalog.attributes.index');
|
||||||
|
|
||||||
|
Route::get('/attributes/{id}/options', 'Webkul\Attribute\Http\Controllers\AttributeController@getAttributeOptions')->defaults('_config', [
|
||||||
|
'view' => 'admin::catalog.attributes.options',
|
||||||
|
])->name('admin.catalog.attributes.options');
|
||||||
|
|
||||||
Route::get('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@create')->defaults('_config', [
|
Route::get('/attributes/create', 'Webkul\Attribute\Http\Controllers\AttributeController@create')->defaults('_config', [
|
||||||
'view' => 'admin::catalog.attributes.create',
|
'view' => 'admin::catalog.attributes.create',
|
||||||
])->name('admin.catalog.attributes.create');
|
])->name('admin.catalog.attributes.create');
|
||||||
|
|
|
||||||
|
|
@ -603,6 +603,7 @@ return [
|
||||||
'options' => 'خيارات',
|
'options' => 'خيارات',
|
||||||
'position' => 'موضع',
|
'position' => 'موضع',
|
||||||
'add-option-btn-title' => 'إضافة خيار',
|
'add-option-btn-title' => 'إضافة خيار',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'التصديقات',
|
'validations' => 'التصديقات',
|
||||||
'input_validation' => 'التحقق من الإدخال',
|
'input_validation' => 'التحقق من الإدخال',
|
||||||
'is_required' => 'مطلوب',
|
'is_required' => 'مطلوب',
|
||||||
|
|
@ -634,6 +635,9 @@ return [
|
||||||
'use_in_flat' => "إنشاء في جدول المنتجات المسطحة",
|
'use_in_flat' => "إنشاء في جدول المنتجات المسطحة",
|
||||||
'is_comparable' => "السمة قابلة للمقارنة",
|
'is_comparable' => "السمة قابلة للمقارنة",
|
||||||
'default_null_option' => 'إنشاء خيار فارغ افتراضي',
|
'default_null_option' => 'إنشاء خيار فارغ افتراضي',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'الأسر',
|
'title' => 'الأسر',
|
||||||
|
|
|
||||||
|
|
@ -594,6 +594,7 @@ return [
|
||||||
'options' => 'Optionen',
|
'options' => 'Optionen',
|
||||||
'position' => 'Position',
|
'position' => 'Position',
|
||||||
'add-option-btn-title' => 'Option hinzufügen',
|
'add-option-btn-title' => 'Option hinzufügen',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validierungen',
|
'validations' => 'Validierungen',
|
||||||
'input_validation' => 'Eingabe-Validierung',
|
'input_validation' => 'Eingabe-Validierung',
|
||||||
'is_required' => 'Ist erforderlich',
|
'is_required' => 'Ist erforderlich',
|
||||||
|
|
@ -624,6 +625,9 @@ return [
|
||||||
'use_in_flat' => 'In Produkt Flat Tabelle erstellen',
|
'use_in_flat' => 'In Produkt Flat Tabelle erstellen',
|
||||||
'is_comparable' => 'Attribut ist vergleichbar',
|
'is_comparable' => 'Attribut ist vergleichbar',
|
||||||
'default_null_option' => 'Erstellen Sie eine leere Standardoption',
|
'default_null_option' => 'Erstellen Sie eine leere Standardoption',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' =>
|
'families' =>
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,7 @@ return [
|
||||||
'options' => 'Options',
|
'options' => 'Options',
|
||||||
'position' => 'Position',
|
'position' => 'Position',
|
||||||
'add-option-btn-title' => 'Add Option',
|
'add-option-btn-title' => 'Add Option',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validations',
|
'validations' => 'Validations',
|
||||||
'input_validation' => 'Input Validation',
|
'input_validation' => 'Input Validation',
|
||||||
'is_required' => 'Is Required',
|
'is_required' => 'Is Required',
|
||||||
|
|
@ -645,6 +646,9 @@ return [
|
||||||
'use_in_flat' => "Create in Product Flat Table",
|
'use_in_flat' => "Create in Product Flat Table",
|
||||||
'is_comparable' => "Attribute is comparable",
|
'is_comparable' => "Attribute is comparable",
|
||||||
'default_null_option' => 'Create default empty option',
|
'default_null_option' => 'Create default empty option',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Families',
|
'title' => 'Families',
|
||||||
|
|
|
||||||
|
|
@ -615,6 +615,7 @@ return [
|
||||||
'options' => 'Opciones',
|
'options' => 'Opciones',
|
||||||
'position' => 'Posición',
|
'position' => 'Posición',
|
||||||
'add-option-btn-title' => 'Agregar opción',
|
'add-option-btn-title' => 'Agregar opción',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validaciones',
|
'validations' => 'Validaciones',
|
||||||
'input_validation' => 'Validación entrada',
|
'input_validation' => 'Validación entrada',
|
||||||
'is_required' => 'Es requerido',
|
'is_required' => 'Es requerido',
|
||||||
|
|
@ -645,6 +646,9 @@ return [
|
||||||
'use_in_flat' => "Crear en tabla plana de productos",
|
'use_in_flat' => "Crear en tabla plana de productos",
|
||||||
'is_comparable' => "El atributo es comparable",
|
'is_comparable' => "El atributo es comparable",
|
||||||
'default_null_option' => 'Crear opción vacía por defecto',
|
'default_null_option' => 'Crear opción vacía por defecto',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Familias',
|
'title' => 'Familias',
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,7 @@ return [
|
||||||
'options' => 'گزینه ها',
|
'options' => 'گزینه ها',
|
||||||
'position' => 'موقعیت',
|
'position' => 'موقعیت',
|
||||||
'add-option-btn-title' => 'افزودن گزینه',
|
'add-option-btn-title' => 'افزودن گزینه',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'اعتبار سنجی ها',
|
'validations' => 'اعتبار سنجی ها',
|
||||||
'input_validation' => 'اعتبار سنجی ورودی',
|
'input_validation' => 'اعتبار سنجی ورودی',
|
||||||
'is_required' => 'مورد نیاز است',
|
'is_required' => 'مورد نیاز است',
|
||||||
|
|
@ -634,6 +635,9 @@ return [
|
||||||
'use_in_flat' => 'اضافه به جدول flat (product_flat)',
|
'use_in_flat' => 'اضافه به جدول flat (product_flat)',
|
||||||
'is_comparable' => "ویژگی قابل مقایسه است",
|
'is_comparable' => "ویژگی قابل مقایسه است",
|
||||||
'default_null_option' => 'گزینه پیش فرض خالی ایجاد کنید',
|
'default_null_option' => 'گزینه پیش فرض خالی ایجاد کنید',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'ویژگی ها',
|
'title' => 'ویژگی ها',
|
||||||
|
|
|
||||||
|
|
@ -614,6 +614,7 @@ return [
|
||||||
'options' => 'Options',
|
'options' => 'Options',
|
||||||
'position' => 'Positionner',
|
'position' => 'Positionner',
|
||||||
'add-option-btn-title' => 'Ajouter une option',
|
'add-option-btn-title' => 'Ajouter une option',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validation',
|
'validations' => 'Validation',
|
||||||
'input_validation' => 'Validation d\'entrée',
|
'input_validation' => 'Validation d\'entrée',
|
||||||
'is_required' => 'Est requis',
|
'is_required' => 'Est requis',
|
||||||
|
|
@ -644,6 +645,9 @@ return [
|
||||||
'use_in_flat' => 'Créer dans la table plate du produit',
|
'use_in_flat' => 'Créer dans la table plate du produit',
|
||||||
'is_comparable' => 'L\'attribut est comparable',
|
'is_comparable' => 'L\'attribut est comparable',
|
||||||
'default_null_option' => 'Créer une option vide par défaut',
|
'default_null_option' => 'Créer une option vide par défaut',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'families' => [
|
'families' => [
|
||||||
|
|
|
||||||
|
|
@ -604,6 +604,7 @@ return [
|
||||||
'options' => 'Opzioni',
|
'options' => 'Opzioni',
|
||||||
'position' => 'Posizione',
|
'position' => 'Posizione',
|
||||||
'add-option-btn-title' => 'Aggiungi Option',
|
'add-option-btn-title' => 'Aggiungi Option',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validazioni',
|
'validations' => 'Validazioni',
|
||||||
'input_validation' => 'Validazione Input',
|
'input_validation' => 'Validazione Input',
|
||||||
'is_required' => 'È Richiesto',
|
'is_required' => 'È Richiesto',
|
||||||
|
|
@ -634,6 +635,9 @@ return [
|
||||||
'use_in_flat' => "Crea in tabella Product flat",
|
'use_in_flat' => "Crea in tabella Product flat",
|
||||||
'is_comparable' => "L'attributo è comparabile",
|
'is_comparable' => "L'attributo è comparabile",
|
||||||
'default_null_option' => 'Crea opzione predefinita vuota',
|
'default_null_option' => 'Crea opzione predefinita vuota',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Famiglie',
|
'title' => 'Famiglie',
|
||||||
|
|
|
||||||
|
|
@ -600,6 +600,7 @@ return [
|
||||||
'options' => 'Opties',
|
'options' => 'Opties',
|
||||||
'position' => 'Positie',
|
'position' => 'Positie',
|
||||||
'add-option-btn-title' => 'Optie toevoegen',
|
'add-option-btn-title' => 'Optie toevoegen',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validations',
|
'validations' => 'Validations',
|
||||||
'input_validation' => 'Input Validation',
|
'input_validation' => 'Input Validation',
|
||||||
'is_required' => 'is verplicht',
|
'is_required' => 'is verplicht',
|
||||||
|
|
@ -631,6 +632,9 @@ return [
|
||||||
'use_in_flat' => "Create in Product Flat Table",
|
'use_in_flat' => "Create in Product Flat Table",
|
||||||
'is_comparable' => "Attribuut is vergelijkbaar ",
|
'is_comparable' => "Attribuut is vergelijkbaar ",
|
||||||
'default_null_option' => 'Create default empty option',
|
'default_null_option' => 'Create default empty option',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Families',
|
'title' => 'Families',
|
||||||
|
|
|
||||||
|
|
@ -602,6 +602,7 @@ return [
|
||||||
'options' => 'Opcje',
|
'options' => 'Opcje',
|
||||||
'position' => 'Pozycja',
|
'position' => 'Pozycja',
|
||||||
'add-option-btn-title' => 'Dodaj opcję',
|
'add-option-btn-title' => 'Dodaj opcję',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Walidacje danych',
|
'validations' => 'Walidacje danych',
|
||||||
'input_validation' => 'Sprawdzanie poprawności danych wejściowych',
|
'input_validation' => 'Sprawdzanie poprawności danych wejściowych',
|
||||||
'is_required' => 'Jest wymagany',
|
'is_required' => 'Jest wymagany',
|
||||||
|
|
@ -633,6 +634,9 @@ return [
|
||||||
'use_in_flat' => "Utwórz w płaskiej tabeli produktu",
|
'use_in_flat' => "Utwórz w płaskiej tabeli produktu",
|
||||||
'is_comparable' => "Atrybut jest porównywalny",
|
'is_comparable' => "Atrybut jest porównywalny",
|
||||||
'default_null_option' => 'Utwórz domyślną pustą opcję',
|
'default_null_option' => 'Utwórz domyślną pustą opcję',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Rodziny atrybutów',
|
'title' => 'Rodziny atrybutów',
|
||||||
|
|
|
||||||
|
|
@ -601,6 +601,7 @@ return [
|
||||||
'options' => 'Opções',
|
'options' => 'Opções',
|
||||||
'position' => 'Posição',
|
'position' => 'Posição',
|
||||||
'add-option-btn-title' => 'Adicionar Opção',
|
'add-option-btn-title' => 'Adicionar Opção',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Validações',
|
'validations' => 'Validações',
|
||||||
'input_validation' => 'Validação de Campo',
|
'input_validation' => 'Validação de Campo',
|
||||||
'is_required' => 'É Obrigratório',
|
'is_required' => 'É Obrigratório',
|
||||||
|
|
@ -632,6 +633,9 @@ return [
|
||||||
'use_in_flat' => "Criar na tabela plana do produto",
|
'use_in_flat' => "Criar na tabela plana do produto",
|
||||||
'is_comparable' => "O atributo é comparável",
|
'is_comparable' => "O atributo é comparável",
|
||||||
'default_null_option' => 'Criar opção vazia padrão',
|
'default_null_option' => 'Criar opção vazia padrão',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Famílias',
|
'title' => 'Famílias',
|
||||||
|
|
|
||||||
|
|
@ -597,6 +597,7 @@ return [
|
||||||
'options' => 'Seçenekler',
|
'options' => 'Seçenekler',
|
||||||
'position' => 'Konum',
|
'position' => 'Konum',
|
||||||
'add-option-btn-title' => 'Seçenek Ekle',
|
'add-option-btn-title' => 'Seçenek Ekle',
|
||||||
|
'load-more-options-btn-title' => 'Load More Options',
|
||||||
'validations' => 'Doğrulamalar',
|
'validations' => 'Doğrulamalar',
|
||||||
'input_validation' => 'Giriş Doğrulaması',
|
'input_validation' => 'Giriş Doğrulaması',
|
||||||
'is_required' => 'Zorunlu',
|
'is_required' => 'Zorunlu',
|
||||||
|
|
@ -627,6 +628,9 @@ return [
|
||||||
'use_in_flat' => "Ürün Tablosu Oluştur",
|
'use_in_flat' => "Ürün Tablosu Oluştur",
|
||||||
'is_comparable' => "Nitelik kıyaslanabilir",
|
'is_comparable' => "Nitelik kıyaslanabilir",
|
||||||
'default_null_option' => 'Varsayılan boş seçenek oluştur',
|
'default_null_option' => 'Varsayılan boş seçenek oluştur',
|
||||||
|
'validation-messages' => [
|
||||||
|
'max-size' => 'The image size must be less than 600 KB'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'families' => [
|
'families' => [
|
||||||
'title' => 'Küme',
|
'title' => 'Küme',
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
@php
|
||||||
|
$allLocales = app('Webkul\Core\Repositories\LocaleRepository')->all();
|
||||||
|
@endphp
|
||||||
|
|
||||||
@extends('admin::layouts.content')
|
@extends('admin::layouts.content')
|
||||||
|
|
||||||
@section('page_title')
|
@section('page_title')
|
||||||
|
|
@ -27,25 +31,29 @@
|
||||||
<div class="page-content">
|
<div class="page-content">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
@csrf()
|
@csrf()
|
||||||
|
|
||||||
<input name="_method" type="hidden" value="PUT">
|
<input name="_method" type="hidden" value="PUT">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.general') }}'" :active="true">
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.controls.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.controls.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
|
||||||
<label for="code" class="required">{{ __('admin::app.catalog.attributes.code') }}</label>
|
<label for="code" class="required">{{ __('admin::app.catalog.attributes.code') }}</label>
|
||||||
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $attribute->code }}" disabled="disabled" data-vv-as=""{{ __('admin::app.catalog.attributes.code') }}"" v-code/>
|
<input type="text" v-validate="'required'" class="control" id="code" name="code" value="{{ old('code') ?: $attribute->code }}" disabled="disabled" data-vv-as=""{{ __('admin::app.catalog.attributes.code') }}"" v-code/>
|
||||||
<input type="hidden" name="code" value="{{ $attribute->code }}"/>
|
<input type="hidden" name="code" value="{{ $attribute->code }}"/>
|
||||||
<span class="control-error" v-if="errors.has('code')">@{{ errors.first('code') }}</span>
|
<span class="control-error" v-if="errors.has('code')" v-text="errors.first('code')"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<?php $selectedOption = old('type') ?: $attribute->type ?>
|
@php
|
||||||
|
$selectedOption = old('type') ?: $attribute->type;
|
||||||
|
@endphp
|
||||||
|
|
||||||
<label for="type">{{ __('admin::app.catalog.attributes.type') }}</label>
|
<label for="type">{{ __('admin::app.catalog.attributes.type') }}</label>
|
||||||
|
|
||||||
<select class="control" id="type" disabled="disabled">
|
<select class="control" id="type" disabled="disabled">
|
||||||
<option value="text" {{ $selectedOption == 'text' ? 'selected' : '' }}>
|
<option value="text" {{ $selectedOption == 'text' ? 'selected' : '' }}>
|
||||||
{{ __('admin::app.catalog.attributes.text') }}
|
{{ __('admin::app.catalog.attributes.text') }}
|
||||||
|
|
@ -81,6 +89,7 @@
|
||||||
{{ __('admin::app.catalog.attributes.checkbox') }}
|
{{ __('admin::app.catalog.attributes.checkbox') }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
|
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -90,39 +99,32 @@
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.general.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.label') }}'" :active="true">
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('admin_name') ? 'has-error' : '']">
|
||||||
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
<label for="admin_name" class="required">{{ __('admin::app.catalog.attributes.admin') }}</label>
|
||||||
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') ?: $attribute->admin_name }}" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
<input type="text" v-validate="'required'" class="control" id="admin_name" name="admin_name" value="{{ old('admin_name') ?: $attribute->admin_name }}" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||||
<span class="control-error" v-if="errors.has('admin_name')">@{{ errors.first('admin_name') }}</span>
|
<span class="control-error" v-if="errors.has('admin_name')" v-text="errors.first('admin_name')"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
@foreach ($allLocales as $locale)
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
|
<label for="locale-{{ $locale->code }}">{{ $locale->name . ' (' . $locale->code . ')' }}</label>
|
||||||
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?? ($attribute->translate($locale->code)->name ?? '') }}"/>
|
<input type="text" class="control" id="locale-{{ $locale->code }}" name="<?php echo $locale->code; ?>[name]" value="{{ old($locale->code)['name'] ?? ($attribute->translate($locale->code)->name ?? '') }}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.controls.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.attributes.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
|
|
||||||
<div class="{{ in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' }}">
|
<div class="{{ in_array($attribute->type, ['select', 'multiselect', 'checkbox']) ?: 'hide' }}">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.options') }}'" :active="true" :id="'options'">
|
||||||
|
|
@ -130,7 +132,10 @@
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<option-wrapper></option-wrapper>
|
<option-wrapper
|
||||||
|
src="{{ route('admin.catalog.attributes.options', $attribute->id) }}"
|
||||||
|
:all-locales="{{ $allLocales->toJson() }}"
|
||||||
|
></option-wrapper>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.controls.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
|
|
@ -138,14 +143,12 @@
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.options.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.validations') }}'" :active="true">
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
@ -190,18 +193,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.controls.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.validations.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
|
<accordian :title="'{{ __('admin::app.catalog.attributes.configuration') }}'" :active="true">
|
||||||
<div slot="body">
|
<div slot="body">
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.before', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.before', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
@ -291,7 +291,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.after', ['attribute' => $attribute]) !!}
|
{!! view_render_event('bagisto.admin.catalog.attribute.edit_form_accordian.configuration.controls.after', ['attribute' => $attribute]) !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</accordian>
|
</accordian>
|
||||||
|
|
||||||
|
|
@ -306,7 +305,6 @@
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script type="text/x-template" id="options-template">
|
<script type="text/x-template" id="options-template">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="control-group" v-if="show_swatch">
|
<div class="control-group" v-if="show_swatch">
|
||||||
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
|
<label for="swatch_type">{{ __('admin::app.catalog.attributes.swatch_type') }}</label>
|
||||||
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
|
<select class="control" id="swatch_type" name="swatch_type" v-model="swatch_type">
|
||||||
|
|
@ -333,6 +331,7 @@
|
||||||
<input type="checkbox" class="control" id="default-null-option" name="default-null-option" v-model="isNullOptionChecked">
|
<input type="checkbox" class="control" id="default-null-option" name="default-null-option" v-model="isNullOptionChecked">
|
||||||
|
|
||||||
<label class="checkbox-view" for="default-null-option"></label>
|
<label class="checkbox-view" for="default-null-option"></label>
|
||||||
|
|
||||||
{{ __('admin::app.catalog.attributes.default_null_option') }}
|
{{ __('admin::app.catalog.attributes.default_null_option') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -345,11 +344,7 @@
|
||||||
|
|
||||||
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
|
<th>{{ __('admin::app.catalog.attributes.admin_name') }}</th>
|
||||||
|
|
||||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
<th v-for="locale in allLocales" v-text="`${locale.name} (${locale.code})`"></th>
|
||||||
|
|
||||||
<th>{{ $locale->name . ' (' . $locale->code . ')' }}</th>
|
|
||||||
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
<th>{{ __('admin::app.catalog.attributes.position') }}</th>
|
<th>{{ __('admin::app.catalog.attributes.position') }}</th>
|
||||||
|
|
||||||
|
|
@ -358,8 +353,12 @@
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{{-- `v-show` used here, so that element remain inside the form. Don't use `v-if` here. --}}
|
||||||
|
<tr v-for="(row, index) in optionRows" :key="row.id" v-show="! row.isDelete">
|
||||||
|
<input type="hidden" :name="'options[' + row.id + '][isNew]'" :value="row.isNew">
|
||||||
|
|
||||||
|
<input type="hidden" :name="'options[' + row.id + '][isDelete]'" :value="row.isDelete">
|
||||||
|
|
||||||
<tr v-for="(row, index) in optionRows" :key="row.id">
|
|
||||||
<td v-if="show_swatch && swatch_type == 'color'">
|
<td v-if="show_swatch && swatch_type == 'color'">
|
||||||
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
|
<swatch-picker :input-name="'options[' + row.id + '][swatch_value]'" :color="row.swatch_value" colors="text-advanced" show-fallback />
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -368,30 +367,28 @@
|
||||||
<div class="control-group" :class="[errors.has('options[' + row.id + '][swatch_value]') ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has('options[' + row.id + '][swatch_value]') ? 'has-error' : '']">
|
||||||
<img style="width: 36px;height: 36px;vertical-align: middle;background: #F2F2F2;border-radius: 2px;margin-right: 10px;" v-if="row.swatch_value_url" :src="row.swatch_value_url"/>
|
<img style="width: 36px;height: 36px;vertical-align: middle;background: #F2F2F2;border-radius: 2px;margin-right: 10px;" v-if="row.swatch_value_url" :src="row.swatch_value_url"/>
|
||||||
<input type="file" v-validate="'size:600'" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
|
<input type="file" v-validate="'size:600'" accept="image/*" :name="'options[' + row.id + '][swatch_value]'"/>
|
||||||
<span class="control-error" v-if="errors.has('options[' + row.id + '][swatch_value]')">The image size must be less than 600 KB</span>
|
<span class="control-error" v-if="errors.has('options[' + row.id + '][swatch_value]')" v-text="'{{ __('admin::app.catalog.attributes.validation-messages.max-size') }}'"></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has(adminName(row)) ? 'has-error' : '']">
|
||||||
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
<input type="text" v-validate="'required'" v-model="row['admin_name']" :name="adminName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.admin_name') }}""/>
|
||||||
<span class="control-error" v-if="errors.has(adminName(row))">@{{ errors.first(adminName(row)) }}</span>
|
<span class="control-error" v-if="errors.has(adminName(row))" v-text="errors.first(adminName(row))"></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
<td v-for="locale in allLocales">
|
||||||
<td>
|
<div class="control-group" :class="[errors.has(localeInputName(row, locale.code)) ? 'has-error' : '']">
|
||||||
<div class="control-group" :class="[errors.has(localeInputName(row, '{{ $locale->code }}')) ? 'has-error' : '']">
|
<input type="text" v-validate="getOptionValidation(row, locale.code)" v-model="row['locales'][locale.code]" :name="localeInputName(row, locale.code)" class="control" :data-vv-as="`"${locale.name} (${locale.code})"`"/>
|
||||||
<input type="text" v-validate="getOptionValidation(row, '{{ $locale->code }}')" v-model="row['locales']['{{ $locale->code }}']" :name="localeInputName(row, '{{ $locale->code }}')" class="control" data-vv-as=""{{ $locale->name . ' (' . $locale->code . ')' }}""/>
|
<span class="control-error" v-if="errors.has(localeInputName(row, locale.code))" v-text="errors.first(localeInputName(row, locale.code))"></span>
|
||||||
<span class="control-error" v-if="errors.has(localeInputName(row, '{{ $locale->code }}'))">@{{ errors.first(localeInputName(row, '{!! $locale->code !!}')) }}</span>
|
</div>
|
||||||
</div>
|
</td>
|
||||||
</td>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
<div class="control-group" :class="[errors.has(sortOrderName(row)) ? 'has-error' : '']">
|
||||||
<input type="text" v-validate="'required|numeric'" v-model="row['sort_order']" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
<input type="text" v-validate="'required|numeric'" v-model="row['sort_order']" :name="sortOrderName(row)" class="control" data-vv-as=""{{ __('admin::app.catalog.attributes.position') }}""/>
|
||||||
<span class="control-error" v-if="errors.has(sortOrderName(row))">@{{ errors.first(sortOrderName(row)) }}</span>
|
<span class="control-error" v-if="errors.has(sortOrderName(row))" v-text="errors.first(sortOrderName(row))"></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
@ -403,6 +400,10 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-lg btn-primary" id="load-more-btm" style="margin-top: 20px" @click="loadMoreOptions()" v-if="loadMore">
|
||||||
|
{{ __('admin::app.catalog.attributes.load-more-options-btn-title') }}
|
||||||
|
</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-lg btn-primary" id="add-option-btn" style="margin-top: 20px" @click="addOptionRow()">
|
<button type="button" class="btn btn-lg btn-primary" id="add-option-btn" style="margin-top: 20px" @click="addOptionRow()">
|
||||||
{{ __('admin::app.catalog.attributes.add-option-btn-title') }}
|
{{ __('admin::app.catalog.attributes.add-option-btn-title') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -411,69 +412,115 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
Vue.component('option-wrapper', {
|
Vue.component('option-wrapper', {
|
||||||
|
|
||||||
template: '#options-template',
|
template: '#options-template',
|
||||||
|
|
||||||
inject: ['$validator'],
|
inject: ['$validator'],
|
||||||
|
|
||||||
|
props: [
|
||||||
|
'src',
|
||||||
|
'allLocales'
|
||||||
|
],
|
||||||
|
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
appLocale: '{{ app()->getLocale() }}',
|
||||||
|
optionPage: 1,
|
||||||
optionRowCount: 0,
|
optionRowCount: 0,
|
||||||
optionRows: [],
|
optionRows: [],
|
||||||
|
loadMore: true,
|
||||||
show_swatch: "{{ $attribute->type == 'select' ? true : false }}",
|
show_swatch: "{{ $attribute->type == 'select' ? true : false }}",
|
||||||
swatch_type: "{{ $attribute->swatch_type == '' ? 'dropdown' : $attribute->swatch_type }}",
|
swatch_type: "{{ $attribute->swatch_type == '' ? 'dropdown' : $attribute->swatch_type }}",
|
||||||
isNullOptionChecked: false,
|
isNullOptionChecked: false,
|
||||||
idNullOption: null
|
idNullOption: null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
isNullOptionChecked: function (val) {
|
||||||
|
if (val) {
|
||||||
|
if (! this.idNullOption) {
|
||||||
|
this.addOptionRow(true);
|
||||||
|
}
|
||||||
|
} else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
||||||
|
const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption);
|
||||||
|
this.removeRow(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
created: function () {
|
created: function () {
|
||||||
@foreach ($attribute->options as $option)
|
this.getAttributeOptions();
|
||||||
this.optionRowCount++;
|
|
||||||
|
|
||||||
var row = {
|
this.activateToggleSwatch();
|
||||||
'id': @json($option->id),
|
|
||||||
'admin_name': @json($option->admin_name),
|
|
||||||
'sort_order': @json($option->sort_order),
|
|
||||||
'swatch_value': @json($option->swatch_value),
|
|
||||||
'swatch_value_url': @json($option->swatch_value_url),
|
|
||||||
'notRequired': '',
|
|
||||||
'locales': {}
|
|
||||||
};
|
|
||||||
|
|
||||||
@if (empty($option->label))
|
|
||||||
this.isNullOptionChecked = true;
|
|
||||||
this.idNullOption = @json($option->id);
|
|
||||||
row['notRequired'] = true;
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
|
||||||
row['locales']['{{ $locale->code }}'] = @json($option->translate($locale->code)['label'] ?? '');
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
this.optionRows.push(row);
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
var this_this = this;
|
|
||||||
|
|
||||||
$('#type').on('change', function (e) {
|
|
||||||
if (['select'].indexOf($(e.target).val()) === -1) {
|
|
||||||
this_this.show_swatch = false;
|
|
||||||
} else {
|
|
||||||
this_this.show_swatch = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
activateToggleSwatch: function () {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
$('#type').on('change', function (e) {
|
||||||
|
if (['select'].indexOf($(e.target).val()) === -1) {
|
||||||
|
self.show_swatch = false;
|
||||||
|
} else {
|
||||||
|
self.show_swatch = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
getAttributeOptions: function () {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
axios.get(`${this.src}?page=${this.optionPage}`).then(function (response) {
|
||||||
|
let options = response.data.data;
|
||||||
|
|
||||||
|
if (response.data.current_page === response.data.last_page) {
|
||||||
|
self.loadMore = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
options.forEach((option) => {
|
||||||
|
self.optionRowCount++;
|
||||||
|
|
||||||
|
let row = {
|
||||||
|
'id': option.id,
|
||||||
|
'admin_name': option.admin_name,
|
||||||
|
'sort_order': option.sort_order,
|
||||||
|
'swatch_value': option.swatch_value,
|
||||||
|
'swatch_value_url': option.swatch_value_url,
|
||||||
|
'notRequired': '',
|
||||||
|
'locales': {},
|
||||||
|
'isNew': false,
|
||||||
|
'isDelete': false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (option.label) {
|
||||||
|
self.isNullOptionChecked = true;
|
||||||
|
self.idNullOption = option.id;
|
||||||
|
row['notRequired'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
option.translations.forEach((translation) => {
|
||||||
|
row['locales'][translation.locale] = translation.label ?? '';
|
||||||
|
});
|
||||||
|
|
||||||
|
self.optionRows.push(row);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
loadMoreOptions: function () {
|
||||||
|
this.optionPage++;
|
||||||
|
|
||||||
|
this.getAttributeOptions();
|
||||||
|
},
|
||||||
|
|
||||||
addOptionRow: function (isNullOptionRow) {
|
addOptionRow: function (isNullOptionRow) {
|
||||||
const rowCount = this.optionRowCount++;
|
const rowCount = this.optionRowCount++;
|
||||||
const id = 'option_' + rowCount;
|
const id = 'option_' + rowCount;
|
||||||
let row = {'id': id, 'locales': {}};
|
let row = {'id': id, 'locales': {}, 'isNew': true, 'isDelete': false};
|
||||||
|
|
||||||
@foreach (app('Webkul\Core\Repositories\LocaleRepository')->all() as $locale)
|
this.allLocales.forEach((locale) => {
|
||||||
row['locales']['{{ $locale->code }}'] = '';
|
row['locales'][locale.code] = '';
|
||||||
@endforeach
|
});
|
||||||
|
|
||||||
row['notRequired'] = '';
|
row['notRequired'] = '';
|
||||||
|
|
||||||
|
|
@ -491,8 +538,31 @@
|
||||||
this.isNullOptionChecked = false;
|
this.isNullOptionChecked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = this.optionRows.indexOf(row)
|
const index = this.optionRows.indexOf(row);
|
||||||
Vue.delete(this.optionRows, index);
|
|
||||||
|
if (this.optionRows[index].isNew) {
|
||||||
|
this.hardDeleteNewRow(index);
|
||||||
|
} else {
|
||||||
|
this.softDeleteExistingRow(index);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
hardDeleteNewRow: function (rowIndex) {
|
||||||
|
Vue.delete(this.optionRows, rowIndex);
|
||||||
|
},
|
||||||
|
|
||||||
|
softDeleteExistingRow: function (rowIndex) {
|
||||||
|
let self = this;
|
||||||
|
|
||||||
|
this.optionRows[rowIndex].isDelete = true;
|
||||||
|
|
||||||
|
let requiredKeys = ['admin_name', 'sort_order'];
|
||||||
|
|
||||||
|
requiredKeys.forEach((key) => {
|
||||||
|
if (self.optionRows[rowIndex][key] === undefined || self.optionRows[rowIndex][key] === '') {
|
||||||
|
self.optionRows[rowIndex][key] = '0';
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
adminName: function (row) {
|
adminName: function (row) {
|
||||||
|
|
@ -507,27 +577,14 @@
|
||||||
return 'options[' + row.id + '][sort_order]';
|
return 'options[' + row.id + '][sort_order]';
|
||||||
},
|
},
|
||||||
|
|
||||||
getOptionValidation: (row, localeCode) => {
|
getOptionValidation: function (row, localeCode) {
|
||||||
if (row.notRequired === true) {
|
if (row.notRequired === true) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ('{{ app()->getLocale() }}' === localeCode) ? 'required' : '';
|
return (this.appLocale === localeCode) ? 'required' : '';
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
|
||||||
isNullOptionChecked: function (val) {
|
|
||||||
if (val) {
|
|
||||||
if (! this.idNullOption) {
|
|
||||||
this.addOptionRow(true);
|
|
||||||
}
|
|
||||||
} else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') {
|
|
||||||
const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption);
|
|
||||||
this.removeRow(row);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,19 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Http\Controllers;
|
namespace Webkul\Attribute\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||||
|
|
||||||
class AttributeController extends Controller
|
class AttributeController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Contains route related configuration
|
* Contains route related configuration.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_config;
|
protected $_config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AttributeRepository object
|
* Attribute repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Attribute\Repositories\AttributeRepository
|
* @var \Webkul\Attribute\Repositories\AttributeRepository
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,7 +70,7 @@ class AttributeController extends Controller
|
||||||
|
|
||||||
$data['is_user_defined'] = 1;
|
$data['is_user_defined'] = 1;
|
||||||
|
|
||||||
$attribute = $this->attributeRepository->create($data);
|
$this->attributeRepository->create($data);
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
|
session()->flash('success', trans('admin::app.response.create-success', ['name' => 'Attribute']));
|
||||||
|
|
||||||
|
|
@ -91,6 +90,19 @@ class AttributeController extends Controller
|
||||||
return view($this->_config['view'], compact('attribute'));
|
return view($this->_config['view'], compact('attribute'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get attribute options associated with attribute.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function getAttributeOptions($id)
|
||||||
|
{
|
||||||
|
$attribute = $this->attributeRepository->findOrFail($id);
|
||||||
|
|
||||||
|
return $attribute->options()->paginate(50);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
|
|
@ -105,7 +117,7 @@ class AttributeController extends Controller
|
||||||
'type' => 'required',
|
'type' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$attribute = $this->attributeRepository->update(request()->all(), $id);
|
$this->attributeRepository->update(request()->all(), $id);
|
||||||
|
|
||||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
|
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
|
||||||
|
|
||||||
|
|
@ -131,7 +143,7 @@ class AttributeController extends Controller
|
||||||
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Attribute']));
|
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Attribute']));
|
||||||
|
|
||||||
return response()->json(['message' => true], 200);
|
return response()->json(['message' => true], 200);
|
||||||
} catch(\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Attribute']));
|
session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Attribute']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +152,7 @@ class AttributeController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resources from database
|
* Remove the specified resources from database.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,15 @@
|
||||||
|
|
||||||
namespace Webkul\Attribute\Repositories;
|
namespace Webkul\Attribute\Repositories;
|
||||||
|
|
||||||
use Webkul\Core\Eloquent\Repository;
|
use Illuminate\Container\Container as App;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||||
use Illuminate\Container\Container as App;
|
use Webkul\Core\Eloquent\Repository;
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
class AttributeRepository extends Repository
|
class AttributeRepository extends Repository
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* AttributeOptionRepository object
|
* Attribute option repository instance.
|
||||||
*
|
*
|
||||||
* @var \Webkul\Attribute\Repositories\AttributeOptionRepository
|
* @var \Webkul\Attribute\Repositories\AttributeOptionRepository
|
||||||
*/
|
*/
|
||||||
|
|
@ -26,24 +25,25 @@ class AttributeRepository extends Repository
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AttributeOptionRepository $attributeOptionRepository,
|
AttributeOptionRepository $attributeOptionRepository,
|
||||||
App $app
|
App $app
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
$this->attributeOptionRepository = $attributeOptionRepository;
|
$this->attributeOptionRepository = $attributeOptionRepository;
|
||||||
|
|
||||||
parent::__construct($app);
|
parent::__construct($app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify Model class name
|
* Specify model class name.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function model()
|
public function model()
|
||||||
{
|
{
|
||||||
return 'Webkul\Attribute\Contracts\Attribute';
|
return 'Webkul\Attribute\Contracts\Attribute';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create attribute.
|
||||||
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return \Webkul\Attribute\Contracts\Attribute
|
* @return \Webkul\Attribute\Contracts\Attribute
|
||||||
*/
|
*/
|
||||||
|
|
@ -73,6 +73,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Update attribute.
|
||||||
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
|
|
@ -88,36 +90,36 @@ class AttributeRepository extends Repository
|
||||||
|
|
||||||
$attribute->update($data);
|
$attribute->update($data);
|
||||||
|
|
||||||
$previousOptionIds = $attribute->options()->pluck('id');
|
|
||||||
|
|
||||||
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
|
if (in_array($attribute->type, ['select', 'multiselect', 'checkbox'])) {
|
||||||
if (isset($data['options'])) {
|
if (isset($data['options'])) {
|
||||||
foreach ($data['options'] as $optionId => $optionInputs) {
|
foreach ($data['options'] as $optionId => $optionInputs) {
|
||||||
if (Str::contains($optionId, 'option_')) {
|
$isNew = $optionInputs['isNew'] == 'true' ? true : false;
|
||||||
|
|
||||||
|
if ($isNew) {
|
||||||
$this->attributeOptionRepository->create(array_merge([
|
$this->attributeOptionRepository->create(array_merge([
|
||||||
'attribute_id' => $attribute->id,
|
'attribute_id' => $attribute->id,
|
||||||
], $optionInputs));
|
], $optionInputs));
|
||||||
} else {
|
} else {
|
||||||
if (is_numeric($index = $previousOptionIds->search($optionId))) {
|
$isDelete = $optionInputs['isDelete'] == 'true' ? true : false;
|
||||||
$previousOptionIds->forget($index);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->attributeOptionRepository->update($optionInputs, $optionId);
|
if ($isDelete) {
|
||||||
|
$this->attributeOptionRepository->delete($optionId);
|
||||||
|
} else {
|
||||||
|
$this->attributeOptionRepository->update($optionInputs, $optionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($previousOptionIds as $optionId) {
|
|
||||||
$this->attributeOptionRepository->delete($optionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
Event::dispatch('catalog.attribute.update.after', $attribute);
|
Event::dispatch('catalog.attribute.update.after', $attribute);
|
||||||
|
|
||||||
return $attribute;
|
return $attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Delete attribute.
|
||||||
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
@ -131,6 +133,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Validate user input.
|
||||||
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -152,6 +156,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get filter attributes.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getFilterAttributes()
|
public function getFilterAttributes()
|
||||||
|
|
@ -160,7 +166,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get product default attributes.
|
||||||
|
*
|
||||||
* @param array $codes
|
* @param array $codes
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -189,6 +196,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get attribute by code.
|
||||||
|
*
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @return \Webkul\Attribute\Contracts\Attribute
|
* @return \Webkul\Attribute\Contracts\Attribute
|
||||||
*/
|
*/
|
||||||
|
|
@ -204,6 +213,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get family attributes.
|
||||||
|
*
|
||||||
* @param \Webkul\Attribute\Contracts\AttributeFamily $attributeFamily
|
* @param \Webkul\Attribute\Contracts\AttributeFamily $attributeFamily
|
||||||
* @return \Webkul\Attribute\Contracts\Attribute
|
* @return \Webkul\Attribute\Contracts\Attribute
|
||||||
*/
|
*/
|
||||||
|
|
@ -219,6 +230,8 @@ class AttributeRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get partials.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getPartial()
|
public function getPartial()
|
||||||
|
|
@ -227,13 +240,13 @@ class AttributeRepository extends Repository
|
||||||
|
|
||||||
$trimmed = [];
|
$trimmed = [];
|
||||||
|
|
||||||
foreach($attributes as $key => $attribute) {
|
foreach ($attributes as $key => $attribute) {
|
||||||
if ($attribute->code != 'tax_category_id'
|
if (
|
||||||
&& (
|
$attribute->code != 'tax_category_id'
|
||||||
$attribute->type == 'select'
|
&& ($attribute->type == 'select'
|
||||||
|| $attribute->type == 'multiselect'
|
|| $attribute->type == 'multiselect'
|
||||||
|| $attribute->code == 'sku'
|
|| $attribute->code == 'sku')
|
||||||
)) {
|
) {
|
||||||
if ($attribute->options()->exists()) {
|
if ($attribute->options()->exists()) {
|
||||||
array_push($trimmed, [
|
array_push($trimmed, [
|
||||||
'id' => $attribute->id,
|
'id' => $attribute->id,
|
||||||
|
|
@ -253,10 +266,9 @@ class AttributeRepository extends Repository
|
||||||
'options' => null,
|
'options' => null,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trimmed;
|
return $trimmed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ class SecureHeaders
|
||||||
*/
|
*/
|
||||||
private function removeUnwantedHeaders()
|
private function removeUnwantedHeaders()
|
||||||
{
|
{
|
||||||
|
if (headers_sent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->unwantedHeaderList as $header) {
|
foreach ($this->unwantedHeaderList as $header) {
|
||||||
header_remove($header);
|
header_remove($header);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,12 @@ use Webkul\Attribute\Models\Attribute;
|
||||||
|
|
||||||
class AttributeCest
|
class AttributeCest
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Test attribute index page.
|
||||||
|
*
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function testIndex(FunctionalTester $I): void
|
public function testIndex(FunctionalTester $I): void
|
||||||
{
|
{
|
||||||
$attribute = $I->have(Attribute::class);
|
$attribute = $I->have(Attribute::class);
|
||||||
|
|
@ -21,6 +27,12 @@ class AttributeCest
|
||||||
$I->see($attribute->admin_name, '//script[@type="text/x-template"]');
|
$I->see($attribute->admin_name, '//script[@type="text/x-template"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute creation test.
|
||||||
|
*
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function testCreate(FunctionalTester $I): void
|
public function testCreate(FunctionalTester $I): void
|
||||||
{
|
{
|
||||||
$I->loginAsAdmin();
|
$I->loginAsAdmin();
|
||||||
|
|
@ -40,6 +52,12 @@ class AttributeCest
|
||||||
$I->seeRecord(Attribute::class, $testData);
|
$I->seeRecord(Attribute::class, $testData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute updation test.
|
||||||
|
*
|
||||||
|
* @param FunctionalTester $I
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function testEdit(FunctionalTester $I): void
|
public function testEdit(FunctionalTester $I): void
|
||||||
{
|
{
|
||||||
$attribute = $I->have(Attribute::class, ['use_in_flat' => 0]);
|
$attribute = $I->have(Attribute::class, ['use_in_flat' => 0]);
|
||||||
|
|
@ -66,11 +84,11 @@ class AttributeCest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param FunctionalTester $I
|
* Fill form.
|
||||||
*
|
*
|
||||||
* @param bool $skipType
|
* @param FunctionalTester $I
|
||||||
*
|
* @param bool $skipType
|
||||||
* @return array with the test-data
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function fillForm(FunctionalTester $I, bool $skipType = false): array
|
private function fillForm(FunctionalTester $I, bool $skipType = false): array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue