Fallback From Config Added

This commit is contained in:
devansh bawari 2021-02-11 20:16:14 +05:30
parent 70af72965d
commit 9f7555244f
13 changed files with 28 additions and 16 deletions

View File

@ -125,7 +125,7 @@
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.before') !!}
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)'></tree-view>
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.after') !!}

View File

@ -137,7 +137,7 @@
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)'></tree-view>
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}

View File

@ -7,7 +7,7 @@
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.before', ['product' => $product]) !!}
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))'></tree-view>
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.after', ['product' => $product]) !!}

View File

@ -306,7 +306,7 @@
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
<div v-if="matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|parent::category_ids'">
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'"></tree-view>
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
<div v-else>

View File

@ -343,7 +343,7 @@
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
<div v-if="matchedAttribute.key == 'product|children::category_ids' || matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|parent::category_ids'">
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'"></tree-view>
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
<div v-else>

View File

@ -230,7 +230,7 @@
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
<div v-if="matchedAttribute.key == 'product|category_ids'">
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'"></tree-view>
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
<div v-else>

View File

@ -239,7 +239,7 @@
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
<div v-if="matchedAttribute.key == 'product|category_ids'">
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'"></tree-view>
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
<div v-else>

View File

@ -54,7 +54,7 @@
</div>
<div class="control-group">
<tree-view value-field="key" id-field="key" items='@json($acl->items)'></tree-view>
<tree-view value-field="key" id-field="key" items='@json($acl->items)' :fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
</div>
</accordian>

View File

@ -56,7 +56,7 @@
</div>
<div class="control-group tree-wrapper {{ $role->permission_type == 'all' ? 'hide' : '' }}">
<tree-view value-field="key" id-field="key" items='@json($acl->items)' value='@json($role->permissions)'></tree-view>
<tree-view value-field="key" id-field="key" items='@json($acl->items)' value='@json($role->permissions)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
</div>
</div>
</accordian>

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/ui.js": "/js/ui.js?id=9458c38dbb791f9c092b",
"/js/ui.js": "/js/ui.js?id=8eae585f880f44e9aa39",
"/css/ui.css": "/css/ui.css?id=72e23fc21cf1623e7aff"
}

View File

@ -39,7 +39,12 @@
type: Array,
required: false,
default: null
}
},
fallbackLocale: {
type: String,
required: false
},
},
created () {
@ -62,7 +67,7 @@
caption () {
return this.items[this.captionField]
? this.items[this.captionField]
: this.items.translations.filter((translation) => translation.locale === 'en')[0][this.captionField];
: this.items.translations.filter((translation) => translation.locale === this.fallbackLocale)[0][this.captionField];
},
allChildren () {
@ -202,7 +207,8 @@
childrenField: this.childrenField,
valueField: this.valueField,
idField: this.idField,
behavior: this.behavior
behavior: this.behavior,
fallbackLocale: this.fallbackLocale
}
})
},

View File

@ -57,7 +57,12 @@
type: [Array, String, Object],
required: false,
default: () => ([])
}
},
fallbackLocale: {
type: String,
required: false
},
},
data() {
@ -104,7 +109,8 @@
childrenField: this.childrenField,
valueField: this.valueField,
idField: this.idField,
behavior: this.behavior
behavior: this.behavior,
fallbackLocale: this.fallbackLocale
},
on: {
input: selection => {