All checks were successful
Build project image / Build-and-release-image (push) Successful in 3m9s
248 lines
13 KiB
PHP
248 lines
13 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<div class="flex flex-row w-full" x-data="invoiceForm">
|
|
<h2 class="grow font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
|
{{ __('invoice.Invoice') }} {{ $invoice->number }} ({{ $invoice->localized_state }})
|
|
</h2>
|
|
<p class="relative flex flex-row">
|
|
<x-pdf-icon class="text-gray-800 cursor-pointer"
|
|
onclick="window.open('/invoice/{{ $invoice->id }}/pdf-download', '_blank', 'popup=true')"/>
|
|
<x-e-icon class="cursor-pointer"
|
|
x-on:click="prepareXML"/>
|
|
</p>
|
|
</div>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
|
|
|
<!-- Customer and addresses -->
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w">
|
|
<section>
|
|
<header>
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
{{ __('customer.Customer') }}: {{ $invoice->customer->name }}
|
|
({{ $invoice->customer->email }})
|
|
</h2>
|
|
<div class="grid grid-cols-2 mt-4 text-sm text-gray-600 dark:text-gray-400">
|
|
<div>{{ __("customer.Invoice Address") }}</div>
|
|
@if($invoice->delivery)
|
|
<div>{{ __("customer.Delivery Address") }}</div>
|
|
@endif
|
|
</div>
|
|
</header>
|
|
|
|
<div class="grid grid-cols-2">
|
|
<div>
|
|
<x-php-card :address="$invoice->address"/>
|
|
</div>
|
|
@if($invoice->delivery)
|
|
<div>
|
|
<x-php-card :address="$invoice->delivery"/>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Invoice options -->
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w">
|
|
<section>
|
|
<header>
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
{{ __('invoice.Invoice options') }}
|
|
</h2>
|
|
</header>
|
|
</section>
|
|
<div class="flex flex-col gap-2 w-1/2 mt-4 text-sm text-gray-600 dark:text-gray-400">
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="type" :value="__('invoice.Type code')"/>
|
|
<x-text-input id="type" name="type" type="text"
|
|
value="{{ \App\Enum\InvoiceTypeCode::label($invoice->type) }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
</div>
|
|
@if(in_array($invoice->type, ['326', '875']))
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="project_count"
|
|
:value="__('invoice.Partial invoice number')"/>
|
|
<x-text-input id="project_count" name="project_count" type="text"
|
|
value="{{ $invoice->project_count }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
@endif
|
|
|
|
@if($invoice->project)
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="project_name"
|
|
:value="__('project.Project')"/>
|
|
<x-text-input id="project_name" name="project_name" type="text"
|
|
value="{{ $invoice->project->name }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="project_number"
|
|
:value="__('project.Project Number')"/>
|
|
<x-text-input id="project_number" name="project_number" type="text"
|
|
value="{{ $invoice->project->project_number }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
@endif
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="due_date"
|
|
:value="__('invoice.Payment terms')"/>
|
|
<x-text-input id="due_date" name="due_date" type="date"
|
|
value="{{ $invoice->due_date }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
<div class="flex flex-row items-center">
|
|
<x-input-label class="w-1/3" for="cash_discount"
|
|
:value="__('invoice.Cash discount')"/>
|
|
<x-text-input id="cash_discount" name="cash_discount" type="number" steps="0.01"
|
|
value="{{ $invoice->cash_discount }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
@if($invoice->cash_discount != 0)
|
|
<div class="flex flex-row items-center" x-show="invoice.cash_discount != 0">
|
|
<x-input-label class="w-1/3" for="cash_discount_date"
|
|
:value="__('invoice.Cash discount until')"/>
|
|
<x-text-input id="cash_discount_date" name="cash_discount_date" type="date"
|
|
value="{{ $invoice->cash_discount_date }}"
|
|
class="mt-1 w-2/3"
|
|
autofocus disabled
|
|
/>
|
|
|
|
</div>
|
|
@endif
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Invoice items -->
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w">
|
|
<section>
|
|
<header>
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
{{ __('invoice.Invoice items') }}
|
|
</h2>
|
|
<div
|
|
class="flex flex-row items-end gap-2 w-full mt-4 text-sm text-gray-600 dark:text-gray-400">
|
|
<x-input-label for="invoice_item.amount" :value="__('invoice.Amount')" class="w-1/12"/>
|
|
<x-input-label for="invoice_item.name" :value="__('invoice.Name')" class="w-7/12"/>
|
|
<x-input-label for="invoice_item.price" :value="__('invoice.Price')"
|
|
class="w-1/12 text-right"/>
|
|
<x-input-label for="invoice_item.tax" :value="__('invoice.Discount')"
|
|
class="w-1/12 text-right"/>
|
|
<x-input-label for="invoice_item.tax" :value="__('invoice.Tax')"
|
|
class="w-1/12 text-right"/>
|
|
<x-input-label for="invoice_item.tax" :value="__('invoice.Sum')"
|
|
class="w-1/12 text-right"/>
|
|
</div>
|
|
</header>
|
|
|
|
<div>
|
|
@foreach($invoice->items as $item)
|
|
<x-invoice-item :item="$item"/>
|
|
@endforeach
|
|
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Invoice information -->
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w">
|
|
<div class="flex flex-row items-end gap-2 w-full">
|
|
<div class="w-1/12"></div>
|
|
<div class="mt-1 block w-2/3">{{ __('invoice.Net') }}</div>
|
|
<div
|
|
class="w-1/4 text-right">{{ \Illuminate\Support\Number::currency($invoice->sum - $invoice->tax) }}</div>
|
|
</div>
|
|
<div class="flex flex-row items-end gap-2 w-full">
|
|
<div class="w-1/12"></div>
|
|
<div class="mt-1 block w-2/3">{{ __('invoice.Tax') }}</div>
|
|
<div class="w-1/4 text-right">{{ \Illuminate\Support\Number::currency($invoice->tax) }}</div>
|
|
</div>
|
|
<div class="flex flex-row items-end gap-2 w-full">
|
|
<div class="w-1/12"></div>
|
|
<div class="mt-1 block w-2/3">{{ __('invoice.Sum') }}</div>
|
|
<div class="w-1/4 text-right">{{ \Illuminate\Support\Number::currency($invoice->sum) }}</div>
|
|
</div>
|
|
@if($invoice->cash_discount != 0)
|
|
<div class="flex flex-row items-end gap-2 w-full">
|
|
<div class="w-1/12"></div>
|
|
<div class="mt-1 block w-2/3">{{ __('invoice.Cash discount sum') }}</div>
|
|
<div class="w-1/4 text-right">{{ \Illuminate\Support\Number::currency($invoice->sum * (100 - $invoice->cash_discount) / 100) }}</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
@if ($invoice->status === 'created')
|
|
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
|
<div class="max-w">
|
|
<div class="flex flex-row items-end gap-2 w-full">
|
|
<x-primary-button
|
|
onclick="window.location.href = '{{ route('invoice.mail', $invoice->id) }}'">
|
|
<x-mail-icon class="mr-4"/>{{ __('form.Send') }}</x-primary-button>
|
|
<x-primary-button
|
|
onclick="window.location.href = '{{ route('invoice.edit', $invoice->id) }}'">
|
|
<x-edit-icon class="mr-4"/>{{ __('form.Edit') }}</x-primary-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
<div id="download"></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</x-app-layout>
|
|
|
|
<script>
|
|
function invoiceForm() {
|
|
return {
|
|
prepareXML() {
|
|
axios.get('/invoice/' + {{ $invoice->id }} + '/xml-download', {responseType: "blob"})
|
|
.then(function(response) {
|
|
let url = window.URL.createObjectURL(response.data);
|
|
let a = document.createElement('a');
|
|
a.href = url;
|
|
a.download = '{!! __('invoice.Invoice') !!} ' + '{{ $invoice->number }}' + '.xml';
|
|
let download = document.querySelector('#download');
|
|
download.appendChild(a);
|
|
a.click();
|
|
window.URL.revokeObjectURL(url);
|
|
console.log(response);
|
|
})
|
|
.catch(function(error) {
|
|
console.log(error);
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|