hide left_sidebar and auto_scroll to item in add order table
This commit is contained in:
@@ -842,10 +842,47 @@ $(function() {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
|
||||
show_item_detail(item_data,"add_icon");
|
||||
code = $(this).data('item-code');
|
||||
element = $('#order-detail-slimscroll').find(`[data-code='${code}']`);
|
||||
item_qty = element.find('#item_qty').text()
|
||||
|
||||
// auto scroll to last order item
|
||||
if (item_qty == 1) {
|
||||
$('#order-detail-slimscroll').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', '')
|
||||
|
||||
element.css({'background-color': '#2091F3'})
|
||||
|
||||
setTimeout(function() {
|
||||
element.css('background-color', '');
|
||||
}, 500);
|
||||
|
||||
calculate_sub_total();
|
||||
|
||||
if (isNotInView(element)) {
|
||||
element.css({'background-color': '#2091F3'});
|
||||
scrollToELement(element);
|
||||
}
|
||||
}); //End Add Icon Click
|
||||
|
||||
function isNotInView(elem){
|
||||
// for scroll up | for scroll down
|
||||
result = (($(elem).offset().top - 100) < $(elem).height() || $('#order-detail-slimscroll').height() < (elem.position().top + elem.outerHeight(true)));
|
||||
console.log(result)
|
||||
return result // reutn boolean
|
||||
}
|
||||
|
||||
function scrollToELement(elem) {
|
||||
console.log('Scroll into view')
|
||||
elem[0].scrollIntoView();
|
||||
}
|
||||
|
||||
function show_item_detail(data,click_type){
|
||||
testqty = parseInt($('.item_box').children('data_qty').text());
|
||||
qty = parseInt(data.attr('data-qty'));
|
||||
|
||||
Reference in New Issue
Block a user