modify foodcourt addorder UI

This commit is contained in:
Zin Moe
2020-03-04 10:53:39 +06:30
parent a1b2514023
commit f396c0aff2
7 changed files with 178 additions and 307 deletions

View File

@@ -845,35 +845,42 @@ $(function() {
show_item_detail(item_data,"add_icon");
code = $(this).data('item-code');
element = $('#order-detail-slimscroll').find(`[data-code='${code}']`);
element = $('.summary-items').find(`[data-code='${code}']`);
item_qty = element.find('#item_qty').text()
parent = element.parents('.card-text')
// auto scroll to last order item
if (item_qty == 1) {
$('#order-detail-slimscroll').animate({
$(parent).animate({
scrollTop: $('.summary-items tbody tr:last').position().top - $('.summary-items tbody tr:first').position().top
})
}
// set border to current item
$('.summary-items tbody tr').css('background-color', '')
$('.summary-items tbody tr').css({
'background-color': '',
'color': ''
})
element.css({'background-color': '#2091F3'})
element.css({
'background-color': '#2091F3',
'color': '#fff'
})
// element.css('background-color', '#2091F3').delay(500)
// .queue(function() {
// $(this).css('background-color', '').dequeue();
// })
setTimeout(function() {
element.css('background-color', '');
}, 500);
calculate_sub_total();
if (isNotInView(element)) {
if (isNotInView(element, parent)) {
element.css({'background-color': '#2091F3'});
scrollToELement(element);
}
}); //End Add Icon Click
function isNotInView(elem){
function isNotInView(elem, parent){
// for scroll up | for scroll down
result = (($(elem).offset().top - 100) < $(elem).height() || $('#order-detail-slimscroll').height() < (elem.position().top + elem.outerHeight(true)));
result = (($(elem).offset().top - 100) < $(elem).height() || $(parent).height() < (elem.position().top + elem.outerHeight(true)));
console.log(result)
return result // reutn boolean
}
@@ -1082,7 +1089,8 @@ $(function() {
window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment";
}
else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment";
module_name = window.location.pathname.includes('origami') ? 'origami' : 'foodcourt'
window.location.href = "/"+module_name+"/sale/"+result.data["sale_id"]+"/"+type+"/payment";
}
}
}

View File

@@ -13,6 +13,37 @@ $(document).ready(function() {
touchScrollStep : 50
});
$('#foodcourt-slimscroll').slimScroll({
height: '100%',
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#foodcourt-order-slimscroll').slimScroll({
height: '100%',
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#foodcourt-menu-slimscroll').slimScroll({
height: '100%',
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
$('#table-slimscroll').slimScroll({
height: height,
size: '5px',