Compare commits
9 Commits
7ee0fd4ffb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2605899348 | |||
| de3c815532 | |||
| 922016020a | |||
| 0ab8debd2e | |||
| 0a4089fe14 | |||
| e1f579c7fd | |||
| f478b4aed6 | |||
| 5deef877ba | |||
| e4238bfda6 |
@@ -71,7 +71,6 @@ jobs:
|
|||||||
severity-cutoff: critical
|
severity-cutoff: critical
|
||||||
registry-username: ${{ vars.LOCAL_REGISTRY_USER }}
|
registry-username: ${{ vars.LOCAL_REGISTRY_USER }}
|
||||||
registry-password: ${{ vars.LOCAL_REGISTRY_PASS }}
|
registry-password: ${{ vars.LOCAL_REGISTRY_PASS }}
|
||||||
grype-version: 'v0.90.0'
|
|
||||||
|
|
||||||
- name: Inspect file
|
- name: Inspect file
|
||||||
run: cat ${{ steps.scan.outputs.table }}
|
run: cat ${{ steps.scan.outputs.table }}
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ class InvoiceController extends Controller
|
|||||||
'address_id' => 'required|integer|exists:addresses,id',
|
'address_id' => 'required|integer|exists:addresses,id',
|
||||||
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
||||||
'project_id' => 'nullable|integer|exists:projects,id',
|
'project_id' => 'nullable|integer|exists:projects,id',
|
||||||
|
'project_count' => 'nullable|integer',
|
||||||
'currency_code' => 'required|string',
|
'currency_code' => 'required|string',
|
||||||
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
||||||
'project_count' => 'nullable|integer',
|
|
||||||
'tax' => 'required|numeric',
|
'tax' => 'required|numeric',
|
||||||
'sum' => 'required|numeric',
|
'sum' => 'required|numeric',
|
||||||
'due_date' => 'required|date',
|
'due_date' => 'required|date',
|
||||||
@@ -73,6 +73,7 @@ class InvoiceController extends Controller
|
|||||||
'address_id' => 'required|integer|exists:addresses,id',
|
'address_id' => 'required|integer|exists:addresses,id',
|
||||||
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
||||||
'project_id' => 'nullable|integer|exists:projects,id',
|
'project_id' => 'nullable|integer|exists:projects,id',
|
||||||
|
'project_count' => 'nullable|integer',
|
||||||
'currency_code' => 'required|string',
|
'currency_code' => 'required|string',
|
||||||
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
||||||
'tax' => 'required|numeric',
|
'tax' => 'required|numeric',
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class InvoiceitemController extends Controller
|
|||||||
'name' => 'required|string',
|
'name' => 'required|string',
|
||||||
'description' => 'nullable|string',
|
'description' => 'nullable|string',
|
||||||
'article_number' => 'nullable|string',
|
'article_number' => 'nullable|string',
|
||||||
|
'sort' => 'required|numeric|min:0',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$item = $invoice->items()->create($itemData);
|
$item = $invoice->items()->create($itemData);
|
||||||
|
|||||||
@@ -43,25 +43,6 @@ class Invoice extends Model
|
|||||||
'localized_state'
|
'localized_state'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the project_count variable automatically, if a project is related to this invoice.
|
|
||||||
*/
|
|
||||||
public static function boot(): void
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
self::creating(function (Invoice $invoice) {
|
|
||||||
if (is_null($invoice->project_id)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ($invoice->type != '326') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
$projectMax = Invoice::where('project_id', '=', $invoice->project_id)->max('project_count') + 1;
|
|
||||||
$invoice->project_count = $projectMax;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the invoice state as translated string.
|
* Get the invoice state as translated string.
|
||||||
*/
|
*/
|
||||||
@@ -123,7 +104,7 @@ class Invoice extends Model
|
|||||||
*/
|
*/
|
||||||
public function items(): HasMany
|
public function items(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(Invoiceitem::class);
|
return $this->hasMany(Invoiceitem::class)->orderBy('sort');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Invoiceitem extends Model
|
|||||||
'total',
|
'total',
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
|
'sort'
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class Payment extends Model
|
|||||||
*/
|
*/
|
||||||
public function invoice(): BelongsTo
|
public function invoice(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Invoice::class);
|
return $this->belongsTo(Invoice::class)->with(['customer']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class Project extends Model
|
|||||||
'end',
|
'end',
|
||||||
'customer_email',
|
'customer_email',
|
||||||
'customer_name',
|
'customer_name',
|
||||||
|
'next_invoice_count',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +57,14 @@ class Project extends Model
|
|||||||
return (is_null($this->start_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->start_date)->format('d.m.Y');
|
return (is_null($this->start_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->start_date)->format('d.m.Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next invoice number for this project.
|
||||||
|
*/
|
||||||
|
public function getNextInvoiceCountAttribute(): int
|
||||||
|
{
|
||||||
|
return $this->invoices()->max('project_count') + 1 ?? 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the end_date attribute in local format.
|
* Get the end_date attribute in local format.
|
||||||
*/
|
*/
|
||||||
@@ -72,6 +81,9 @@ class Project extends Model
|
|||||||
return $this->belongsTo(Customer::class)->withTrashed();
|
return $this->belongsTo(Customer::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the invoices for this project.
|
||||||
|
*/
|
||||||
public function invoices(): HasMany
|
public function invoices(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(Invoice::class);
|
return $this->hasMany(Invoice::class);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^8.4",
|
"php": "^8.4",
|
||||||
"barryvdh/laravel-dompdf": "^3.0",
|
"barryvdh/laravel-dompdf": "^3.0",
|
||||||
"laravel/framework": "^11.31",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
"phpoffice/phpspreadsheet": "^3.8",
|
"phpoffice/phpspreadsheet": "^3.8",
|
||||||
|
|||||||
1347
composer.lock
generated
1347
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoiceitems', function (Blueprint $table) {
|
||||||
|
$table->integer('sort')->default(0)->after('invoice_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('invoiceitems', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('sort');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1091,9 +1091,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001696",
|
"version": "1.0.30001741",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001696.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001741.tgz",
|
||||||
"integrity": "sha512-pDCPkvzfa39ehJtJ+OwGT/2yvT2SbjfHhiIW2LWOAcMQ7BzwxT/XuyUp4OTOd0XFWA6BKw0JalnBHgSi5DGJBQ==",
|
"integrity": "sha512-QGUGitqsc8ARjLdgAfxETDhRbJ0REsP6O3I96TAth/mVjh2cYzN2u+3AzPP3aVSm2FehEItaJw1xd+IGBXWeSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
axios.get('/customer-with-trashed')
|
axios.get('/customer')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
vm.customers = response.data;
|
vm.customers = response.data;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
<template x-for="(project, index) in getFilteredProject()">
|
<template x-for="(project, index) in getFilteredProject()">
|
||||||
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
||||||
:class="project.id == invoice.project_id ? 'font-bold' : ''"
|
:class="project.id == invoice.project_id ? 'font-bold' : ''"
|
||||||
@click="invoice.project_id = project.id; selected_project = project; invoice.customer_id = project.customer.id; selected_customer = project.customer; getCustomerAddresses();">
|
@click="invoice.project_id = project.id; selected_project = project; invoice.customer_id = project.customer.id; selected_customer = project.customer; invoice.project_count = project.next_invoice_count; getCustomerAddresses();">
|
||||||
<div x-text="project.name"></div>
|
<div x-text="project.name"></div>
|
||||||
<div x-text="project.project_number"></div>
|
<div x-text="project.project_number"></div>
|
||||||
<div x-text="project.customer_name"></div>
|
<div x-text="project.customer_name"></div>
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row items-center"
|
<div class="flex flex-row items-center"
|
||||||
x-show="!from_project && (invoice.type === '326' || invoice.type === '875')">
|
x-show="invoice.type === '326' || invoice.type === '875'">
|
||||||
<x-input-label class="w-1/3" for="project_count"
|
<x-input-label class="w-1/3" for="project_count"
|
||||||
:value="__('invoice.Partial invoice number')"/>
|
:value="__('invoice.Partial invoice number')"/>
|
||||||
<x-text-input id="project_count" name="project_count" type="text"
|
<x-text-input id="project_count" name="project_count" type="text"
|
||||||
@@ -401,7 +401,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<x-primary-button x-on:click="submit();" class="">{{ __('form.Save') }}</x-primary-button>
|
<x-primary-button x-on:click="submit();" class="">{{ __('form.Save') }}</x-primary-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -443,6 +442,7 @@
|
|||||||
tax: 0,
|
tax: 0,
|
||||||
sum: 0,
|
sum: 0,
|
||||||
project_id: null,
|
project_id: null,
|
||||||
|
project_count: null,
|
||||||
due_date: '{!! \Illuminate\Support\Carbon::today()->addDays(intval($options->payment_terms))->format('Y-m-d') !!}',
|
due_date: '{!! \Illuminate\Support\Carbon::today()->addDays(intval($options->payment_terms))->format('Y-m-d') !!}',
|
||||||
cash_discount: 0,
|
cash_discount: 0,
|
||||||
cash_discount_date: '{!! \Illuminate\Support\Carbon::today()->addDays(intval($options->cash_discount_date))->format('Y-m-d') !!}',
|
cash_discount_date: '{!! \Illuminate\Support\Carbon::today()->addDays(intval($options->cash_discount_date))->format('Y-m-d') !!}',
|
||||||
@@ -655,6 +655,7 @@
|
|||||||
for (let i = 0; i < self.items.length; i++) {
|
for (let i = 0; i < self.items.length; i++) {
|
||||||
let pos = sort_flipped[i];
|
let pos = sort_flipped[i];
|
||||||
let item = self.items[pos];
|
let item = self.items[pos];
|
||||||
|
item.sort = i;
|
||||||
const result = axios.post('invoice/' + self.invoice_id + '/item', item)
|
const result = axios.post('invoice/' + self.invoice_id + '/item', item)
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
self.error = true;
|
self.error = true;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row items-center"
|
<div class="flex flex-row items-center"
|
||||||
x-show="!from_project && (invoice.type === '326' || invoice.type === '875')">
|
x-show="invoice.type === '326' || invoice.type === '875'">
|
||||||
<x-input-label class="w-1/3" for="project_count"
|
<x-input-label class="w-1/3" for="project_count"
|
||||||
:value="__('invoice.Partial invoice number')"/>
|
:value="__('invoice.Partial invoice number')"/>
|
||||||
<x-text-input id="project_count" name="project_count" type="text"
|
<x-text-input id="project_count" name="project_count" type="text"
|
||||||
@@ -662,6 +662,7 @@
|
|||||||
for (let i = 0; i < self.items.length; i++) {
|
for (let i = 0; i < self.items.length; i++) {
|
||||||
let pos = sort_flipped[i];
|
let pos = sort_flipped[i];
|
||||||
let item = self.items[pos];
|
let item = self.items[pos];
|
||||||
|
item.sort = i;
|
||||||
const result = axios.post('invoice/' + self.invoice.id + '/item', item)
|
const result = axios.post('invoice/' + self.invoice.id + '/item', item)
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
self.error = true;
|
self.error = true;
|
||||||
|
|||||||
@@ -36,11 +36,23 @@
|
|||||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||||
{{ __('invoice.Existing invoices') }}
|
{{ __('invoice.Existing invoices') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
<div class="grid grid-cols-2">
|
||||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||||
<x-text-input type="date" id="from" name="from" x-model="from" x-on:change="fetchInvoices()"/>
|
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||||
<x-input-label for="end" :value="__('invoice.End')"/>
|
<x-text-input type="date" id="from" name="from" x-model="from" x-on:change="fetchInvoices()"/>
|
||||||
<x-text-input type="date" id="end" name="end" x-model="end" x-on:change="fetchInvoices()"/>
|
<x-input-label for="end" :value="__('invoice.End')"/>
|
||||||
|
<x-text-input type="date" id="end" name="end" x-model="end" x-on:change="fetchInvoices()"/>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row items-center gap-8">
|
||||||
|
<x-input-label for="search_invoice" :value="__('common.Search')"/>
|
||||||
|
<x-text-input id="search_invoice" name="search_invoice" type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
x-ref="search_invoice"
|
||||||
|
autofocus
|
||||||
|
placeholder="{{ __('incoming.Search invoice') }}"
|
||||||
|
x-on:keydown.window.prevent.slash="$refs.search_invoice.focus()"
|
||||||
|
x-model="search_invoice"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -53,7 +65,7 @@
|
|||||||
<div class="w-1/12 font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
<div class="w-1/12 font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
||||||
</summary>
|
</summary>
|
||||||
|
|
||||||
<template x-for="invoice in invoices">
|
<template x-for="invoice in getFilteredInvoices()">
|
||||||
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||||
<summary class="cursor-pointer flex flex-row w-full" @click="window.location.href='/invoice/' + invoice.id;">
|
<summary class="cursor-pointer flex flex-row w-full" @click="window.location.href='/invoice/' + invoice.id;">
|
||||||
<div class="w-1/6" x-text="invoice.number"></div>
|
<div class="w-1/6" x-text="invoice.number"></div>
|
||||||
@@ -96,6 +108,7 @@
|
|||||||
from: "{{ $first }}",
|
from: "{{ $first }}",
|
||||||
end: "{{ $last }}",
|
end: "{{ $last }}",
|
||||||
invoices: [],
|
invoices: [],
|
||||||
|
search_invoice: '',
|
||||||
sum: 0,
|
sum: 0,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
|
|
||||||
@@ -115,6 +128,22 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getFilteredInvoices() {
|
||||||
|
if (this.search_invoice === '') {
|
||||||
|
return this.invoices;
|
||||||
|
}
|
||||||
|
return this.invoices.filter((invoice) => {
|
||||||
|
return invoice.customer.name
|
||||||
|
.replace(/ /g, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||||
|
|| invoice.number
|
||||||
|
.replace(/ /g, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
calculateSum() {
|
calculateSum() {
|
||||||
this.sum = 0;
|
this.sum = 0;
|
||||||
this.tax = 0;
|
this.tax = 0;
|
||||||
|
|||||||
@@ -81,9 +81,9 @@
|
|||||||
|
|
||||||
@if($invoice->project)
|
@if($invoice->project)
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
<x-input-label class="w-1/3" for="project_count"
|
<x-input-label class="w-1/3" for="project_name"
|
||||||
:value="__('project.Project')"/>
|
:value="__('project.Project')"/>
|
||||||
<x-text-input id="project_count" name="project_count" type="text"
|
<x-text-input id="project_name" name="project_name" type="text"
|
||||||
value="{{ $invoice->project->name }}"
|
value="{{ $invoice->project->name }}"
|
||||||
class="mt-1 w-2/3"
|
class="mt-1 w-2/3"
|
||||||
autofocus disabled
|
autofocus disabled
|
||||||
@@ -91,9 +91,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row items-center">
|
<div class="flex flex-row items-center">
|
||||||
<x-input-label class="w-1/3" for="project_count"
|
<x-input-label class="w-1/3" for="project_number"
|
||||||
:value="__('project.Project Number')"/>
|
:value="__('project.Project Number')"/>
|
||||||
<x-text-input id="project_count" name="project_count" type="text"
|
<x-text-input id="project_number" name="project_number" type="text"
|
||||||
value="{{ $invoice->project->project_number }}"
|
value="{{ $invoice->project->project_number }}"
|
||||||
class="mt-1 w-2/3"
|
class="mt-1 w-2/3"
|
||||||
autofocus disabled
|
autofocus disabled
|
||||||
|
|||||||
@@ -35,28 +35,43 @@
|
|||||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||||
{{ __('invoice.Existing payments') }}
|
{{ __('invoice.Existing payments') }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
<div class="grid grid-cols-2">
|
||||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||||
<x-text-input type="date" id="from" name="from" x-model="from" x-on:change="fetchPayments()"/>
|
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||||
<x-input-label for="end" :value="__('invoice.End')"/>
|
<x-text-input type="date" id="from" name="from" x-model="from" x-on:change="fetchPayments()"/>
|
||||||
<x-text-input type="date" id="end" name="end" x-model="end" x-on:change="fetchPayments()"/>
|
<x-input-label for="end" :value="__('invoice.End')"/>
|
||||||
|
<x-text-input type="date" id="end" name="end" x-model="end" x-on:change="fetchPayments()"/>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row items-center gap-8">
|
||||||
|
<x-input-label for="search_invoice" :value="__('common.Search')"/>
|
||||||
|
<x-text-input id="search_invoice" name="search_invoice" type="text"
|
||||||
|
class="mt-1 block w-full"
|
||||||
|
x-ref="search_invoice"
|
||||||
|
autofocus
|
||||||
|
placeholder="{{ __('incoming.Search invoice') }}"
|
||||||
|
x-on:keydown.window.prevent.slash="$refs.search_invoice.focus()"
|
||||||
|
x-model="search_invoice"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<summary class="flex flex-row w-full mt-4">
|
<summary class="flex flex-row w-full mt-4">
|
||||||
<div class="w-1/4 font-bold border-b-2">{{ __('invoice.Invoice Number') }}</div>
|
<div class="w-1/6 font-bold border-b-2">{{ __('invoice.Invoice Number') }}</div>
|
||||||
|
<div class="w-1/4 font-bold border-b-2">{{ __('common.Name') }}</div>
|
||||||
<div class="w-1/4 font-bold border-b-2">{{ __('invoice.State') }}</div>
|
<div class="w-1/4 font-bold border-b-2">{{ __('invoice.State') }}</div>
|
||||||
<div class="w-1/4 text-right font-bold border-b-2 text-right">{{ __('invoice.Sum') }}</div>
|
<div class="w-1/6 text-right font-bold border-b-2 text-right">{{ __('invoice.Sum') }}</div>
|
||||||
<div class="w-1/4 text-right font-bold border-b-2 text-right">{{ __('invoice.Paid at') }}</div>
|
<div class="w-1/6 text-right font-bold border-b-2 text-right">{{ __('invoice.Paid at') }}</div>
|
||||||
</summary>
|
</summary>
|
||||||
|
|
||||||
<template x-for="payment in payments">
|
<template x-for="payment in getFilteredInvoices()">
|
||||||
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||||
<summary class="cursor-pointer flex flex-row w-full" @click="window.location.href='/payment/' + payment.id + '/edit';">
|
<summary class="cursor-pointer flex flex-row w-full" @click="window.location.href='/payment/' + payment.id + '/edit';">
|
||||||
<div class="w-1/4" x-text="payment.invoice.number"></div>
|
<div class="w-1/6" x-text="payment.invoice.number"></div>
|
||||||
|
<div class="w-1/4" x-text="payment.invoice.customer.name"></div>
|
||||||
<div class="w-1/4" x-text="payment.localized_state"></div>
|
<div class="w-1/4" x-text="payment.localized_state"></div>
|
||||||
<div class="w-1/4 text-right" x-text="payment.paid_amount + ' €'"></div>
|
<div class="w-1/6 text-right" x-text="payment.paid_amount + ' €'"></div>
|
||||||
<div class="w-1/4 text-right" x-text="payment.date"></div>
|
<div class="w-1/6 text-right" x-text="payment.date"></div>
|
||||||
</summary>
|
</summary>
|
||||||
</details>
|
</details>
|
||||||
</template>
|
</template>
|
||||||
@@ -90,6 +105,7 @@
|
|||||||
from: "{{ $first }}",
|
from: "{{ $first }}",
|
||||||
end: "{{ $last }}",
|
end: "{{ $last }}",
|
||||||
payments: [],
|
payments: [],
|
||||||
|
search_invoice: '',
|
||||||
sum: 0,
|
sum: 0,
|
||||||
tax: 0,
|
tax: 0,
|
||||||
|
|
||||||
@@ -109,10 +125,26 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getFilteredInvoices() {
|
||||||
|
if (this.search_invoice === '') {
|
||||||
|
return this.payments;
|
||||||
|
}
|
||||||
|
return this.payments.filter((payment) => {
|
||||||
|
return payment.invoice.customer.name
|
||||||
|
.replace(/ /g, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||||
|
|| payment.invoice.number
|
||||||
|
.replace(/ /g, '')
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
calculateSum() {
|
calculateSum() {
|
||||||
this.sum = 0;
|
this.sum = 0;
|
||||||
this.tax = 0;
|
this.tax = 0;
|
||||||
for (const [key, payment] of Object.entries(this.payments)) {
|
for (const [key, payment] of Object.entries(this.getFilteredInvoices())) {
|
||||||
this.sum += parseFloat(payment.paid_amount);
|
this.sum += parseFloat(payment.paid_amount);
|
||||||
this.tax += payment.invoice.tax * payment.paid_amount / payment.invoice.sum;
|
this.tax += payment.invoice.tax * payment.paid_amount / payment.invoice.sum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<div class="grid grid-cols-4 font-bold">
|
||||||
|
<div>{{ __('customer.Customer') }}</div>
|
||||||
|
<div>{{ __('common.Email') }}</div>
|
||||||
|
<div>{{ __('common.Address') }}</div>
|
||||||
|
<div>{{ __('common.City') }}</div>
|
||||||
|
</div>
|
||||||
<template x-for="(customer, index) in getFilteredCustomer()">
|
<template x-for="(customer, index) in getFilteredCustomer()">
|
||||||
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
||||||
:class="customer.id == project.customer_id ? 'font-bold' : ''"
|
:class="customer.id == project.customer_id ? 'font-bold' : ''"
|
||||||
@@ -39,7 +45,7 @@
|
|||||||
<div x-text="customer.name"></div>
|
<div x-text="customer.name"></div>
|
||||||
<div x-text="customer.email"></div>
|
<div x-text="customer.email"></div>
|
||||||
<div x-text="(customer.address) ? customer.address.address : ''"></div>
|
<div x-text="(customer.address) ? customer.address.address : ''"></div>
|
||||||
<div x-text="(customer.address) ? customer.address.city : ''"></div>
|
<div x-text="(customer.address) ? customer.address.zip + ' ' + customer.address.city : ''"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
@foreach($project->invoices as $invoice)
|
@foreach($project->invoices as $invoice)
|
||||||
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||||
<summary class="cursor-pointer flex flex-row w-full"
|
<summary class="cursor-pointer flex flex-row w-full"
|
||||||
@click="window.location.href='/invoice/' + invoice.id;">
|
onclick="window.location.href='/invoice/{{ $invoice->id }}'">
|
||||||
<div class="w-1/6">{{ $invoice->number }}</div>
|
<div class="w-1/6">{{ $invoice->number }}</div>
|
||||||
<div class="w-1/3">{{ $invoice->customer->name }}</div>
|
<div class="w-1/3">{{ $invoice->customer->name }}</div>
|
||||||
<div class="w-1/4">{{ $invoice->address->name }}</div>
|
<div class="w-1/4">{{ $invoice->address->name }}</div>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
let vm = this;
|
let vm = this;
|
||||||
axios.get('/supplier-with-trashed')
|
axios.get('/supplier')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
vm.suppliers = response.data;
|
vm.suppliers = response.data;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -117,7 +117,7 @@
|
|||||||
<cbc:PayableAmount currencyID="{{ $invoice->currency_code }}">{{ $invoice->sum }}</cbc:PayableAmount>
|
<cbc:PayableAmount currencyID="{{ $invoice->currency_code }}">{{ $invoice->sum }}</cbc:PayableAmount>
|
||||||
</cac:LegalMonetaryTotal>
|
</cac:LegalMonetaryTotal>
|
||||||
@foreach($invoice->items as $item)
|
@foreach($invoice->items as $item)
|
||||||
<cac:InvoiceLine>+
|
<cac:InvoiceLine>
|
||||||
<cbc:ID>1</cbc:ID>
|
<cbc:ID>1</cbc:ID>
|
||||||
<cbc:InvoicedQuantity unitCode="C62">{{ $item->amount }}</cbc:InvoicedQuantity>
|
<cbc:InvoicedQuantity unitCode="C62">{{ $item->amount }}</cbc:InvoicedQuantity>
|
||||||
<cbc:LineExtensionAmount currencyID="{{ $invoice->currency_code }}">{{ $item->amount * $item->price * (100 - $item->discount) / 100 }}</cbc:LineExtensionAmount>
|
<cbc:LineExtensionAmount currencyID="{{ $invoice->currency_code }}">{{ $item->amount * $item->price * (100 - $item->discount) / 100 }}</cbc:LineExtensionAmount>
|
||||||
|
|||||||
Reference in New Issue
Block a user