mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Standardize archive/deleted behaviors
This commit is contained in:
parent
48f2f58d3f
commit
147df1ef91
@ -85,7 +85,7 @@ class ProductController extends BaseController
|
||||
$data = [
|
||||
'account' => $account,
|
||||
'taxRates' => $account->invoice_item_taxes ? TaxRate::scope()->get(['id', 'name', 'rate']) : null,
|
||||
'product' => Product::scope($publicId)->firstOrFail(),
|
||||
'product' => Product::scope($publicId)->withTrashed()->firstOrFail(),
|
||||
'method' => 'PUT',
|
||||
'url' => 'products/'.$publicId,
|
||||
'title' => trans('texts.edit_product'),
|
||||
@ -137,7 +137,7 @@ class ProductController extends BaseController
|
||||
private function save($productPublicId = false)
|
||||
{
|
||||
if ($productPublicId) {
|
||||
$product = Product::scope($productPublicId)->firstOrFail();
|
||||
$product = Product::scope($productPublicId)->withTrashed()->firstOrFail();
|
||||
} else {
|
||||
$product = Product::createNew();
|
||||
}
|
||||
|
@ -66,7 +66,9 @@ class UserController extends BaseController
|
||||
public function edit($publicId)
|
||||
{
|
||||
$user = User::where('account_id', '=', Auth::user()->account_id)
|
||||
->where('public_id', '=', $publicId)->firstOrFail();
|
||||
->where('public_id', '=', $publicId)
|
||||
->withTrashed()
|
||||
->firstOrFail();
|
||||
|
||||
$data = [
|
||||
'user' => $user,
|
||||
@ -157,7 +159,9 @@ class UserController extends BaseController
|
||||
|
||||
if ($userPublicId) {
|
||||
$user = User::where('account_id', '=', Auth::user()->account_id)
|
||||
->where('public_id', '=', $userPublicId)->firstOrFail();
|
||||
->where('public_id', '=', $userPublicId)
|
||||
->withTrashed()
|
||||
->firstOrFail();
|
||||
|
||||
$rules['email'] = 'required|email|unique:users,email,'.$user->id.',id';
|
||||
} else {
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
class UpdateTaxRateRequest extends TaxRateRequest
|
||||
{
|
||||
// Expenses
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
|
@ -123,7 +123,9 @@ class ActivityListener
|
||||
return;
|
||||
}
|
||||
|
||||
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')->find($event->invoice->id);
|
||||
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')
|
||||
->withArchived()
|
||||
->find($event->invoice->id);
|
||||
|
||||
$activity = $this->activityRepo->create(
|
||||
$event->invoice,
|
||||
|
@ -89,7 +89,11 @@ class PaymentDatatable extends EntityDatatable
|
||||
[
|
||||
'payment_date',
|
||||
function ($model) {
|
||||
return Utils::dateToString($model->payment_date);
|
||||
if ($model->is_deleted) {
|
||||
return Utils::dateToString($model->payment_date);
|
||||
} else {
|
||||
return link_to("payments/{$model->public_id}/edit", Utils::dateToString($model->payment_date))->toHtml();
|
||||
}
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@ -80,6 +80,10 @@ class ClientRepository extends BaseRepository
|
||||
$client = Client::scope($publicId)->with('contacts')->firstOrFail();
|
||||
}
|
||||
|
||||
if ($client->is_deleted) {
|
||||
return $client;
|
||||
}
|
||||
|
||||
// convert currency code to id
|
||||
if (isset($data['currency_code'])) {
|
||||
$currencyCode = strtolower($data['currency_code']);
|
||||
|
@ -118,11 +118,17 @@ class ExpenseRepository extends BaseRepository
|
||||
// do nothing
|
||||
} elseif ($publicId) {
|
||||
$expense = Expense::scope($publicId)->firstOrFail();
|
||||
\Log::warning('Entity not set in expense repo save');
|
||||
if (Utils::isNinjaDev()) {
|
||||
\Log::warning('Entity not set in expense repo save');
|
||||
}
|
||||
} else {
|
||||
$expense = Expense::createNew();
|
||||
}
|
||||
|
||||
if ($expense->is_deleted) {
|
||||
return $expense;
|
||||
}
|
||||
|
||||
// First auto fill
|
||||
$expense->fill($input);
|
||||
|
||||
|
@ -280,7 +280,13 @@ class InvoiceRepository extends BaseRepository
|
||||
}
|
||||
} else {
|
||||
$invoice = Invoice::scope($publicId)->firstOrFail();
|
||||
\Log::warning('Entity not set in invoice repo save');
|
||||
if (Utils::isNinjaDev()) {
|
||||
\Log::warning('Entity not set in invoice repo save');
|
||||
}
|
||||
}
|
||||
|
||||
if ($invoice->is_deleted) {
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
$invoice->fill($data);
|
||||
|
@ -150,11 +150,17 @@ class PaymentRepository extends BaseRepository
|
||||
// do nothing
|
||||
} elseif ($publicId) {
|
||||
$payment = Payment::scope($publicId)->firstOrFail();
|
||||
\Log::warning('Entity not set in payment repo save');
|
||||
if (Utils::isNinjaDev()) {
|
||||
\Log::warning('Entity not set in payment repo save');
|
||||
}
|
||||
} else {
|
||||
$payment = Payment::createNew();
|
||||
}
|
||||
|
||||
if ($payment->is_deleted) {
|
||||
return $payment;
|
||||
}
|
||||
|
||||
$paymentTypeId = false;
|
||||
if (isset($input['payment_type_id'])) {
|
||||
$paymentTypeId = $input['payment_type_id'] ? $input['payment_type_id'] : null;
|
||||
|
@ -67,11 +67,15 @@ class TaskRepository
|
||||
if ($task) {
|
||||
// do nothing
|
||||
} elseif ($publicId) {
|
||||
$task = Task::scope($publicId)->firstOrFail();
|
||||
$task = Task::scope($publicId)->withTrashed()->firstOrFail();
|
||||
} else {
|
||||
$task = Task::createNew();
|
||||
}
|
||||
|
||||
if ($task->is_deleted) {
|
||||
return $task;
|
||||
}
|
||||
|
||||
if (isset($data['client']) && $data['client']) {
|
||||
$task->client_id = Client::getPrivateId($data['client']);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use Utils;
|
||||
use DB;
|
||||
use App\Models\Vendor;
|
||||
|
||||
@ -70,7 +71,13 @@ class VendorRepository extends BaseRepository
|
||||
$vendor = Vendor::createNew();
|
||||
} else {
|
||||
$vendor = Vendor::scope($publicId)->with('vendor_contacts')->firstOrFail();
|
||||
\Log::warning('Entity not set in vendor repo save');
|
||||
if (Utils::isNinjaDev()) {
|
||||
\Log::warning('Entity not set in vendor repo save');
|
||||
}
|
||||
}
|
||||
|
||||
if ($vendor->is_deleted) {
|
||||
return $vendor;
|
||||
}
|
||||
|
||||
$vendor->fill($data);
|
||||
|
@ -77,6 +77,7 @@ class DatatableService
|
||||
if (!$model->deleted_at || $model->deleted_at == '0000-00-00') {
|
||||
foreach ($datatable->actions() as $action) {
|
||||
if (count($action)) {
|
||||
// if show function isn't set default to true
|
||||
if (count($action) == 2) {
|
||||
$action[] = function() {
|
||||
return true;
|
||||
@ -84,11 +85,10 @@ class DatatableService
|
||||
}
|
||||
list($value, $url, $visible) = $action;
|
||||
if ($visible($model)) {
|
||||
if($value == '--divider--'){
|
||||
if ($value == '--divider--') {
|
||||
$dropdown_contents .= '<li class="divider"></li>';
|
||||
$lastIsDivider = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$urlVal = $url($model);
|
||||
$urlStr = is_string($urlVal) ? $urlVal : $urlVal['url'];
|
||||
$attributes = '';
|
||||
|
@ -131,7 +131,7 @@ class PaymentService extends BaseService
|
||||
if(!Utils::hasPermission('view_all')){
|
||||
$query->where('payments.user_id', '=', Auth::user()->id);
|
||||
}
|
||||
|
||||
|
||||
return $this->datatableService->createDatatable($datatable, $query);
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
@parent
|
||||
|
||||
{!! Former::open_for_files()->addClass('warn-on-exit')->rules(array(
|
||||
'first_name' => 'required',
|
||||
'last_name' => 'required',
|
||||
'email' => 'email|required'
|
||||
)) !!}
|
||||
|
||||
|
@ -44,26 +44,34 @@
|
||||
->withAttributes(['target' => '_blank']) !!}
|
||||
@endif
|
||||
|
||||
@if ( ! $client->is_deleted)
|
||||
@can('edit', $client)
|
||||
{!! DropdownButton::normal(trans('texts.edit_client'))
|
||||
->withAttributes(['class'=>'normalDropDown'])
|
||||
->withContents([
|
||||
($client->trashed() ? false : ['label' => trans('texts.archive_client'), 'url' => "javascript:onArchiveClick()"]),
|
||||
['label' => trans('texts.delete_client'), 'url' => "javascript:onDeleteClick()"],
|
||||
]
|
||||
)->split() !!}
|
||||
@endcan
|
||||
@if ( ! $client->trashed())
|
||||
@can('create', ENTITY_INVOICE)
|
||||
{!! DropdownButton::primary(trans('texts.new_invoice'))
|
||||
->withAttributes(['class'=>'primaryDropDown'])
|
||||
->withContents($actionLinks)->split() !!}
|
||||
@endcan
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if ($client->trashed())
|
||||
@can('edit', $client)
|
||||
{!! Button::primary(trans('texts.restore_client'))->withAttributes(['onclick' => 'onRestoreClick()']) !!}
|
||||
@endcan
|
||||
@else
|
||||
@can('edit', $client)
|
||||
{!! DropdownButton::normal(trans('texts.edit_client'))
|
||||
->withAttributes(['class'=>'normalDropDown'])
|
||||
->withContents([
|
||||
['label' => trans('texts.archive_client'), 'url' => "javascript:onArchiveClick()"],
|
||||
['label' => trans('texts.delete_client'), 'url' => "javascript:onDeleteClick()"],
|
||||
]
|
||||
)->split() !!}
|
||||
@endcan
|
||||
@can('create', ENTITY_INVOICE)
|
||||
{!! DropdownButton::primary(trans('texts.new_invoice'))
|
||||
->withAttributes(['class'=>'primaryDropDown'])
|
||||
->withContents($actionLinks)->split() !!}
|
||||
{!! Button::primary(trans('texts.restore_client'))
|
||||
->appendIcon(Icon::create('cloud-download'))
|
||||
->withAttributes(['onclick' => 'onRestoreClick()']) !!}
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
</div>
|
||||
|
@ -171,28 +171,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Auth::user()->canCreateOrEdit(ENTITY_EXPENSE, $expense))
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))
|
||||
->asLinkTo(URL::to('/expenses'))
|
||||
->appendIcon(Icon::create('remove-circle'))
|
||||
->large() !!}
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))
|
||||
->asLinkTo(URL::to('/expenses'))
|
||||
->appendIcon(Icon::create('remove-circle'))
|
||||
->large() !!}
|
||||
|
||||
@if (Auth::user()->canCreateOrEdit(ENTITY_EXPENSE, $expense))
|
||||
@if (Auth::user()->hasFeature(FEATURE_EXPENSES))
|
||||
{!! Button::success(trans('texts.save'))
|
||||
->appendIcon(Icon::create('floppy-disk'))
|
||||
->large()
|
||||
->submit() !!}
|
||||
@if (!$expense || !$expense->is_deleted)
|
||||
{!! Button::success(trans('texts.save'))
|
||||
->appendIcon(Icon::create('floppy-disk'))
|
||||
->large()
|
||||
->submit() !!}
|
||||
@endif
|
||||
|
||||
@if ($expense)
|
||||
@if ($expense && !$expense->trashed())
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->large()
|
||||
->dropup() !!}
|
||||
@endif
|
||||
|
||||
@if ($expense && $expense->trashed())
|
||||
{!! Button::primary(trans('texts.restore'))
|
||||
->withAttributes(['onclick' => 'submitAction("restore")'])
|
||||
->appendIcon(Icon::create('cloud-download'))
|
||||
->large() !!}
|
||||
@endif
|
||||
|
||||
@endif
|
||||
</center>
|
||||
@endif
|
||||
@endif
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
|
@ -539,19 +539,24 @@
|
||||
@if (Auth::user()->canCreateOrEdit(ENTITY_INVOICE, $invoice))
|
||||
@if ($invoice->isClientTrashed())
|
||||
<!-- do nothing -->
|
||||
@elseif ($invoice->trashed())
|
||||
{!! Button::success(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@elseif (!$invoice->trashed())
|
||||
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
|
||||
@if ($invoice->id)
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->dropup() !!}
|
||||
@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')) !!}
|
||||
@else
|
||||
@if (!$invoice->is_deleted)
|
||||
{!! Button::success(trans("texts.save_{$entityType}"))->withAttributes(array('id' => 'saveButton', 'onclick' => 'onSaveClick()'))->appendIcon(Icon::create('floppy-disk')) !!}
|
||||
{!! Button::info(trans("texts.email_{$entityType}"))->withAttributes(array('id' => 'emailButton', 'onclick' => 'onEmailClick()'))->appendIcon(Icon::create('send')) !!}
|
||||
@if (!$invoice->trashed())
|
||||
@if ($invoice->id)
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->dropup() !!}
|
||||
@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')) !!}
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
@if ($invoice->trashed())
|
||||
{!! Button::primary(trans('texts.restore'))->withAttributes(['onclick' => 'submitBulkAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@ -1334,7 +1339,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@if ($invoice->trashed())
|
||||
@if ($invoice->is_deleted)
|
||||
if ($('#bulk_action').val() != 'restore') {
|
||||
return false;
|
||||
}
|
||||
|
@ -13,11 +13,11 @@
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
|
||||
{!! Former::open($url)->addClass('col-md-10 col-md-offset-1 warn-on-exit')->method($method)->rules(array(
|
||||
'client' => 'required',
|
||||
'invoice' => 'required',
|
||||
'amount' => 'required',
|
||||
'invoice' => 'required',
|
||||
'amount' => 'required',
|
||||
)) !!}
|
||||
|
||||
@if ($payment)
|
||||
@ -27,7 +27,7 @@
|
||||
<span style="display:none">
|
||||
{!! Former::text('public_id') !!}
|
||||
</span>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-md-offset-1">
|
||||
|
||||
@ -70,7 +70,9 @@
|
||||
|
||||
<center class="buttons">
|
||||
{!! Button::normal(trans('texts.cancel'))->appendIcon(Icon::create('remove-circle'))->asLinkTo(URL::to('/payments'))->large() !!}
|
||||
{!! Button::success(trans('texts.save'))->appendIcon(Icon::create('floppy-disk'))->submit()->large() !!}
|
||||
@if (!$payment || !$payment->is_deleted)
|
||||
{!! Button::success(trans('texts.save'))->appendIcon(Icon::create('floppy-disk'))->submit()->large() !!}
|
||||
@endif
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
@ -89,7 +91,7 @@
|
||||
populateInvoiceComboboxes({{ $clientPublicId }}, {{ $invoicePublicId }});
|
||||
@endif
|
||||
|
||||
$('#payment_type_id').combobox();
|
||||
$('#payment_type_id').combobox();
|
||||
|
||||
@if (!$payment && !$clientPublicId)
|
||||
$('.client-select input.form-control').focus();
|
||||
@ -106,4 +108,4 @@
|
||||
|
||||
</script>
|
||||
|
||||
@stop
|
||||
@stop
|
||||
|
@ -128,35 +128,41 @@
|
||||
</div>
|
||||
|
||||
|
||||
<center class="buttons">
|
||||
|
||||
@if (Auth::user()->canCreateOrEdit(ENTITY_TASK, $task))
|
||||
<center class="buttons">
|
||||
@if (Auth::user()->hasFeature(FEATURE_TASKS))
|
||||
@if ($task && $task->is_running)
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::primary(trans('texts.stop'))->large()->appendIcon(Icon::create('stop'))->withAttributes(['id' => 'stop-button']) !!}
|
||||
@elseif ($task && $task->trashed())
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::success(trans('texts.restore'))->large()->withAttributes(['onclick' => 'submitAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@else
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
@if ($task)
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::primary(trans('texts.resume'))->large()->appendIcon(Icon::create('play'))->withAttributes(['id' => 'resume-button']) !!}
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->large()
|
||||
->dropup() !!}
|
||||
@else
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::success(trans('texts.start'))->large()->appendIcon(Icon::create('play'))->withAttributes(['id' => 'start-button']) !!}
|
||||
@endif
|
||||
@endif
|
||||
@if (Auth::user()->hasFeature(FEATURE_TASKS))
|
||||
@if ($task && $task->is_running)
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::primary(trans('texts.stop'))->large()->appendIcon(Icon::create('stop'))->withAttributes(['id' => 'stop-button']) !!}
|
||||
@elseif ($task && $task->is_deleted)
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::primary(trans('texts.restore'))->large()->withAttributes(['onclick' => 'submitAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@elseif ($task && $task->trashed())
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::primary(trans('texts.restore'))->large()->withAttributes(['onclick' => 'submitAction("restore")'])->appendIcon(Icon::create('cloud-download')) !!}
|
||||
@else
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
@if ($task)
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::primary(trans('texts.resume'))->large()->appendIcon(Icon::create('play'))->withAttributes(['id' => 'resume-button']) !!}
|
||||
{!! DropdownButton::normal(trans('texts.more_actions'))
|
||||
->withContents($actions)
|
||||
->large()
|
||||
->dropup() !!}
|
||||
@else
|
||||
{!! Button::success(trans('texts.save'))->large()->appendIcon(Icon::create('floppy-disk'))->withAttributes(['id' => 'save-button']) !!}
|
||||
{!! Button::success(trans('texts.start'))->large()->appendIcon(Icon::create('play'))->withAttributes(['id' => 'start-button']) !!}
|
||||
@endif
|
||||
@endif
|
||||
</center>
|
||||
@else
|
||||
{!! Button::normal(trans('texts.cancel'))->large()->asLinkTo(URL::to('/tasks'))->appendIcon(Icon::create('remove-circle')) !!}
|
||||
@endif
|
||||
@endif
|
||||
|
||||
</center>
|
||||
|
||||
{!! Former::close() !!}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
41
resources/views/vendors/show.blade.php
vendored
41
resources/views/vendors/show.blade.php
vendored
@ -28,21 +28,34 @@
|
||||
{!! Former::text('public_id')->value($vendor->public_id) !!}
|
||||
</div>
|
||||
|
||||
@if ($vendor->trashed())
|
||||
{!! Button::primary(trans('texts.restore_vendor'))->withAttributes(['onclick' => 'onRestoreClick()']) !!}
|
||||
@else
|
||||
{!! DropdownButton::normal(trans('texts.edit_vendor'))
|
||||
->withAttributes(['class'=>'normalDropDown'])
|
||||
->withContents([
|
||||
['label' => trans('texts.archive_vendor'), 'url' => "javascript:onArchiveClick()"],
|
||||
['label' => trans('texts.delete_vendor'), 'url' => "javascript:onDeleteClick()"],
|
||||
]
|
||||
)->split() !!}
|
||||
@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
|
||||
|
||||
|
||||
{!! Button::primary(trans("texts.new_expense"))
|
||||
->asLinkTo(URL::to("/expenses/create/{$vendor->public_id}"))
|
||||
->appendIcon(Icon::create('plus-sign')) !!}
|
||||
@endif
|
||||
{!! Former::close() !!}
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user