restore composer.json, add mysqli extension
This commit is contained in:
306
resources/js/components/Dashboard/Category/Index.vue
Executable file
306
resources/js/components/Dashboard/Category/Index.vue
Executable file
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div
|
||||
class="card"
|
||||
style="
|
||||
border-radius: 0;
|
||||
box-shadow: 0 -1px 4px 0 rgb(0 0 0 / 15%);
|
||||
"
|
||||
>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="">Категория</label>
|
||||
<select
|
||||
v-model="category"
|
||||
@change="handleMainCategory"
|
||||
class="form-control"
|
||||
>
|
||||
<option :value="null">---</option>
|
||||
<option
|
||||
v-for="category in mainCategories"
|
||||
:value="category"
|
||||
>
|
||||
{{ category.category }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="">Подкатегория</label>
|
||||
<select
|
||||
v-model="subCategory"
|
||||
@change="handleSubCategory"
|
||||
class="form-control"
|
||||
>
|
||||
<option :value="null">---</option>
|
||||
<option
|
||||
v-for="category in subCategories"
|
||||
:value="category"
|
||||
>
|
||||
{{ category.category }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Tree
|
||||
:data="categories"
|
||||
@change="Change"
|
||||
draggable="draggable"
|
||||
cross-tree="cross-tree"
|
||||
>
|
||||
<div slot-scope="{ data, store }">
|
||||
<template v-if="!data.isDragPlaceHolder">
|
||||
<div class="d-flex justify-content-start">
|
||||
<b
|
||||
v-if="data.children && data.children.length"
|
||||
@click="store.toggleOpen(data)"
|
||||
>
|
||||
<i
|
||||
:class="
|
||||
data.open
|
||||
? 'fa fa-minus-square'
|
||||
: 'fa fa-plus-square'
|
||||
"
|
||||
></i>
|
||||
|
||||
</b>
|
||||
<span>
|
||||
<b>ID: {{ data.id }} </b>
|
||||
{{ data.category }}
|
||||
</span>
|
||||
|
||||
<div class="ml-auto">
|
||||
<a
|
||||
:href="
|
||||
'/dashboard/categories/update/' +
|
||||
data.id
|
||||
"
|
||||
class="btn-primary btn btn-icon btn-sm"
|
||||
>
|
||||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
|
||||
<a
|
||||
:href="
|
||||
'/dashboard/categories/delete/' +
|
||||
data.id
|
||||
"
|
||||
onclick="return confirm('Вы действително хотите удалить')"
|
||||
class="btn-danger btn btn-icon btn-sm"
|
||||
>
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</Tree>
|
||||
<div class="mt-2 mb-3">
|
||||
<button class="btn btn-primary" @click="SendForm">
|
||||
<i class="fa fa-save"></i> Сохранить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { DraggableTree } from "vue-draggable-nested-tree";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
categoriesData: {},
|
||||
},
|
||||
|
||||
components: {
|
||||
Tree: DraggableTree,
|
||||
},
|
||||
|
||||
mounted() {
|
||||
console.log(this.categoriesData);
|
||||
this.Change();
|
||||
},
|
||||
|
||||
data() {
|
||||
console.log(this.categoriesData);
|
||||
return {
|
||||
categories: this.categoriesData,
|
||||
mainCategories: this.categoriesData,
|
||||
subCategories: [],
|
||||
category: null,
|
||||
subCategory: null,
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
async SendForm() {
|
||||
const formData = new FormData();
|
||||
for (var i = 0; i < this.categories.length; i++) {
|
||||
formData.append(
|
||||
"categories[" + i + "][id]",
|
||||
this.categories[i].id
|
||||
);
|
||||
formData.append(
|
||||
"categories[" + i + "][position]",
|
||||
this.categories[i].position
|
||||
);
|
||||
formData.append(
|
||||
"categories[" + i + "][parent_id]",
|
||||
this.categories[i].parent_id
|
||||
);
|
||||
if (this.categories[i].children.length > 0) {
|
||||
for (
|
||||
var c = 0;
|
||||
c < this.categories[i].children.length;
|
||||
c++
|
||||
) {
|
||||
formData.append(
|
||||
"categories[" + i + "][children][" + c + "][id]",
|
||||
this.categories[i].children[c].id
|
||||
);
|
||||
formData.append(
|
||||
"categories[" +
|
||||
i +
|
||||
"][children][" +
|
||||
c +
|
||||
"][position]",
|
||||
this.categories[i].children[c].position
|
||||
);
|
||||
formData.append(
|
||||
"categories[" +
|
||||
i +
|
||||
"][children][" +
|
||||
c +
|
||||
"][parent_id]",
|
||||
this.categories[i].children[c].parent_id
|
||||
);
|
||||
if (
|
||||
this.categories[i].children[c].children.length > 0
|
||||
) {
|
||||
for (
|
||||
var w = 0;
|
||||
w <
|
||||
this.categories[i].children[c].children.length;
|
||||
w++
|
||||
) {
|
||||
formData.append(
|
||||
"categories[" +
|
||||
i +
|
||||
"][children][" +
|
||||
c +
|
||||
"][children][" +
|
||||
w +
|
||||
"][id]",
|
||||
this.categories[i].children[c].children[w]
|
||||
.id
|
||||
);
|
||||
formData.append(
|
||||
"categories[" +
|
||||
i +
|
||||
"][children][" +
|
||||
c +
|
||||
"][children][" +
|
||||
w +
|
||||
"][position]",
|
||||
this.categories[i].children[c].children[w]
|
||||
.position
|
||||
);
|
||||
formData.append(
|
||||
"categories[" +
|
||||
i +
|
||||
"][children][" +
|
||||
c +
|
||||
"][children][" +
|
||||
w +
|
||||
"][parent_id]",
|
||||
this.categories[i].children[c].children[w]
|
||||
.parent_id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { data } = await axios.post(
|
||||
"/dashboard/categories/position",
|
||||
formData
|
||||
);
|
||||
|
||||
if (data.status) {
|
||||
// window.location.href = "/dashboard/categories";
|
||||
}
|
||||
},
|
||||
|
||||
Change() {
|
||||
for (var i = 0; i < this.categories.length; i++) {
|
||||
var num = i + 1;
|
||||
|
||||
this.categories[i].position = num;
|
||||
this.categories[i].droppable = true;
|
||||
|
||||
if (this.categories[i].children.length > 0) {
|
||||
for (
|
||||
var c = 0;
|
||||
c < this.categories[i].children.length;
|
||||
c++
|
||||
) {
|
||||
var numm = c + 1;
|
||||
this.categories[i].children[c].position = numm;
|
||||
this.categories[i].children[c].parent_id =
|
||||
this.categories[i].id;
|
||||
this.categories[i].children[c].droppable = true;
|
||||
|
||||
if (
|
||||
this.categories[i].children[c].children.length > 0
|
||||
) {
|
||||
for (
|
||||
var w = 0;
|
||||
w <
|
||||
this.categories[i].children[c].children.length;
|
||||
w++
|
||||
) {
|
||||
var nummm = w + 1;
|
||||
|
||||
this.categories[i].children[c].children[
|
||||
w
|
||||
].position = nummm;
|
||||
this.categories[i].children[c].children[
|
||||
w
|
||||
].parent_id = this.categories[i].children[c].id;
|
||||
this.categories[i].children[c].children[
|
||||
w
|
||||
].droppable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleMainCategory() {
|
||||
if (this.category) {
|
||||
this.categories = this.category.children;
|
||||
this.subCategories = this.category.children;
|
||||
} else {
|
||||
this.categories = this.categoriesData;
|
||||
this.subCategories = null;
|
||||
}
|
||||
},
|
||||
|
||||
handleSubCategory() {
|
||||
if (this.subCategory) this.categories = this.subCategory.children;
|
||||
else this.categories = this.category.children;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
821
resources/js/components/Dashboard/Category/Store.vue
Executable file
821
resources/js/components/Dashboard/Category/Store.vue
Executable file
@@ -0,0 +1,821 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<form
|
||||
class="form form-vertical w-100"
|
||||
@submit.prevent="saveForm"
|
||||
action="#"
|
||||
enctype="multipart/form-data"
|
||||
method="post"
|
||||
>
|
||||
<div class="col-md-12 col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{{ $t("admin.add") }}</h4>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="form-body">
|
||||
<p>{{ $t("admin.all_fields_with") }}</p>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label
|
||||
for="first-name-vertical"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.name"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="first-name-vertical"
|
||||
v-model="
|
||||
category.name.uz
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' UZ'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="nameru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.name"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="nameru"
|
||||
required
|
||||
v-model="
|
||||
category.name.ru
|
||||
"
|
||||
class="form-control"
|
||||
name="name[ru]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' RU'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="form-group">
|
||||
<label for="position"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.position"
|
||||
)
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="position"
|
||||
required
|
||||
class="form-control"
|
||||
v-model="category.position"
|
||||
name="position"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.position'
|
||||
)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-file">
|
||||
<input
|
||||
id="uploadImage"
|
||||
class="custom-file-input"
|
||||
type="file"
|
||||
name="image"
|
||||
@change="ImageFile($event)"
|
||||
onchange="PreviewImage();"
|
||||
/>
|
||||
<label
|
||||
class="custom-file-label"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.image"
|
||||
)
|
||||
}}</label
|
||||
>
|
||||
</div>
|
||||
<br />
|
||||
<div class="text-center">
|
||||
<img
|
||||
id="uploadPreview"
|
||||
style="
|
||||
width: 300px;
|
||||
height: auto;
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label
|
||||
>{{
|
||||
$t("admin.brands.title")
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
|
||||
<multiselect
|
||||
:options="brandsData"
|
||||
v-model="category.brands"
|
||||
:multiple="true"
|
||||
:taggable="true"
|
||||
label="name"
|
||||
track-by="name"
|
||||
></multiselect>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<h3>Характеристики</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div
|
||||
class="col-12"
|
||||
v-for="(char, index) in char"
|
||||
:key="index"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'first-name-vertical-uz' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.name"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:id="
|
||||
'first-name-vertical-uz' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.name.uz
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' UZ'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'first-name-vertical-ru' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.name"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:id="
|
||||
'first-name-vertical-ru' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.name.ru
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' RU'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'type' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.type"
|
||||
)
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
<select
|
||||
class="form-control"
|
||||
:id="
|
||||
'type' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.type
|
||||
"
|
||||
>
|
||||
<option
|
||||
value="text"
|
||||
>
|
||||
Text
|
||||
</option>
|
||||
<option
|
||||
value="number"
|
||||
>
|
||||
Number
|
||||
</option>
|
||||
<option
|
||||
value="checkbox"
|
||||
>
|
||||
checkbox
|
||||
</option>
|
||||
<option
|
||||
value="select"
|
||||
>
|
||||
select
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<fieldset>
|
||||
<label
|
||||
>Фильтр</label
|
||||
>
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="
|
||||
char.filter
|
||||
"
|
||||
/>
|
||||
<span
|
||||
class="vs-checkbox"
|
||||
>
|
||||
<span
|
||||
class="vs-checkbox--check"
|
||||
>
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<button
|
||||
@click="
|
||||
removeChar(
|
||||
index
|
||||
)
|
||||
"
|
||||
class="btn btn-danger mt-2"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
class="fa fa-trash"
|
||||
></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-warning"
|
||||
@click="addChar"
|
||||
>
|
||||
<i class="fa fa-plus"></i> Добавить
|
||||
характеристики
|
||||
</button>
|
||||
|
||||
<div class="controls mt-1">
|
||||
<button
|
||||
id="add_cat"
|
||||
type="button"
|
||||
class="btn btn-outline-primary w-100"
|
||||
>
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.add_cat"
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
<button
|
||||
id="remove_cat"
|
||||
type="button"
|
||||
class="btn btn-secondary w-100"
|
||||
>
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.remove_cat"
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<div id="sub_cat" class="controls">
|
||||
<label>{{
|
||||
$t(
|
||||
"admin.categories.sub_category"
|
||||
)
|
||||
}}</label>
|
||||
<select
|
||||
class="form-control"
|
||||
v-model="category.parent_id"
|
||||
>
|
||||
<option value="0">
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.choose_cat"
|
||||
)
|
||||
}}
|
||||
</option>
|
||||
|
||||
<option
|
||||
v-for="(
|
||||
category, index
|
||||
) in categoriesData"
|
||||
:key="index"
|
||||
:value="category.id"
|
||||
>
|
||||
{{
|
||||
getName(
|
||||
category.name
|
||||
)
|
||||
}}
|
||||
<span
|
||||
v-if="
|
||||
category.parent
|
||||
"
|
||||
>
|
||||
(
|
||||
{{
|
||||
getName(
|
||||
category
|
||||
.parent
|
||||
.name
|
||||
)
|
||||
}}
|
||||
)
|
||||
</span>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">SEO</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="nameru"
|
||||
>Title Seo RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
v-model="category.title_seo.ru"
|
||||
id="nameru"
|
||||
class="form-control"
|
||||
placeholder="Title Seo RU *"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="name">Title Seo UZ *</label>
|
||||
<input
|
||||
type="text"
|
||||
v-model="category.title_seo.uz"
|
||||
id="name"
|
||||
class="form-control"
|
||||
placeholder="Title Seo UZ *"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.keywords.ru
|
||||
"
|
||||
id="label-keywords-ru"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.keywords'
|
||||
) + ' RU'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-keywords-ru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.keywords"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.keywords.uz
|
||||
"
|
||||
id="label-keywords"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.keywords'
|
||||
) + ' UZ'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-keywords"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.keywords"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.descriptions.ru
|
||||
"
|
||||
id="label-description-ru"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.description'
|
||||
) + ' RU'
|
||||
"
|
||||
></textarea>
|
||||
<label
|
||||
for="label-description-ru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.description"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.descriptions.uz
|
||||
"
|
||||
id="label-description"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.description'
|
||||
) + ' UZ'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-description"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.description"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if="error">
|
||||
<div class="alert alert-danger mt-2">
|
||||
<ul>
|
||||
<li v-for="(error, index) in errors" :key="index">
|
||||
<span v-for="msg in error" :key="msg">
|
||||
{{ msg }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="form-group mt-1">
|
||||
<fieldset class="checkbox">
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
name="popular"
|
||||
v-model="category.published"
|
||||
/>
|
||||
<span class="vs-checkbox">
|
||||
<span class="vs-checkbox--check">
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class=""> Опубликовать </span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="checkbox">
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
name="is_filter_power"
|
||||
v-model="category.is_filter_power"
|
||||
/>
|
||||
<span class="vs-checkbox">
|
||||
<span class="vs-checkbox--check">
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="">
|
||||
Сортировать по kW
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer pb-0 pl-0 pt-1">
|
||||
<div class="col-12 mb-0">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary mr-1 mb-1 waves-effect waves-light btn-icon"
|
||||
>
|
||||
<i class="feather icon-save"></i>
|
||||
{{ $t("admin.save") }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-9">
|
||||
<a
|
||||
href="/dashboard/categories"
|
||||
class="btn btn-danger mr-1 mb-1 waves-effect waves-light btn-icon pull-right"
|
||||
>
|
||||
<i
|
||||
class="feather icon-x-circle"
|
||||
></i>
|
||||
{{ $t("admin.cancel") }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ["brandsData", "categoriesData"],
|
||||
|
||||
data() {
|
||||
return {
|
||||
category: {
|
||||
name: {
|
||||
uz: "",
|
||||
ru: "",
|
||||
},
|
||||
|
||||
published: true,
|
||||
position: 0,
|
||||
brands: [],
|
||||
is_filter_power: false,
|
||||
|
||||
parent_id: 0,
|
||||
|
||||
descriptions: {
|
||||
uz: "",
|
||||
ru: "",
|
||||
},
|
||||
|
||||
keywords: {
|
||||
uz: "",
|
||||
ru: "",
|
||||
},
|
||||
|
||||
title_seo: {
|
||||
uz: "",
|
||||
ru: "",
|
||||
},
|
||||
|
||||
image: null,
|
||||
},
|
||||
|
||||
char: [],
|
||||
|
||||
error: false,
|
||||
errors: [],
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
getName(name) {
|
||||
const lang = document.documentElement.lang.substr(0, 2);
|
||||
let value = "";
|
||||
|
||||
if (lang) {
|
||||
switch (lang) {
|
||||
case "ru":
|
||||
value = name.ru;
|
||||
break;
|
||||
case "uz":
|
||||
value = name.uz;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
value = name.ru;
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
async saveForm() {
|
||||
const header = {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
};
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("name[ru]", this.category.name.ru);
|
||||
formData.append("name[uz]", this.category.name.uz);
|
||||
|
||||
formData.append("position", this.category.position);
|
||||
formData.append("parent_id", this.category.parent_id);
|
||||
if (this.category.image)
|
||||
formData.append("image", this.category.image);
|
||||
formData.append("published", this.category.published);
|
||||
formData.append("is_filter_power", this.category.is_filter_power);
|
||||
formData.append("descriptions[ru]", this.category.descriptions.ru);
|
||||
formData.append("descriptions[uz]", this.category.descriptions.uz);
|
||||
formData.append("keywords[ru]", this.category.keywords.ru);
|
||||
formData.append("keywords[uz]", this.category.keywords.uz);
|
||||
formData.append("title_seo[ru]", this.category.title_seo.ru);
|
||||
formData.append("title_seo[uz]", this.category.title_seo.uz);
|
||||
|
||||
for (var i = 0; i < this.category.brands.length; i++) {
|
||||
formData.append(
|
||||
"brands[" + i + "]",
|
||||
this.category.brands[i].id
|
||||
);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.char.length; i++) {
|
||||
formData.append(
|
||||
"char[" + i + "][name][ru]",
|
||||
this.char[i].name.ru
|
||||
);
|
||||
formData.append(
|
||||
"char[" + i + "][name][uz]",
|
||||
this.char[i].name.uz
|
||||
);
|
||||
formData.append("char[" + i + "][type]", this.char[i].type);
|
||||
formData.append("char[" + i + "][filter]", this.char[i].filter);
|
||||
}
|
||||
|
||||
axios
|
||||
.post("/dashboard/categories/store", formData, header)
|
||||
.then((response) => {
|
||||
if (response.data.status) {
|
||||
window.location.href = "/dashboard/categories";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response) {
|
||||
this.error = true;
|
||||
this.errors = error.response.data.errors;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
ImageFile(event) {
|
||||
this.category.image = event.target.files[0];
|
||||
},
|
||||
|
||||
addChar() {
|
||||
this.char.push({
|
||||
name: {
|
||||
ru: "",
|
||||
uz: "",
|
||||
},
|
||||
type: "text",
|
||||
filter: false,
|
||||
});
|
||||
},
|
||||
|
||||
removeChar(index) {
|
||||
this.char.splice(index, 1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
|
||||
<style scoped></style>
|
||||
836
resources/js/components/Dashboard/Category/Update.vue
Executable file
836
resources/js/components/Dashboard/Category/Update.vue
Executable file
@@ -0,0 +1,836 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<form
|
||||
class="form form-vertical w-100"
|
||||
@submit.prevent="saveForm"
|
||||
action="#"
|
||||
enctype="multipart/form-data"
|
||||
method="post"
|
||||
>
|
||||
<div class="col-md-12 col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{{ $t("admin.edit") }}</h4>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="form-body">
|
||||
<p>{{ $t("admin.all_fields_with") }}</p>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label
|
||||
for="first-name-vertical"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.name"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="first-name-vertical"
|
||||
v-model="
|
||||
category.name.uz
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' UZ'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="nameru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.name"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="nameru"
|
||||
required
|
||||
v-model="
|
||||
category.name.ru
|
||||
"
|
||||
class="form-control"
|
||||
name="name[ru]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' RU'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="form-group">
|
||||
<label for="position"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.position"
|
||||
)
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
id="position"
|
||||
required
|
||||
class="form-control"
|
||||
v-model="category.position"
|
||||
name="position"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.position'
|
||||
)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-file">
|
||||
<input
|
||||
id="uploadImage"
|
||||
class="custom-file-input"
|
||||
type="file"
|
||||
name="image"
|
||||
@change="ImageFile($event)"
|
||||
onchange="PreviewImage();"
|
||||
/>
|
||||
<label
|
||||
class="custom-file-label"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.image"
|
||||
)
|
||||
}}</label
|
||||
>
|
||||
</div>
|
||||
<br />
|
||||
<div class="text-center">
|
||||
<img
|
||||
id="uploadPreview"
|
||||
style="
|
||||
width: 300px;
|
||||
height: auto;
|
||||
"
|
||||
:src="category.image"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label
|
||||
>{{
|
||||
$t("admin.brands.title")
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
|
||||
<multiselect
|
||||
:options="brandsData"
|
||||
v-model="category.brands"
|
||||
:multiple="true"
|
||||
:taggable="true"
|
||||
label="name"
|
||||
track-by="name"
|
||||
></multiselect>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<h3>Характеристики</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div
|
||||
class="col-12"
|
||||
v-for="(
|
||||
char, index
|
||||
) in category.characteristics"
|
||||
:key="index"
|
||||
>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'first-name-vertical-uz' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.name"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:id="
|
||||
'first-name-vertical-uz' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.name.uz
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' UZ'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'first-name-vertical-ru' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.name"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
:id="
|
||||
'first-name-vertical-ru' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.name.ru
|
||||
"
|
||||
required
|
||||
class="form-control"
|
||||
name="name[uz]"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.categories.name'
|
||||
) + ' RU'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<div class="form-group">
|
||||
<label
|
||||
:for="
|
||||
'type' +
|
||||
index
|
||||
"
|
||||
>{{
|
||||
$t(
|
||||
"admin.categories.char.type"
|
||||
)
|
||||
}}
|
||||
*</label
|
||||
>
|
||||
<select
|
||||
class="form-control"
|
||||
:id="
|
||||
'type' +
|
||||
index
|
||||
"
|
||||
v-model="
|
||||
char.type
|
||||
"
|
||||
>
|
||||
<option
|
||||
value="text"
|
||||
>
|
||||
Text
|
||||
</option>
|
||||
<option
|
||||
value="number"
|
||||
>
|
||||
Number
|
||||
</option>
|
||||
<option
|
||||
value="checkbox"
|
||||
>
|
||||
checkbox
|
||||
</option>
|
||||
<option
|
||||
value="select"
|
||||
>
|
||||
select
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<fieldset>
|
||||
<label
|
||||
>Фильтр</label
|
||||
>
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="
|
||||
char.filter
|
||||
"
|
||||
/>
|
||||
<span
|
||||
class="vs-checkbox"
|
||||
>
|
||||
<span
|
||||
class="vs-checkbox--check"
|
||||
>
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<button
|
||||
@click="
|
||||
removeChar(
|
||||
index,
|
||||
char
|
||||
)
|
||||
"
|
||||
class="btn btn-danger mt-2"
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
class="fa fa-trash"
|
||||
></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-warning"
|
||||
@click="addChar"
|
||||
>
|
||||
<i class="fa fa-plus"></i> Добавить
|
||||
характеристики
|
||||
</button>
|
||||
|
||||
<div class="controls mt-1">
|
||||
<button
|
||||
id="add_cat"
|
||||
type="button"
|
||||
class="btn btn-outline-primary w-100"
|
||||
>
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.add_cat"
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
<button
|
||||
id="remove_cat"
|
||||
type="button"
|
||||
class="btn btn-secondary w-100"
|
||||
>
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.remove_cat"
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<div id="sub_cat" class="controls">
|
||||
<label>{{
|
||||
$t(
|
||||
"admin.categories.sub_category"
|
||||
)
|
||||
}}</label>
|
||||
<select
|
||||
class="form-control"
|
||||
v-model="category.parent_id"
|
||||
>
|
||||
<option value="0">
|
||||
{{
|
||||
$t(
|
||||
"admin.categories.choose_cat"
|
||||
)
|
||||
}}
|
||||
</option>
|
||||
|
||||
<option
|
||||
v-for="(
|
||||
category, index
|
||||
) in categoriesData"
|
||||
:key="index"
|
||||
:value="category.id"
|
||||
>
|
||||
{{
|
||||
getName(
|
||||
category.name
|
||||
)
|
||||
}}
|
||||
<span
|
||||
v-if="
|
||||
category.parent
|
||||
"
|
||||
>
|
||||
(
|
||||
{{
|
||||
getName(
|
||||
category
|
||||
.parent
|
||||
.name
|
||||
)
|
||||
}}
|
||||
)
|
||||
</span>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12" v-if="error">
|
||||
<div class="alert alert-danger mt-2">
|
||||
<ul>
|
||||
<li
|
||||
v-for="(
|
||||
error, index
|
||||
) in errors"
|
||||
:key="index"
|
||||
>
|
||||
<span
|
||||
v-for="msg in error"
|
||||
:key="msg"
|
||||
>
|
||||
{{ msg }}
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">SEO</h4>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="nameru"
|
||||
>Title Seo RU *</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
v-model="category.title_seo.ru"
|
||||
id="nameru"
|
||||
class="form-control"
|
||||
placeholder="Title Seo RU *"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<div class="form-group">
|
||||
<label for="name">Title Seo UZ *</label>
|
||||
<input
|
||||
type="text"
|
||||
v-model="category.title_seo.uz"
|
||||
id="name"
|
||||
class="form-control"
|
||||
placeholder="Title Seo UZ *"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.keywords.ru
|
||||
"
|
||||
id="label-keywords-ru"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.keywords'
|
||||
) + ' RU'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-keywords-ru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.keywords"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.keywords.uz
|
||||
"
|
||||
id="label-keywords"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.keywords'
|
||||
) + ' UZ'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-keywords"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.keywords"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.descriptions.ru
|
||||
"
|
||||
id="label-description-ru"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.description'
|
||||
) + ' RU'
|
||||
"
|
||||
></textarea>
|
||||
<label
|
||||
for="label-description-ru"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.description"
|
||||
)
|
||||
}}
|
||||
RU *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 float-left">
|
||||
<fieldset class="form-label-group">
|
||||
<textarea
|
||||
class="form-control"
|
||||
v-model="
|
||||
category.descriptions.uz
|
||||
"
|
||||
id="label-description"
|
||||
rows="3"
|
||||
:placeholder="
|
||||
$t(
|
||||
'admin.settings.description'
|
||||
) + ' UZ'
|
||||
"
|
||||
></textarea>
|
||||
<label for="label-description"
|
||||
>{{
|
||||
$t(
|
||||
"admin.settings.description"
|
||||
)
|
||||
}}
|
||||
UZ *</label
|
||||
>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<fieldset class="checkbox">
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
name="popular"
|
||||
v-model="category.published"
|
||||
/>
|
||||
<span class="vs-checkbox">
|
||||
<span class="vs-checkbox--check">
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class=""> Опубликовать </span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="checkbox">
|
||||
<div
|
||||
class="vs-checkbox-con vs-checkbox-primary"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
value="1"
|
||||
name="is_filter_power"
|
||||
v-model="category.is_filter_power"
|
||||
/>
|
||||
<span class="vs-checkbox">
|
||||
<span class="vs-checkbox--check">
|
||||
<i
|
||||
class="vs-icon feather icon-check"
|
||||
></i>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="">
|
||||
Сортировать по kW
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer pb-0 pl-0 pt-1">
|
||||
<div class="col-12 mb-0">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary mr-1 mb-1 waves-effect waves-light btn-icon"
|
||||
>
|
||||
<i class="feather icon-save"></i>
|
||||
{{ $t("admin.save") }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="col-9">
|
||||
<a
|
||||
href="/dashboard/categories"
|
||||
class="btn btn-danger mr-1 mb-1 waves-effect waves-light btn-icon pull-right"
|
||||
>
|
||||
<i class="feather icon-x-circle"></i>
|
||||
{{ $t("admin.cancel") }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
brandsData: {},
|
||||
categoriesData: {},
|
||||
categoryData: {},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
category: this.categoryData,
|
||||
|
||||
char: [],
|
||||
file: null,
|
||||
|
||||
error: false,
|
||||
errors: [],
|
||||
|
||||
deleted: {
|
||||
char: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
getName(name) {
|
||||
const lang = document.documentElement.lang.substr(0, 2);
|
||||
let value = "";
|
||||
|
||||
if (lang) {
|
||||
switch (lang) {
|
||||
case "ru":
|
||||
value = name.ru;
|
||||
break;
|
||||
case "uz":
|
||||
value = name.uz;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
value = name.ru;
|
||||
}
|
||||
|
||||
return value;
|
||||
},
|
||||
|
||||
async saveForm() {
|
||||
const header = {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
};
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("name[ru]", this.category.name.ru);
|
||||
formData.append("name[uz]", this.category.name.uz);
|
||||
|
||||
formData.append("position", this.category.position);
|
||||
|
||||
//formData.append('brands', this.category.brands);
|
||||
formData.append("parent_id", this.category.parent_id);
|
||||
formData.append("published", this.category.published);
|
||||
formData.append("is_filter_power", this.category.is_filter_power);
|
||||
formData.append("image", this.file);
|
||||
formData.append("descriptions[ru]", this.category.descriptions.ru);
|
||||
formData.append("descriptions[uz]", this.category.descriptions.uz);
|
||||
formData.append("keywords[ru]", this.category.keywords.ru);
|
||||
formData.append("keywords[uz]", this.category.keywords.uz);
|
||||
|
||||
formData.append("title_seo[ru]", this.category.title_seo.ru);
|
||||
formData.append("title_seo[uz]", this.category.title_seo.uz);
|
||||
|
||||
for (var i = 0; i < this.category.brands.length; i++) {
|
||||
formData.append(
|
||||
"brands[" + i + "]",
|
||||
this.category.brands[i].id
|
||||
);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.category.characteristics.length; i++) {
|
||||
formData.append(
|
||||
"char[" + i + "][name][ru]",
|
||||
this.category.characteristics[i].name.ru
|
||||
);
|
||||
formData.append(
|
||||
"char[" + i + "][name][uz]",
|
||||
this.category.characteristics[i].name.uz
|
||||
);
|
||||
formData.append(
|
||||
"char[" + i + "][type]",
|
||||
this.category.characteristics[i].type
|
||||
);
|
||||
formData.append(
|
||||
"char[" + i + "][filter]",
|
||||
this.category.characteristics[i].filter
|
||||
);
|
||||
formData.append(
|
||||
"char[" + i + "][id]",
|
||||
this.category.characteristics[i].id
|
||||
);
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.deleted.char.length; i++) {
|
||||
formData.append(
|
||||
"deletes[char][" + i + "]",
|
||||
this.deleted.char[i]
|
||||
);
|
||||
}
|
||||
|
||||
axios
|
||||
.post(
|
||||
"/dashboard/categories/update/" + this.category.id,
|
||||
formData,
|
||||
header
|
||||
)
|
||||
.then((response) => {
|
||||
if (response.data.status) {
|
||||
window.location.href = "/dashboard/categories";
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response) {
|
||||
this.error = true;
|
||||
this.errors = error.response.data.errors;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
ImageFile(event) {
|
||||
this.file = event.target.files[0];
|
||||
},
|
||||
|
||||
addChar() {
|
||||
this.category.characteristics.push({
|
||||
id: null,
|
||||
name: {
|
||||
ru: "",
|
||||
uz: "",
|
||||
},
|
||||
type: "text",
|
||||
filter: false,
|
||||
});
|
||||
},
|
||||
|
||||
removeChar(index, char) {
|
||||
if (char.id != null) this.deleted.char.push(char.id);
|
||||
|
||||
this.category.characteristics.splice(index, 1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped></style>
|
||||
533
resources/js/components/Dashboard/Logs.vue
Executable file
533
resources/js/components/Dashboard/Logs.vue
Executable file
@@ -0,0 +1,533 @@
|
||||
<template>
|
||||
<div>
|
||||
<ul class="activity-timeline timeline-left list-unstyled" :key="index">
|
||||
<!-- v-if="log.log_name != 'products' && log.decription != 'created' && log.properties.attributes.name != null"-->
|
||||
<li v-for="(log, index) in logs" :key="index">
|
||||
<div class="timeline-icon bg-primary" v-if="log.description == 'updated'">
|
||||
<i class="feather icon-edit font-medium-2 align-middle"></i>
|
||||
</div>
|
||||
|
||||
<div class="timeline-icon bg-danger" v-if="log.description == 'deleted'">
|
||||
<i class="feather icon-trash-2 font-medium-2 align-middle"></i>
|
||||
</div>
|
||||
|
||||
<div class="timeline-icon bg-success" v-if="log.description == 'created'">
|
||||
<i class="feather icon-plus-circle font-medium-2 align-middle"></i>
|
||||
</div>
|
||||
|
||||
<div class="timeline-info">
|
||||
<p class="font-weight-bold mb-0">
|
||||
|
||||
<i :class="getIcon(log)"></i> {{ getType(log) }}
|
||||
|
||||
</p>
|
||||
<span class="font-small-3" v-html="getMessage(log)">
|
||||
</span>
|
||||
<a href="#" @click="getData(log)" data-toggle="modal" data-target="#exampleModalLong">
|
||||
подробнее
|
||||
</a>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
{{ log.created_at | moment("HH:mm, DD.MM.YYYY") }} | ID: {{ log.causer.id }} | Пользователь: <b>{{ log.causer.username }}</b>
|
||||
</small>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLongTitle">Подробнее</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" v-if="log_modal">
|
||||
<fieldset class="form-group">
|
||||
<label for="basicInput">Пользователь</label>
|
||||
<input type="text" class="form-control" disabled :value="log.causer.username" id="basicInput">
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group">
|
||||
<label for="basicInput">ID</label>
|
||||
<input type="text" class="form-control" disabled :value="log.subject_id" id="basicInput" >
|
||||
</fieldset>
|
||||
|
||||
<div v-if="log.log_name === 'products'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.name">
|
||||
<label for="basicInput">Названия Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.name.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.name">
|
||||
<label for="basicInput">Названия Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.name.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.price">
|
||||
<label for="basicInput">Цена</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.price" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.price : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.price_discount">
|
||||
<label for="basicInput">Цена со скидкой</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.price_discount" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.price_discount : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.count <= 0">
|
||||
<label for="basicInput">Количество товаров на складе</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.count" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.count : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.article_number">
|
||||
<label for="basicInput">Артикул</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.article_number" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.article_number : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.published === false || log.properties.attributes.published">
|
||||
<label for="basicInput">Публиковать</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.published" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.published : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.available === false || log.properties.attributes.available">
|
||||
<label for="basicInput">В наличии</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.available" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.available : '' }}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name === 'orders'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.status">
|
||||
<label for="basicInput">Статус</label>
|
||||
<input type="text" class="form-control" disabled :value="getStatus(log.properties.attributes.status)" id="basicInput" >
|
||||
Было: {{ getStatus(log.properties.old.status) }}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name === 'staffs'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.username">
|
||||
<label for="basicInput">Логин</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.username" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.username : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.password">
|
||||
<label for="basicInput">Пароль</label>
|
||||
<input type="password" class="form-control" disabled :value="log.properties.attributes.password" id="basicInput" >
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.role.name">
|
||||
<label for="basicInput">Роль</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.role.name" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.role.name : '' }}
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name === 'roles'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.name">
|
||||
<label for="basicInput">Названия</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.name" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name : '' }}
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name != 'products'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.name">
|
||||
<label for="basicInput">Названия Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.name.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.name">
|
||||
<label for="basicInput">Названия Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.name.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name === 'special_offer'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.description">
|
||||
<label for="basicInput">Описания Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.description.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.name.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.description">
|
||||
<label for="basicInput">Описания Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.description.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.description.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.link">
|
||||
<label for="basicInput">Ccылка</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.link" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.link : '' }}
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="log.log_name === 'settings'">
|
||||
<div v-if="log.description">
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.title">
|
||||
<label for="basicInput">Названия Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.title.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.title.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.title">
|
||||
<label for="basicInput">Названия Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.title.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.title.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.phone">
|
||||
<label for="basicInput">Телефон</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.phone.default" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.phone.default : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.phone">
|
||||
<label for="basicInput">Телефон другой</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.phone.other" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.phone.other : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.address">
|
||||
<label for="basicInput">Адрес Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.address.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.address.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.address">
|
||||
<label for="basicInput">Адрес Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.address.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.address.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.socials">
|
||||
<label for="basicInput">Телеграм</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.socials.telegram" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.socials.telegram : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.socials">
|
||||
<label for="basicInput">Facebook</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.socials.facebook" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.socials.facebook : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.socials">
|
||||
<label for="basicInput">Instagram</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.socials.instagram" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.socials.instagram : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.socials">
|
||||
<label for="basicInput">Youtube</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.socials.youtube" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.socials.youtube : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.socials">
|
||||
<label for="basicInput">Ok.ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.socials.okru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.socials.okru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.email">
|
||||
<label for="basicInput">Email</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.email" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.email : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.landmark">
|
||||
<label for="basicInput">Ориентер Ru</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.landmark.ru" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.landmark.ru : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.address">
|
||||
<label for="basicInput">Ориентер Uz</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.landmark.uz" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.landmark.uz : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.day_delivery">
|
||||
<label for="basicInput">Время доставки</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.day_delivery" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.day_delivery : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.price_delivery">
|
||||
<label for="basicInput">Стоимость доставки</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.price_delivery" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.day_delivery : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.pickup === false || log.properties.attributes.pickup">
|
||||
<label for="basicInput">Самовывоз</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.pickup" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.pickup : '' }}
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="form-group" v-if="log.properties.attributes.delivery === false || log.properties.attributes.delivery">
|
||||
<label for="basicInput">Доставка курьером</label>
|
||||
<input type="text" class="form-control" disabled :value="log.properties.attributes.delivery" id="basicInput" >
|
||||
Было: {{ log.properties.old ? log.properties.old.delivery : '' }}
|
||||
</fieldset>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
logsData: {}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
logs: this.logsData.data,
|
||||
|
||||
log_modal: false,
|
||||
log: {}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getType(log) {
|
||||
let message;
|
||||
switch (log.log_name) {
|
||||
case 'roles':
|
||||
message = 'Роли';
|
||||
break;
|
||||
case 'products':
|
||||
message = 'Продукты';
|
||||
break;
|
||||
case 'orders':
|
||||
message = 'Заказы';
|
||||
break;
|
||||
case 'staffs':
|
||||
message = 'Стаф';
|
||||
break;
|
||||
case 'users':
|
||||
message = 'Пользователи';
|
||||
break;
|
||||
case 'posts':
|
||||
message = 'Посты';
|
||||
break;
|
||||
case 'sliders':
|
||||
message = 'Баннеры';
|
||||
break;
|
||||
case 'categories':
|
||||
message = 'Категории';
|
||||
break;
|
||||
case 'billings':
|
||||
message = 'История оплаты';
|
||||
break;
|
||||
case 'regions':
|
||||
message = 'Регионы';
|
||||
break;
|
||||
case 'cities':
|
||||
message = 'Города';
|
||||
break;
|
||||
case 'settings':
|
||||
message = 'Настройки';
|
||||
break;
|
||||
case 'addresses':
|
||||
message = 'Адрес';
|
||||
break;
|
||||
case 'brand':
|
||||
message = 'Бренды';
|
||||
break;
|
||||
case 'pages':
|
||||
message = 'Страницы';
|
||||
break;
|
||||
case 'special_offer':
|
||||
message = 'Спецпредложения';
|
||||
break;
|
||||
}
|
||||
|
||||
// addresses, brand, pages, special_offer
|
||||
|
||||
return message;
|
||||
},
|
||||
|
||||
getIcon(log) {
|
||||
let icon;
|
||||
switch (log.log_name) {
|
||||
case 'roles':
|
||||
icon = 'feather icon-check-circle';
|
||||
break;
|
||||
case 'products':
|
||||
icon = 'feather icon-box';
|
||||
break;
|
||||
case 'orders':
|
||||
icon = 'feather icon-shopping-cart';
|
||||
break;
|
||||
case 'staffs':
|
||||
icon = 'feather icon-users';
|
||||
break;
|
||||
case 'users':
|
||||
icon = 'feather icon-users';
|
||||
break;
|
||||
case 'posts':
|
||||
icon = 'feather icon-align-center';
|
||||
break;
|
||||
case 'sliders':
|
||||
icon = 'feather icon-align-center';
|
||||
break;
|
||||
case 'categories':
|
||||
icon = 'feather icon-tag';
|
||||
break;
|
||||
case 'billings':
|
||||
icon = 'feather icon-credit-card';
|
||||
break;
|
||||
case 'regions':
|
||||
icon = 'feather icon-database';
|
||||
break;
|
||||
case 'cities':
|
||||
icon = 'feather icon-layers';
|
||||
break;
|
||||
case 'settings':
|
||||
icon = 'feather icon-settings';
|
||||
break;
|
||||
case 'addresses':
|
||||
icon = 'feather icon-home';
|
||||
break;
|
||||
case 'brand':
|
||||
icon = 'feather icon-cast';
|
||||
break;
|
||||
case 'pages':
|
||||
icon = 'feather icon-align-center';
|
||||
break;
|
||||
case 'special_offer':
|
||||
icon = 'feather icon-command';
|
||||
break;
|
||||
}
|
||||
|
||||
return icon;
|
||||
},
|
||||
|
||||
getMessage(log) {
|
||||
let message;
|
||||
switch (log.description) {
|
||||
case 'created':
|
||||
message = '<b>ID: ' + log.subject_id + '</b> успешно создано';
|
||||
break;
|
||||
case 'deleted':
|
||||
message = '<b>ID: ' + log.subject_id + '</b> успешно удалено';
|
||||
break;
|
||||
case 'updated':
|
||||
message = '<b>ID: ' + log.subject_id + '</b> успешно редактировано';
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
// switch (log.log_name) {
|
||||
// case 'products':
|
||||
// switch (log.description) {
|
||||
// case 'created':
|
||||
// message = 'Продукт <b>ID: ' + log.subject_id + '</b> успешно создано';
|
||||
// break;
|
||||
// case 'deleted':
|
||||
// message = 'Продукт <b>ID: ' + log.subject_id + '</b> успешно удалено';
|
||||
// break;
|
||||
// case 'updated':
|
||||
// message = 'Продукт <b>ID: ' + log.subject_id + '</b> успешно редактировано';
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// case 'orders':
|
||||
// switch (log.description) {
|
||||
// case 'deleted':
|
||||
// message = 'Заказ <b>ID: ' + log.subject_id + '</b> успешно удалено';
|
||||
// break;
|
||||
// case 'updated':
|
||||
// message = 'Заказ <b>ID: ' + log.subject_id + '</b> успешно редактировано';
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// return message;
|
||||
},
|
||||
|
||||
getStatus(status) {
|
||||
let message;
|
||||
switch (status) {
|
||||
case 'processing':
|
||||
message = 'В обработке';
|
||||
break;
|
||||
case 'collected':
|
||||
message = 'Собран';
|
||||
break;
|
||||
case 'waiting_buyer':
|
||||
message = 'Ожидает покупателя';
|
||||
break;
|
||||
case 'in_way':
|
||||
message = 'В пути';
|
||||
break;
|
||||
case 'closed':
|
||||
message = 'Закрыт';
|
||||
break;
|
||||
case 'cancelled':
|
||||
message = 'Отменен';
|
||||
break;
|
||||
case 'replacement':
|
||||
message = 'Замена';
|
||||
break;
|
||||
}
|
||||
|
||||
return message;
|
||||
},
|
||||
|
||||
getData(log) {
|
||||
this.log_modal = true;
|
||||
this.log = log;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
0
resources/js/components/Dashboard/Statics.vue
Executable file
0
resources/js/components/Dashboard/Statics.vue
Executable file
Reference in New Issue
Block a user