Add product deletion

This commit is contained in:
Amanmyrat 2023-09-15 00:30:33 +05:00
parent 466a6a33f8
commit b38019f04c
1 changed files with 26 additions and 1 deletions

View File

@ -17,7 +17,32 @@
<div class="flex justify-center lg:justify-end items-center p-5 border-t border-slate-200/60 dark:border-darkmode-400">
<a class="flex items-center text-primary mr-auto" href="javascript:;"> <i data-lucide="eye" class="w-4 h-4 mr-1"></i> {{price}} </a>
<a class="flex items-center mr-3" href="/seller/product/update/{{id}}"> <i data-lucide="check-square" class="w-4 h-4 mr-1"></i> {{'product.edit'|_}} </a>
<a class="flex items-center text-danger" href="javascript:;" data-tw-toggle="modal" data-tw-target="#delete-confirmation-modal"> <i data-lucide="trash-2" class="w-4 h-4 mr-1"></i> {{'product.delete'|_}} </a>
<a class="flex items-center text-danger" onclick="deleteProduct('{{ id }}')"> <i data-lucide="trash-2" class="w-4 h-4 mr-1"></i> {{'product.delete'|_}} </a>
</div>
</div>
</div>
{% put scripts %}
<script>
function deleteProduct(id){
$.ajax({
type: 'POST',
url: 'https://nurgul.com.tm/app/api/seller/delete/product/' + id,
cache: false,
contentType: false,
processData: false,
success: function (data) {
console.log("success");
console.log(data);
location.reload()
},
error: function (data) {
console.log("error");
console.log(data);
}
});
}
</script>
{% endput %}