Show placeholder row if no invoice items are left
This commit is contained in:
parent
3132812308
commit
0615ae0dc8
2 changed files with 11 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -266,8 +266,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="14" class="placeholder-row">
|
||||
<tr class="placeholder-row">
|
||||
<td colspan="14">
|
||||
No items to display.
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -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');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue