close #2616 Enhancement: Add payment from invoice/bill index ( #3g3rnd2 )
This commit is contained in:
parent
cf565f55e0
commit
8c61a4ee73
@ -113,13 +113,7 @@ class DocumentTransactions extends Controller
|
|||||||
$response = $this->ajaxDispatch(new CreateBankingDocumentTransaction($document, $request));
|
$response = $this->ajaxDispatch(new CreateBankingDocumentTransaction($document, $request));
|
||||||
|
|
||||||
if ($response['success']) {
|
if ($response['success']) {
|
||||||
$route = config('type.document.' . $document->type . '.route.prefix');
|
$response['redirect'] = url()->previous();
|
||||||
|
|
||||||
if ($alias = config('type.document.' . $document->type . '.alias')) {
|
|
||||||
$route = $alias . '.' . $route;
|
|
||||||
}
|
|
||||||
|
|
||||||
$response['redirect'] = route($route . '.show', $document->id);
|
|
||||||
|
|
||||||
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
$message = trans('messages.success.added', ['type' => trans_choice('general.payments', 1)]);
|
||||||
|
|
||||||
|
@ -595,6 +595,26 @@ class Document extends Model
|
|||||||
'type' => 'divider',
|
'type' => 'divider',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ((empty($this->transactions->count()) || (! empty($this->transactions->count()) && $this->paid != $this->amount))) {
|
||||||
|
try {
|
||||||
|
$actions[] = [
|
||||||
|
'type' => 'button',
|
||||||
|
'title' => trans('invoices.add_payment'),
|
||||||
|
'icon' => 'payments',
|
||||||
|
'url' => route('modals.documents.document.transactions.create', $this->id),
|
||||||
|
'permission' => 'read-' . $group . '-' . $permission_prefix,
|
||||||
|
'attributes' => [
|
||||||
|
'id' => 'index-more-actions-payment-' . $this->id,
|
||||||
|
'@click' => 'onPayment("' . $this->id . '")',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
|
||||||
|
$actions[] = [
|
||||||
|
'type' => 'divider',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->status != 'cancelled') {
|
if ($this->status != 'cancelled') {
|
||||||
try {
|
try {
|
||||||
$actions[] = [
|
$actions[] = [
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
@stack('timeline_get_paid_body_button_payment_start')
|
@stack('timeline_get_paid_body_button_payment_start')
|
||||||
|
|
||||||
@if (! $hideAddPayment)
|
@if (! $hideAddPayment)
|
||||||
@if(empty($document->transactions->count()) || (! empty($document->transactions->count()) && $document->paid != $document->amount))
|
@if (empty($document->transactions->count()) || (! empty($document->transactions->count()) && $document->paid != $document->amount))
|
||||||
<x-button
|
<x-button
|
||||||
@click="onPayment"
|
@click="onPayment"
|
||||||
id="button-payment"
|
id="button-payment"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user