1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Show archived/deleted in breadcrumbs

This commit is contained in:
Hillel Coren 2016-10-18 17:55:07 +03:00
parent 597f0f5548
commit 733890ec3f
15 changed files with 93 additions and 74 deletions

View File

@ -134,6 +134,7 @@ class ExpenseController extends BaseController
$data = [
'vendor' => null,
'expense' => $expense,
'entity' => $expense,
'method' => 'PUT',
'url' => 'expenses/'.$expense->public_id,
'title' => 'Edit Expense',

View File

@ -142,11 +142,13 @@ class PaymentController extends BaseController
'invoices' => Invoice::scope()->invoiceType(INVOICE_TYPE_STANDARD)->where('is_recurring', '=', false)
->with('client', 'invoice_status')->orderBy('invoice_number')->get(),
'payment' => $payment,
'entity' => $payment,
'method' => 'PUT',
'url' => 'payments/'.$payment->public_id,
'title' => trans('texts.edit_payment'),
'paymentTypes' => Cache::get('paymentTypes'),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), ];
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
];
return View::make('payments.edit', $data);
}

View File

@ -81,11 +81,13 @@ class ProductController extends BaseController
public function edit($publicId)
{
$account = Auth::user()->account;
$product = Product::scope($publicId)->withTrashed()->firstOrFail();
$data = [
'account' => $account,
'taxRates' => $account->invoice_item_taxes ? TaxRate::scope()->get(['id', 'name', 'rate']) : null,
'product' => Product::scope($publicId)->withTrashed()->firstOrFail(),
'product' => $product,
'entity' => $product,
'method' => 'PUT',
'url' => 'products/'.$publicId,
'title' => trans('texts.edit_product'),

View File

@ -177,6 +177,7 @@ class TaskController extends BaseController
$data = [
'task' => $task,
'entity' => $task,
'clientPublicId' => $task->client ? $task->client->public_id : 0,
'method' => 'PUT',
'url' => 'tasks/'.$task->public_id,
@ -185,7 +186,6 @@ class TaskController extends BaseController
'actions' => $actions,
'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE,
'datetimeFormat' => Auth::user()->account->getMomentDateTimeFormat(),
//'entityStatus' => $task->present()->status,
];
$data = array_merge($data, self::getViewModel());

View File

@ -23,22 +23,4 @@ class ClientPresenter extends EntityPresenter {
return $account->formatMoney($client->paid_to_date, $client);
}
public function status()
{
$class = $text = '';
if ($this->entity->is_deleted) {
$class = 'danger';
$text = trans('texts.deleted');
} elseif ($this->entity->trashed()) {
$class = 'warning';
$text = trans('texts.archived');
} else {
$class = 'success';
$text = trans('texts.active');
}
return "<span class=\"label label-{$class}\">{$text}</span>";
}
}

View File

@ -17,6 +17,24 @@ class EntityPresenter extends Presenter
return URL::to($link);
}
public function statusLabel()
{
$class = $text = '';
if ($this->entity->is_deleted) {
$class = 'danger';
$text = trans('texts.deleted');
} elseif ($this->entity->trashed()) {
$class = 'warning';
$text = trans('texts.archived');
} else {
//$class = 'success';
//$text = trans('texts.active');
}
return "<span style=\"font-size:13px\" class=\"label label-{$class}\">{$text}</span>";
}
/**
* @return mixed
*/

View File

@ -117,7 +117,7 @@ class AppServiceProvider extends ServiceProvider
}
if ($status) {
$str .= '&nbsp;&nbsp;&nbsp;&nbsp;' . $status;
$str .= $status;
}
return $str . '</ol>';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1220,3 +1220,8 @@ div.panel-body div.panel-body {
background-color: #eee!important;
color: #999!important;
}
.breadcrumb .label {
vertical-align: middle;
margin-left: 16px;
}

View File

@ -23,12 +23,10 @@
<div class="row">
<div class="col-md-7">
<div>
<span style="font-size:28px">{{ $client->getDisplayName() }}</span>
@if ($client->trashed())
&nbsp;&nbsp;{!! $client->present()->status !!}
@endif
</div>
<ol class="breadcrumb">
<li>{{ link_to('/clients', trans('texts.clients')) }}</li>
<li class='active'>{{ $client->getDisplayName() }}</li> {!! $client->present()->statusLabel !!}
</ol>
</div>
<div class="col-md-5">
<div class="pull-right">
@ -83,7 +81,6 @@
{{ trans('texts.last_logged_in') }} {{ Utils::timestampToDateTimeString(strtotime($client->last_login)) }}
</small></h3>
@endif
<br/>
<div class="panel panel-default">
<div class="panel-body">

View File

