print template

This commit is contained in:
batuhanbas 2019-12-25 19:09:04 +03:00
parent c6dbb977b9
commit 76367a31ec
16 changed files with 1133 additions and 285 deletions

View File

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

View File

@ -0,0 +1,126 @@
<?php
namespace App\Http\Controllers\Modals;
use App\Abstracts\Http\Controller;
use App\Http\Requests\Setting\Setting as Request;
use App\Models\Common\Company;
use App\Models\Module\Module;
use App\Traits\DateTime;
use App\Traits\Uploads;
use Illuminate\Support\Str;
class InvoiceTemplates extends Controller
{
use DateTime, Uploads;
public $skip_keys = ['company_id', '_method', '_token', '_prefix', '_template'];
public $file_keys = ['company.logo', 'invoice.logo'];
/**
* Instantiate a new controller instance.
*/
public function __construct()
{
// Add CRUD permission check
$this->middleware('permission:create-settings-settings')->only(['create', 'store']);
$this->middleware('permission:read-settings-settings')->only(['index', 'edit']);
$this->middleware('permission:update-settings-settings')->only(['update', 'enable', 'disable']);
$this->middleware('permission:delete-settings-settings')->only('destroy');
}
/**
* Update the specified resource in storage.
*
* @param Request $request
*
* @return Response
*/
public function update(Request $request)
{
$fields = $request->all();
$prefix = $request->get('_prefix', 'general');
$company_id = $request->get('company_id');
if (empty($company_id)) {
$company_id = session('company_id');
}
$company = Company::find($company_id);
$companies = Company::all()->count();
foreach ($fields as $key => $value) {
$real_key = $prefix . '.' . $key;
// Don't process unwanted keys
if (in_array($key, $this->skip_keys)) {
continue;
}
// Process file uploads
if (in_array($real_key, $this->file_keys)) {
// Upload attachment
if ($request->file($key)) {
$media = $this->getMedia($request->file($key), 'settings');
$company->attachMedia($media, Str::snake($real_key));
$value = $media->id;
}
// Prevent reset
if (empty($value)) {
continue;
}
}
if ($real_key == 'default.locale') {
user()->setAttribute('locale', $value)->save();
}
// If only 1 company
if ($companies == 1) {
$this->oneCompany($real_key, $value);
}
setting()->set($real_key, $value);
}
// Save all settings
setting()->save();
$message = trans('messages.success.updated', ['type' => trans_choice('general.settings', 2)]);
$response = [
'status' => null,
'success' => true,
'error' => false,
'message' => $message,
'data' => null,
'redirect' => route('settings.invoice.edit'),
];
flash($message)->success();
return response()->json($response);
}
protected function oneCompany($real_key, $value)
{
switch ($real_key) {
case 'company.name':
Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']);
break;
case 'company.email':
Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]);
break;
case 'default.locale':
Installer::updateEnv(['APP_LOCALE' => $value]);
break;
case 'schedule.time':
Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $value . '"']);
break;
}
}
}

View File

@ -58,7 +58,7 @@ class ViewComposer extends Provider
// Add logo
View::composer(
['expenses.bills.print', 'expenses.bills.show', 'incomes.invoices.print', 'incomes.invoices.show', 'portal.invoices.show'],
['expenses.bills.print', 'expenses.bills.show', 'incomes.invoices.print_default', 'incomes.invoices.print_classic', 'incomes.invoices.print_modern', 'incomes.invoices.show', 'portal.invoices.show'],
'App\Http\ViewComposers\Logo'
);

59
public/css/custom.css vendored
View File

