This commit is contained in:
2026-04-15 19:34:56 +05:00
parent 34ffed1e4a
commit e243821f50
26 changed files with 2072 additions and 1258 deletions

View File

@@ -318,7 +318,7 @@
<div class="text-center">
<img
id="uploadPreview"
:src="product.poster"
:src="getPosterPreview()"
style="
width: 300px;
height: auto;
@@ -1110,6 +1110,12 @@ export default {
this.remaincharUZCount();
this.setCategory();
this.products.childrens.forEach((child) => {
if (!child.filesDataForUpload) {
this.$set(child, "filesDataForUpload", []);
}
});
if (this.products.categories.length == 0) {
this.watch_count = {
first: 2,
@@ -1120,6 +1126,12 @@ export default {
},
methods: {
getPosterPreview() {
if (this.products.poster instanceof File) {
return URL.createObjectURL(this.products.poster);
}
return this.products.poster;
},
setCategory() {
if (this.products.categories[0]) {
if (this.products.categories[0].parent) {
@@ -1332,10 +1344,25 @@ export default {
);
}
formData.append(
"colors[" + i + "][screens][" + screens + "][image]",
this.products.childrens[i].screens[screens].file
);
if (this.products.childrens[i].screens[screens].file) {
formData.append(
"colors[" + i + "][screens][" + screens + "][image]",
this.products.childrens[i].screens[screens].file
);
}
}
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
);
}
}
}
@@ -1410,6 +1437,7 @@ export default {
sizes: [],
article_number: null,
screens: [],
filesDataForUpload: [],
});
},

View File

@@ -335,6 +335,7 @@
<div class="text-center">
<img
id="uploadPreview"
:src="getPosterPreview()"
style="
width: 300px;
height: auto;
@@ -1172,6 +1173,12 @@ export default {
},
methods: {
getPosterPreview() {
if (this.product.poster instanceof File) {
return URL.createObjectURL(this.product.poster);
}
return this.product.poster;
},
async StoreProduct() {
const header = {
headers: {
@@ -1263,10 +1270,25 @@ export default {
screens < this.product.colors[i].screens.length;
screens++
) {
formData.append(
"colors[" + i + "][screens][" + screens + "][image]",
this.product.colors[i].screens[screens].file
);
if (this.product.colors[i].screens[screens].file) {
formData.append(
"colors[" + i + "][screens][" + screens + "][image]",
this.product.colors[i].screens[screens].file
);
}
}
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
);
}
}
}

View File

@@ -33,10 +33,10 @@
@endsection
@push('css')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-file-agent@latest/dist/vue-file-agent.css" />
@endpush
@push('js')
{{-- @vite('resources/js/app.js')</script> --}}
@vite('resources/js/app.js')
<script>
@@ -57,18 +57,4 @@
});
});
</script>
<script type="text/javascript">
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);
oFReader.onload = function(oFREvent) {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
};
</script>
@vite('resources/js/app.js')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-file-agent@latest/dist/vue-file-agent.css" />
@endpush

View File

@@ -39,7 +39,7 @@
@endpush
@push('js')
@vite('resources/js/app.js')</script>
@vite('resources/js/app.js')
<script>
$(document).ready(function() {
@@ -59,15 +59,4 @@
});
});
</script>
<script type="text/javascript">
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);
oFReader.onload = function(oFREvent) {
document.getElementById("uploadPreview").src = oFREvent.target.result;
};
};
</script>
@endpush

View File

@@ -1,4 +1,4 @@
@extends('site.layouts.app')
@extends('layouts.app')
@section('title', trans('app.main'))