1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Clarify recurring invoice status

This commit is contained in:
Hillel Coren 2017-03-09 15:08:18 +02:00
parent 419e950448
commit 8623c3a3c6
4 changed files with 30 additions and 3 deletions

View File

@ -5,6 +5,7 @@ namespace App\Ninja\Datatables;
use Auth;
use URL;
use Utils;
use App\Models\Invoice;
class RecurringInvoiceDatatable extends EntityDatatable
{
@ -53,9 +54,27 @@ class RecurringInvoiceDatatable extends EntityDatatable
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
},
],
[
'status',
function ($model) {
return self::getStatusLabel($model);
},
],
];
}
private function getStatusLabel($model)
{
$class = Invoice::calcStatusClass($model->invoice_status_id, $model->balance, $model->due_date, $model->is_recurring);
$label = Invoice::calcStatusLabel($model->invoice_status_name, $class, $this->entityType, $model->quote_invoice_id);
if ($model->invoice_status_id == INVOICE_STATUS_SENT && (! $model->last_sent_date || $model->last_sent_date == '0000-00-00')) {
$label = trans('texts.pending');
}
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
}
public function actions()
{
return [

View File

@ -136,6 +136,7 @@ class InvoiceRepository extends BaseRepository
$query = DB::table('invoices')
->join('accounts', 'accounts.id', '=', 'invoices.account_id')
->join('clients', 'clients.id', '=', 'invoices.client_id')
->join('invoice_statuses', 'invoice_statuses.id', '=', 'invoices.invoice_status_id')
->join('frequencies', 'frequencies.id', '=', 'invoices.frequency_id')
->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('invoices.account_id', '=', $accountId)
@ -160,7 +161,13 @@ class InvoiceRepository extends BaseRepository
'contacts.email',
'invoices.deleted_at',
'invoices.is_deleted',
'invoices.user_id'
'invoices.user_id',
'invoice_statuses.name as invoice_status_name',
'invoices.invoice_status_id',
'invoices.balance',
'invoices.due_date',
'invoices.is_recurring',
'invoices.quote_invoice_id'
);
if ($clientPublicId) {

View File

@ -2396,6 +2396,7 @@ $LANG = array(
'create_vendor' => 'Create vendor',
'create_expense_category' => 'Create category',
'pro_plan_reports' => ':link to enable reports by joining the Pro Plan',
'mark_ready' => 'Mark Ready',
);

View File

@ -54,7 +54,7 @@
<li class="active">{{ $invoice->invoice_number }}</li>
@endif
@if ($invoice->is_recurring && $invoice->isSent() && (! $invoice->last_sent_date || $invoice->last_sent_date == '0000-00-00'))
{!! $invoice->present()->statusLabel(trans('texts.active')) !!}
{!! $invoice->present()->statusLabel(trans('texts.pending')) !!}
@else
{!! $invoice->present()->statusLabel !!}
@endif
@ -564,7 +564,7 @@
@else
{!! Button::normal(trans("texts.save_draft"))->withAttributes(array('id' => 'draftButton', 'onclick' => 'onSaveDraftClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
@if (! $invoice->trashed())
{!! Button::success(trans($invoice->is_recurring ? "texts.mark_active" : "texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!}
{!! Button::success(trans($invoice->is_recurring ? "texts.mark_ready" : "texts.mark_sent"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onMarkSentClick()'))->appendIcon(Icon::create('globe')) !!}
@endif
@endif
@if (! $invoice->trashed())