mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Hide 2nd table when invoicing tasks by default
This commit is contained in:
parent
507ac7387c
commit
050df75868
@ -2425,6 +2425,7 @@ $LANG = array(
|
|||||||
'include_errors' => 'Include Errors',
|
'include_errors' => 'Include Errors',
|
||||||
'include_errors_help' => 'Include :link from storage/logs/laravel-error.log',
|
'include_errors_help' => 'Include :link from storage/logs/laravel-error.log',
|
||||||
'recent_errors' => 'recent errors',
|
'recent_errors' => 'recent errors',
|
||||||
|
'add_item' => 'Add Item',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -536,8 +536,10 @@
|
|||||||
@endif
|
@endif
|
||||||
@if ($invoice->id)
|
@if ($invoice->id)
|
||||||
{!! DropdownButton::normal(trans('texts.more_actions'))->withContents($invoice->present()->moreActions())->dropup() !!}
|
{!! DropdownButton::normal(trans('texts.more_actions'))->withContents($invoice->present()->moreActions())->dropup() !!}
|
||||||
@elseif ( ! $invoice->isQuote() && Request::is('*/clone'))
|
@elseif (! $invoice->isQuote() && Request::is('*/clone'))
|
||||||
{!! Button::normal(trans($invoice->is_recurring ? 'texts.disable_recurring' : 'texts.enable_recurring'))->withAttributes(['id' => 'recurrButton', 'onclick' => 'onRecurrClick()'])->appendIcon(Icon::create('repeat')) !!}
|
{!! Button::normal(trans($invoice->is_recurring ? 'texts.disable_recurring' : 'texts.enable_recurring'))->withAttributes(['id' => 'recurrButton', 'onclick' => 'onRecurrClick()'])->appendIcon(Icon::create('repeat')) !!}
|
||||||
|
@elseif (! empty($tasks))
|
||||||
|
{!! Button::normal(trans('texts.add_item'))->withAttributes(['id' => 'addItemButton', 'onclick' => 'onAddItemClick()'])->appendIcon(Icon::create('plus-sign')) !!}
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
@if ($invoice->trashed())
|
@if ($invoice->trashed())
|
||||||
@ -1224,6 +1226,11 @@
|
|||||||
$('#saveButton').html(actionLabel + "<span class='glyphicon glyphicon-globe'></span>");
|
$('#saveButton').html(actionLabel + "<span class='glyphicon glyphicon-globe'></span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onAddItemClick() {
|
||||||
|
model.forceShowItems(true);
|
||||||
|
$('#addItemButton').hide();
|
||||||
|
}
|
||||||
|
|
||||||
function onEmailClick() {
|
function onEmailClick() {
|
||||||
if (!NINJA.isRegistered) {
|
if (!NINJA.isRegistered) {
|
||||||
swal("{!! trans('texts.registration_required') !!}");
|
swal("{!! trans('texts.registration_required') !!}");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<thead {!! $isTasks ? 'style="display:none;" data-bind="visible: $root.hasTasks"' : '' !!}>
|
<thead {!! $isTasks ? 'style="display:none;" data-bind="visible: $root.hasTasks"' : (! empty($tasks) ? 'data-bind="visible: $root.hasItems"' : '') !!}>
|
||||||
@if ($isTasks)
|
@if ($isTasks)
|
||||||
<tr><td style="20px" colspan="20"></td></tr>
|
<tr><td style="20px" colspan="20"></td></tr>
|
||||||
@endif
|
@endif
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<th style="min-width:32px;" class="hide-border"></th>
|
<th style="min-width:32px;" class="hide-border"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody data-bind="sortable: { data: invoice_items_{{ $isTasks ? 'with_tasks' : 'without_tasks' }}, allowDrop: false, afterMove: onDragged} {{ $isTasks ? ', visible: $root.hasTasks' : '' }}"
|
<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' : '') }}"
|
||||||
{!! $isTasks ? 'style="display:none;border-spacing: 100px"' : '' !!}>
|
{!! $isTasks ? 'style="display:none;border-spacing: 100px"' : '' !!}>
|
||||||
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
||||||
<td class="hide-border td-icon">
|
<td class="hide-border td-icon">
|
||||||
|
@ -173,7 +173,7 @@ function ViewModel(data) {
|
|||||||
}
|
}
|
||||||
invoice = self.invoice();
|
invoice = self.invoice();
|
||||||
for (var i=0; i<invoice.invoice_items_with_tasks().length; ++i) {
|
for (var i=0; i<invoice.invoice_items_with_tasks().length; ++i) {
|
||||||
var item = invoice.invoice_items()[i];
|
var item = invoice.invoice_items_with_tasks()[i];
|
||||||
if (! item.isEmpty()) {
|
if (! item.isEmpty()) {
|
||||||
self.hasTasksCached = true;
|
self.hasTasksCached = true;
|
||||||
return true;
|
return true;
|
||||||
@ -181,6 +181,26 @@ function ViewModel(data) {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.hasItemsCached = false;
|
||||||
|
self.forceShowItems = ko.observable(false);
|
||||||
|
self.hasItems = ko.computed(function() {
|
||||||
|
if (self.forceShowItems()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (self.hasItemsCached) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
invoice = self.invoice();
|
||||||
|
for (var i=0; i<invoice.invoice_items_without_tasks().length; ++i) {
|
||||||
|
var item = invoice.invoice_items_without_tasks()[i];
|
||||||
|
if (! item.isEmpty()) {
|
||||||
|
self.hasItemsCached = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function InvoiceModel(data) {
|
function InvoiceModel(data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user