storage url o'zgartirildi
This commit is contained in:
@@ -152,6 +152,13 @@ class Controller extends ExController
|
||||
*/
|
||||
public function characteristics($id)
|
||||
{
|
||||
if (!ctype_digit((string) $id)) {
|
||||
return [
|
||||
'status' => false,
|
||||
'characteristics' => []
|
||||
];
|
||||
}
|
||||
|
||||
$category = Category::find($id);
|
||||
|
||||
if (empty($category)) {
|
||||
|
||||
@@ -1048,21 +1048,27 @@ export default {
|
||||
|
||||
"category.two": function (newVal) {
|
||||
if (this.watch_count.two > 1) {
|
||||
if (newVal.parents.length > 0) {
|
||||
if (!newVal || !newVal.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newVal.parents && newVal.parents.length > 0) {
|
||||
this.DetectCategoryTwo();
|
||||
} else {
|
||||
if (newVal.id) {
|
||||
this.products.category_id = newVal.id;
|
||||
this.getCharacteristics(newVal.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.watch_count.two = 2;
|
||||
},
|
||||
|
||||
"category.three": function (newVal) {
|
||||
if (this.watch_count.three > 1) {
|
||||
if (!newVal || !newVal.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.DetectCategoryThree();
|
||||
}
|
||||
|
||||
@@ -1206,6 +1212,10 @@ export default {
|
||||
},
|
||||
|
||||
DetectCategoryThree() {
|
||||
if (!this.category.three || !this.category.three.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.getCharacteristics(this.category.three.id);
|
||||
this.products.category_id = this.category.three.id;
|
||||
},
|
||||
|
||||
@@ -1153,7 +1153,9 @@ export default {
|
||||
|
||||
watch: {
|
||||
"product.category_id": function (newVal) {
|
||||
if (newVal) {
|
||||
this.getCharacteristics(newVal);
|
||||
}
|
||||
},
|
||||
|
||||
"category.first": function (newVal) {
|
||||
@@ -1161,16 +1163,22 @@ export default {
|
||||
},
|
||||
|
||||
"category.two": function (newVal) {
|
||||
if (newVal.parents.length > 0) {
|
||||
if (!newVal || !newVal.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (newVal.parents && newVal.parents.length > 0) {
|
||||
this.DetectCategoryTwo();
|
||||
} else {
|
||||
if (newVal.id) {
|
||||
this.product.category_id = newVal.id;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"category.three": function (newVal) {
|
||||
if (!newVal || !newVal.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.DetectCategoryThree();
|
||||
},
|
||||
},
|
||||
@@ -1367,6 +1375,13 @@ export default {
|
||||
},
|
||||
|
||||
async getCharacteristics(id) {
|
||||
id = id && id.id ? id.id : id;
|
||||
|
||||
if (!id) {
|
||||
this.characteristics = [];
|
||||
return;
|
||||
}
|
||||
|
||||
const { data } = await axios.get(
|
||||
"/dashboard/products/characteristics/" + id
|
||||
);
|
||||
@@ -1382,10 +1397,16 @@ export default {
|
||||
this.category.three = {};
|
||||
this.category.three_view = false;
|
||||
|
||||
if (this.category.first.parents.length > 0) {
|
||||
this.category.two_view = true;
|
||||
} else {
|
||||
if (!this.category.first || !this.category.first.id) {
|
||||
this.product.category_id = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.product.category_id = this.category.first.id;
|
||||
this.getCharacteristics(this.category.first.id);
|
||||
|
||||
if (this.category.first.parents && this.category.first.parents.length > 0) {
|
||||
this.category.two_view = true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1393,12 +1414,23 @@ export default {
|
||||
this.category.three = {};
|
||||
this.category.three_view = false;
|
||||
|
||||
if (this.category.two.parents.length > 0) {
|
||||
if (!this.category.two || !this.category.two.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.product.category_id = this.category.two.id;
|
||||
this.getCharacteristics(this.category.two.id);
|
||||
|
||||
if (this.category.two.parents && this.category.two.parents.length > 0) {
|
||||
this.category.three_view = true;
|
||||
}
|
||||
},
|
||||
|
||||
DetectCategoryThree() {
|
||||
if (!this.category.three || !this.category.three.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.product.category_id = this.category.three.id;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user