From 0615ae0dc89d6865e5a98d79f4f36ce03da8c308 Mon Sep 17 00:00:00 2001 From: Ramon Gutierrez Date: Wed, 17 Jan 2018 20:47:49 +0800 Subject: [PATCH] Show placeholder row if no invoice items are left --- public/assets/css/style.css | 2 +- templates/job-order/incoming.html.twig | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 5d856433..c6ec12a6 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -104,7 +104,7 @@ span.has-danger, font-weight: 400; } -.placeholder-row { +.placeholder-row td { background-color: #fff !important; padding: 32px 0 !important; text-align: center; diff --git a/templates/job-order/incoming.html.twig b/templates/job-order/incoming.html.twig index 744419a5..642bdfc5 100644 --- a/templates/job-order/incoming.html.twig +++ b/templates/job-order/incoming.html.twig @@ -266,8 +266,8 @@ - - + + No items to display. @@ -682,6 +682,7 @@ $(function() { // remove from invoice table $(document).on("click", ".btn-invoice-delete", function() { + var tbody = $("#invoice-table tbody"); var row = $(this).closest('tr'); var qty = row.find('.col-quantity').html(); var unitPrice = row.find('.col-unit-price').html(); @@ -702,6 +703,13 @@ $(function() { // remove from table row.remove(); + + // get total item rows and show placeholder if needed + var visibleRows = tbody.find('tr:not(.placeholder-row)').length; + + if (visibleRows === 0) { + tbody.find('.placeholder-row').removeClass('hide'); + } }); });