/**
* App eCommerce review
*/
'use strict';
// apex-chart
(function () {
let cardColor, shadeColor, labelColor, headingColor;
if (isDarkStyle) {
cardColor = config.colors_dark.cardColor;
labelColor = config.colors_dark.textMuted;
headingColor = config.colors_dark.headingColor;
shadeColor = 'dark';
} else {
cardColor = config.colors.cardColor;
labelColor = config.colors.textMuted;
headingColor = config.colors.headingColor;
shadeColor = '';
}
// Visitor Bar Chart
// --------------------------------------------------------------------
const visitorBarChartEl = document.querySelector('#reviewsChart'),
visitorBarChartConfig = {
chart: {
height: 160,
width: 190,
type: 'bar',
toolbar: {
show: false
}
},
plotOptions: {
bar: {
barHeight: '75%',
columnWidth: '40%',
startingShape: 'rounded',
endingShape: 'rounded',
borderRadius: 5,
distributed: true
}
},
grid: {
show: false,
padding: {
top: -25,
bottom: -12
}
},
colors: [
config.colors_label.success,
config.colors_label.success,
config.colors_label.success,
config.colors_label.success,
config.colors.success,
config.colors_label.success,
config.colors_label.success
],
dataLabels: {
enabled: false
},
series: [
{
data: [20, 40, 60, 80, 100, 80, 60]
}
],
legend: {
show: false
},
xaxis: {
categories: ['M', 'T', 'W', 'T', 'F', 'S', 'S'],
axisBorder: {
show: false
},
axisTicks: {
show: false
},
labels: {
style: {
colors: labelColor,
fontSize: '13px'
}
}
},
yaxis: {
labels: {
show: false
}
},
responsive: [
{
breakpoint: 0,
options: {
chart: {
width: '100%'
},
plotOptions: {
bar: {
columnWidth: '40%'
}
}
}
},
{
breakpoint: 1440,
options: {
chart: {
height: 150,
width: 190,
toolbar: {
show: false
}
},
plotOptions: {
bar: {
borderRadius: 6,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 1400,
options: {
plotOptions: {
bar: {
borderRadius: 6,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 1200,
options: {
chart: {
height: 130,
width: 190,
toolbar: {
show: false
}
},
plotOptions: {
bar: {
borderRadius: 6,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 992,
chart: {
height: 150,
width: 190,
toolbar: {
show: false
}
},
options: {
plotOptions: {
bar: {
borderRadius: 5,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 883,
options: {
plotOptions: {
bar: {
borderRadius: 5,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 768,
options: {
chart: {
height: 150,
width: 190,
toolbar: {
show: false
}
},
plotOptions: {
bar: {
borderRadius: 4,
columnWidth: '40%'
}
}
}
},
{
breakpoint: 576,
options: {
chart: {
width: '100%',
height: '200',
type: 'bar'
},
plotOptions: {
bar: {
borderRadius: 6,
columnWidth: '30% '
}
}
}
},
{
breakpoint: 420,
options: {
plotOptions: {
chart: {
width: '100%',
height: '200',
type: 'bar'
},
bar: {
borderRadius: 3,
columnWidth: '30%'
}
}
}
}
]
};
if (typeof visitorBarChartEl !== undefined && visitorBarChartEl !== null) {
const visitorBarChart = new ApexCharts(visitorBarChartEl, visitorBarChartConfig);
visitorBarChart.render();
}
})();
// Datatable (jquery)
$(function () {
let borderColor, bodyBg, headingColor;
if (isDarkStyle) {
borderColor = config.colors_dark.borderColor;
bodyBg = config.colors_dark.bodyBg;
headingColor = config.colors_dark.headingColor;
} else {
borderColor = config.colors.borderColor;
bodyBg = config.colors.bodyBg;
headingColor = config.colors.headingColor;
}
// Variable declaration for table
var dt_customer_review = $('.datatables-review'),
customerView = 'app-ecommerce-customer-details-overview.html',
statusObj = {
Pending: { title: 'Pending', class: 'bg-label-warning' },
Published: { title: 'Published', class: 'bg-label-success' }
};
// reviewer datatable
if (dt_customer_review.length) {
var dt_review = dt_customer_review.DataTable({
ajax: assetsPath + 'json/app-ecommerce-reviews.json', // JSON file to add data
columns: [
// columns according to JSON
{ data: '' },
{ data: 'id' },
{ data: 'product' },
{ data: 'reviewer' },
{ data: 'review' },
{ data: 'date' },
{ data: 'status' },
{ data: ' ' }
],
columnDefs: [
{
// For Responsive
className: 'control',
searchable: false,
orderable: false,
responsivePriority: 2,
targets: 0,
render: function (data, type, full, meta) {
return '';
}
},
{
// For Checkboxes
targets: 1,
orderable: false,
searchable: false,
responsivePriority: 3,
checkboxes: true,
render: function () {
return '';
},
checkboxes: {
selectAllRender: ''
}
},
{
// product
targets: 2,
render: function (data, type, full, meta) {
var $product = full['product'],
$company_name = full['company_name'],
$id = full['id'],
$image = full['product_image'];
if ($image) {
// For Avatar image
var $output =
'';
} else {
// For Avatar badge
var stateNum = Math.floor(Math.random() * 6);
var states = ['success', 'danger', 'warning', 'info', 'dark', 'primary', 'secondary'];
var $state = states[stateNum],
$product = full['product'],
$initials = $product.match(/\b\w/g) || [];
$initials = (($initials.shift() || '') + ($initials.pop() || '')).toUpperCase();
$output = '' + $initials + '';
}
// Creates full output for row
var $row_output =
'
' + $heading + '
' + '' + $comment + '' + '