storage url o'zgartirildi

This commit is contained in:
2026-04-28 15:02:06 +05:00
parent 3aa4601229
commit bb733d14c1
37 changed files with 282 additions and 407 deletions

View File

@@ -34,7 +34,7 @@
<div class="col-md-12">
<div class="form-group">
<label for="category">Категория</label>
<select id="category" class="form-control" v-model="category_id">
<select id="category" class="form-control" v-model="category_id" @change="SearchProduct('')">
<option value="0">Все</option>
<option v-for="category in categories" :value="category.id">
{{ category.name.ru }}
@@ -194,19 +194,17 @@
async SearchProduct(query) {
let name = query;
if (name.length > 0) {
axios.post('/dashboard/compilations/product/search', { name: name})
.then((response) => {
if (response.data.status) {
this.products = response.data.products;
}
}).catch((error) => {
if (error.response) {
this.error = true;
this.errors = error.response.data.errors;
axios.post('/dashboard/compilations/product/search', { name: name, category_id: this.category_id})
.then((response) => {
if (response.data.status) {
this.products = response.data.products;
}
});
}
}).catch((error) => {
if (error.response) {
this.error = true;
this.errors = error.response.data.errors;
}
});
console.log(query);
},

View File

@@ -34,7 +34,7 @@
<div class="col-md-12">
<div class="form-group">
<label for="category">Категория</label>
<select id="category" class="form-control" v-model="category_id">
<select id="category" class="form-control" v-model="category_id" @change="SearchProduct('')">
<option value="0">Все</option>
<option v-for="category in categories" :value="category.id">
{{ category.name.ru }}
@@ -196,19 +196,17 @@
async SearchProduct(query) {
let name = query;
if (name.length > 0) {
axios.post('/dashboard/compilations/product/search', { name: name})
.then((response) => {
if (response.data.status) {
this.products = response.data.products;
}
}).catch((error) => {
if (error.response) {
this.error = true;
this.errors = error.response.data.errors;
axios.post('/dashboard/compilations/product/search', { name: name, category_id: this.category_id})
.then((response) => {
if (response.data.status) {
this.products = response.data.products;
}
});
}
}).catch((error) => {
if (error.response) {
this.error = true;
this.errors = error.response.data.errors;
}
});
console.log(query);
},

View File

@@ -137,168 +137,67 @@ export default {
subCategories: [],
category: null,
subCategory: null,
currentParentId: 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
{
categories: this.normalizeTree(this.categoriesData, null, 0),
}
);
if (data.status) {
// window.location.href = "/dashboard/categories";
window.location.reload();
}
},
Change() {
for (var i = 0; i < this.categories.length; i++) {
var num = i + 1;
this.normalizeTree(this.categoriesData, null, 0);
},
this.categories[i].position = num;
this.categories[i].droppable = true;
normalizeTree(categories, parentId, level) {
return categories.map((category, index) => {
category.position = index + 1;
category.parent_id = parentId;
category.droppable = level < 2;
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;
const children = Array.isArray(category.children)
? this.normalizeTree(category.children, category.id, level + 1)
: [];
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;
}
}
}
}
}
return {
id: category.id,
position: category.position,
parent_id: category.parent_id,
children,
};
});
},
handleMainCategory() {
if (this.category) {
this.categories = this.category.children;
this.subCategories = this.category.children;
this.currentParentId = this.category.id;
} else {
this.categories = this.categoriesData;
this.subCategories = null;
this.currentParentId = null;
}
},
handleSubCategory() {
if (this.subCategory) this.categories = this.subCategory.children;
else this.categories = this.category.children;
if (this.subCategory) {
this.categories = this.subCategory.children;
this.currentParentId = this.subCategory.id;
} else {
this.categories = this.category.children;
this.currentParentId = this.category ? this.category.id : null;
}
},
},
};

View File