@ -148,6 +148,14 @@
/*--------Border Radius 0 Finished--------*/
/*--------Border Radius 5--------*/
.border-radius-5
{
border-radius: 5px !important;
}
/*--------Border Radius 5 Finished--------*/
.dropup .dropdown-toggle::after
{
display: none !important;
@ -749,6 +757,57 @@ table .align-items-center td span.badge {
font-size: 9px;
}
/*--------Print Template--------*/
.choose
{
cursor: pointer;
}
.choose:hover > img
{
opacity: 0.50 !important;
}
.bg-print
{
background-color: rgba(229, 229, 229, 0.4)!important;;
}
.print-edge
{
width: 147px;
}
/*--------Border Dashed--------*/
.border-dashed
{
border-top: 1px dashed #3c3f72 !important;
}
/*--------Border Dashed Finish--------*/
.invoice-classic-line
{
border: 2px solid #3c3f72;
border-radius: 5px;
}
.invoice-classic-frame
{
width: 100%;
height:100px;
border: 3px solid #3c3f72;
}
.invoice-classic-inline-frame
{
margin: 7px 1%;
width: 98%;
height: 80px;
border: 3px solid #3c3f72;
}
/*--------Print Template Finish--------*/
/*----------------RESPONSIVE START LINE----------------*/
/*--------Xs Breakpoint--------*/
@media (min-width: 304px) and (max-width: 575.98px)

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -36,6 +36,14 @@ const app = new Vue({
smtpUsername:true,
smtpPassword:true,
smtpEncryption:true,
},
invoice_form: new Form('template'),
template: {
modal: false,
title: '',
message: '',
html: '',
errors: new Error()
}
}
},
@ -72,6 +80,31 @@ const app = new Vue({
this.email.smtpEncryption = true;
break;
}
}
},
onTemplate() {
this.template.modal = true;
this.invoice_form = new Form('template');
this.invoice_form.template = this.invoice_form._template;
},
addTemplate() {
if (this.invoice_form.template != 1) {
this.invoice_form.submit();
this.template.errors = this.invoice_form.errors;
}
},
closeTemplate() {
this.template = {
modal: false,
title: '',
message: '',
errors: this.invoice_form.errors
};
},
}
});

View File

