File: /var/www/javago-portal-updates/public/assets/js/cafe/cafeMenu.js
$(document).ready(function () {
let tmp = false;
let cafeMenuTable = $('#cafe_menu').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>',
},
// "sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [[10, 20, 30, 40, 50], [10, 20, 30, 40, 50]],
"pageLength": 10,
// "info": false,
processing: true,
serverSide: true,
ajax: {
'type': 'POST',
"url": getData,
"data": function (data) {
data.veg = $("#filter_form input[name='Veg']").prop('checked') ? $("#filter_form input[name='Veg']").val() : '';
data.nonVeg = $("#filter_form input[name='Non-Veg']").prop('checked') ? $("#filter_form input[name='Non-Veg']").val() : '';
data.vegan = $("#filter_form input[name='Vegan']").prop('checked') ? $("#filter_form input[name='Vegan']").val() : '';
}
},
fnDrawCallback: function() {
if (!tmp) {
$('#filter_form input[type="checkbox"]').each(function() {
$(this).prop('checked', false);
});
}
},
columns: [
{
data: 'DT_RowIndex',
name: 'DT_RowIndex',
orderable: false,
searchable: false
},
{
data: 'item_image',
name: 'item_image',
orderable: false,
searchable: false
},
{
data: 'item_name',
name: 'item_name',
orderable: false,
// searchable: false
},
{
data: 'item_category',
name: 'item_category',
orderable: false,
searchable: false
},
{
data: 'item_price',
name: 'item_price',
orderable: false,
searchable: false
},
// {
// data: 'item_description',
// name: 'item_description',
// orderable: false,
// searchable: false
// },
{
data: 'item_type',
name: 'item_type',
orderable: false,
searchable: false
},
{
data: 'status',
name: 'status',
orderable: false,
searchable: false
},
{
data: 'is_available',
name: 'is_available',
orderable: false,
searchable: false
},
{
data: 'action',
orderable: false,
searchable: false
}
],
order: [[1, '']],
});
// $("#filter_form").submit(function () {
$("#filter-save").click(function () {
tmp = true;
cafeMenuTable.draw();
// return false;
});
//review setup profile
$('#cafe_menu_review').DataTable({
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
"<'table-responsive'tr>" +
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
"oLanguage": {
"oPaginate": {
"sPrevious": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',
"sNext": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>',
},
// "sInfo": "Showing page _PAGE_ of _PAGES_",
"sSearch": '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
"sSearchPlaceholder": "Search...",
"sLengthMenu": "Results : _MENU_",
},
"stripeClasses": [],
"lengthMenu": [[10, 20, 30, 40, 50], [10, 20, 30, 40, 50]],
"pageLength": 10,
// "info": false,
processing: true,
serverSide: true,
ajax: {
'type': 'POST',
"url": reviewgetData,
"data": function (data) {
data.veg = $("#filter_form input[name='Veg']").prop('checked') ? $("#filter_form input[name='Veg']").val() : '';
data.nonVeg = $("#filter_form input[name='Non-Veg']").prop('checked') ? $("#filter_form input[name='Non-Veg']").val() : '';
data.vegan = $("#filter_form input[name='Vegan']").prop('checked') ? $("#filter_form input[name='Vegan']").val() : '';
}
},
fnDrawCallback: function() {
if (!tmp) {
$('#filter_form input[type="checkbox"]').each(function() {
$(this).prop('checked', false);
});
}
},
columns: [
{
data: 'DT_RowIndex',
name: 'DT_RowIndex',
orderable: false,
searchable: false
},
{
data: 'item_image',
name: 'item_image',
orderable: false,
searchable: false
},
{
data: 'item_name',
name: 'item_name',
orderable: false,
// searchable: false
},
{
data: 'item_category',
name: 'item_category',
orderable: false,
searchable: false
},
{
data: 'item_price',
name: 'item_price',
orderable: false,
searchable: false
},
// {
// data: 'item_description',
// name: 'item_description',
// orderable: false,
// searchable: false
// },
{
data: 'item_type',
name: 'item_type',
orderable: false,
searchable: false
},
{
data: 'status',
name: 'status',
orderable: false,
searchable: false
},
{
data: 'is_available',
name: 'is_available',
orderable: false,
searchable: false
},
{
data: 'action',
orderable: false,
searchable: false
}
],
order: [[1, '']],
});
});