api order

This commit is contained in:
Kerim 2023-09-01 00:16:01 +05:00
parent 17a65967fc
commit 02b0646832
2 changed files with 130 additions and 95 deletions

View File

@ -5,100 +5,70 @@ layout = "seller-master"
==
<div class="intro-y flex flex-col sm:flex-row items-center mt-8">
<h2 class="text-lg font-medium mr-auto">
Tabulator
</h2>
<div class="w-full sm:w-auto flex mt-4 sm:mt-0">
<button class="btn btn-primary shadow-md mr-2">Add New Product</button>
<div class="dropdown ml-auto sm:ml-0">
<button class="dropdown-toggle btn px-2 box" aria-expanded="false" data-tw-toggle="dropdown">
<span class="w-5 h-5 flex items-center justify-center"> <i class="w-4 h-4" data-lucide="plus"></i>
</span>
</button>
<div class="dropdown-menu w-40">
<ul class="dropdown-content">
<li>
<a href="" class="dropdown-item"> <i data-lucide="file-plus" class="w-4 h-4 mr-2"></i> New
Category </a>
</li>
<li>
<a href="" class="dropdown-item"> <i data-lucide="users" class="w-4 h-4 mr-2"></i> New Group
</a>
</li>
</ul>
</div>
</div>
<h2 class="intro-y text-lg font-medium mt-10">
{{'seller.orders.title'|_}}
</h2>
<div class="grid grid-cols-12 gap-6 mt-5">
<div class="intro-y col-span-12 flex flex-wrap xl:flex-nowrap items-center mt-2">
<div class="hidden xl:block mx-auto text-slate-500"></div>
</div>
<!-- BEGIN: Data List -->
<div class="intro-y col-span-12 overflow-auto 2xl:overflow-visible">
<table class="table table-report -mt-2">
<thead>
<tr>
<th class="whitespace-nowrap">{{'order.no'|_}}</th>
<th class="whitespace-nowrap">{{'customer.name'|_}}</th>
<th class="text-center whitespace-nowrap">{{'order.status'}}</th>
<th class="text-right whitespace-nowrap">
<div class="pr-16">{{'order.total.transaction'|_}}</div>
</th>
<th class="text-right whitespace-nowrap">
{{'order.qty'|_}}
</th>
</tr>
</thead>
<tbody id="seller_order">
</tbody>
</table>
</div>
<!-- END: Data List -->
<!-- BEGIN: Pagination -->
<!-- <div class="intro-y col-span-12 flex flex-wrap sm:flex-row sm:flex-nowrap items-center">
<nav class="w-full sm:w-auto sm:mr-auto">
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#"> <i class="w-4 h-4" data-lucide="chevrons-left"></i> </a>
</li>
<li class="page-item">
<a class="page-link" href="#"> <i class="w-4 h-4" data-lucide="chevron-left"></i> </a>
</li>
<li class="page-item"> <a class="page-link" href="#">...</a> </li>
<li class="page-item"> <a class="page-link" href="#">1</a> </li>
<li class="page-item active"> <a class="page-link" href="#">2</a> </li>
<li class="page-item"> <a class="page-link" href="#">3</a> </li>
<li class="page-item"> <a class="page-link" href="#">...</a> </li>
<li class="page-item">
<a class="page-link" href="#"> <i class="w-4 h-4" data-lucide="chevron-right"></i> </a>
</li>
<li class="page-item">
<a class="page-link" href="#"> <i class="w-4 h-4" data-lucide="chevrons-right"></i> </a>
</li>
</ul>
</nav>
<select class="w-20 form-select box mt-3 sm:mt-0">
<option>10</option>
<option>25</option>
<option>35</option>
<option>50</option>
</select>
</div> -->
<!-- END: Pagination -->
</div>
<!-- BEGIN: HTML Table Data -->
<div class="intro-y box p-5 mt-5">
<div class="flex flex-col sm:flex-row sm:items-end xl:items-start">
<form id="tabulator-html-filter-form" class="xl:flex sm:mr-auto">
<div class="sm:flex items-center sm:mr-4">
<label class="w-12 flex-none xl:w-auto xl:flex-initial mr-2">Field</label>
<select id="tabulator-html-filter-field"
class="form-select w-full sm:w-32 2xl:w-full mt-2 sm:mt-0 sm:w-auto">
<option value="name">Name</option>
<option value="category">Category</option>
<option value="remaining_stock">Remaining Stock</option>
</select>
</div>
<div class="sm:flex items-center sm:mr-4 mt-2 xl:mt-0">
<label class="w-12 flex-none xl:w-auto xl:flex-initial mr-2">Type</label>
<select id="tabulator-html-filter-type" class="form-select w-full mt-2 sm:mt-0 sm:w-auto">
<option value="like" selected>like</option>
<option value="=">=</option>
<option value="<">&lt;</option>
<option value="<=">&lt;=</option>
<option value=">">></option>
<option value=">=">>=</option>
<option value="!=">!=</option>
</select>
</div>
<div class="sm:flex items-center sm:mr-4 mt-2 xl:mt-0">
<label class="w-12 flex-none xl:w-auto xl:flex-initial mr-2">Value</label>
<input id="tabulator-html-filter-value" type="text" class="form-control sm:w-40 2xl:w-full mt-2 sm:mt-0"
placeholder="Search...">
</div>
<div class="mt-2 xl:mt-0">
<button id="tabulator-html-filter-go" type="button" class="btn btn-primary w-full sm:w-16">Go</button>
<button id="tabulator-html-filter-reset" type="button"
class="btn btn-secondary w-full sm:w-16 mt-2 sm:mt-0 sm:ml-1">Reset</button>
</div>
</form>
<div class="flex mt-5 sm:mt-0">
<button id="tabulator-print" class="btn btn-outline-secondary w-1/2 sm:w-auto mr-2"> <i
data-lucide="printer" class="w-4 h-4 mr-2"></i> Print </button>
<div class="dropdown w-1/2 sm:w-auto">
<button class="dropdown-toggle btn btn-outline-secondary w-full sm:w-auto" aria-expanded="false"
data-tw-toggle="dropdown"> <i data-lucide="file-text" class="w-4 h-4 mr-2"></i> Export <i
data-lucide="chevron-down" class="w-4 h-4 ml-auto sm:ml-2"></i> </button>
<div class="dropdown-menu w-40">
<ul class="dropdown-content">
<li>
<a id="tabulator-export-csv" href="javascript:;" class="dropdown-item"> <i
data-lucide="file-text" class="w-4 h-4 mr-2"></i> Export CSV </a>
</li>
<li>
<a id="tabulator-export-json" href="javascript:;" class="dropdown-item"> <i
data-lucide="file-text" class="w-4 h-4 mr-2"></i> Export JSON </a>
</li>
<li>
<a id="tabulator-export-xlsx" href="javascript:;" class="dropdown-item"> <i
data-lucide="file-text" class="w-4 h-4 mr-2"></i> Export XLSX </a>
</li>
<li>
<a id="tabulator-export-html" href="javascript:;" class="dropdown-item"> <i
data-lucide="file-text" class="w-4 h-4 mr-2"></i> Export HTML </a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="overflow-x-auto scrollbar-hidden">
<div id="tabulator" class="mt-5 table-report table-report--tabulator"></div>
</div>
</div>
<!-- END: HTML Table Data -->
{% partial "sellerApi/getOrders" sellerId=user.seller_id %}