@ -52,6 +52,11 @@ return [
'subheading' => 'Subheading',
'due_receipt' => 'Due upon receipt',
'due_days' => 'Due within :days days',
'invoice_template' => 'Invoice Template',
'choose_template' => 'Choose a template',
'default' => 'Default',
'classic' => 'Classic',
'modern' => 'Modern',
],
'default' => [

View File

@ -1,282 +0,0 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')
<div class="mt-6">
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-2">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</th>
</tr>
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('invoices.bill_to') }}
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
<tr>
<th>
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}
@stack('address_input_end')
</th>
</tr>
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
@stack('tax_number_input_end')
</th>
</tr>
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
<tr>
<th>
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('invoice_number_input_start')
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@stack('invoice_number_input_end')
@stack('order_number_input_start')
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr class="row">
@stack('name_th_start')
<th class="col-xs-4 col-sm-3 pl-5">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-3 text-center">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-center d-none d-sm-block pl-5">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $item)
<tr class="row">
@stack('name_td_start')
<td class="col-xs-4 col-sm-3 pl-5">
{{ $item->name }}
@if ($item->desc)
<br><small>{!! $item->desc !!}</small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-3 text-center">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-center d-none d-sm-block pl-5">@money($item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-5">
<div class="col-md-7">
<div class="table-responsive">
@stack('notes_input_start')
@if ($invoice->notes)
<table class="table table-borderless">
<tbody>
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="form-control text-muted">{{ $invoice->notes }}</p>
</th>
</tr>
</tbody>
</table>
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
<th>
{{ trans($total->title) }}:
</th>
<td class="text-right">
@money($total->amount, $invoice->currency_code, true)
</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($invoice->paid)
<tr>
<th>
{{ trans('invoices.paid') }}:
</th>
<td class="text-right">
- @money($invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
<th>
{{ trans($total->name) }}:
</th>
<td class="text-right">
@money($total->amount - $invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@stack('grand_total_td_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{!! $invoice->footer !!}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
@endsection

View File

@ -0,0 +1,265 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')
<div class="row">
<div class="col-md-7">
<img class="mt-4" src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</div>
<div class="col-md-5 text-right">
<p class="mb-0 mt-4 font-weight-600">
{{ setting('company.name') }}
</p>
<p class="mb-0">
{!! nl2br(setting('company.address')) !!}
</p>
<p class="mb-0">
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</p>
<p class="mb-0 mt-3">
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</p>
<p class="mb-0">
{{ setting('company.email') }}
</p>
</div>
</div>
<div class="row my-4">
<div class="col-md-4">
<hr class="bg-default invoice-classic-line mb-1 mt-5">
<hr class="bg-default invoice-classic-line my-0">
</div>
<div class="col-md-4 text-center">
<div class="invoice-classic-frame">
<div class="invoice-classic-inline-frame">
@stack('invoice_number_input_start')
<p class="mt-4">
<b>{{ trans('invoices.invoice_number') }}:</b>
{{ $invoice->invoice_number }}
</p>
@stack('invoice_number_input_end')
</div>
</div>
</div>
<div class="col-md-4">
<hr class="bg-default invoice-classic-line mb-1 mt-5">
<hr class="bg-default invoice-classic-line my-0">
</div>
</div>
<div class="row mb-4">
<div class="col-md-7">
<h4>{{ trans('invoices.bill_to') }}</h4>
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
@stack('address_input_start')
<p class="mb-0">
{!! nl2br($invoice->contact_address) !!}
</p>
@stack('address_input_end')
@stack('tax_number_input_start')
<p class="mb-0">
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
</p>
@stack('tax_number_input_end')
@stack('phone_input_start')
<p class="mb-0 mt-3">
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
</p>
@stack('phone_input_end')
@stack('email_start')
<p class="mb-0">
{{ $invoice->contact_email }}
</p>
@stack('email_input_end')
</div>
<div class="col-md-5 text-right">
@stack('order_number_input_start')
@if ($invoice->order_number)
<p>
<b>{{ trans('invoices.order_number') }}:</b>
{{ $invoice->order_number }}
</p>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<p>
<b>{{ trans('invoices.invoice_date') }}:</b>
@date($invoice->invoiced_at)
</p>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<p>
<b>{{ trans('invoices.payment_due') }}:</b>
@date($invoice->due_at)
</p>
@stack('due_at_input_end')
@foreach ($invoice->totals as $total)
@if ($total->code == 'total')
<p class="bg-light border-radius-5 float-right text-center w-50">
<b>{{ trans($total->name) }}:</b>
@money($total->amount - $invoice->paid, $invoice->currency_code, true)
</p>
@endif
@endforeach
</div>
</div>
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr class="row border-dashed">
@stack('name_th_start')
<th class="col-xs-4 col-sm-3 pl-5">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-3 text-center">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-center d-none d-sm-block pl-5">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $item)
<tr class="row border-dashed">
@stack('name_td_start')
<td class="col-xs-4 col-sm-3 pl-5">
{{ $item->name }}
@if ($item->desc)
<br><small>{!! $item->desc !!}</small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-3 text-center">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-center d-none d-sm-block pl-5">@money($item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-7">
<div class="table-responsive">
@stack('notes_input_start')
@if ($invoice->notes)
<table class="table table-borderless">
<tbody>
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="form-control text-muted">{{ $invoice->notes }}</p>
</th>
</tr>
</tbody>
</table>
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless border-dashed">
<tbody>
@foreach ($invoice->totals as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr class="border-dashed">
<th>
{{ trans($total->title) }}:
</th>
<td class="text-right">
@money($total->amount, $invoice->currency_code, true)
</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($invoice->paid)
<tr class="border-dashed">
<th>
{{ trans('invoices.paid') }}:
</th>
<td class="text-right">
- @money($invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr class="border-dashed">
<th>
{{ trans($total->name) }}:
</th>
<td class="text-right">
@money($total->amount - $invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@stack('grand_total_td_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-borderless mb-0">
<tbody>
<tr>
<th>
{!! $invoice->footer !!}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
@endsection

View File

@ -0,0 +1,280 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-4">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</th>
</tr>
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('invoices.bill_to') }}
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
<tr>
<th>
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}
@stack('address_input_end')
</th>
</tr>
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
@stack('tax_number_input_end')
</th>
</tr>
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
<tr>
<th>
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('invoice_number_input_start')
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@stack('invoice_number_input_end')
@stack('order_number_input_start')
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive">
<table class="table">
<tbody>
<tr class="row bg-default text-white">
@stack('name_th_start')
<th class="col-xs-4 col-sm-3 pl-5 text-white">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-3 text-center text-white">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-center d-none d-sm-block pl-5 text-white">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5 text-white">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $item)
<tr class="row">
@stack('name_td_start')
<td class="col-xs-4 col-sm-3 pl-5">
{{ $item->name }}
@if ($item->desc)
<br><small>{!! $item->desc !!}</small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-3 text-center">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-center d-none d-sm-block pl-5">@money($item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-5">
<div class="col-md-7">
<div class="table-responsive">
@stack('notes_input_start')
@if ($invoice->notes)
<table class="table table-borderless">
<tbody>
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="form-control text-muted">{{ $invoice->notes }}</p>
</th>
</tr>
</tbody>
</table>
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
<th>
{{ trans($total->title) }}:
</th>
<td class="text-right">
@money($total->amount, $invoice->currency_code, true)
</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($invoice->paid)
<tr>
<th>
{{ trans('invoices.paid') }}:
</th>
<td class="text-right">
- @money($invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
<th>
{{ trans($total->name) }}:
</th>
<td class="text-right">
@money($total->amount - $invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@stack('grand_total_td_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{!! $invoice->footer !!}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
@endsection

View File

@ -0,0 +1,276 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('content')
<div class="row">
<div class="col-md-7 bg-primary">
<div class="table-responsive">
<table class="table table-borderless mt-4">
<tbody>
<tr>
<th class="d-flex align-items-center">
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
<h3 class="ml-4 text-white">{{ setting('company.name') }}</h3>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 bg-default">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th class="text-white">
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th class="text-white">
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</th>
</tr>
<tr>
<th class="text-white">
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</th>
</tr>
<tr>
<th class="text-white">
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<h4>{{ trans('invoices.bill_to') }}</h4>
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
<tr>
<td>
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}
@stack('address_input_end')
</td>
</tr>
<tr>
<td>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
@stack('tax_number_input_end')
</td>
</tr>
<tr>
<td>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</td>
</tr>
<tr>
<td>
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('invoice_number_input_start')
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@stack('invoice_number_input_end')
@stack('order_number_input_start')
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr class="row bg-default">
@stack('name_th_start')
<th class="col-xs-4 col-sm-3 pl-5 text-white">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-3 text-center text-white">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-center d-none d-sm-block pl-5 text-white">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5 text-white">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $item)
<tr class="row">
@stack('name_td_start')
<td class="col-xs-4 col-sm-3 pl-5">
{{ $item->name }}
@if ($item->desc)
<br><small>{!! $item->desc !!}</small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-3 text-center">{{ $item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-center d-none d-sm-block pl-5">@money($item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-3">
<div class="col-md-7">
<div class="table-responsive">
@stack('notes_input_start')
@if ($invoice->notes)
<table class="table table-borderless">
<tbody>
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="form-control text-muted">{{ $invoice->notes }}</p>
</th>
</tr>
</tbody>
</table>
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@foreach ($invoice->totals as $total)
@if ($total->code != 'total')
@stack($total->code . '_td_start')
<tr>
<th>
{{ trans($total->title) }}:
</th>
<td class="text-right">
@money($total->amount, $invoice->currency_code, true)
</td>
</tr>
@stack($total->code . '_td_end')
@else
@if ($invoice->paid)
<tr>
<th>
{{ trans('invoices.paid') }}:
</th>
<td class="text-right">
- @money($invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@endif
@stack('grand_total_td_start')
<tr>
<th>
{{ trans($total->name) }}:
</th>
<td class="text-right">
@money($total->amount - $invoice->paid, $invoice->currency_code, true)
</td>
</tr>
@stack('grand_total_td_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row">
<div class="col-md-12 bg-default">
<div class="table-responsive">
<table class="table table-borderless mb-0">
<tbody>
<tr>
<th class="text-white">
{!! $invoice->footer !!}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@endif
@endsection

View File

@ -0,0 +1,48 @@
<div class="modal-body">
{!! Form::open([
'route' => 'modals.invoice-template.update',
'method' => 'PATCH',
'id' => 'template',
'@submit.prevent' => 'onSubmit',
'@keydown' => 'invoice_form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button mb-0',
'novalidate' => true
]) !!}
<div class="row">
<div class="col-md-4 text-center px-0">
<div class="bg-print border-radius-5 print-edge choose" @click="invoice_form.template='default'">
<img src="{{ asset('public/img/print_templates/default.png') }}" class="mb-1 mt-3" height="200" alt="Default"/>
<label>
<input type="radio" name="template" value="default" v-model="invoice_form.template">
{{ trans('settings.invoice.default') }}
</label>
</div>
</div>
<div class="col-md-4 text-center px-0">
<div class="bg-print border-radius-5 print-edge choose" @click="invoice_form.template='classic'">
<img src="{{ asset('public/img/print_templates/classic.png') }}" class="mb-1 mt-3" height="200" alt="Classic"/>
<label>
<input type="radio" name="template" value="classic" v-model="invoice_form.template">
{{ trans('settings.invoice.classic') }}
</label>
</div>
</div>
<div class="col-md-4 text-center px-0">
<div class="bg-print border-radius-5 print-edge choose" @click="invoice_form.template='modern'">
<img src="{{ asset('public/img/print_templates/modern.png') }}" class="mb-1 mt-3" height="200" alt="Modern"/>
<label>
<input type="radio" name="template" value="modern" v-model="invoice_form.template">
{{ trans('settings.invoice.modern') }}
</label>
</div>
</div>
</div>
{!! Form::hidden('_template', $setting['template']) !!}
{!! Form::hidden('_prefix', 'invoice') !!}
{!! Form::close() !!}
</div>

View File

@ -39,6 +39,16 @@
{{ Form::invoice_text('price_name', trans('settings.invoice.price_name'), 'font', $price_names, null, [], 'price_name_input', null) }}
{{ Form::invoice_text('quantity_name', trans('settings.invoice.quantity_name'), 'font', $quantity_names, null, [], 'quantity_name_input', null) }}
<div class="form-group col-md-6">
{!! Form::label('invoice_template', trans('settings.invoice.invoice_template'), ['class' => 'form-control-label']) !!}
<div class="input-group">
<a href="#" class="btn btn-block btn-outline-primary" @click="onTemplate">
<i class="fas fa-palette"></i>&nbsp; {{ trans('settings.invoice.choose_template') }}
</a>
</div>
</div>
</div>
</div>
@ -56,6 +66,33 @@
{!! Form::close() !!}
@endsection
@push('content_content_end')
<akaunting-modal
:show="template.modal"
@cancel="template.modal = false"
:title="'{{ trans('settings.invoice.choose_template') }}'"
:message="template.html"
:button_cancel="'{{ trans('general.button.save') }}'"
:button_delete="'{{ trans('general.button.cancel') }}'">
<template #modal-body>
@include('modals.settings.template')
</template>
<template #card-footer>
<div class="float-right">
<button type="button" class="btn btn-outline-secondary" @click="closeTemplate">
<span>{{ trans('general.cancel') }}</span>
</button>
<button type="button" class="btn btn-success button-submit" @click="addTemplate">
<div class="aka-loader d-none"></div>
<span>{{ trans('general.confirm') }}</span>
</button>
</div>
</template>
</akaunting-modal>
@endpush
@push('scripts_start')
<script src="{{ asset('public/js/settings/settings.js?v=' . version('short')) }}"></script>
@endpush

View File

@ -203,6 +203,7 @@ Route::group(['as' => 'modals.', 'prefix' => 'modals'], function () {
Route::resource('categories', 'Modals\Categories');
Route::resource('customers', 'Modals\Customers');
Route::resource('vendors', 'Modals\Vendors');
Route::patch('invoice-templates', 'Modals\InvoiceTemplates@update')->name('invoice-template.update');
Route::resource('invoices/{invoice}/transactions', 'Modals\InvoiceTransactions', ['middleware' => ['date.format', 'money']]);
Route::resource('bills/{bill}/transactions', 'Modals\BillTransactions', ['middleware' => ['date.format', 'money']]);
Route::resource('taxes', 'Modals\Taxes');