@@ -111,7 +111,6 @@
type="file"
name="image"
@change="ImageFile($event)"
onchange="PreviewImage();"
/>
<label
class="custom-file-label"
@@ -126,6 +125,7 @@
<div class="text-center">
<img
id="uploadPreview"
:src="category.imagePreview"
style="
width: 300px;
height: auto;
@@ -707,6 +707,7 @@ export default {
},
image: null,
imagePreview: null,
},
char: [],
@@ -798,6 +799,12 @@ export default {
ImageFile(event) {
this.category.image = event.target.files[0];
if (this.category.image) {
this.category.imagePreview = URL.createObjectURL(
this.category.image
);
}
},
addChar() {

View File

@@ -111,7 +111,6 @@
type="file"
name="image"
@change="ImageFile($event)"
onchange="PreviewImage();"
/>
<label
class="custom-file-label"
@@ -811,6 +810,10 @@ export default {
ImageFile(event) {
this.file = event.target.files[0];
if (this.file) {
this.category.image_url = URL.createObjectURL(this.file);
}
},
addChar() {

View File

@@ -309,7 +309,6 @@
<input
class="form-control"
@change="posterFile($event)"
onchange="PreviewImage();"
type="file"
id="poster"
/>
@@ -670,6 +669,7 @@
:theme="'default'"
:multiple="true"
:deletable="true"
:linkable="true"
:meta="true"
:accept="'image/*'"
:maxSize="'10MB'"
@@ -679,10 +679,13 @@
type: 'Invalid file type. Only images or zip Allowed',
size: 'Files should not exceed 10MB in size',
}"
@select="
filesSelected($event, index)
"
@beforedelete="
onBeforeDelete(
$event,
index
)
"
@delete="
fileDeleted($event, index)
"
v-model="color.screens"
@@ -1352,18 +1355,6 @@ export default {
}
}
if (this.products.childrens[i].filesDataForUpload) {
for (
let f = 0;
f < this.products.childrens[i].filesDataForUpload.length;
f++
) {
formData.append(
"colors[" + i + "][screens][new_" + f + "][image]",
this.products.childrens[i].filesDataForUpload[f].file
);
}
}
}
for (let i = 0; i < this.deletes.childrens.length; i++) {
@@ -1394,7 +1385,12 @@ export default {
.catch((error) => {
if (error.response) {
this.error = true;
this.errors = error.response.data.errors;
this.errors = error.response.data.errors || {
product: [
error.response.data.messages ||
"Ошибка при сохранении",
],
};
}
});
},
@@ -1488,26 +1484,19 @@ export default {
this.products.childrens[index].sizes.splice(indexx, 1);
},
filesSelected: function (filesDataNewlySelected, index) {
let validFilesData = filesDataNewlySelected.filter(
(fileData) => !fileData.error
);
this.products.childrens[index].filesDataForUpload =
this.products.childrens[index].filesDataForUpload.concat(
validFilesData
);
onBeforeDelete: function (fileData, index) {
const agent = Array.isArray(this.$refs.vueFileAgent)
? this.$refs.vueFileAgent[index]
: this.$refs.vueFileAgent;
if (agent) {
agent.deleteFileRecord(fileData);
}
},
fileDeleted: function (fileData, index) {
let i = this.products.childrens[index].screens.indexOf(fileData);
if (i !== -1) {
this.products.childrens[index].screens.splice(i, 1);
let id = fileData.id ? fileData.id : null;
if (fileData.id) {
this.deletes.screens.push(id);
}
fileDeleted: function (fileData) {
if (fileData.id && !this.deletes.screens.includes(fileData.id)) {
this.deletes.screens.push(fileData.id);
}
},
},

View File

@@ -324,7 +324,6 @@
<input
class="form-control"
@change="posterFile($event)"
onchange="PreviewImage();"
required
type="file"
id="poster"
@@ -684,6 +683,7 @@
:theme="'default'"
:multiple="true"
:deletable="true"
:linkable="true"
:meta="true"
:accept="'image/*'"
:maxSize="'10MB'"
@@ -693,10 +693,13 @@
type: 'Invalid file type. Only images or zip Allowed',
size: 'Files should not exceed 10MB in size',
}"
@select="
filesSelected($event, index)
"
@beforedelete="
onBeforeDelete(
$event,
index
)
"
@delete="
fileDeleted($event, index)
"
v-model="color.screens"
@@ -1278,18 +1281,6 @@ export default {
}
}
if (this.product.colors[i].filesDataForUpload) {
for (
let f = 0;
f < this.product.colors[i].filesDataForUpload.length;
f++
) {
formData.append(
"colors[" + i + "][screens][new_" + f + "][image]",
this.product.colors[i].filesDataForUpload[f].file
);
}
}
}
for (var i = 0; i < this.characteristics.length; i++) {
@@ -1442,25 +1433,17 @@ export default {
// this.$refs.vueFileAgent.deleteUpload(this.uploadUrl, this.uploadHeaders, fileData);
// },
filesSelected: function (filesDataNewlySelected, index) {
var validFilesData = filesDataNewlySelected.filter(
(fileData) => !fileData.error
);
this.product.colors[index].filesDataForUpload =
this.product.colors[index].filesDataForUpload.concat(
validFilesData
);
},
onBeforeDelete: function (fileData, index) {
const agent = Array.isArray(this.$refs.vueFileAgent)
? this.$refs.vueFileAgent[index]
: this.$refs.vueFileAgent;
fileDeleted: function (fileData, index) {
var i =
this.product.colors[index].filesDataForUpload.indexOf(fileData);
if (i !== -1) {
this.product.colors[index].filesDataForUpload.splice(i, 1);
} else {
this.deleteUploadedFile(fileData);
if (agent) {
agent.deleteFileRecord(fileData);
}
},
fileDeleted: function () {},
},
};
</script>

View File

@@ -118,6 +118,17 @@
</li>
@endif
@can('view', 'sliders')
<li class="nav-item {{ active([route('dashboard.sliders'), route('dashboard.sliders') . '/*']) }}">
<a href="{{ route('dashboard.sliders') }}">
<i class="feather icon-image"></i>
<span class="menu-title">
@lang('admin.slider.title')
</span>
</a>
</li>
@endcan
@can('view', 'users')
<li class="nav-item {{ active([route('dashboard.users'), route('dashboard.users') . '/*']) }}"><a
href="{{ route('dashboard.users') }}">

View File

@@ -29,7 +29,7 @@
<div id="app">
<product-edit :product="{{ json_encode($product) }}" :brands="{{ json_encode($brands) }}"
:categories="{{ json_encode($categories) }}" :colors="{{ json_encode($colors) }}"
:back-url="{{ json_encode(url()->previous()) }}" :measurement="{{ json_encode($measurement) }}"></product-edit>
:back-url="{{ json_encode(route('dashboard.products')) }}" :measurement="{{ json_encode($measurement) }}"></product-edit>
</div>
@endsection