Change 'Mark Sent' to 'Mark Active' for recurring invoices

This commit is contained in:
Hillel Coren 2017-01-31 14:59:20 +02:00
parent d76edb0fce
commit c1789839b8
3 changed files with 15 additions and 7 deletions

View File

@ -29,7 +29,7 @@ class EntityPresenter extends Presenter
return $this->url() . '/edit'; return $this->url() . '/edit';
} }
public function statusLabel() public function statusLabel($label = false)
{ {
$class = $text = ''; $class = $text = '';
@ -41,7 +41,7 @@ class EntityPresenter extends Presenter
$label = trans('texts.archived'); $label = trans('texts.archived');
} else { } else {
$class = $this->entity->statusClass(); $class = $this->entity->statusClass();
$label = $this->entity->statusLabel(); $label = $label ?: $this->entity->statusLabel();
} }
return "<span style=\"font-size:13px\" class=\"label label-{$class}\">{$label}</span>"; return "<span style=\"font-size:13px\" class=\"label label-{$class}\">{$label}</span>";

View File

@ -2345,6 +2345,7 @@ $LANG = array(
'statement' => 'Statement', 'statement' => 'Statement',
'statement_date' => 'Statement Date', 'statement_date' => 'Statement Date',
'inactivity_logout' => 'Due to inactivity, you have been automatically logged out.', 'inactivity_logout' => 'Due to inactivity, you have been automatically logged out.',
'mark_active' => 'Mark Active',
); );

View File

@ -51,7 +51,11 @@
<li>{!! link_to(($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'), trans('texts.' . ($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'))) !!}</li> <li>{!! link_to(($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'), trans('texts.' . ($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'))) !!}</li>
<li class="active">{{ $invoice->invoice_number }}</li> <li class="active">{{ $invoice->invoice_number }}</li>
@endif @endif
{!! $invoice->present()->statusLabel !!} @if ($invoice->is_recurring && $invoice->isSent() && (! $invoice->last_sent_date || $invoice->last_sent_date == '0000-00-00'))
{!! $invoice->present()->statusLabel(trans('texts.active')) !!}
@else
{!! $invoice->present()->statusLabel !!}
@endif
</ol> </ol>
@endif @endif
@ -559,7 +563,7 @@
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!} {!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
@else @else
{!! Button::normal(trans("texts.save_draft"))->withAttributes(array('id' => 'draftButton', 'onclick' => 'onSaveDraftClick()'))->appendIcon(Icon::create('floppy-disk')) !!} {!! Button::normal(trans("texts.save_draft"))->withAttributes(array('id' => 'draftButton', 'onclick' => 'onSaveDraftClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
{!! Button::success(trans("texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!} {!! Button::success(trans($invoice->is_recurring ? "texts.mark_active" : "texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!}
@endif @endif
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!} {!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
@if (!$invoice->trashed()) @if (!$invoice->trashed())
@ -1246,13 +1250,16 @@
var invoice = model.invoice(); var invoice = model.invoice();
if (invoice.is_recurring()) { if (invoice.is_recurring()) {
var recurring = false; var recurring = false;
var label = "{{ trans('texts.enable_recurring')}}"; var enableLabel = "{{ trans('texts.enable_recurring')}}";
var actionLabel = "{{ trans('texts.mark_sent') }}";
} else { } else {
var recurring = true; var recurring = true;
var label = "{{ trans('texts.disable_recurring')}}"; var enableLabel = "{{ trans('texts.disable_recurring')}}";
var actionLabel = "{{ trans('texts.mark_active') }}";
} }
invoice.is_recurring(recurring); invoice.is_recurring(recurring);
$('#recurrButton').html(label + "<span class='glyphicon glyphicon-repeat'></span>"); $('#recurrButton').html(enableLabel + "<span class='glyphicon glyphicon-repeat'></span>");
$('#saveButton').html(actionLabel + "<span class='glyphicon glyphicon-globe'></span>");
} }
function onEmailClick() { function onEmailClick() {