Viewing file: 4d47ef581c063263a2b46c0b38e0513fd3da6530.php (44.51 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $__env->startSection('title'); ?> <?php echo app('translator')->get('translation.orders'); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('css'); ?>
<link href="<?php echo e(URL::asset('assets/libs/sweetalert2/sweetalert2.min.css')); ?>" rel="stylesheet" type="text/css" />
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<?php $__env->startComponent('components.breadcrumb'); ?>
<?php $__env->slot('li_1'); ?> Ecommerce <?php $__env->endSlot(); ?>
<?php $__env->slot('title'); ?> Orders <?php $__env->endSlot(); ?>
<?php echo $__env->renderComponent(); ?>
<div class="row">
<div class="col-lg-12">
<div class="card" id="orderList">
<div class="card-header border-0">
<div class="d-flex align-items-center">
<h5 class="card-title mb-0 flex-grow-1">Order History</h5>
<div class="flex-shrink-0">
<button type="button" class="btn btn-success add-btn" data-bs-toggle="modal"
id="create-btn" data-bs-target="#showModal"><i
class="ri-add-line align-bottom me-1"></i> Create
Order</button>
<button type="button" class="btn btn-info"><i
class="ri-file-download-line align-bottom me-1"></i> Import</button>
<button class="btn btn-soft-danger" onClick="deleteMultiple()"><i
class="ri-delete-bin-2-line"></i></button>
</div>
</div>
</div>
<div class="card-body border border-dashed border-end-0 border-start-0">
<form>
<div class="row g-3">
<div class="col-xxl-5 col-sm-6">
<div class="search-box">
<input type="text" class="form-control search"
placeholder="Search for order ID, customer, order status or something...">
<i class="ri-search-line search-icon"></i>
</div>
</div>
<!--end col-->
<div class="col-xxl-2 col-sm-6">
<div>
<input type="text" class="form-control" data-provider="flatpickr"
data-date-format="d M, Y" data-range-date="true"
id="demo-datepicker" placeholder="Select date">
</div>
</div>
<!--end col-->
<div class="col-xxl-2 col-sm-4">
<div>
<select class="form-control" data-choices data-choices-search-false
name="choices-single-default" id="idStatus">
<option value="">Status</option>
<option value="all" selected>All</option>
<option value="Pending">Pending</option>
<option value="Inprogress">Inprogress</option>
<option value="Cancelled">Cancelled</option>
<option value="Pickups">Pickups</option>
<option value="Returns">Returns</option>
<option value="Delivered">Delivered</option>
</select>
</div>
</div>
<!--end col-->
<div class="col-xxl-2 col-sm-4">
<div>
<select class="form-control" data-choices data-choices-search-false
name="choices-single-default" id="idPayment">
<option value="">Select Payment</option>
<option value="all" selected>All</option>
<option value="Mastercard">Mastercard</option>
<option value="Paypal">Paypal</option>
<option value="Visa">Visa</option>
<option value="COD">COD</option>
</select>
</div>
</div>
<!--end col-->
<div class="col-xxl-1 col-sm-4">
<div>
<button type="button" class="btn btn-primary w-100"
onclick="SearchData();"> <i
class="ri-equalizer-fill me-1 align-bottom"></i>
Filters
</button>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
</form>
</div>
<div class="card-body pt-0">
<div>
<ul class="nav nav-tabs nav-tabs-custom nav-success mb-3" role="tablist">
<li class="nav-item">
<a class="nav-link active All py-3" data-bs-toggle="tab" id="All"
href="#home1" role="tab" aria-selected="true">
<i class="ri-store-2-fill me-1 align-bottom"></i> All Orders
</a>
</li>
<li class="nav-item">
<a class="nav-link py-3 Open" data-bs-toggle="tab" id="Open"
href="#open" role="tab" aria-selected="false">
<i class="ri-checkbox-circle-line me-1 align-bottom"></i> Open
</a>
</li>
<li class="nav-item">
<a class="nav-link py-3 Done" data-bs-toggle="tab" id="Done"
href="#done" role="tab" aria-selected="false">
<i class="ri-truck-line me-1 align-bottom"></i> Done
<!-- <span
class="badge bg-danger align-middle ms-1">2</span> -->
</a>
</li>
</ul>
<div class="table-responsive table-card mb-1">
<table class="table table-nowrap align-middle" id="orderTable">
<thead class="text-muted table-light">
<tr class="text-uppercase">
<th scope="col" style="width: 25px;">
<div class="form-check">
<input class="form-check-input" type="checkbox"
id="checkAll" value="option">
</div>
</th>
<th class="sort" data-sort="id">Order#</th>
<th>Customer</th>
<th>Total Amount</th>
<th>Delivery Deadline</th>
<th>Sales Items</th>
<th>Ingredients</th>
<th>Production</th>
<th>Delivery</th>
<th>Action</th>
</tr>
</thead>
<tbody class="list form-check-all">
<tr>
<th scope="row">
<div class="form-check">
<input class="form-check-input" type="checkbox"
name="checkAll" value="option1">
</div>
</th>
<td class="id"><a href="apps-ecommerce-order-details"
class="fw-medium link-primary"></a></td>
<td class="customer_name"></td>
<td class="amount"></td>
<td class="delivery_date"></td>
<td class="sales_item"></td>
<td class="ingredients"><span
class="badge badge-soft-warning text-uppercase"></span>
</td>
<td class="production"></td>
<td class="delivery"></td>
<td>
<ul class="list-inline hstack gap-2 mb-0">
<li class="list-inline-item" data-bs-toggle="tooltip"
data-bs-trigger="hover" data-bs-placement="top"
title="View">
<a href="apps-ecommerce-order-details"
class="text-primary d-inline-block">
<i class="ri-eye-fill fs-16"></i>
</a>
</li>
<li class="list-inline-item edit"
data-bs-toggle="tooltip" data-bs-trigger="hover"
data-bs-placement="top" title="Edit">
<a href="#showModal" data-bs-toggle="modal"
class="text-primary d-inline-block edit-item-btn">
<i class="ri-pencil-fill fs-16"></i>
</a>
</li>
<li class="list-inline-item" data-bs-toggle="tooltip"
data-bs-trigger="hover" data-bs-placement="top"
title="Remove">
<a class="text-danger d-inline-block remove-item-btn"
data-bs-toggle="modal" href="#deleteOrder">
<i class="ri-delete-bin-5-fill fs-16"></i>
</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="noresult" style="display: none">
<div class="text-center">
<lord-icon src="https://cdn.lordicon.com/msoeawqm.json"
trigger="loop" colors="primary:#405189,secondary:#0ab39c"
style="width:75px;height:75px">
</lord-icon>
<h5 class="mt-2">Sorry! No Result Found</h5>
<p class="text-muted">We've searched more than 150+ Orders We did
not find any
orders for you search.</p>
</div>
</div>
</div>
<div class="d-flex justify-content-end">
<div class="pagination-wrap hstack gap-2">
<a class="page-item pagination-prev disabled" href="#">
Previous
</a>
<ul class="pagination listjs-pagination mb-0"></ul>
<a class="page-item pagination-next" href="#">
Next
</a>
</div>
</div>
</div>
<div class="modal fade" id="showModal" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light p-3">
<h5 class="modal-title" id="exampleModalLabel"> </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close" id="close-modal"></button>
</div>
<form action="#">
<div class="modal-body">
<input type="hidden" id="id-field" />
<div class="mb-3" id="modal-id">
<label for="orderId" class="form-label">ID</label>
<input type="text" id="orderId" class="form-control"
placeholder="ID" readonly />
</div>
<div class="mb-3">
<label for="customername-field" class="form-label">Customer
Name</label>
<input type="text" id="customername-field"
class="form-control" placeholder="Enter name"
required />
</div>
<div class="mb-3">
<label for="productname-field"
class="form-label">Product</label>
<select class="form-control" data-trigger
name="productname-field" id="productname-field">
<option value="">Product</option>
<option value="Puma Tshirt">Puma Tshirt</option>
<option value="Adidas Sneakers">Adidas Sneakers</option>
<option value="350 ml Glass Grocery Container">350 ml
Glass Grocery Container</option>
<option value="American egale outfitters Shirt">American
egale outfitters Shirt</option>
<option value="Galaxy Watch4">Galaxy Watch4</option>
<option value="Apple iPhone 12">Apple iPhone 12</option>
<option value="Funky Prints T-shirt">Funky Prints
T-shirt</option>
<option
value="USB Flash Drive Personalized with 3D Print">
USB Flash Drive Personalized with 3D Print</option>
<option value="Oxford Button-Down Shirt">Oxford
Button-Down Shirt</option>
<option value="Classic Short Sleeve Shirt">Classic Short
Sleeve Shirt</option>
<option value="Half Sleeve T-Shirts (Blue)">Half Sleeve
T-Shirts (Blue)</option>
<option value="Noise Evolve Smartwatch">Noise Evolve
Smartwatch</option>
</select>
</div>
<div class="mb-3">
<label for="date-field" class="form-label">Order
Date</label>
<input type="date" id="date-field" class="form-control"
data-provider="flatpickr" data-date-format="d M, Y"
data-enable-time required placeholder="Select date" />
</div>
<div class="row gy-4 mb-3">
<div class="col-md-6">
<div>
<label for="amount-field"
class="form-label">Amount</label>
<input type="text" id="amount-field"
class="form-control" placeholder="Total amount"
required />
</div>
</div>
<div class="col-md-6">
<div>
<label for="payment-field"
class="form-label">Payment
Method</label>
<select class="form-control" data-trigger
name="payment-method" id="payment-field" required>
<option value="">Payment Method</option>
<option value="Mastercard">Mastercard</option>
<option value="Visa">Visa</option>
<option value="COD">COD</option>
<option value="Paypal">Paypal</option>
</select>
<div class="invalid-tooltip">
Please select a valid state.
</div>
</div>
</div>
</div>
<div>
<label for="delivered-status" class="form-label">Delivery
Status</label>
<select class="form-control" data-trigger
name="delivered-status" id="delivered-status">
<option value="">Delivery Status</option>
<option value="Pending">Pending</option>
<option value="Inprogress">Inprogress</option>
<option value="Cancelled">Cancelled</option>
<option value="Pickups">Pickups</option>
<option value="Delivered">Delivered</option>
<option value="Returns">Returns</option>
</select>
</div>
</div>
<div class="modal-footer">
<div class="hstack gap-2 justify-content-end">
<button type="button" class="btn btn-light"
data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-success"
id="add-btn">Add Order</button>
<button type="button" class="btn btn-success"
id="edit-btn">Update</button>
</div>
</div>
</form>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade flip" id="deleteOrder" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body p-5 text-center">
<lord-icon src="https://cdn.lordicon.com/gsqxdxog.json"
trigger="loop" colors="primary:#405189,secondary:#f06548"
style="width:90px;height:90px"></lord-icon>
<div class="mt-4 text-center">
<h4>You are about to delete a order ?</h4>
<p class="text-muted fs-15 mb-4">Deleting your order will remove
all of
your information from our database.</p>
<div class="hstack gap-2 justify-content-center remove">
<button
class="btn btn-link link-success fw-medium text-decoration-none"
data-bs-dismiss="modal" id="deleteRecord-close" ><i
class="ri-close-line me-1 align-middle"></i>
Close</button>
<button class="btn btn-danger" id="delete-record">Yes,
Delete It</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--end modal -->
</div>
</div>
</div>
<!--end col-->
</div>
<!--end row-->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script src="<?php echo e(URL::asset('assets/libs/list.js/list.js.min.js')); ?>"></script>
<script src="<?php echo e(URL::asset('assets/libs/list.pagination.js/list.pagination.js.min.js')); ?>"></script>
<!--ecommerce-customer init js -->
<!-- <script src="<?php echo e(URL::asset('assets/js/pages/ecommerce-order.init.js')); ?>"></script> -->
<script src="<?php echo e(URL::asset('assets/libs/sweetalert2/sweetalert2.min.js')); ?>"></script>
<script src="<?php echo e(URL::asset('/assets/js/app.min.js')); ?>"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(function () {
var url = window.location;
// for single sidebar menu
$('ul.navbar-nav a').filter(function () {
return this.href == url;
}).addClass('active');
});
var str_dt = function formatDate(date) {
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var d = new Date(date),
time_s = (d.getHours() + ':' + d.getMinutes());
var t = time_s.split(":");
var hours = t[0];
var minutes = t[1];
var newformat = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12;
minutes = minutes < 10 ? '0' + minutes : minutes;
month = '' + monthNames[(d.getMonth())],
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [day + " " + month + "," + year + " <small class='text-muted'>" + hours + ':' + minutes + ' ' + newformat + "</small>"];
};
var isChoiceEl = document.getElementById("idStatus");
var choices = new Choices(isChoiceEl, {
searchEnabled: false,
});
var isPaymentEl = document.getElementById("idPayment");
var choices = new Choices(isPaymentEl, {
searchEnabled: false,
});
var checkAll = document.getElementById("checkAll");
if (checkAll) {
checkAll.onclick = function() {
var checkboxes = document.querySelectorAll('.form-check-all input[type="checkbox"]');
if (checkAll.checked == true) {
Array.from(checkboxes).forEach(function(checkbox) {
checkbox.checked = true;
checkbox.closest("tr").classList.add("table-active");
});
} else {
Array.from(checkboxes).forEach(function(checkbox) {
checkbox.checked = false;
checkbox.closest("tr").classList.remove("table-active");
});
}
};
}
var perPage = 8;
//Table
var options = {
valueNames: [
"id",
"customer_name",
"amount",
"delivery_date",
"sales_item",
"ingredients",
"production",
"delivery"
],
page: perPage,
pagination: true,
plugins: [
ListPagination({
left: 2,
right: 2,
}),
],
};
// Init list
var orderList = new List("orderList", options).on("updated", function(list) {
list.matchingItems.length == 0 ?
(document.getElementsByClassName("noresult")[0].style.display = "block") :
(document.getElementsByClassName("noresult")[0].style.display = "none");
var isFirst = list.i == 1;
var isLast = list.i > list.matchingItems.length - list.page;
// make the Prev and Nex buttons disabled on first and last pages accordingly
document.querySelector(".pagination-prev.disabled") ?
document.querySelector(".pagination-prev.disabled").classList.remove("disabled") : "";
document.querySelector(".pagination-next.disabled") ?
document.querySelector(".pagination-next.disabled").classList.remove("disabled") : "";
if (isFirst) {
document.querySelector(".pagination-prev").classList.add("disabled");
}
if (isLast) {
document.querySelector(".pagination-next").classList.add("disabled");
}
if (list.matchingItems.length <= perPage) {
document.querySelector(".pagination-wrap").style.display = "none";
} else {
document.querySelector(".pagination-wrap").style.display = "flex";
}
if (list.matchingItems.length == perPage) {
document.querySelector(".pagination.listjs-pagination").firstElementChild.children[0].click()
}
if (list.matchingItems.length > 0) {
document.getElementsByClassName("noresult")[0].style.display = "none";
} else {
document.getElementsByClassName("noresult")[0].style.display = "block";
}
});
// data into
$.ajax({
type:'get',
url:'/get_orders',
success:function(data) {
// $("#msg").html(data.msg);
var json_records = JSON.parse(data);
Array.from(json_records).forEach(function(element) {
var st;
if (element.status=="0") {
st="Open";
}else{
st="Done";
}
var url = '<?php echo e(route("order_details", ":order_id")); ?>';
url = url.replace(':order_id', element.id);
orderList.add({
id: '<a href="'+url+'" class="fw-medium link-primary">#' + element.id + '</a>',
customer_name: element.customer_name,
amount: element.amount,
delivery_date: str_dt(element.delivery_date),
sales_item: element.sales_item,
ingredients: element.ingredients,
production: element.production,
delivery: element.delivery,
status: '<span class="badge badge-soft-success text-uppercase">' +
st +
"</span>"
});
orderList.sort('id', { order: "desc" });
refreshCallbacks();
});
orderList.remove("id", `<a href="apps-ecommerce-order-details" class="fw-medium link-primary"></a>`);
}
});
isCount = new DOMParser().parseFromString(
orderList.items.slice(-1)[0]._values.id,
"text/html"
);
var isValue = isCount.body.firstElementChild.innerHTML;
var idField = document.getElementById("orderId"),
customerNameField = document.getElementById("customername-field"),
productNameField = document.getElementById("productname-field"),
dateField = document.getElementById("date-field"),
amountField = document.getElementById("amount-field"),
paymentField = document.getElementById("payment-field"),
statusField = document.getElementById("delivered-status"),
addBtn = document.getElementById("add-btn"),
editBtn = document.getElementById("edit-btn"),
removeBtns = document.getElementsByClassName("remove-item-btn"),
editBtns = document.getElementsByClassName("edit-item-btn");
refreshCallbacks();
//filterOrder("All");
var tabEl = document.querySelectorAll('a[data-bs-toggle="tab"]');
Array.from(tabEl).forEach(function(item) {
item.addEventListener("shown.bs.tab", function(event) {
filterOrder(event.target.id);
});
});
function filterOrder(isValue) {
var values_status = isValue;
orderList.filter(function(data) {
var statusFilter = false;
matchData = new DOMParser().parseFromString(
data.values().status,
"text/html"
);
var status = matchData.body.firstElementChild.innerHTML;
if ( status =="All" || values_status == "All") {
statusFilter = true;
} else {
statusFilter = status == values_status;
}
return statusFilter;
});
orderList.update();
}
function updateList() {
var values_status = document.querySelector("input[name=status]:checked").value;
data = userList.filter(function(item) {
var statusFilter = false;
if (values_status == "All") {
statusFilter = true;
} else {
statusFilter = item.values().sts == values_status;
}
return statusFilter;
});
userList.update();
}
document.getElementById("showModal").addEventListener("show.bs.modal", function(e) {
if (e.relatedTarget.classList.contains("edit-item-btn")) {
document.getElementById("exampleModalLabel").innerHTML = "Edit Order";
document.getElementById("showModal").querySelector(".modal-footer").style.display = "block";
document.getElementById("add-btn").style.display = "none";
document.getElementById("edit-btn").style.display = "block";
} else if (e.relatedTarget.classList.contains("add-btn")) {
document.getElementById("modal-id").style.display = "none";
document.getElementById("exampleModalLabel").innerHTML = "Add Order";
document.getElementById("showModal").querySelector(".modal-footer").style.display = "block";
document.getElementById("edit-btn").style.display = "none";
document.getElementById("add-btn").style.display = "block";
} else {
document.getElementById("exampleModalLabel").innerHTML = "List Order";
document.getElementById("showModal").querySelector(".modal-footer").style.display = "none";
}
});
ischeckboxcheck();
document.getElementById("showModal").addEventListener("hidden.bs.modal", function() {
clearFields();
});
document.querySelector("#orderList").addEventListener("click", function() {
refreshCallbacks();
ischeckboxcheck();
});
var table = document.getElementById("orderTable");
// save all tr
var tr = table.getElementsByTagName("tr");
var trlist = table.querySelectorAll(".list tr");
function SearchData() {
var isstatus = document.getElementById("idStatus").value;
var payment = document.getElementById("idPayment").value;
var pickerVal = document.getElementById("demo-datepicker").value;
var date1 = pickerVal.split(" to ")[0];
var date2 = pickerVal.split(" to ")[1];
orderList.filter(function(data) {
matchData = new DOMParser().parseFromString(
data.values().status,
"text/html"
);
var status = matchData.body.firstElementChild.innerHTML;
var statusFilter = false;
var paymentFilter = false;
var dateFilter = false;
if (status == "all" || isstatus == "all") {
statusFilter = true;
} else {
statusFilter = status == isstatus;
}
if (data.values().payment == "all" || payment == "all") {
paymentFilter = true;
} else {
paymentFilter = data.values().payment == payment;
}
if (
new Date(data.values().date.slice(0, 12)) >= new Date(date1) &&
new Date(data.values().date.slice(0, 12)) <= new Date(date2)
) {
dateFilter = true;
} else {
dateFilter = false;
}
if (statusFilter && paymentFilter && dateFilter) {
return statusFilter && paymentFilter && dateFilter;
} else if (statusFilter && paymentFilter && pickerVal == "") {
return statusFilter && paymentFilter;
} else if (paymentFilter && dateFilter && pickerVal == "") {
return paymentFilter && dateFilter;
}
});
orderList.update();
}
var count = 13;
// addBtn.addEventListener("click", function(e) {
// if (
// customerNameField.value !== "" &&
// productNameField.value !== "" &&
// dateField.value !== "" &&
// amountField.value !== "" &&
// paymentField.value !== ""
// ) {
// orderList.add({
// id: '<a href="apps-ecommerce-order-details" class="fw-medium link-primary">#VZ' + count + "</a>",
// customer_name: customerNameField.value,
// product_name: productNameField.value,
// date: dateField.value,
// amount: "$" + amountField.value,
// payment: paymentField.value,
// status: isStatus(statusField.value),
// });
// orderList.sort('id', { order: "desc" });
// document.getElementById("close-modal").click();
// clearFields();
// refreshCallbacks();
// filterOrder("All");
// count++;
// Swal.fire({
// position: 'center',
// icon: 'success',
// title: 'Order inserted successfully!',
// showConfirmButton: false,
// timer: 2000,
// showCloseButton: true
// });
// }
// });
// editBtn.addEventListener("click", function(e) {
// document.getElementById("exampleModalLabel").innerHTML = "Edit Order";
// var editValues = orderList.get({
// id: idField.value,
// });
// Array.from(editValues).forEach(function(x) {
// isid = new DOMParser().parseFromString(x._values.id, "text/html");
// var selectedid = isid.body.firstElementChild.innerHTML;
// if (selectedid == itemId) {
// x.values({
// id: '<a href="javascript:void(0);" class="fw-medium link-primary">' + idField.value + "</a>",
// customer_name: customerNameField.value,
// product_name: productNameField.value,
// date: dateField.value.slice(0, 14) + '<small class="text-muted">' + dateField.value.slice(14, 22),
// amount: amountField.value,
// payment: paymentField.value,
// status: isStatus(statusField.value),
// });
// }
// });
// document.getElementById("close-modal").click();
// clearFields();
// Swal.fire({
// position: 'center',
// icon: 'success',
// title: 'Order updated Successfully!',
// showConfirmButton: false,
// timer: 2000,
// showCloseButton: true
// });
// });
var example = new Choices(paymentField);
var statusVal = new Choices(statusField);
var productnameVal = new Choices(productNameField);
function isStatus(val) {
switch (val) {
case "Delivered":
return (
'<span class="badge badge-soft-success text-uppercase">' +
val +
"</span>"
);
case "Cancelled":
return (
'<span class="badge badge-soft-danger text-uppercase">' +
val +
"</span>"
);
case "Inprogress":
return (
'<span class="badge badge-soft-secondary text-uppercase">' +
val +
"</span>"
);
case "Pickups":
return (
'<span class="badge badge-soft-info text-uppercase">' + val + "</span>"
);
case "Returns":
return (
'<span class="badge badge-soft-primary text-uppercase">' +
val +
"</span>"
);
case "Pending":
return (
'<span class="badge badge-soft-warning text-uppercase">' +
val +
"</span>"
);
}
}
function ischeckboxcheck() {
Array.from(document.getElementsByName("checkAll")).forEach(function(x) {
x.addEventListener("click", function(e) {
if (e.target.checked) {
e.target.closest("tr").classList.add("table-active");
} else {
e.target.closest("tr").classList.remove("table-active");
}
});
});
}
function refreshCallbacks() {
Array.from(removeBtns).forEach(function(btn) {
btn.addEventListener("click", function(e) {
e.target.closest("tr").children[1].innerText;
itemId = e.target.closest("tr").children[1].innerText;
var itemValues = orderList.get({
id: itemId,
});
Array.from(itemValues).forEach(function(x) {
deleteid = new DOMParser().parseFromString(x._values.id, "text/html");
var isElem = deleteid.body.firstElementChild;
var isdeleteid = deleteid.body.firstElementChild.innerHTML;
if (isdeleteid == itemId) {
document.getElementById("delete-record").addEventListener("click", function() {
orderList.remove("id", isElem.outerHTML);
document.getElementById("deleteRecord-close").click();
});
}
});
});
});
Array.from(editBtns).forEach(function(btn) {
btn.addEventListener("click", function(e) {
e.target.closest("tr").children[1].innerText;
itemId = e.target.closest("tr").children[1].innerText;
var itemValues = orderList.get({
id: itemId,
});
Array.from(itemValues).forEach(function(x) {
isid = new DOMParser().parseFromString(x._values.id, "text/html");
var selectedid = isid.body.firstElementChild.innerHTML;
if (selectedid == itemId) {
idField.value = selectedid;
customerNameField.value = x._values.customer_name;
productNameField.value = x._values.product_name;
dateField.value = x._values.date;
amountField.value = x._values.amount;
if (example) example.destroy();
example = new Choices(paymentField, {
searchEnabled: false
});
var selected = x._values.payment;
example.setChoiceByValue(selected);
if (productnameVal) productnameVal.destroy();
productnameVal = new Choices(productNameField, {
searchEnabled: false,
});
var selectedproduct = x._values.product_name;
productnameVal.setChoiceByValue(selectedproduct);
if (statusVal) statusVal.destroy();
statusVal = new Choices(statusField, {
searchEnabled: false
});
val = new DOMParser().parseFromString(x._values.status, "text/html");
var statusSelec = val.body.firstElementChild.innerHTML;
statusVal.setChoiceByValue(statusSelec);
flatpickr("#date-field", {
enableTime: true,
dateFormat: "d M, Y, h:i K",
defaultDate: x._values.date,
});
}
});
});
});
}
function clearFields() {
customerNameField.value = "";
productNameField.value = "";
dateField.value = "";
amountField.value = "";
paymentField.value = "";
if (example) example.destroy();
example = new Choices(paymentField);
if (productnameVal) productnameVal.destroy();
productnameVal = new Choices(productNameField);
if (statusVal) statusVal.destroy();
statusVal = new Choices(statusField);
}
document.querySelector(".pagination-next").addEventListener("click", function() {
document.querySelector(".pagination.listjs-pagination") ?
document.querySelector(".pagination.listjs-pagination").querySelector(".active") ?
document.querySelector(".pagination.listjs-pagination").querySelector(".active").nextElementSibling.children[0].click() : "" : "";
});
document.querySelector(".pagination-prev").addEventListener("click", function() {
document.querySelector(".pagination.listjs-pagination") ?
document.querySelector(".pagination.listjs-pagination").querySelector(".active") ?
document.querySelector(".pagination.listjs-pagination").querySelector(".active").previousSibling.children[0].click() : "" : "";
});
// Delete Multiple Records
function deleteMultiple() {
ids_array = [];
var items = document.querySelectorAll('.form-check [value=option1]');
Array.from(items).forEach(function(ele) {
if (ele.checked == true) {
var id_value = ele.parentNode.parentNode.parentNode;
var id_get = id_value.querySelector("td a").innerHTML;
ids_array.push(id_get);
}
});
if (typeof ids_array !== 'undefined' && ids_array.length > 0) {
if (confirm('Are you sure you want to delete this?')) {
Array.from(ids_array).forEach(function(id) {
orderList.remove("id", `<a href="apps-ecommerce-order-details" class="fw-medium link-primary">` + id + `</a>`);
});
document.getElementById("checkAll").checked = false;
} else {
return false;
}
} else {
Swal.fire({
title: 'Please select at least one checkbox',
confirmButtonClass: 'btn btn-info',
buttonsStyling: false,
showCloseButton: true
});
}
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\jiff\default\resources\views/pages/orders.blade.php ENDPATH**/ ?>
|