mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Hide 2nd table when invoicing tasks by default
This commit is contained in:
parent
9186047e6c
commit
e32632cd9a
@ -1464,6 +1464,17 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
{
|
||||
return $this->isQuote() ? 'valid_until' : 'due_date';
|
||||
}
|
||||
|
||||
public function onlyHasTasks()
|
||||
{
|
||||
foreach ($this->invoice_items as $item) {
|
||||
if ($item->invoice_item_type_id != INVOICE_ITEM_TYPE_TASK) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Invoice::creating(function ($invoice) {
|
||||
|
@ -239,6 +239,10 @@ class InvoicePresenter extends EntityPresenter
|
||||
$actions[] = ['url' => url("quotes/{$invoice->quote->public_id}/edit"), 'label' => trans('texts.view_quote')];
|
||||
}
|
||||
|
||||
if ($invoice->onlyHasTasks()) {
|
||||
$actions[] = ['url' => 'javascript:onAddItemClick()', 'label' => trans('texts.add_item')];
|
||||
}
|
||||
|
||||
if ($invoice->canBePaid()) {
|
||||
$actions[] = ['url' => 'javascript:submitBulkAction("markPaid")', 'label' => trans('texts.mark_paid')];
|
||||
$actions[] = ['url' => 'javascript:onPaymentClick()', 'label' => trans('texts.enter_payment')];
|
||||
|
@ -1,6 +1,8 @@
|
||||
<thead {!! $isTasks ? 'style="display:none;" data-bind="visible: $root.hasTasks"' : (! empty($tasks) ? 'data-bind="visible: $root.hasItems"' : '') !!}>
|
||||
<thead {!! $isTasks ? 'style="display:none;" data-bind="visible: $root.hasTasks"' : ($invoice->exists || ! empty($tasks) ? 'data-bind="visible: $root.hasItems"' : '') !!}>
|
||||
@if ($isTasks)
|
||||
<tr><td style="20px" colspan="20"></td></tr>
|
||||
<tr data-bind="visible: $root.hasItems">
|
||||
<td style="20px" colspan="20"></td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th style="min-width:32px;" class="hide-border"></th>
|
||||
@ -19,7 +21,7 @@
|
||||
<th style="min-width:32px;" class="hide-border"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="sortable: { data: invoice_items_{{ $isTasks ? 'with_tasks' : 'without_tasks' }}, allowDrop: false, afterMove: onDragged} {{ $isTasks ? ', visible: $root.hasTasks' : (! empty($tasks) ? ', visible: $root.hasItems' : '') }}"
|
||||
<tbody data-bind="sortable: { data: invoice_items_{{ $isTasks ? 'with_tasks' : 'without_tasks' }}, allowDrop: false, afterMove: onDragged} {{ $isTasks ? ', visible: $root.hasTasks' : ($invoice->exists || ! empty($tasks) ? ', visible: $root.hasItems' : '') }}"
|
||||
{!! $isTasks ? 'style="display:none;border-spacing: 100px"' : '' !!}>
|
||||
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
||||
<td class="hide-border td-icon">
|
||||
|
Loading…
Reference in New Issue
Block a user