/** * Page Detail overview */ 'use strict'; // Datatable (jquery) $(function () { // Variable declaration for table var dt_customer_order = $('.datatables-customer-order'), order_details = 'app-ecommerce-order-details.html', statusObj = { 1: { title: 'Ready to Pickup', class: 'bg-label-info' }, 2: { title: 'Dispatched', class: 'bg-label-warning' }, 3: { title: 'Delivered', class: 'bg-label-success' }, 4: { title: 'Out for delivery', class: 'bg-label-primary' } }; // orders datatable if (dt_customer_order.length) { var dt_order = dt_customer_order.DataTable({ ajax: assetsPath + 'json/ecommerce-customer-order.json', // JSON file to add data columns: [ // columns according to JSON { data: '' }, { data: 'order' }, { data: 'date' }, { data: 'status' }, { data: 'spent' }, { data: ' ' } ], columnDefs: [ { // For Responsive className: 'control', searchable: false, orderable: false, responsivePriority: 2, targets: 0, render: function (data, type, full, meta) { return ''; } }, { // order order number targets: 1, responsivePriority: 4, render: function (data, type, full, meta) { var $id = full['order']; return "#" + $id + ''; } }, { // date targets: 2, render: function (data, type, full, meta) { var date = new Date(full.date); // convert the date string to a Date object var formattedDate = date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }); return '' + formattedDate + ' '; } }, { // status targets: 3, render: function (data, type, full, meta) { var $status = full['status']; return ( '' + statusObj[$status].title + '' ); } }, { // spent targets: 4, render: function (data, type, full, meta) { var $spent = full['spent']; return '' + $spent + ''; } }, { // Actions targets: -1, title: 'Actions', searchable: false, orderable: false, render: function (data, type, full, meta) { return ( '