mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:54:30 -04:00
Enabled restoring entities
This commit is contained in:
parent
8930265447
commit
f43d52005e
@ -32,7 +32,7 @@ class ClientController extends \BaseController {
|
|||||||
$clients = $this->clientRepo->find(Input::get('sSearch'));
|
$clients = $this->clientRepo->find(Input::get('sSearch'));
|
||||||
|
|
||||||
return Datatable::query($clients)
|
return Datatable::query($clients)
|
||||||
->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; })
|
->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>'; })
|
||||||
->addColumn('name', function($model) { return link_to('clients/' . $model->public_id, $model->name); })
|
->addColumn('name', function($model) { return link_to('clients/' . $model->public_id, $model->name); })
|
||||||
->addColumn('first_name', function($model) { return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name); })
|
->addColumn('first_name', function($model) { return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name); })
|
||||||
->addColumn('email', function($model) { return link_to('clients/' . $model->public_id, $model->email); })
|
->addColumn('email', function($model) { return link_to('clients/' . $model->public_id, $model->email); })
|
||||||
@ -41,21 +41,34 @@ class ClientController extends \BaseController {
|
|||||||
->addColumn('balance', function($model) { return Utils::formatMoney($model->balance, $model->currency_id); })
|
->addColumn('balance', function($model) { return Utils::formatMoney($model->balance, $model->currency_id); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
if ($model->is_deleted)
|
||||||
|
{
|
||||||
|
return '<div style="height:38px"/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">';
|
||||||
<li><a href="' . URL::to('clients/'.$model->public_id.'/edit') . '">'.trans('texts.edit_client').'</a></li>
|
|
||||||
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00')
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="' . URL::to('clients/'.$model->public_id.'/edit') . '">'.trans('texts.edit_client').'</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="' . URL::to('invoices/create/'.$model->public_id) . '">'.trans('texts.new_invoice').'</a></li>
|
<li><a href="' . URL::to('invoices/create/'.$model->public_id) . '">'.trans('texts.new_invoice').'</a></li>
|
||||||
<li><a href="' . URL::to('payments/create/'.$model->public_id) . '">'.trans('texts.new_payment').'</a></li>
|
<li><a href="' . URL::to('payments/create/'.$model->public_id) . '">'.trans('texts.new_payment').'</a></li>
|
||||||
<li><a href="' . URL::to('credits/create/'.$model->public_id) . '">'.trans('texts.new_credit').'</a></li>
|
<li><a href="' . URL::to('credits/create/'.$model->public_id) . '">'.trans('texts.new_credit').'</a></li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_client').'</a></li>
|
<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_client').'</a></li>';
|
||||||
<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_client').'</a></li>
|
}
|
||||||
</ul>
|
else
|
||||||
</div>';
|
{
|
||||||
|
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id. ')">'.trans('texts.restore_client').'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str . '<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_client').'</a></li></ul>
|
||||||
|
</div>';
|
||||||
})
|
})
|
||||||
->make();
|
->make();
|
||||||
}
|
}
|
||||||
@ -276,6 +289,13 @@ class ClientController extends \BaseController {
|
|||||||
$message = Utils::pluralize($action.'d_client', $count);
|
$message = Utils::pluralize($action.'d_client', $count);
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('clients');
|
if ($action == 'restore' && $count == 1)
|
||||||
|
{
|
||||||
|
return Redirect::to('clients/' . $ids[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Redirect::to('clients');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,24 +35,37 @@ class CreditController extends \BaseController {
|
|||||||
|
|
||||||
if (!$clientPublicId)
|
if (!$clientPublicId)
|
||||||
{
|
{
|
||||||
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; })
|
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>'; })
|
||||||
->addColumn('client_name', function($model) { return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)); });
|
->addColumn('client_name', function($model) { return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)); });
|
||||||
}
|
}
|
||||||
|
|
||||||
return $table->addColumn('amount', function($model){ return Utils::formatMoney($model->amount, $model->currency_id); })
|
return $table->addColumn('amount', function($model){ return Utils::formatMoney($model->amount, $model->currency_id) . '<span ' . Utils::getEntityRowClass($model) . '/>'; })
|
||||||
->addColumn('balance', function($model){ return Utils::formatMoney($model->balance, $model->currency_id); })
|
->addColumn('balance', function($model){ return Utils::formatMoney($model->balance, $model->currency_id); })
|
||||||
->addColumn('credit_date', function($model) { return Utils::fromSqlDate($model->credit_date); })
|
->addColumn('credit_date', function($model) { return Utils::fromSqlDate($model->credit_date); })
|
||||||
->addColumn('private_notes', function($model) { return $model->private_notes; })
|
->addColumn('private_notes', function($model) { return $model->private_notes; })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
if ($model->is_deleted)
|
||||||
|
{
|
||||||
|
return '<div style="height:38px"/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">';
|
||||||
<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_credit').'</a></li>
|
|
||||||
<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_credit').'</a></li>
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00')
|
||||||
</ul>
|
{
|
||||||
|
$str .= '<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_credit').'</a></li>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id. ')">'.trans('texts.restore_credit').'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str . '<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_credit').'</a></li></ul>
|
||||||
</div>';
|
</div>';
|
||||||
})
|
})
|
||||||
->make();
|
->make();
|
||||||
|
@ -30,7 +30,14 @@ class InvoiceController extends \BaseController {
|
|||||||
'columns'=>Utils::trans(['checkbox', 'invoice_number', 'client', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status', 'action'])
|
'columns'=>Utils::trans(['checkbox', 'invoice_number', 'client', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status', 'action'])
|
||||||
];
|
];
|
||||||
|
|
||||||
if (Invoice::scope()->where('is_recurring', '=', true)->count() > 0)
|
$recurringInvoices = Invoice::scope()->where('is_recurring', '=', true);
|
||||||
|
|
||||||
|
if (Session::get('show_trash:invoice'))
|
||||||
|
{
|
||||||
|
$recurringInvoices->withTrashed();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($recurringInvoices->count() > 0)
|
||||||
{
|
{
|
||||||
$data['secEntityType'] = ENTITY_RECURRING_INVOICE;
|
$data['secEntityType'] = ENTITY_RECURRING_INVOICE;
|
||||||
$data['secColumns'] = Utils::trans(['checkbox', 'frequency', 'client', 'start_date', 'end_date', 'invoice_total', 'action']);
|
$data['secColumns'] = Utils::trans(['checkbox', 'frequency', 'client', 'start_date', 'end_date', 'invoice_total', 'action']);
|
||||||
@ -88,7 +95,7 @@ class InvoiceController extends \BaseController {
|
|||||||
$table = Datatable::query($query);
|
$table = Datatable::query($query);
|
||||||
|
|
||||||
if (!$clientPublicId) {
|
if (!$clientPublicId) {
|
||||||
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; });
|
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" '. Utils::getEntityRowClass($model) . '>'; });
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->addColumn('frequency', function($model) { return link_to('invoices/' . $model->public_id, $model->frequency); });
|
$table->addColumn('frequency', function($model) { return link_to('invoices/' . $model->public_id, $model->frequency); });
|
||||||
@ -102,17 +109,34 @@ class InvoiceController extends \BaseController {
|
|||||||
->addColumn('amount', function($model) { return Utils::formatMoney($model->amount, $model->currency_id); })
|
->addColumn('amount', function($model) { return Utils::formatMoney($model->amount, $model->currency_id); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
if ($model->is_deleted)
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
{
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
return '<div style="height:38px"/>';
|
||||||
</button>
|
}
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li><a href="' . URL::to('invoices/'.$model->public_id.'/edit') . '">'.trans('texts.edit_invoice').'</a></li>
|
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<li class="divider"></li>
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans('texts.archive_invoice').'</a></li>
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans('texts.delete_invoice').'</a></li>
|
</button>
|
||||||
</ul>
|
<ul class="dropdown-menu" role="menu">';
|
||||||
</div>';
|
|
||||||
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00')
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="' . URL::to('invoices/'.$model->public_id.'/edit') . '">'.trans('texts.edit_invoice').'</a></li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans('texts.archive_invoice').'</a></li>
|
||||||
|
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans('texts.delete_invoice').'</a></li>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id. ')">'.trans('texts.restore_invoice').'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str . '</ul>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
->make();
|
->make();
|
||||||
}
|
}
|
||||||
@ -313,7 +337,7 @@ class InvoiceController extends \BaseController {
|
|||||||
$action = Input::get('action');
|
$action = Input::get('action');
|
||||||
$entityType = Input::get('entityType');
|
$entityType = Input::get('entityType');
|
||||||
|
|
||||||
if ($action == 'archive' || $action == 'delete' || $action == 'mark')
|
if (in_array($action, ['archive', 'delete', 'mark', 'restore']))
|
||||||
{
|
{
|
||||||
return InvoiceController::bulk($entityType);
|
return InvoiceController::bulk($entityType);
|
||||||
}
|
}
|
||||||
@ -466,7 +490,14 @@ class InvoiceController extends \BaseController {
|
|||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::to("{$entityType}s");
|
if ($action == 'restore' && $count == 1)
|
||||||
|
{
|
||||||
|
return Redirect::to("{$entityType}s/" . $ids[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Redirect::to("{$entityType}s");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function convertQuote($publicId)
|
public function convertQuote($publicId)
|
||||||
|
@ -45,10 +45,10 @@ class PaymentController extends \BaseController
|
|||||||
$table = Datatable::query($payments);
|
$table = Datatable::query($payments);
|
||||||
|
|
||||||
if (!$clientPublicId) {
|
if (!$clientPublicId) {
|
||||||
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; });
|
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>'; });
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->addColumn('invoice_number', function($model) { return $model->invoice_public_id ? link_to('invoices/' . $model->invoice_public_id . '/edit', $model->invoice_number) : ''; });
|
$table->addColumn('invoice_number', function($model) { return $model->invoice_public_id ? link_to('invoices/' . $model->invoice_public_id . '/edit', $model->invoice_number, ['class' => Utils::getEntityRowClass($model)]) : ''; });
|
||||||
|
|
||||||
if (!$clientPublicId) {
|
if (!$clientPublicId) {
|
||||||
$table->addColumn('client_name', function($model) { return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)); });
|
$table->addColumn('client_name', function($model) { return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model)); });
|
||||||
@ -61,14 +61,27 @@ class PaymentController extends \BaseController
|
|||||||
->addColumn('payment_date', function($model) { return Utils::dateToString($model->payment_date); })
|
->addColumn('payment_date', function($model) { return Utils::dateToString($model->payment_date); })
|
||||||
->addColumn('dropdown', function($model)
|
->addColumn('dropdown', function($model)
|
||||||
{
|
{
|
||||||
return '<div class="btn-group tr-action" style="visibility:hidden;">
|
if ($model->is_deleted)
|
||||||
|
{
|
||||||
|
return '<div style="height:38px"/>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">';
|
||||||
<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_payment').'</a></li>
|
|
||||||
<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_payment').'</a></li>
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00')
|
||||||
</ul>
|
{
|
||||||
|
$str .= '<li><a href="javascript:archiveEntity(' . $model->public_id. ')">'.trans('texts.archive_payment').'</a></li>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id. ')">'.trans('texts.restore_payment').'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str . '<li><a href="javascript:deleteEntity(' . $model->public_id. ')">'.trans('texts.delete_payment').'</a></li></ul>
|
||||||
</div>';
|
</div>';
|
||||||
})
|
})
|
||||||
->make();
|
->make();
|
||||||
|
@ -476,6 +476,19 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -466,6 +466,20 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -474,4 +474,18 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -446,5 +446,19 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -467,4 +467,18 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -469,6 +469,20 @@ return array(
|
|||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -477,6 +477,20 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -475,6 +475,19 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -470,6 +470,20 @@ return array(
|
|||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -457,6 +457,19 @@ return array(
|
|||||||
'bought_white_label' => 'Successfully enabled white label license',
|
'bought_white_label' => 'Successfully enabled white label license',
|
||||||
'white_labeled' => 'White labeled',
|
'white_labeled' => 'White labeled',
|
||||||
|
|
||||||
|
'restore' => 'Restore',
|
||||||
|
'restore_invoice' => 'Restore Invoice',
|
||||||
|
'restore_quote' => 'Restore Quote',
|
||||||
|
'restore_client' => 'Restore Client',
|
||||||
|
'restore_credit' => 'Restore Credit',
|
||||||
|
'restore_payment' => 'Restore Payment',
|
||||||
|
|
||||||
|
'restored_invoice' => 'Successfully restored invoice',
|
||||||
|
'restored_quote' => 'Successfully restored quote',
|
||||||
|
'restored_client' => 'Successfully restored client',
|
||||||
|
'restored_payment' => 'Successfully restored payment',
|
||||||
|
'restored_credit' => 'Successfully restored credit',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -579,4 +579,20 @@ class Utils
|
|||||||
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
|
return $needle === "" || substr($haystack, -strlen($needle)) === $needle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getEntityRowClass($model)
|
||||||
|
{
|
||||||
|
$str = $model->is_deleted || ($model->deleted_at && $model->deleted_at != '0000-00-00') ? 'DISABLED ' : '';
|
||||||
|
|
||||||
|
if ($model->is_deleted)
|
||||||
|
{
|
||||||
|
$str .= 'ENTITY_DELETED ';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($model->deleted_at && $model->deleted_at != '0000-00-00')
|
||||||
|
{
|
||||||
|
$str .= 'ENTITY_ARCHIVED ';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
}
|
}
|
@ -29,6 +29,12 @@ define("ACTIVITY_TYPE_VIEW_QUOTE", 21);
|
|||||||
define("ACTIVITY_TYPE_ARCHIVE_QUOTE", 22);
|
define("ACTIVITY_TYPE_ARCHIVE_QUOTE", 22);
|
||||||
define("ACTIVITY_TYPE_DELETE_QUOTE", 23);
|
define("ACTIVITY_TYPE_DELETE_QUOTE", 23);
|
||||||
|
|
||||||
|
define("ACTIVITY_TYPE_RESTORE_QUOTE", 24);
|
||||||
|
define("ACTIVITY_TYPE_RESTORE_INVOICE", 25);
|
||||||
|
define("ACTIVITY_TYPE_RESTORE_CLIENT", 26);
|
||||||
|
define("ACTIVITY_TYPE_RESTORE_PAYMENT", 27);
|
||||||
|
define("ACTIVITY_TYPE_RESTORE_CREDIT", 28);
|
||||||
|
|
||||||
|
|
||||||
class Activity extends Eloquent
|
class Activity extends Eloquent
|
||||||
{
|
{
|
||||||
@ -106,6 +112,16 @@ class Activity extends Eloquent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function restoreClient($client)
|
||||||
|
{
|
||||||
|
$activity = Activity::getBlank();
|
||||||
|
$activity->client_id = $client->id;
|
||||||
|
$activity->activity_type_id = ACTIVITY_TYPE_RESTORE_CLIENT;
|
||||||
|
$activity->message = Utils::encodeActivity(Auth::user(), 'restored', $client);
|
||||||
|
$activity->balance = $client->balance;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
|
||||||
public static function createInvoice($invoice)
|
public static function createInvoice($invoice)
|
||||||
{
|
{
|
||||||
if (Auth::check())
|
if (Auth::check())
|
||||||
@ -153,6 +169,18 @@ class Activity extends Eloquent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function restoreInvoice($invoice)
|
||||||
|
{
|
||||||
|
$activity = Activity::getBlank();
|
||||||
|
$activity->invoice_id = $invoice->id;
|
||||||
|
$activity->client_id = $invoice->client_id;
|
||||||
|
$activity->activity_type_id = $invoice->is_quote ? ACTIVITY_TYPE_RESTORE_QUOTE : ACTIVITY_TYPE_RESTORE_INVOICE;
|
||||||
|
$activity->message = Utils::encodeActivity(Auth::user(), 'restored', $invoice);
|
||||||
|
$activity->balance = $invoice->client->balance;
|
||||||
|
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
|
||||||
public static function emailInvoice($invitation)
|
public static function emailInvoice($invitation)
|
||||||
{
|
{
|
||||||
$adjustment = 0;
|
$adjustment = 0;
|
||||||
@ -370,6 +398,21 @@ class Activity extends Eloquent
|
|||||||
$activity->save();
|
$activity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function restorePayment($payment)
|
||||||
|
{
|
||||||
|
$client = $payment->client;
|
||||||
|
$invoice = $payment->invoice;
|
||||||
|
|
||||||
|
$activity = Activity::getBlank();
|
||||||
|
$activity->payment_id = $payment->id;
|
||||||
|
$activity->invoice_id = $invoice->id;
|
||||||
|
$activity->client_id = $client->id;
|
||||||
|
$activity->activity_type_id = ACTIVITY_TYPE_RESTORE_PAYMENT;
|
||||||
|
$activity->message = Utils::encodeActivity(Auth::user(), 'restored ' . $payment->getName());
|
||||||
|
$activity->balance = $client->balance;
|
||||||
|
$activity->adjustment = 0;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
|
||||||
public static function createCredit($credit)
|
public static function createCredit($credit)
|
||||||
{
|
{
|
||||||
@ -437,6 +480,17 @@ class Activity extends Eloquent
|
|||||||
$activity->save();
|
$activity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function restoreCredit($credit)
|
||||||
|
{
|
||||||
|
$activity = Activity::getBlank();
|
||||||
|
$activity->client_id = $credit->client_id;
|
||||||
|
$activity->credit_id = $credit->id;
|
||||||
|
$activity->activity_type_id = ACTIVITY_TYPE_RESTORE_CREDIT;
|
||||||
|
$activity->message = Utils::encodeActivity(Auth::user(), 'restored ' . Utils::formatMoney($credit->balance, $credit->client->currency_id) . ' credit');
|
||||||
|
$activity->balance = $credit->client->balance;
|
||||||
|
$activity->save();
|
||||||
|
}
|
||||||
|
|
||||||
private static function checkSubscriptions($event, $data)
|
private static function checkSubscriptions($event, $data)
|
||||||
{
|
{
|
||||||
if (!Auth::check()) {
|
if (!Auth::check()) {
|
||||||
|
@ -253,3 +253,8 @@ Client::deleting(function($client)
|
|||||||
{
|
{
|
||||||
Activity::archiveClient($client);
|
Activity::archiveClient($client);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Client::restoring(function($client)
|
||||||
|
{
|
||||||
|
Activity::restoreClient($client);
|
||||||
|
});
|
@ -55,3 +55,8 @@ Credit::deleting(function($credit)
|
|||||||
{
|
{
|
||||||
Activity::archiveCredit($credit);
|
Activity::archiveCredit($credit);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Credit::restoring(function($credit)
|
||||||
|
{
|
||||||
|
Activity::restoreCredit($credit);
|
||||||
|
});
|
@ -234,3 +234,8 @@ Invoice::deleting(function($invoice)
|
|||||||
{
|
{
|
||||||
Activity::archiveInvoice($invoice);
|
Activity::archiveInvoice($invoice);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Invoice::restoring(function($invoice)
|
||||||
|
{
|
||||||
|
Activity::restoreInvoice($invoice);
|
||||||
|
});
|
@ -58,3 +58,8 @@ Payment::deleting(function($payment)
|
|||||||
{
|
{
|
||||||
Activity::archivePayment($payment);
|
Activity::archivePayment($payment);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Payment::restoring(function($payment)
|
||||||
|
{
|
||||||
|
Activity::restorePayment($payment);
|
||||||
|
});
|
@ -11,7 +11,7 @@ class ClientRepository
|
|||||||
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||||
->where('clients.account_id', '=', \Auth::user()->account_id)
|
->where('clients.account_id', '=', \Auth::user()->account_id)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('clients.public_id','clients.name','contacts.first_name','contacts.last_name','clients.balance','clients.last_login','clients.created_at','clients.work_phone','contacts.email','clients.currency_id');
|
->select('clients.public_id','clients.name','contacts.first_name','contacts.last_name','clients.balance','clients.last_login','clients.created_at','clients.work_phone','contacts.email','clients.currency_id', 'clients.deleted_at', 'clients.is_deleted');
|
||||||
|
|
||||||
if (!\Session::get('show_trash:client'))
|
if (!\Session::get('show_trash:client'))
|
||||||
{
|
{
|
||||||
@ -198,13 +198,20 @@ class ClientRepository
|
|||||||
|
|
||||||
foreach ($clients as $client)
|
foreach ($clients as $client)
|
||||||
{
|
{
|
||||||
if ($action == 'delete')
|
if ($action == 'restore')
|
||||||
{
|
{
|
||||||
$client->is_deleted = true;
|
$client->restore();
|
||||||
$client->save();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$client->is_deleted = true;
|
||||||
|
$client->save();
|
||||||
|
}
|
||||||
|
|
||||||
$client->delete();
|
$client->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($clients);
|
return count($clients);
|
||||||
|
@ -15,7 +15,7 @@ class CreditRepository
|
|||||||
->where('clients.account_id', '=', \Auth::user()->account_id)
|
->where('clients.account_id', '=', \Auth::user()->account_id)
|
||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('credits.public_id', 'clients.name as client_name', 'clients.public_id as client_public_id', 'credits.amount', 'credits.balance', 'credits.credit_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'credits.private_notes');
|
->select('credits.public_id', 'clients.name as client_name', 'clients.public_id as client_public_id', 'credits.amount', 'credits.balance', 'credits.credit_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'credits.private_notes', 'credits.deleted_at', 'credits.is_deleted');
|
||||||
|
|
||||||
if ($clientPublicId)
|
if ($clientPublicId)
|
||||||
{
|
{
|
||||||
@ -70,13 +70,20 @@ class CreditRepository
|
|||||||
|
|
||||||
foreach ($credits as $credit)
|
foreach ($credits as $credit)
|
||||||
{
|
{
|
||||||
if ($action == 'delete')
|
if ($action == 'restore')
|
||||||
{
|
{
|
||||||
$credit->is_deleted = true;
|
$credit->restore();
|
||||||
$credit->save();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$credit->is_deleted = true;
|
||||||
|
$credit->save();
|
||||||
|
}
|
||||||
|
|
||||||
$credit->delete();
|
$credit->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($credits);
|
return count($credits);
|
||||||
|
@ -20,7 +20,7 @@ class InvoiceRepository
|
|||||||
->where('contacts.deleted_at', '=', null)
|
->where('contacts.deleted_at', '=', null)
|
||||||
->where('invoices.is_recurring', '=', false)
|
->where('invoices.is_recurring', '=', false)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('clients.public_id as client_public_id', 'invoice_number', 'invoice_status_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id');
|
->select('clients.public_id as client_public_id', 'invoice_number', 'invoice_status_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'invoices.balance', 'invoice_date', 'due_date', 'invoice_statuses.name as invoice_status_name', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'quote_id', 'quote_invoice_id', 'invoices.deleted_at', 'invoices.is_deleted');
|
||||||
|
|
||||||
if (!\Session::get('show_trash:' . $entityType))
|
if (!\Session::get('show_trash:' . $entityType))
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ class InvoiceRepository
|
|||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
->where('invoices.is_recurring', '=', true)
|
->where('invoices.is_recurring', '=', true)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email');
|
->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'invoices.deleted_at', 'invoices.is_deleted');
|
||||||
|
|
||||||
if ($clientPublicId)
|
if ($clientPublicId)
|
||||||
{
|
{
|
||||||
@ -121,10 +121,10 @@ class InvoiceRepository
|
|||||||
|
|
||||||
if (!$clientPublicId)
|
if (!$clientPublicId)
|
||||||
{
|
{
|
||||||
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">'; });
|
$table->addColumn('checkbox', function($model) { return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>'; });
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->addColumn("invoice_number", function($model) use ($entityType) { return link_to("{$entityType}s/" . $model->public_id . '/edit', $model->invoice_number); });
|
$table->addColumn("invoice_number", function($model) use ($entityType) { return link_to("{$entityType}s/" . $model->public_id . '/edit', $model->invoice_number, ['class' => Utils::getEntityRowClass($model)]); });
|
||||||
|
|
||||||
if (!$clientPublicId)
|
if (!$clientPublicId)
|
||||||
{
|
{
|
||||||
@ -143,14 +143,22 @@ class InvoiceRepository
|
|||||||
->addColumn('invoice_status_name', function($model) { return $model->invoice_status_name; })
|
->addColumn('invoice_status_name', function($model) { return $model->invoice_status_name; })
|
||||||
->addColumn('dropdown', function($model) use ($entityType)
|
->addColumn('dropdown', function($model) use ($entityType)
|
||||||
{
|
{
|
||||||
|
if ($model->is_deleted)
|
||||||
|
{
|
||||||
|
return '<div style="height:38px"/>';
|
||||||
|
}
|
||||||
|
|
||||||
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
'.trans('texts.select').' <span class="caret"></span>
|
'.trans('texts.select').' <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" role="menu">
|
<ul class="dropdown-menu" role="menu">';
|
||||||
<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/edit') . '">'.trans("texts.edit_{$entityType}").'</a></li>
|
|
||||||
<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/clone') . '">'.trans("texts.clone_{$entityType}").'</a></li>
|
if (!$model->deleted_at || $model->deleted_at == '0000-00-00')
|
||||||
<li class="divider"></li>';
|
{
|
||||||
|
$str .= '<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/edit') . '">'.trans("texts.edit_{$entityType}").'</a></li>
|
||||||
|
<li><a href="' . \URL::to("{$entityType}s/".$model->public_id.'/clone') . '">'.trans("texts.clone_{$entityType}").'</a></li>
|
||||||
|
<li class="divider"></li>';
|
||||||
|
|
||||||
if ($model->invoice_status_id < INVOICE_STATUS_SENT)
|
if ($model->invoice_status_id < INVOICE_STATUS_SENT)
|
||||||
{
|
{
|
||||||
@ -177,13 +185,20 @@ class InvoiceRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str . '<li class="divider"></li>
|
$str .= '<li class="divider"></li>
|
||||||
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans("texts.archive_{$entityType}").'</a></li>
|
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">'.trans("texts.archive_{$entityType}").'</a></li>
|
||||||
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans("texts.delete_{$entityType}").'</a></li>
|
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans("texts.delete_{$entityType}").'</a></li>';
|
||||||
</ul>
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$str .= '<li><a href="javascript:restoreEntity(' . $model->public_id. ')">'.trans("texts.restore_{$entityType}").'</a></li>
|
||||||
|
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">'.trans("texts.delete_{$entityType}").'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str . '</ul>
|
||||||
</div>';
|
</div>';
|
||||||
})
|
})
|
||||||
->make();
|
->make();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getErrors($input)
|
public function getErrors($input)
|
||||||
@ -483,6 +498,10 @@ class InvoiceRepository
|
|||||||
$invoice->invoice_status_id = $statusId;
|
$invoice->invoice_status_id = $statusId;
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
}
|
}
|
||||||
|
else if ($action == 'restore')
|
||||||
|
{
|
||||||
|
$invoice->restore();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
|
@ -18,7 +18,7 @@ class PaymentRepository
|
|||||||
->where('payments.account_id', '=', \Auth::user()->account_id)
|
->where('payments.account_id', '=', \Auth::user()->account_id)
|
||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
->select('payments.public_id', 'payments.transaction_reference', 'clients.name as client_name', 'clients.public_id as client_public_id', 'payments.amount', 'payments.payment_date', 'invoices.public_id as invoice_public_id', 'invoices.invoice_number', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'payment_types.name as payment_type', 'payments.account_gateway_id');
|
->select('payments.public_id', 'payments.transaction_reference', 'clients.name as client_name', 'clients.public_id as client_public_id', 'payments.amount', 'payments.payment_date', 'invoices.public_id as invoice_public_id', 'invoices.invoice_number', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'payment_types.name as payment_type', 'payments.account_gateway_id', 'payments.deleted_at', 'payments.is_deleted');
|
||||||
|
|
||||||
if (!\Session::get('show_trash:payment'))
|
if (!\Session::get('show_trash:payment'))
|
||||||
{
|
{
|
||||||
@ -148,13 +148,20 @@ class PaymentRepository
|
|||||||
|
|
||||||
foreach ($payments as $payment)
|
foreach ($payments as $payment)
|
||||||
{
|
{
|
||||||
if ($action == 'delete')
|
if ($action == 'restore')
|
||||||
{
|
{
|
||||||
$payment->is_deleted = true;
|
$payment->restore();
|
||||||
$payment->save();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($action == 'delete')
|
||||||
|
{
|
||||||
|
$payment->is_deleted = true;
|
||||||
|
$payment->save();
|
||||||
|
}
|
||||||
|
|
||||||
$payment->delete();
|
$payment->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return count($payments);
|
return count($payments);
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
|
||||||
@if (!$client->trashed())
|
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{ Former::open('clients/bulk')->addClass('mainForm') }}
|
{{ Former::open('clients/bulk')->addClass('mainForm') }}
|
||||||
<div style="display:none">
|
<div style="display:none">
|
||||||
@ -11,6 +10,9 @@
|
|||||||
{{ Former::text('id')->value($client->public_id) }}
|
{{ Former::text('id')->value($client->public_id) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if ($client->trashed())
|
||||||
|
{{ Button::primary(trans('texts.restore_client'), ['onclick' => 'onRestoreClick()']) }}
|
||||||
|
@else
|
||||||
{{ DropdownButton::normal(trans('texts.edit_client'),
|
{{ DropdownButton::normal(trans('texts.edit_client'),
|
||||||
Navigation::links(
|
Navigation::links(
|
||||||
[
|
[
|
||||||
@ -23,10 +25,11 @@
|
|||||||
, ['id'=>'normalDropDown'])->split(); }}
|
, ['id'=>'normalDropDown'])->split(); }}
|
||||||
|
|
||||||
{{ DropdownButton::primary('Create Invoice', Navigation::links($actionLinks), ['id'=>'primaryDropDown'])->split(); }}
|
{{ DropdownButton::primary('Create Invoice', Navigation::links($actionLinks), ['id'=>'primaryDropDown'])->split(); }}
|
||||||
{{ Former::close() }}
|
@endif
|
||||||
|
{{ Former::close() }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
|
|
||||||
<h2>{{ $client->getDisplayName() }}</h2>
|
<h2>{{ $client->getDisplayName() }}</h2>
|
||||||
@if ($client->last_login > 0)
|
@if ($client->last_login > 0)
|
||||||
@ -209,6 +212,11 @@
|
|||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onRestoreClick() {
|
||||||
|
$('#action').val('restore');
|
||||||
|
$('.mainForm').submit();
|
||||||
|
}
|
||||||
|
|
||||||
function onDeleteClick() {
|
function onDeleteClick() {
|
||||||
if (confirm("{{ trans('texts.are_you_sure') }}")) {
|
if (confirm("{{ trans('texts.are_you_sure') }}")) {
|
||||||
$('#action').val('delete');
|
$('#action').val('delete');
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
// dynamic table
|
// dynamic table
|
||||||
jQuery('.{{ $class }}').dataTable({
|
jQuery('.{{ $class }}').dataTable({
|
||||||
|
"fnRowCallback": function(row, data) {
|
||||||
|
if (data[0].indexOf('ENTITY_DELETED') > 0) {
|
||||||
|
$(row).addClass('entityDeleted');
|
||||||
|
}
|
||||||
|
if (data[0].indexOf('ENTITY_ARCHIVED') > 0) {
|
||||||
|
$(row).addClass('entityArchived');
|
||||||
|
}
|
||||||
|
},
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
@if (isset($hasCheckboxes) && $hasCheckboxes)
|
@if (isset($hasCheckboxes) && $hasCheckboxes)
|
||||||
'aaSorting': [['1', 'asc']],
|
'aaSorting': [['1', 'asc']],
|
||||||
|
@ -314,6 +314,8 @@
|
|||||||
@if ($invoice && $invoice->id && $entityType == ENTITY_INVOICE)
|
@if ($invoice && $invoice->id && $entityType == ENTITY_INVOICE)
|
||||||
{{ Button::primary(trans('texts.enter_payment'), array('onclick' => 'onPaymentClick()'))->append_with_icon('usd'); }}
|
{{ Button::primary(trans('texts.enter_payment'), array('onclick' => 'onPaymentClick()'))->append_with_icon('usd'); }}
|
||||||
@endif
|
@endif
|
||||||
|
@elseif ($invoice && $invoice->trashed())
|
||||||
|
{{ Button::success(trans('texts.restore'), ['onclick' => 'submitAction("restore")'])->append_with_icon('cloud-download') }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -68,6 +68,11 @@
|
|||||||
submitForm('archive');
|
submitForm('archive');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreEntity(id) {
|
||||||
|
$('#id').val(id);
|
||||||
|
submitForm('restore');
|
||||||
|
}
|
||||||
|
|
||||||
function markEntity(id, statusId) {
|
function markEntity(id, statusId) {
|
||||||
$('#id').val(id);
|
$('#id').val(id);
|
||||||
$('#statusId').val(statusId);
|
$('#statusId').val(statusId);
|
||||||
@ -118,7 +123,7 @@
|
|||||||
|
|
||||||
$('tbody tr').click(function(event) {
|
$('tbody tr').click(function(event) {
|
||||||
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
|
if (event.target.type !== 'checkbox' && event.target.type !== 'button' && event.target.tagName.toLowerCase() !== 'a') {
|
||||||
$checkbox = $(this).closest('tr').find(':checkbox');
|
$checkbox = $(this).closest('tr').find(':checkbox:not(:disabled)');
|
||||||
var checked = $checkbox.prop('checked');
|
var checked = $checkbox.prop('checked');
|
||||||
$checkbox.prop('checked', !checked);
|
$checkbox.prop('checked', !checked);
|
||||||
setArchiveEnabled();
|
setArchiveEnabled();
|
||||||
@ -142,8 +147,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.selectAll').click(function() {
|
$('.selectAll').click(function() {
|
||||||
$(this).closest('table').find(':checkbox').prop('checked', this.checked);
|
$(this).closest('table').find(':checkbox:not(:disabled)').prop('checked', this.checked);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function setArchiveEnabled() {
|
function setArchiveEnabled() {
|
||||||
|
@ -3517,6 +3517,14 @@ box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.entityArchived {
|
||||||
|
color: #888 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entityDeleted {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 992px) {
|
@media screen and (min-width: 992px) {
|
||||||
.hide-desktop {display: none;}
|
.hide-desktop {display: none;}
|
||||||
}
|
}
|
||||||
|
@ -717,6 +717,14 @@ box-shadow: 0px 0px 15px 0px rgba(0, 5, 5, 0.2);
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.entityArchived {
|
||||||
|
color: #888 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entityDeleted {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 992px) {
|
@media screen and (min-width: 992px) {
|
||||||
.hide-desktop {display: none;}
|
.hide-desktop {display: none;}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user