modify foodcourt addorder UI
This commit is contained in:
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user