Merge pull request #959 from denisdulici/master

Renamed print files
This commit is contained in:
Denis Duliçi 2019-11-30 00:41:56 +03:00 committed by GitHub
commit b4063b5f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 174 deletions

View File

@ -376,7 +376,7 @@ class Bills extends Controller
$bill->paid = $paid;
$bill->template_path = 'expenses.bills.bill';
$bill->template_path = 'expenses.bills.print';
return $bill;
}

View File

@ -444,7 +444,7 @@ class Invoices extends Controller
$invoice->paid = $paid;
$invoice->template_path = 'incomes.invoices.invoice';
$invoice->template_path = 'incomes.invoices.print';
event(new \App\Events\Income\InvoicePrinting($invoice));

View File

@ -124,7 +124,7 @@ class Invoices extends Controller
$invoice->paid = $paid;
$invoice->template_path = 'incomes.invoices.invoice';
$invoice->template_path = 'incomes.invoices.print';
event(new \App\Events\Income\InvoicePrinting($invoice));

View File

@ -21,13 +21,7 @@ class Logo
{
$logo = '';
$media_id = setting('company.logo');
if (setting('invoice.logo')) {
$media_id = setting('invoice.logo');
}
$media = Media::find($media_id);
$media = Media::find(setting('company.logo'));
if (!empty($media)) {
$path = Storage::path($media->getDiskPath());
@ -36,10 +30,12 @@ class Logo
return $logo;
}
} else {
$path = asset('public/img/akaunting-logo-green.png');
$path = asset('public/img/company.png');
}
$image = Image::make($path)->encode()->getEncoded();
$width = $height = setting('invoice.logo_size', 128);
$image = Image::make($path)->resize($width, $height)->encode()->getEncoded();
if (empty($image)) {
return $logo;

View File

@ -16,22 +16,24 @@ class ViewComposer extends Provider
{
// Suggestions
View::composer(
['partials.admin.header'], 'App\Http\ViewComposers\Suggestions'
'partials.admin.header', 'App\Http\ViewComposers\Suggestions'
);
// Notifications
View::composer(
['partials.admin.content'], 'App\Http\ViewComposers\Notifications'
'partials.admin.content', 'App\Http\ViewComposers\Notifications'
);
// Add company info to menu
View::composer(
['partials.admin.menu', 'partials.portal.menu'], 'App\Http\ViewComposers\Menu'
['partials.admin.menu', 'partials.portal.menu'],
'App\Http\ViewComposers\Menu'
);
// Add notifications to header
View::composer(
['partials.wizard.navbar', 'partials.admin.navbar', 'partials.portal.navbar'], 'App\Http\ViewComposers\Header'
['partials.wizard.navbar', 'partials.admin.navbar', 'partials.portal.navbar'],
'App\Http\ViewComposers\Header'
);
// Add limits and bulk actions to index
@ -51,17 +53,19 @@ class ViewComposer extends Provider
// Add recurring
View::composer(
['partials.form.recurring',], 'App\Http\ViewComposers\Recurring'
'partials.form.recurring', 'App\Http\ViewComposers\Recurring'
);
// Add logo
View::composer(
['incomes.invoices.invoice', 'expenses.bills.bill'], 'App\Http\ViewComposers\Logo'
['expenses.bills.print', 'expenses.bills.show', 'incomes.invoices.print', 'incomes.invoices.show', 'portal.invoices.show'],
'App\Http\ViewComposers\Logo'
);
// Add Invoice Text
View::composer(
['incomes.invoices.*', 'portal.invoices.*'], 'App\Http\ViewComposers\InvoiceText'
['incomes.invoices.*', 'portal.invoices.*'],
'App\Http\ViewComposers\InvoiceText'
);
}

View File

@ -11,8 +11,10 @@
<tbody>
<tr>
<th>
@if ($logo)
<img src="{{ asset('public/img/company.png') }}" height="128" width="128" alt="Company"/>
@if (!empty($bill->contact->logo) && !empty($bill->contact->logo->id))
<img src="{{ Storage::url($bill->contact->logo->id) }}" height="128" width="128" alt="{{ $bill->contact_name }}"/>
@else
<img src="{{ $logo }}" alt="{{ $bill->contact_name }}"/>
@endif
</th>
</tr>

View File

@ -163,10 +163,10 @@
<tbody>
<tr>
<th>
@if (isset($bill->contact->logo) && !empty($bill->contact->logo->id))
<img src="{{ Storage::url($bill->contact->logo->id) }}"/>
@if (!empty($bill->contact->logo) && !empty($bill->contact->logo->id))
<img src="{{ Storage::url($bill->contact->logo->id) }}" height="128" width="128" alt="{{ $bill->contact_name }}"/>
@else
<img src="{{ asset('public/img/company.png') }}" height="128" width="128" alt="Company"/>
<img src="{{ $logo }}" alt="{{ $bill->contact_name }}"/>
@endif
</th>
</tr>

View File

@ -11,9 +11,7 @@
<tbody>
<tr>
<th>
@if ($logo)
<img src="{{ asset('public/img/company.png') }}" height="128" width="128" alt="Company"/>
@endif
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>

View File

@ -185,11 +185,7 @@
<tbody>
<tr>
<th>
@if (setting('company.logo'))
<img src="{{ Storage::url(setting('company.logo')) }}"/>
@else
<img src="{{ asset('public/img/company.png') }}" height="128" width="128" alt="Company"/>
@endif
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>

View File

@ -1,135 +0,0 @@
@extends('layouts.portal')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')
<div class="row">
<div class="col-md-7">
@if ($logo)
<img src="{{ $logo }}"/>
@endif
</div>
<div class="col-md-5 invoice-company">
<address>
<strong>{{ setting('company.name') }}</strong><br>
{{ setting('company.address') }}<br>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}<br>
@endif
<br>
@if (setting('company.phone'))
{{ setting('company.phone') }}<br>
@endif
{{ setting('company.email') }}
</address>
</div>
</div>
<div class="row">
<div class="col-md-7">
{{ trans('invoices.bill_to') }}
<address>
<strong>{{ $invoice->contact_name }}</strong><br>
{{ $invoice->contact_address }}<br>
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
<br>
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}<br>
@endif
{{ $invoice->contact_email }}
</address>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table no-border">
<tbody>
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_At)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 table-responsive">
<table class="table table-striped">
<tbody>
<tr>
<th>{{ trans_choice('general.items', 1) }}</th>
<th class="text-center">{{ trans('invoices.quantity') }}</th>
<th class="text-right">{{ trans('invoices.price') }}</th>
<th class="text-right">{{ trans('invoices.total') }}</th>
</tr>
@foreach($invoice->items as $item)
<tr>
<td>
{{ $item->name }}
</td>
<td class="text-center">{{ $item->quantity }}</td>
<td class="text-right">@money($item->price, $invoice->currency_code, true)</td>
<td class="text-right">@money($item->total, $invoice->currency_code, true)</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-7">
@if ($invoice->notes)
<p class="lead">{{ trans_choice('general.notes', 2) }}</p>
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
{{ $invoice->notes }}
</p>
@endif
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach($invoice->totals as $total)
@if($total->code != 'total')
<tr>
<th>{{ trans($total['name']) }}:</th>
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
</tr>
@else
@if ($invoice->paid)
<tr class="text-success">
<th>{{ trans('invoices.paid') }}:</th>
<td class="text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
</tr>
@endif
<tr>
<th>{{ trans($total['name']) }}:</th>
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection

View File

@ -20,13 +20,7 @@
<tbody>
<tr>
<th>
@if (setting('company.logo'))
<img src="{{ Storage::url(setting('company.logo')) }}"/>
@else
<span class="avatar avatar-size rounded-circle bg-primary">
<i class="fas fa-building"></i>
</span>
@endif
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>