Invoice page

This commit is contained in:
Čarodej
2022-01-18 08:28:58 +01:00
parent 2403f89ca3
commit ffebe7fecc
11 changed files with 342 additions and 611 deletions

View File

@@ -21,7 +21,6 @@
<title>{{ $settings->app_title ?? 'VueFileManager' }} | {{ $settings->app_description ?? __t('app_description') }}</title>
{{--StyleSheet--}}
{{--<link href="{{ asset('css/app.css') }}?v={{ get_version() }}" rel="stylesheet">--}}
<link href="{{ mix('css/app.css') }}?v={{ get_version() }}" rel="stylesheet" type="text/css">
<link href="{{ asset('css/tailwind.css') }}?v={{ get_version() }}" rel="stylesheet" type="text/css">

View File

@@ -2,365 +2,305 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<title>{{ __t('invoice_title') }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;600;700;900&display=swap"
rel="stylesheet">
<link href="{{ env('APP_ENV') !== 'local' ? asset('css/invoice.css') : mix('css/invoice.css') }}?v={{ get_version() }}"
rel="stylesheet">
<title>
{{ __t('invoice_title') }}
</title>
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;600;700;800;900&display=swap" rel="stylesheet">
<link href="{{ mix('css/tailwind.css') }}?v={{ get_version() }}" rel="stylesheet" type="text/css">
<style>
.table td {
padding: 8px;
line-height: 20px;
text-align: left;
vertical-align: top;
* {
outline: 0;
margin: 0;
padding: 0;
font-family: 'Nunito', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
font-size: 15px;
text-decoration: none;
color: #1B2539;
}
</style>
@include('vuefilemanager.others.color-template')
</head>
<body>
<div id="toolbar-wrapper">
<button class="button group hover-bg-theme-100" onclick="window.print();">
<svg class="icon group-hover-text-theme" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-printer">
<polyline points="6 9 6 2 18 2 18 9"></polyline>
<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"></path>
<rect x="6" y="14" width="12" height="8"></rect>
</svg>
<span class="label group-hover-text-theme">{{ __t('print_button') }}</span>
</button>
</div>
<div id="invoice-wrapper">
<header class="invoice-header">
<div class="logo">
@if(isset($settings->app_logo_horizontal))
<img src="{{ url($settings->app_logo_horizontal) }}"
alt="{{ $settings->app_title ?? 'VueFileManager' }}">
@else
<h1>{{ $settings->app_title ?? 'VueFileManager' }}</h1>
@endif
</div>
<div class="title">
<h1 class="text-theme">{{ __t('invoice_title') }}</h1>
</div>
</header>
<section class="invoice-subject">
<ul class="list">
<li class="list-item">
<b>{{ __t('date') }}:</b>
<span>{{ format_date($invoice->date()) }}</span>
</li>
<li class="list-item">
<b>{{ __t('product') }}:</b>
<span>{{ __t('subscription') }}</span>
</li>
<li class="list-item">
<b>{{ __t('invoice_number') }}:</b>
<span>{{ $invoice->number }}</span>
</li>
<body class="bg-light-background">
<div class="rounded-xl max-w-3xl mx-auto my-5 print:hidden">
<button class="flex items-center bg-white py-1 px-2 rounded-lg" onclick="window.print();">
<!-- Extra / VAT Information -->
@if (isset($vat))
<li class="list-item">
<b>{{ __t('vat') }}:</b>
<span>{{ $vat }}</span>
</li>
@endif
</ul>
</section>
<div class="invoice-partners">
<div class="partner">
<h2 class="partner-title text-theme">{{ __t('seller') }}:</h2>
<ul class="list">
@isset($settings->billing_vat_number)
<li class="list-item">
<b>{{ __t('seller_vat') }}:</b>
<span>{{ $settings->billing_vat_number }}</span>
</li>
@endisset
<svg class="transform scale-75" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="6 9 6 2 18 2 18 9"></polyline>
<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"></path>
<rect x="6" y="14" width="12" height="8"></rect>
</svg>
@isset($settings->billing_name)
<li class="list-item">
<b>{{ __t('seller_name') }}:</b>
<span>{{ $settings->billing_name }}</span>
</li>
@endisset
@isset($settings->billing_phone_number)
<li class="list-item">
<b>{{ __t('seller_phone') }}:</b>
<span>{{ $settings->billing_phone_number }}</span>
</li>
@endisset
</ul>
<ul class="list">
@isset($settings->billing_address)
<li class="list-item">
<b>{{ __t('address') }}:</b>
<span>{{ $settings->billing_address }}</span>
</li>
@endisset
@isset($settings->billing_city)
<li class="list-item">
<b>{{ __t('city') }}:</b>
<span>{{ $settings->billing_city }}</span>
</li>
@endisset
@isset($settings->billing_state)
<li class="list-item">
<b>{{ __t('state') }}:</b>
<span>{{ $settings->billing_state }}</span>
</li>
@endisset
@isset($settings->billing_postal_code)
<li class="list-item">
<b>{{ __t('postal_code') }}:</b>
<span>{{ $settings->billing_postal_code }}</span>
</li>
@endisset
@isset($settings->billing_country)
<li class="list-item">
<b>{{ __t('country') }}:</b>
<span>{{ $settings->billing_country }}</span>
</li>
@endisset
</ul>
</div>
<div class="partner">
<h2 class="partner-title text-theme">{{ __t('client') }}:</h2>
<ul class="list">
@isset($invoice->customer_name)
<li class="list-item">
<b>{{ __t('name') }}:</b>
<span>{{ $invoice->customer_name }}</span>
</li>
@endisset
@isset($invoice->customer_phone)
<li class="list-item">
<b>{{ __t('phone') }}:</b>
<span>{{ $invoice->customer_phone }}</span>
</li>
@endisset
</ul>
<ul class="list">
@isset($invoice->customer_address['line1'])
<li class="list-item">
<b>{{ __t('address') }}:</b>
<span>{{ $invoice->customer_address['line1'] }}</span>
</li>
@endisset
@isset($invoice->customer_address['city'])
<li class="list-item">
<b>{{ __t('city') }}:</b>
<span>{{ $invoice->customer_address['city'] }}</span>
</li>
@endisset
@isset($invoice->customer_address['state'])
<li class="list-item">
<b>{{ __t('state') }}:</b>
<span>{{ $invoice->customer_address['state'] }}</span>
</li>
@endisset
@isset($invoice->customer_address['postal_code'])
<li class="list-item">
<b>{{ __t('postal_code') }}:</b>
<span>{{ $invoice->customer_address['postal_code'] }}</span>
</li>
@endisset
@isset($invoice->customer_address['country'])
<li class="list-item">
<b>{{ __t('country') }}:</b>
<span>{{ $invoice->customer_address['country'] }}</span>
</li>
@endisset
</ul>
</div>
<span class="font-bold ml-2 text-sm">
{{ __t('print_button') }}
</span>
</button>
</div>
<div class="invoice-order">
{{--<table class="table" width="100%" border="0">
<thead class="table-header">
<tr>
<td>@lang('vuefilemanager.col_description')</td>
<td>@lang('vuefilemanager.col_date')</td>
<td>@lang('vuefilemanager.col_amount')</td>
</tr>
</thead>
<tbody class="table-body">
<div class="bg-white rounded-xl max-w-3xl mx-auto print:p-0 p-10">
--}}{{--Display invoices--}}{{--
@foreach($invoice->invoiceItems() as $item)
<tr>
<td colspan="2">{{ $item->description }}</td>
<td>{{ $item->total() }}</td>
</tr>
@endforeach
--}}{{--Display subscription--}}{{--
@foreach($invoice->subscriptions() as $subscription)
<tr>
<td>@lang('vuefilemanager.subscription') ({{ $subscription->quantity }})</td>
<td>{{ $subscription->startDateAsCarbon()->formatLocalized('%d. %B. %Y') }} -
{{ $subscription->endDateAsCarbon()->formatLocalized('%d. %B. %Y') }}</td>
<td>{{ $subscription->total() }}</td>
</tr>
@endforeach
<!-- Display The Taxes -->
@unless ($invoice->isNotTaxExempt())
<tr>
<td colspan="{{ $invoice->hasTax() ? 2 : 1 }}" style="text-align: right;">
@if ($invoice->isTaxExempt())
Tax is exempted
@else
Tax to be paid on reverse charge basis
@endif
</td>
<td></td>
</tr>
@else
@foreach ($invoice->taxes() as $tax)
<tr>
<td colspan="2" style="text-align: right;">
{{ $tax->display_name }} {{ $tax->country ? ' - '.$tax->country : '' }}
({{ $tax->percentage }}%{{ $tax->isInclusive() ? ' incl.' : '' }})
</td>
<td>{{ $tax->amount() }}</td>
</tr>
@endforeach
@endunless
</tbody>
</table>--}}
<!-- Invoice Table -->
<table width="100%" class="table" border="0">
<thead class="table-header">
<tr>
<td class="text-theme">{{ __t('col_description') }}</td>
<td class="text-theme">{{ __t('col_date') }}</td>
@if ($invoice->hasTax())
<td class="text-theme" align="right">{{ __t('vat')}}</td>
@endif
<td class="text-theme">{{ __t('col_amount') }}</td>
</tr>
</thead>
<tbody class="table-body">
<!-- Display The Invoice Items -->
@foreach ($invoice->invoiceItems() as $item)
<tr class="row">
<td colspan="2">{{ $item->description }}</td>
@if ($invoice->hasTax())
<td>
@if ($inclusiveTaxPercentage = $item->inclusiveTaxPercentage())
{{ $inclusiveTaxPercentage }}% incl.
@endif
@if ($item->hasBothInclusiveAndExclusiveTax())
+
@endif
@if ($exclusiveTaxPercentage = $item->exclusiveTaxPercentage())
{{ $exclusiveTaxPercentage }}%
@endif
</td>
@endif
<td>{{ $item->total() }}</td>
</tr>
@endforeach
<!-- Display The Subscriptions -->
@foreach ($invoice->subscriptions() as $subscription)
<tr class="row">
<td>{{ __t('subscription') }} ({{ $subscription->quantity }})</td>
<td>
{{ $subscription->startDateAsCarbon()->formatLocalized('%B %e, %Y') }} -
{{ $subscription->endDateAsCarbon()->formatLocalized('%B %e, %Y') }}
</td>
@if ($invoice->hasTax())
<td>
@if ($inclusiveTaxPercentage = $subscription->inclusiveTaxPercentage())
{{ $inclusiveTaxPercentage }}% {{ __t('vat_included') }}
@endif
@if ($subscription->hasBothInclusiveAndExclusiveTax())
+
@endif
@if ($exclusiveTaxPercentage = $subscription->exclusiveTaxPercentage())
{{ $exclusiveTaxPercentage }}%
@endif
</td>
@endif
<td>{{ $subscription->total() }}</td>
</tr>
@endforeach
<!-- Display The Subtotal -->
@if ($invoice->hasDiscount() || $invoice->hasTax() || $invoice->hasStartingBalance())
<tr>
<td colspan="{{ $invoice->hasTax() ? 3 : 2 }}" style="text-align: right;">{{ __t('subtotal')}}</td>
<td>{{ $invoice->subtotal() }}</td>
</tr>
@endif
<!-- Display The Taxes -->
@unless ($invoice->isNotTaxExempt())
<tr>
<td colspan="{{ $invoice->hasTax() ? 3 : 2 }}" style="text-align: right;">
@if ($invoice->isTaxExempt())
{{ __t('tax_exempted')}}
@else
{{ __t('tax_be_paid_reverse') }}
@endif
</td>
<td></td>
</tr>
<!--Invoice Header-->
<header class="flex justify-between items-start pb-4 mb-4 border-b dark:border-opacity-5 border-light border-dashed">
<div>
@if(isset($settings->app_logo_horizontal))
<img src="{{ url($settings->app_logo_horizontal) }}" alt="{{ $settings->app_title ?? 'VueFileManager' }}" class="h-8">
@else
@foreach ($invoice->taxes() as $tax)
<tr>
<td colspan="3" style="text-align: right;">
{{ $tax->display_name }} {{ $tax->country ? ' - '.$tax->country : '' }}
({{ $tax->percentage }}%{{ $tax->isInclusive() ? ' ' . __t('vat_included') : '' }})
</td>
<td>{{ $tax->amount() }}</td>
</tr>
@endforeach
@endunless
<h1 class="text-2xl font-bold">
{{ $settings->app_title ?? 'VueFileManager' }}
</h1>
@endif
<!-- Display The Final Total -->
<tr>
<td colspan="{{ $invoice->hasTax() ? 3 : 2 }}" style="text-align: right;">
<strong>{{ __t('total') }}</strong>
</td>
<td>
<strong>{{ $invoice->total() }}</strong>
</td>
</tr>
</tbody>
<b class="text-gray-800 text-sm">
{{ $settings->contact_email }}
</b>
</div>
</table>
<div class="text-right">
<h1 class="text-2xl font-bold">
{{ __t('invoice_title') }}
</h1>
<b class="text-gray-800 text-sm">
Number: {{ $invoice->id }}
</b>
</div>
</header>
<!-- Invoice partners -->
<div class="flex justify-between items-start space-x-8 pb-6 mb-6 border-b dark:border-opacity-5 border-light border-dashed">
<!-- Seller -->
<div>
<div class="mb-3">
<b class="text-theme text-base font-bold mb-1 block">
{{ __t('seller') }}:
</b>
@isset($settings->billing_name)
<span class="font-bold">
{{ $settings->billing_name }}
</span>
@endisset
</div>
<div class="mb-3">
<b class="text-theme text-base font-bold mb-1 block">
Head Office:
</b>
@isset($settings->billing_address)
<span class="font-bold block">
{{ $settings->billing_address }}
</span>
@endisset
@isset($settings->billing_city)
<span class="font-bold block">
{{ $settings->billing_city }}
</span>
@endisset
@isset($settings->billing_state)
<span class="font-bold block">
{{ $settings->billing_state }}
</span>
@endisset
@isset($settings->billing_postal_code)
<span class="font-bold block">
{{ $settings->billing_postal_code }}
</span>
@endisset
@isset($settings->billing_country)
<span class="font-bold block">
{{ $settings->billing_country }}
</span>
@endisset
@isset($settings->billing_phone_number)
<span class="font-bold block">
{{ $settings->billing_phone_number }}
</span>
@endisset
</div>
<div>
<b class="text-theme text-base font-bold mb-1 block">
Billing Information:
</b>
@isset($settings->billing_vat_number)
<span class="font-bold block">
VAT ID: {{ $settings->billing_vat_number }}
</span>
@endisset
{{--@if(isset($vat))
<span class="text-base">
{{ $vat }}
</span>
@endif--}}
</div>
</div>
<!--Client-->
<div>
<div class="bg-light-background rounded-xl p-4" style="width: 360px">
<b class="text-theme text-base font-bold mb-1.5 block">
Client:
</b>
@isset($invoice->user->settings->name)
<span class="font-bold block">
{{ $invoice->user->settings->name }}
</span>
@endisset
@isset($invoice->user->settings->address)
<span class="font-bold block">
{{ $invoice->user->settings->address }}
</span>
@endisset
@isset($invoice->user->settings->postal_code)
<span class="font-bold inline-block">
{{ $invoice->user->settings->postal_code }}
</span>
@endisset
@isset($invoice->user->settings->city)
<span class="font-bold inline-block">
{{ $invoice->user->settings->city }}
</span>,
@endisset
@isset($invoice->user->settings->state)
<span class="font-bold inline-block">
{{ $invoice->user->settings->state }}
</span>
@endisset
@isset($invoice->user->settings->country)
<span class="font-bold inline-block">
{{ $invoice->user->settings->country }}
</span>
@endisset
@isset($invoice->user->settings->phone_number)
<span class="font-bold block">
{{ $invoice->user->settings->phone_number }}
</span>
@endisset
</div>
<div class="font-bold block text-right pt-3">
Date of issue: {{ format_date($invoice->created_at) }}
</div>
</div>
</div>
<!-- Invoice Items -->
<div class="pb-6 mb-6 border-b dark:border-opacity-5 border-light border-dashed">
<!--Items-->
<table class="w-full mb-12">
<thead>
<tr>
<td class="pb-5">
<span class="text-theme dark:text-gray-500 text-gray-400 text-xs font-bold">
Description
</span>
</td>
<td class="pb-5">
<span class="text-theme dark:text-gray-500 text-gray-400 text-xs font-bold">
Period
</span>
</td>
<td class="pb-5">
<span class="text-theme dark:text-gray-500 text-gray-400 text-xs font-bold">
Usage
</span>
</td>
<td class="pb-5 text-right">
<span class="text-theme dark:text-gray-500 text-gray-400 text-xs font-bold">
Amount
</span>
</td>
</tr>
</thead>
@if($invoice->metadata)
<tbody>
@foreach($invoice->metadata as $item)
<tr class="border-b dark:border-opacity-5 border-light border-dashed whitespace-nowrap {{ $loop->index % 2 ? 'bg-light-background' : '' }}">
<td class="py-1.5 px-3">
<span class="text-sm font-bold">
{{ __t($item['feature']) }}
</span>
</td>
<td class="py-1.5">
<span class="text-sm font-bold">
{{ $invoice->note }}
</span>
</td>
<td class="py-1.5">
<span class="text-sm font-bold">
{{ $item['usage'] }}
</span>
</td>
<td class="py-1.5 px-3 text-right">
<span class="text-sm font-bold">
{{ $item['cost'] }}
</span>
</td>
</tr>
@endforeach
</tbody>
@else
<tr class="whitespace-nowrap">
<td class="py-1.5 pr-3">
<span class="text-sm font-bold">
Subscription
</span>
</td>
<td class="py-1.5">
<span class="text-sm font-bold">
{{ $invoice->note }}
</span>
</td>
<td class="py-1.5">
<span class="text-sm font-bold">
1
</span>
</td>
<td class="py-1.5 pl-3 text-right">
<span class="text-sm font-bold">
{{ format_currency($invoice->amount, $invoice->currency) }}
</span>
</td>
</tr>
@endif
</table>
<!-- Invoice Total -->
<div class="text-right">
<b class="text-2xl font-extrabold">
{{ __t('total') }} {{ format_currency($invoice->amount, $invoice->currency) }}
</b>
</div>
</div>
<!-- Invoice Items -->
<footer class="text-center">
<p class="font-bold">
Generated by <a href="{{ url('/') }}" target="_blank" class="font-bold text-theme underline">{{ $settings->app_title }}</a>
</p>
</footer>
</div>
<div class="invoice-summary">
<b>{{ __t('total') }} {{ $invoice->total() }}</b>
</div>
</div>
</body>
</html>