Fix errors on new product creation

This commit is contained in:
Amanmyrat 2023-09-14 23:22:37 +05:00
parent 6a0be7f0ba
commit 4c9d754d02
2 changed files with 44 additions and 44 deletions

View File

@ -13,7 +13,6 @@ layout = "seller-master"
<div class="intro-y col-span-12 flex flex-wrap sm:flex-nowrap items-center mt-2">
<a href="/seller/product/add" class="btn btn-primary shadow-md mr-2">{{'add.prod.title'|_}}</a>
<div class="hidden md:block mx-auto text-slate-500">Showing 1 to 10 of 150 entries</div>
<div class="w-full sm:w-auto mt-3 sm:mt-0 sm:ml-auto md:ml-0">
<div class="w-56 relative text-slate-500">
<input type="text" class="form-control w-56 box pr-10" placeholder="Search...">

View File

@ -192,15 +192,15 @@
// $("input[name='images[files][]']").val(product.images[0].original_image_url);
// $("select[name='status']").val(product.status);
if (product) {
$("#product_status").html(`
<option value="1" `+ (product.status == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
<option value="0" `+ (product.status == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
<option value="1" ` + (product.status == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
<option value="0" ` + (product.status == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
`);
$("#product_featured").html(`
<option value="1" `+ (product.featured == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
<option value="0" `+ (product.featured == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
<option value="1" ` + (product.featured == 1 ? `selected` : ``) + `>{{'product.enable'|_}}</option>
<option value="0" ` + (product.featured == 0 ? `selected` : ``) + `>{{'product.disable'|_}}</option>
`);
$("div.product_featured select").val(product.featured);
// $("#product_featured select").val(product.featured).change();
@ -216,15 +216,14 @@
$("input[name='qty']").val(product.qty);
let category = product.categories[0];
if(category){
if (category) {
$('#product_categories').append(`
<option selected value="`+category.id+`">`+ category.name +`</option>
<option selected value="` + category.id + `">` + category.name + `</option>
`);
}
vendorCats();
product.images.forEach(image => {
let mockFile = { name: image.original_image_url, size: 12345 };
let mockFile = {name: image.original_image_url, size: 12345};
myDropzone.options.addedfile.call(myDropzone, mockFile);
myDropzone.options.thumbnail.call(myDropzone, mockFile, image.original_image_url);
myDropzone.emit("complete", mockFile);
@ -242,6 +241,8 @@
}
xhrr.send()
})
}
vendorCats();
},
error: function (xhr, textStatus, errorThrown) {
console.log('Error in Operation');