Portal payment added print and pdf action..
This commit is contained in:
parent
116562ea03
commit
339e7b320a
@ -349,7 +349,7 @@ abstract class TransactionShow extends Base
|
||||
$this->transaction = $transaction;
|
||||
$this->transactionTemplate = $this->getTransactionTemplate($type, $transactionTemplate);
|
||||
$this->logo = $this->getLogo($logo);
|
||||
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods();
|
||||
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
|
||||
$this->date_format = $this->getCompanyDateFormat();
|
||||
|
||||
// Navbar Hide
|
||||
@ -909,7 +909,7 @@ abstract class TransactionShow extends Base
|
||||
$default_key = 'payment_made';
|
||||
break;
|
||||
default:
|
||||
$default_key = 'revenue_made';
|
||||
$default_key = 'revenue_received';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -919,7 +919,7 @@ abstract class TransactionShow extends Base
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return 'revenues.revenue_made';
|
||||
return 'revenues.revenue_received';
|
||||
}
|
||||
|
||||
protected function getTextPaidAt($type, $textPaidAt)
|
||||
|
@ -187,7 +187,7 @@ abstract class TransactionTemplate extends Base
|
||||
$this->transaction = $transaction;
|
||||
|
||||
$this->logo = $this->getLogo($logo);
|
||||
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods();
|
||||
$this->payment_methods = ($payment_methods) ?: Modules::getPaymentMethods('all');
|
||||
|
||||
// Company Information Hide checker
|
||||
$this->hideCompany = $hideCompany;
|
||||
@ -313,7 +313,7 @@ abstract class TransactionTemplate extends Base
|
||||
$default_key = 'payment_made';
|
||||
break;
|
||||
default:
|
||||
$default_key = 'revenue_made';
|
||||
$default_key = 'revenue_received';
|
||||
break;
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ abstract class TransactionTemplate extends Base
|
||||
return $translation;
|
||||
}
|
||||
|
||||
return 'revenues.revenue_made';
|
||||
return 'revenues.revenue_received';
|
||||
}
|
||||
|
||||
protected function getTextPaidAt($type, $textPaidAt)
|
||||
|
@ -7,10 +7,13 @@ use App\Models\Banking\Transaction;
|
||||
use App\Models\Setting\Currency;
|
||||
use App\Http\Requests\Portal\PaymentShow as Request;
|
||||
use App\Utilities\Modules;
|
||||
use App\Traits\Transactions;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class Payments extends Controller
|
||||
{
|
||||
use Transactions;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@ -53,6 +56,50 @@ class Payments extends Controller
|
||||
return $this->response('portal.currencies.index', compact('currencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @param Transaction $payment
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function printPayment(Transaction $payment, Request $request)
|
||||
{
|
||||
event(new \App\Events\Transaction\TransactionPrinting($payment));
|
||||
|
||||
$revenue = $payment;
|
||||
$view = view($payment->template_path, compact('revenue'));
|
||||
|
||||
return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for viewing the specified resource.
|
||||
*
|
||||
* @param Transaction $payment
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function pdfPayment(Transaction $payment, Request $request)
|
||||
{
|
||||
event(new \App\Events\Transaction\TransactionPrinting($payment));
|
||||
|
||||
$currency_style = true;
|
||||
|
||||
$revenue = $payment;
|
||||
$view = view($payment->template_path, compact('revenue', 'currency_style'))->render();
|
||||
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->loadHTML($html);
|
||||
|
||||
//$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
$file_name = $this->getTransactionFileName($payment);
|
||||
|
||||
return $pdf->download($file_name);
|
||||
}
|
||||
|
||||
public function signed(Transaction $payment)
|
||||
{
|
||||
if (empty($payment)) {
|
||||
|
@ -5,7 +5,5 @@ return [
|
||||
'payment_made' => 'Payment Made',
|
||||
'paid_to' => 'Paid To',
|
||||
'related_bill' => 'Releated Bill',
|
||||
|
||||
'overdue_payment' => 'Overdue Payment',
|
||||
|
||||
];
|
||||
|
@ -2,10 +2,8 @@
|
||||
|
||||
return [
|
||||
|
||||
'revenue_made' => 'Revenue Made',
|
||||
'paid_by' => 'Paid By',
|
||||
'related_invoice' => 'Releated Invoice',
|
||||
|
||||
'overdue_revenue' => 'Overdue Revenue',
|
||||
'revenue_received' => 'Revenue Received',
|
||||
'paid_by' => 'Paid By',
|
||||
'related_invoice' => 'Releated Invoice',
|
||||
|
||||
];
|
||||
|
@ -33,7 +33,7 @@
|
||||
</td>
|
||||
|
||||
<td class="col-xs-4 col-sm-6 text-left long-texts">
|
||||
{{ $history->creator->name }}
|
||||
{{ $history->owner->name }}
|
||||
</td>
|
||||
@stack('row_footer_histories_body_td_end')
|
||||
</tr>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
@section('new_button')
|
||||
@stack('button_print_start')
|
||||
<a href="{{ route('portal.invoices.print', $invoice->id) }}" target="_blank" class="btn btn-success btn-sm">
|
||||
<a href="{{ route('portal.invoices.print', $invoice->id) }}" target="_blank" class="btn btn-white btn-sm">
|
||||
{{ trans('general.print') }}
|
||||
</a>
|
||||
@stack('button_print_end')
|
||||
|
@ -1,144 +1,39 @@
|
||||
@extends('layouts.portal')
|
||||
|
||||
@section('title', trans_choice('general.payments', 1))
|
||||
@section('title', trans_choice('general.payments', 1) . ': ' . @date($payment->paid_at))
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="m-0 float-right">@date($payment->paid_at)</h3>
|
||||
</div>
|
||||
@section('new_button')
|
||||
@stack('button_print_start')
|
||||
<a href="{{ route('portal.payments.print', $payment->id) }}" target="_blank" class="btn btn-white btn-sm">
|
||||
{{ trans('general.print') }}
|
||||
</a>
|
||||
@stack('button_print_end')
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card list-group">
|
||||
<li class="list-group-item list-group-item-action active">
|
||||
<b>{{ trans('general.from') }}:</b> {{ setting('company.name') }}
|
||||
</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.address') }}:</b> {{ setting('company.address') }}</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.phone') }}:</b> {{ setting('company.phone') }}</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.email') }}:</b> {{ setting('company.email') }}</li>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card list-group">
|
||||
<li class="list-group-item list-group-item-action active">
|
||||
<b>{{ trans('general.to') }}:</b> {{ $payment->contact->name }}
|
||||
</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.address') }}:</b> {{ $payment->contact->address }}</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.phone') }}:</b> {{ $payment->contact->phone }}</li>
|
||||
<li class="list-group-item"><b>{{ trans('general.email') }}:</b> {{ $payment->contact->email }}</li>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
@if ($payment->description)
|
||||
<p class="form-control-label">{{ trans('general.description') }}</p>
|
||||
<p class="text-muted long-texts">{{ $payment->description }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header border-bottom-0">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-12 text-nowrap">
|
||||
<h4 class="mb-0">{{ trans_choice('general.payments', 1) }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-flush table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr class="row table-head-line">
|
||||
<th class="col-xs-4 col-sm-2 text-right">{{ trans('general.amount') }}</th>
|
||||
<th class="col-xs-4 col-sm-3 text-left">{{ trans_choice('general.payment_methods', 1) }}</th>
|
||||
<th class="col-xs-4 col-sm-7 text-left long-texts">{{ trans('general.description') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="row border-top-1 tr-py">
|
||||
<td class="col-xs-4 col-sm-2 text-right">@money($payment->amount, $payment->currency_code, true)</td>
|
||||
<td class="col-xs-4 col-sm-3 text-left">{{ $payment_methods[$payment->payment_method] }}</td>
|
||||
<td class="col-xs-4 col-sm-7 text-left long-texts">{{ $payment->description }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($payment->attachment)
|
||||
<div class="card-footer">
|
||||
<div class="row float-right">
|
||||
<div class="col-md-12">
|
||||
@if (1)
|
||||
<div class="card mb-0">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto">
|
||||
<i class="far fa-file-pdf display-3"></i>
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<a class="btn btn-sm btn-icon btn-white" type="button">
|
||||
<span class="btn-inner--icon">
|
||||
<i class="fas fa-paperclip"></i>
|
||||
{{ basename($payment->attachment) }}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-sm btn-icon btn-info text-white float-right" type="button">
|
||||
<span class="btn-inner--icon">
|
||||
<i class="fas fa-file-download"></i>
|
||||
{{ basename($payment->attachment) }}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="card mb-0">
|
||||
<div class="card-body">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto">
|
||||
@if($payment->attachment)
|
||||
<img src="public/img/invoice_templates/classic.png" alt="Attachment">
|
||||
@else
|
||||
<i class="far fa-file-image display-3"></i>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<a class="btn btn-sm btn-icon btn-white" type="button">
|
||||
<span class="btn-inner--icon">
|
||||
<i class="fas fa-camera"></i>
|
||||
{{ basename($payment->attachment) }}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a class="btn btn-sm btn-icon btn-info text-white float-right" type="button">
|
||||
<span class="btn-inner--icon">
|
||||
<i class="fas fa-file-download"></i>
|
||||
{{ basename($payment->attachment) }}
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@stack('button_pdf_start')
|
||||
<a href="{{ route('portal.payments.pdf', $payment->id) }}" class="btn btn-white btn-sm">
|
||||
{{ trans('general.download') }}
|
||||
</a>
|
||||
@stack('button_pdf_end')
|
||||
@endsection
|
||||
|
||||
@push('scripts_start')
|
||||
@section('content')
|
||||
<x-transactions.show.header
|
||||
type="payment"
|
||||
:transaction="$payment"
|
||||
hide-header-contact
|
||||
class-header-status="col-md-8"
|
||||
/>
|
||||
|
||||
<x-transactions.show.transaction
|
||||
type="payment"
|
||||
:transaction="$payment"
|
||||
transaction-template="{{ setting('payment.template', 'default') }}"
|
||||
hide-payment-methods
|
||||
/>
|
||||
@endsection
|
||||
|
||||
@push('footer_start')
|
||||
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
|
||||
|
||||
<script src="{{ asset('public/js/portal/payments.js?v=' . version('short')) }}"></script>
|
||||
@endpush
|
||||
|
@ -1,6 +1,6 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', trans('revenues.revenue_made'))
|
||||
@section('title', trans('revenues.revenue_received'))
|
||||
|
||||
@section('new_button')
|
||||
<x-transactions.show.top-buttons type="income" :transaction="$revenue" />
|
||||
|
@ -17,6 +17,8 @@ Route::group(['as' => 'portal.'], function () {
|
||||
Route::resource('invoices', 'Portal\Invoices');
|
||||
|
||||
Route::get('payments/currencies', 'Portal\Payments@currencies')->name('payment.currencies');
|
||||
Route::get('payments/{payment}/print', 'Portal\Payments@printPayment')->name('payments.print');
|
||||
Route::get('payments/{payment}/pdf', 'Portal\Payments@pdfPayment')->name('payments.pdf');
|
||||
Route::resource('payments', 'Portal\Payments');
|
||||
|
||||
Route::get('profile/read-invoices', 'Portal\Profile@readOverdueInvoices')->name('invoices.read');
|
||||
|
Loading…
x
Reference in New Issue
Block a user