$(document).ready(function() { /* expand order details */ $('.myacc_ic_cb_expandComanda').click(function() { $(this).closest('.myacc_ic_cb_bottomBox').addClass('active'); $(this).parent().find('.myacc_ic_cb_hideComanda').show(); var $orderBlock = $(this).hide().closest('.myacc_istoricComenzi_comandaBox').find('.myacc_ic_cb_infoComandaWrapper'); var renewal = $orderBlock.data('isrenewal'); if(renewal == true) { var id = $orderBlock.data('orderrefid'); if($orderBlock.find('#order_renewal_link').length == 0) { getDocUrl(id, $orderBlock); } } $(this).hide().closest('.myacc_istoricComenzi_comandaBox').find('.myacc_ic_cb_infoComandaWrapper').show(); var windw = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if (windw > 1200) { var maxHeight = 0; function eqHeightTotalTables() { $(".myacc_ic_cb_dciBox").each(function(){ if ($(this).outerHeight() > maxHeight) {maxHeight = $(this).outerHeight();} }); $(".myacc_ic_cb_dciBox").css('min-height', maxHeight); } setTimeout(eqHeightTotalTables, 200); } return false; }); /* hide order details */ $('.myacc_ic_cb_hideComanda').click(function() { $(this).closest('.myacc_ic_cb_bottomBox').removeClass('active'); $(this).parent().find('.myacc_ic_cb_expandComanda').show(); $(this).hide().closest('.myacc_istoricComenzi_comandaBox').find('.myacc_ic_cb_infoComandaWrapper').hide(); return false; }); $(".showOrderCancellationModal").click(function() { var orderId = $(this).attr("id"); orderId = orderId.split("-"); $("#orderIdForCancellation").val(orderId[1]); $("#cancelOrderForm").find(".modal").modal("show"); }); $("#modalCancelOrderConfirmationButton").click(function() { $("#cancelOrderForm").find("input[type=submit]").click(); return false; }); }); function getDocUrl(orderRefId, block) { if(orderRefId != null) { $.ajax({ url : '/blocks/myaccount/one/istoricActiuni/renewalDocumentUrlOrderJsonObject.jsp', async : true, dataType : 'html', data : "orderRefId=" + orderRefId, success : function(data) { data = data.trim(); if(data.length > 0) { $(block).find('#renewal_pdf').append(data); } }, error : function() { } }); } }