View File

@ -0,0 +1,65 @@
{% put scripts %}
<script>
getOrders(`{{sellerId}}`);
// console.log("qqq");
function getOrders(sellerId) {
let formData = new FormData()
formData.append('user', "romanah_")
formData.append('password', "bt110226$$")
formData.append('seller_id', sellerId)
$(document).ready(function () {
$.ajax({
url: `https://nurgul.com.tm/app/api/seller/orders`,
type: 'POST',
data: formData,
cache: false,
contentType: false,
processData: false,
beforeSend: function () {
// $('#products_{{id}}').hide();
// $('#loader_{{id}}').show();
},
success: function (data, textStatus, xhr) {
// $('#loader_{{id}}').hide();
// $('#products_{{id}}').show();
console.log(data.data);
var orders = data.data;
for (var order of orders) {
$('#seller_order').append(`
<tr class="intro-x">
<td class="w-40 !py-4"> <a href=""
class="underline decoration-dotted whitespace-nowrap">#{{'order.title'|_}} `+ order.order_id + `</a> </td>
<td class="w-40">
<a href="" class="font-medium whitespace-nowrap">Keanu Reeves</a>
<div class="text-slate-500 text-xs whitespace-nowrap mt-0.5">Ohio, Ohio</div>
</td>
<td class="text-center">
<div class="flex items-center justify-center whitespace-nowrap text-success"> <i
data-lucide="check-square" class="w-4 h-4 mr-2"></i> `+ order.status + ` </div>
</td>
<td class="w-40 text-right">
<div class="pr-16">`+ order.base_seller_total + ` TMT</div>
</td>
<td class="w-40 text-right">
`+ order.total_qty_ordered + `
</td>
</tr>
`);
}
},
error: function (xhr, textStatus, errorThrown) {
console.log('Error in Operation');
}
});
});
}
</script>
{% endput %}