@ -585,7 +585,7 @@
@endif
@if (!isset($showBreadcrumbs) || $showBreadcrumbs)
{!! Form::breadcrumbs(isset($entityStatus) ? $entityStatus : '') !!}
{!! Form::breadcrumbs((isset($entity) && $entity->exists) ? $entity->present()->statusLabel : false) !!}
@endif
@yield('content')

View File

@ -36,14 +36,15 @@
<div class="alert alert-danger">{{ trans($errors->first('invoice_items')) }}</div>
@endif
@if ($invoice->id)
@if ($invoice->id)
<ol class="breadcrumb">
@if ($invoice->is_recurring)
<li>{!! link_to('invoices', trans('texts.recurring_invoice')) !!}</li>
@else
<li>{!! link_to(($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'), trans('texts.' . ($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'))) !!}</li>
<li class="active">{{ $invoice->invoice_number }}</li>
@endif
@if ($invoice->is_recurring)
<li>{!! link_to('invoices', trans('texts.recurring_invoice')) !!}</li>
@else
<li>{!! link_to(($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'), trans('texts.' . ($entityType == ENTITY_QUOTE ? 'quotes' : 'invoices'))) !!}</li>
<li class="active">{{ $invoice->invoice_number }}</li>
@endif
{!! $invoice->present()->statusLabel !!}
</ol>
@endif

View File

@ -123,7 +123,7 @@
<div id="upgrade-modal" class="container" style="">
<div class="row">
<div class="col-md-10 text-right">
<a href="#"><i class="fa fa-close" onclick="hideUpgradeModal()"></i></a>
<a href="#"><i class="fa fa-close" onclick="hideUpgradeModal()" title="{{ trans('texts.close') }}"></i></a>
</div>
</div>
<div class="row">

View File

@ -21,47 +21,58 @@
@section('content')
<div class="pull-right">
{!! Former::open('vendors/bulk')->addClass('mainForm') !!}
<div style="display:none">
{!! Former::text('action') !!}
{!! Former::text('public_id')->value($vendor->public_id) !!}
</div>
<div class="row">
<div class="col-md-7">
<ol class="breadcrumb">
<li>{{ link_to('/vendors', trans('texts.vendors')) }}</li>
<li class='active'>{{ $vendor->getDisplayName() }}</li> {!! $vendor->present()->statusLabel !!}
</ol>
</div>
<div class="col-md-5">
<div class="pull-right">
@if ( ! $vendor->is_deleted)
@can('edit', $vendor)
{!! DropdownButton::normal(trans('texts.edit_vendor'))
->withAttributes(['class'=>'normalDropDown'])
->withContents([
($vendor->trashed() ? false : ['label' => trans('texts.archive_vendor'), 'url' => "javascript:onArchiveClick()"]),
['label' => trans('texts.delete_vendor'), 'url' => "javascript:onDeleteClick()"],
]
)->split() !!}
@endcan
@if ( ! $vendor->trashed())
@can('create', ENTITY_EXPENSE)
{!! Button::primary(trans("texts.new_expense"))
->asLinkTo(URL::to("/expenses/create/{$vendor->public_id}"))
->appendIcon(Icon::create('plus-sign')) !!}
@endcan
@endif
@endif
{!! Former::open('vendors/bulk')->addClass('mainForm') !!}
<div style="display:none">
{!! Former::text('action') !!}
{!! Former::text('public_id')->value($vendor->public_id) !!}
</div>
@if ($vendor->trashed())
@can('edit', $vendor)
{!! Button::primary(trans('texts.restore_vendor'))
->appendIcon(Icon::create('cloud-download'))
->withAttributes(['onclick' => 'onRestoreClick()']) !!}
@endcan
@endif
@if ( ! $vendor->is_deleted)
@can('edit', $vendor)
{!! DropdownButton::normal(trans('texts.edit_vendor'))
->withAttributes(['class'=>'normalDropDown'])
->withContents([
($vendor->trashed() ? false : ['label' => trans('texts.archive_vendor'), 'url' => "javascript:onArchiveClick()"]),
['label' => trans('texts.delete_vendor'), 'url' => "javascript:onDeleteClick()"],
]
)->split() !!}
@endcan
@if ( ! $vendor->trashed())
@can('create', ENTITY_EXPENSE)
{!! Button::primary(trans("texts.new_expense"))
->asLinkTo(URL::to("/expenses/create/{$vendor->public_id}"))
->appendIcon(Icon::create('plus-sign')) !!}
@endcan
@endif
@endif
@if ($vendor->trashed())
@can('edit', $vendor)
{!! Button::primary(trans('texts.restore_vendor'))
->appendIcon(Icon::create('cloud-download'))
->withAttributes(['onclick' => 'onRestoreClick()']) !!}
@endcan
@endif
{!! Former::close() !!}
{!! Former::close() !!}
</div>
</div>
</div>
</div>
<h2>{{ $vendor->getDisplayName() }}</h2>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">