Compare commits
26 Commits
7b4d8f7fb0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2605899348 | |||
| de3c815532 | |||
| 922016020a | |||
| 0ab8debd2e | |||
| 0a4089fe14 | |||
| e1f579c7fd | |||
| f478b4aed6 | |||
| 5deef877ba | |||
| e4238bfda6 | |||
| 7ee0fd4ffb | |||
| 63b37d4385 | |||
| f740941a81 | |||
| 3695b012d5 | |||
| 2334ed0ede | |||
| eb8750c9ef | |||
| 2011a24753 | |||
| 286de46e3d | |||
| 9cb9c4de23 | |||
| a99ce5bec7 | |||
| ae0d99e239 | |||
| 65a3c4ba07 | |||
| f3d8c00d78 | |||
| 71e6a74120 | |||
| d5961d202f | |||
| 447a7d59d5 | |||
| c5a58436e1 |
@@ -1,15 +1,14 @@
|
||||
name: Build project's laravel image
|
||||
name: Build project image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
# Run every Sunday at midnight
|
||||
- cron: '1 0 * * 0'
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
REGISTRY: cs-registry.ddnss.de
|
||||
USER: chris
|
||||
PASS: q',\H(Od:G3).Xv<#!5P
|
||||
|
||||
IMAGE: /ri-st/project
|
||||
|
||||
jobs:
|
||||
Build-and-release-image:
|
||||
@@ -22,24 +21,62 @@ jobs:
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
buildkitd-flags: '--allow-insecure-entitlement network.host'
|
||||
driver-opts: network=host
|
||||
|
||||
- name: Log into registry
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: https://cs-git.ddnss.de
|
||||
username: ${{ env.USER }}
|
||||
password: ${{ env.PASS }}
|
||||
username: ${{ vars.DOCKERHUB_USER }}
|
||||
password: ${{ vars.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Log into CS registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.CS_REGISTRY_URL }}
|
||||
username: ${{ vars.CS_REGISTRY_USER }}
|
||||
password: ${{ vars.CS_REGISTRY_PASS }}
|
||||
|
||||
- name: Log into local registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.LOCAL_REGISTRY_URL }}
|
||||
username: ${{ vars.LOCAL_REGISTRY_USER }}
|
||||
password: ${{ vars.LOCAL_REGISTRY_PASS }}
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: cs-git.ddnss.de/ri-st/project
|
||||
images: ${{ secrets.REGISTRY_URL }}${{ env.IMAGE }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
ACTIONS_RUNTIME_TOKEN: ''
|
||||
with:
|
||||
tags: cs-git.ddnss.de/ri-st/project:master
|
||||
allow: network.host
|
||||
network: host
|
||||
tags: ${{ vars.LOCAL_REGISTRY_URL }}${{ env.IMAGE }}:latest
|
||||
push: true
|
||||
|
||||
- name: Scan image
|
||||
uses: anchore/scan-action@v6
|
||||
id: scan
|
||||
with:
|
||||
image: ${{ vars.LOCAL_REGISTRY_URL }}${{ env.IMAGE }}:latest
|
||||
fail-build: false
|
||||
output-format: table
|
||||
severity-cutoff: critical
|
||||
registry-username: ${{ vars.LOCAL_REGISTRY_USER }}
|
||||
registry-password: ${{ vars.LOCAL_REGISTRY_PASS }}
|
||||
|
||||
- name: Inspect file
|
||||
run: cat ${{ steps.scan.outputs.table }}
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: scan-result
|
||||
path: ${{ steps.scan.outputs.table }}
|
||||
|
||||
@@ -15,7 +15,7 @@ RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
#Use prebuilt image
|
||||
FROM cs-git.ddnss.de/docker/php-apache-8-4:latest AS final
|
||||
FROM gitea.fam-steinle.de/docker/php-apache-8-4:latest AS final
|
||||
WORKDIR /var/www
|
||||
COPY --from=npm-build /var/www/html /var/www
|
||||
|
||||
|
||||
@@ -18,6 +18,14 @@ class CustomerController extends Controller
|
||||
return response()->json(Customer::with(['address', 'delivery'])->orderBy('name')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function withTrashed(): JsonResponse
|
||||
{
|
||||
return response()->json(Customer::with(['address', 'delivery'])->withTrashed()->orderBy('name')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
@@ -66,4 +74,14 @@ class CustomerController extends Controller
|
||||
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the specified resource.
|
||||
*/
|
||||
public function restore(int $id): JsonResponse
|
||||
{
|
||||
$customer = Customer::withTrashed()->findOrFail($id)->restore();
|
||||
|
||||
return response()->json($customer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,25 @@ class IncomingController extends Controller
|
||||
return response()->json(Incoming::whereBetween('issue_date', [$from, $end])->with(['supplier'])->orderBy('issue_date', 'desc')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function payment($from = null, $end = null): JsonResponse
|
||||
{
|
||||
Option::updateOrCreate(['name' => 'incoming_payments_from'], ['value' => $from]);
|
||||
Option::updateOrCreate(['name' => 'incoming_payments_end'], ['value' => $end]);
|
||||
|
||||
return response()->json(Incoming::whereBetween('pay_date', [$from, $end])->with(['supplier'])->orderBy('pay_date', 'desc')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource that are not paid.
|
||||
*/
|
||||
public function open(): JsonResponse
|
||||
{
|
||||
return response()->json(Incoming::where('pay_date', '=', null)->orderBy('issue_date', 'desc')->with(['supplier'])->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an upload file for the resource.
|
||||
*/
|
||||
@@ -79,7 +98,7 @@ class IncomingController extends Controller
|
||||
'supplier.contact_email' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$supplier = Supplier::where('name', '=', $supplierData['supplier']['name'])->firstOrNew($supplierData['supplier']);
|
||||
$supplier = Supplier::updateOrCreate(['name' => $supplierData['supplier']['name']], $supplierData['supplier']);
|
||||
$supplier->save();
|
||||
|
||||
$incomingData = $request->validate([
|
||||
@@ -118,23 +137,6 @@ class IncomingController extends Controller
|
||||
*/
|
||||
public function update(Request $request, Incoming $incoming): JsonResponse
|
||||
{
|
||||
$incomingData = $request->validate([
|
||||
'incoming.invoice_number' => 'required|string',
|
||||
'incoming.issue_date' => 'required|date',
|
||||
'incoming.due_date' => 'nullable|date',
|
||||
'incoming.invoice_type_code' => 'required|string',
|
||||
'incoming.currency_code' => 'required|string',
|
||||
'incoming.net' => 'required|numeric',
|
||||
'incoming.gross' => 'required|numeric',
|
||||
'incoming.tax' => 'required|numeric',
|
||||
'incoming.pay_date' => 'nullable|date',
|
||||
'incoming.pay_name' => 'nullable|string',
|
||||
'incoming.pay_bic' => 'nullable|string',
|
||||
'incoming.pay_iban' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$incoming->update($incomingData['incoming']);
|
||||
|
||||
$supplierData = $request->validate([
|
||||
'supplier.name' => 'required|string',
|
||||
'supplier.registration_name' => 'nullable|string',
|
||||
@@ -150,7 +152,25 @@ class IncomingController extends Controller
|
||||
'supplier.contact_email' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$incoming->supplier()->update($supplierData['supplier']);
|
||||
$supplier = Supplier::updateOrCreate(['name' => $supplierData['supplier']['name']], $supplierData['supplier']);
|
||||
|
||||
$incomingData = $request->validate([
|
||||
'incoming.invoice_number' => 'required|string',
|
||||
'incoming.issue_date' => 'required|date',
|
||||
'incoming.due_date' => 'nullable|date',
|
||||
'incoming.invoice_type_code' => 'required|string',
|
||||
'incoming.currency_code' => 'required|string',
|
||||
'incoming.net' => 'required|numeric',
|
||||
'incoming.gross' => 'required|numeric',
|
||||
'incoming.tax' => 'required|numeric',
|
||||
'incoming.pay_date' => 'nullable|date',
|
||||
'incoming.pay_name' => 'nullable|string',
|
||||
'incoming.pay_bic' => 'nullable|string',
|
||||
'incoming.pay_iban' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$incomingData['incoming']['supplier_id'] = $supplier->id;
|
||||
$incoming->update($incomingData['incoming']);
|
||||
|
||||
$itemsData = $request->validate([
|
||||
'items.*.name' => 'required|string',
|
||||
|
||||
@@ -43,9 +43,9 @@ class InvoiceController extends Controller
|
||||
'address_id' => 'required|integer|exists:addresses,id',
|
||||
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
||||
'project_id' => 'nullable|integer|exists:projects,id',
|
||||
'project_count' => 'nullable|integer',
|
||||
'currency_code' => 'required|string',
|
||||
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
||||
'project_count' => 'nullable|integer',
|
||||
'tax' => 'required|numeric',
|
||||
'sum' => 'required|numeric',
|
||||
'due_date' => 'required|date',
|
||||
@@ -72,6 +72,10 @@ class InvoiceController extends Controller
|
||||
'customer_id' => 'required|integer|exists:customers,id',
|
||||
'address_id' => 'required|integer|exists:addresses,id',
|
||||
'delivery_id' => 'nullable|integer|exists:addresses,id',
|
||||
'project_id' => 'nullable|integer|exists:projects,id',
|
||||
'project_count' => 'nullable|integer',
|
||||
'currency_code' => 'required|string',
|
||||
'type' => [Rule::enum(InvoiceTypeCode::class)],
|
||||
'tax' => 'required|numeric',
|
||||
'sum' => 'required|numeric',
|
||||
'due_date' => 'required|date',
|
||||
|
||||
@@ -32,7 +32,7 @@ class InvoiceitemController extends Controller
|
||||
'name' => 'required|string',
|
||||
'description' => 'nullable|string',
|
||||
'article_number' => 'nullable|string',
|
||||
|
||||
'sort' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
$item = $invoice->items()->create($itemData);
|
||||
|
||||
@@ -18,6 +18,14 @@ class SupplierController extends Controller
|
||||
return response()->json($suppliers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function withTrashed(): JsonResponse
|
||||
{
|
||||
return response()->json(Supplier::with(['invoices'])->withTrashed()->orderBy('name')->get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
@@ -69,4 +77,25 @@ class SupplierController extends Controller
|
||||
return response()->json($supplier);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Supplier $supplier): JsonResponse
|
||||
{
|
||||
$supplier->delete();
|
||||
|
||||
return response()->json(null, 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the specified resource.
|
||||
*/
|
||||
public function restore(int $id): JsonResponse
|
||||
{
|
||||
$supplier = Supplier::withTrashed()->findOrFail($id)->restore();
|
||||
|
||||
return response()->json($supplier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,26 @@ class IncomingController extends Controller
|
||||
return view('incoming.index', ['first' => $first, 'last' => $last]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function payment(): View
|
||||
{
|
||||
if (Option::where('name', '=', 'incoming_payments_from')->count() > 0) {
|
||||
$first = Option::where('name', '=', 'incoming_payments_from')->first()->value;
|
||||
} else {
|
||||
$first = Date::now()->firstOfMonth()->format('Y-m-d');
|
||||
}
|
||||
|
||||
if (Option::where('name', '=', 'incoming_payments_end')->count() > 0) {
|
||||
$last = Option::where('name', '=', 'incoming_payments_end')->first()->value;
|
||||
} else {
|
||||
$last = Date::now()->format('Y-m-d');
|
||||
}
|
||||
|
||||
return view('incoming.payment', ['first' => $first, 'last' => $last]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
@@ -37,6 +57,15 @@ class IncomingController extends Controller
|
||||
return view('incoming.create');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function createPayment(): View
|
||||
{
|
||||
return view('incoming.create-payment');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for uploading a new resource.
|
||||
*/
|
||||
|
||||
@@ -72,7 +72,7 @@ class Incoming extends Model
|
||||
*/
|
||||
public function supplier(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Supplier::class);
|
||||
return $this->belongsTo(Supplier::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,25 +43,6 @@ class Invoice extends Model
|
||||
'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.
|
||||
*/
|
||||
@@ -99,7 +80,7 @@ class Invoice extends Model
|
||||
*/
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
return $this->belongsTo(Customer::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +104,7 @@ class Invoice extends Model
|
||||
*/
|
||||
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',
|
||||
'name',
|
||||
'description',
|
||||
'sort'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class Payment extends Model
|
||||
*/
|
||||
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',
|
||||
'customer_email',
|
||||
'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');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@@ -69,9 +78,12 @@ class Project extends Model
|
||||
*/
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
return $this->belongsTo(Customer::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoices for this project.
|
||||
*/
|
||||
public function invoices(): HasMany
|
||||
{
|
||||
return $this->hasMany(Invoice::class);
|
||||
|
||||
@@ -4,9 +4,12 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Supplier extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"require": {
|
||||
"php": "^8.4",
|
||||
"barryvdh/laravel-dompdf": "^3.0",
|
||||
"laravel/framework": "^11.31",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"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('suppliers', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('suppliers', function (Blueprint $table) {
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,7 @@ return [
|
||||
|
||||
'Customers' => 'Kunden',
|
||||
'Customer' => 'Kunde',
|
||||
'Search customer' => 'Kunden suchen',
|
||||
'Add new customer' => 'Neuer Kunde',
|
||||
'Edit existing customer' => 'Bestehenden Kunden bearbeiten',
|
||||
'Edit existing address' => 'Bestehende Adresse bearbeiten',
|
||||
|
||||
@@ -19,8 +19,8 @@ return [
|
||||
'Generate' => 'Generieren',
|
||||
'Outgoing invoices' => 'Ausgangsrechnungen',
|
||||
'Incoming payments' => 'Zahlungseingang',
|
||||
'Incoming by issue date' => 'Eingang nach Rechnungsdatum',
|
||||
'Outgoing by pay date' => 'Eingang nach Zahlungsdatum',
|
||||
'Incoming invoices' => 'Eingangrechnungen',
|
||||
'Outgoing payments' => 'Zahlungsausgang',
|
||||
|
||||
|
||||
];
|
||||
|
||||
@@ -14,6 +14,7 @@ return [
|
||||
'Add' => 'Anlegen',
|
||||
'Edit' => 'Bearbeiten',
|
||||
'Delete' => 'Löschen',
|
||||
'Restore' => 'Wiederherstellen',
|
||||
'Save' => 'Speichern',
|
||||
'Change' => 'Ändern',
|
||||
'SaveAndContinue' => 'Speichern und Weiter',
|
||||
|
||||
@@ -12,6 +12,7 @@ return [
|
||||
*/
|
||||
|
||||
'Incoming' => 'Eingang',
|
||||
'Search invoice' => 'Rechnung suchen',
|
||||
'Add new invoice' => 'Neue Eingangsrechnung manuell anlegen',
|
||||
'Add new invoice by clicking add' => 'Neue Eingangsrechnung durch Klick auf "Anlegen" erstellen. Die Daten zur Rechnung müssen händisch eingegeben werden.',
|
||||
'Upload new invoice' => 'Neue Eingangsrechnung hochladen',
|
||||
@@ -26,5 +27,12 @@ return [
|
||||
'Select supplier' => 'Lieferant wählen',
|
||||
'Create incoming' => 'Neue Eingangsrechnung anlegen',
|
||||
'Incoming invoices' => 'Eingangsrechnungen',
|
||||
'Incoming payments' => 'Zahlungsausgang',
|
||||
'Add new payment' => 'Neuen Zahlungsausgang erstellen',
|
||||
'Add new payment by clicking add' => 'Durch Klick auf "Anlegen" neuen Zahlungsausgang erstellen',
|
||||
'Create new payment' => 'Neuen Zahlungsausgang anlegen',
|
||||
'Select invoice' => 'Eingangsrechnung auswählen',
|
||||
'Select your invoice for payment' => 'Wähle die Rechnung für den Zahlungsasusgang aus'
|
||||
|
||||
|
||||
];
|
||||
|
||||
@@ -57,6 +57,7 @@ return [
|
||||
'state_created' => 'Erstellt',
|
||||
'state_sent' => 'Gesendet',
|
||||
'state_paid' => 'Bezahlt',
|
||||
'state_deleted' => 'Storniert',
|
||||
'Mail' => 'E-Mail',
|
||||
'Send email to your customer with attachments.' => 'E-Mail mit Anlagen an den Kunden versenden.',
|
||||
'Invoice body' => 'Sehr geehrte Kundin, sehr geehrter Kunde\n\nim Anhang erhalten Sie die Rechnung :invoice_number.\n\nMit freundlichen Grüßen',
|
||||
@@ -67,7 +68,7 @@ return [
|
||||
'Sent menually' => 'Manuell versendet',
|
||||
'Payment' => 'Zahlung',
|
||||
'Payment for invoice' => 'Zahlung zur Rechnung',
|
||||
'Payments' => 'Zahlungen',
|
||||
'Payments' => 'Zahlungseingang',
|
||||
'Existing payments' => 'Bestehende Zahlungseingänge',
|
||||
'Add new payment' => 'Neuen Zahlungseingang erstellen',
|
||||
'Add new payment by clicking add' => 'Durch Klick auf "Anlegen" neuen Zahlungseingang erstellen',
|
||||
@@ -104,5 +105,6 @@ return [
|
||||
'Cash discount sum' => 'Skonto-Summe',
|
||||
'Cash discount until' => 'Skonto bis',
|
||||
'Cash discount terms in days' => 'Skontogültigkeit in Tagen',
|
||||
'No invoices' => 'Keine Rechnungen vorhanden',
|
||||
|
||||
];
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1091,9 +1091,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001696",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001696.tgz",
|
||||
"integrity": "sha512-pDCPkvzfa39ehJtJ+OwGT/2yvT2SbjfHhiIW2LWOAcMQ7BzwxT/XuyUp4OTOd0XFWA6BKw0JalnBHgSi5DGJBQ==",
|
||||
"version": "1.0.30001741",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001741.tgz",
|
||||
"integrity": "sha512-QGUGitqsc8ARjLdgAfxETDhRbJ0REsP6O3I96TAth/mVjh2cYzN2u+3AzPP3aVSm2FehEItaJw1xd+IGBXWeSw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
|
||||
3
resources/views/components/restore-icon.blade.php
Normal file
3
resources/views/components/restore-icon.blade.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" {{ $attributes->merge(['class' => 'size-8 p-1']) }}>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 280 B |
@@ -19,34 +19,76 @@
|
||||
{{ __("customer.Add new customer by clicking add") }}
|
||||
</p>
|
||||
</header>
|
||||
<a class="mt-6 inline-block" href="{{ route('customer.create') }}"><x-primary-button>{{ __('form.Add') }}</x-primary-button></a>
|
||||
<a class="mt-6 inline-block" href="{{ route('customer.create') }}">
|
||||
<x-primary-button>{{ __('form.Add') }}</x-primary-button>
|
||||
</a>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w" x-data="{ customers: []}"
|
||||
x-init="customers = await fetchCustomers().then((data) => data );">
|
||||
<div class="max-w" x-data="customerForm()">
|
||||
<section>
|
||||
<header>
|
||||
<header class="grid grid-cols-2">
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('customer.Existing customers') }}
|
||||
</h2>
|
||||
<div class="flex flex-row items-center gap-8">
|
||||
<x-input-label for="search_customer" :value="__('common.Search')"/>
|
||||
<x-text-input id="search_customer" name="search_customer" type="text"
|
||||
class="mt-1 block w-full"
|
||||
x-ref="search_customer"
|
||||
autofocus
|
||||
placeholder="{{ __('customer.Search customer') }}"
|
||||
x-on:keydown.window.prevent.slash="$refs.search_customer.focus()"
|
||||
x-model="search_customer"/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="cursor-pointer grid grid-cols-3 mt-4">
|
||||
<div class="font-bold border-b-2">{{ __('common.Name') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Email') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Created at') }}</div>
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
<p x-show="success" x-transition
|
||||
class="text-sm text-green-600 dark:text-green-400">{{ __('form.Saved') }}</p>
|
||||
|
||||
<div class="flex flex-row mt-4">
|
||||
<div class="w-11/12 grid grid-cols-3">
|
||||
<div class="font-bold border-b-2">{{ __('common.Name') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Email') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Created at') }}</div>
|
||||
</div>
|
||||
<div class="w-1/12 border-b-2"></div>
|
||||
</div>
|
||||
|
||||
<template x-for="customer in customers">
|
||||
<div class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||
<div class="cursor-pointer grid grid-cols-3" x-on:click="window.location.href='/customer/' + customer.id;">
|
||||
<template x-for="(customer, index) in getFilteredCustomers()">
|
||||
<div class="even:bg-gray-100 odd:bg-white hover:bg-gray-400 flex flex-row">
|
||||
<div class="w-11/12 grid grid-cols-3"
|
||||
:class="(customer.deleted_at == null) ? 'cursor-pointer' : 'line-through';"
|
||||
x-on:click="(customer.deleted_at == null) ? window.location.href='/customer/' + customer.id : ''">
|
||||
<div x-text="customer.name"></div>
|
||||
<div x-text="customer.email"></div>
|
||||
<div x-text="customer.created"></div>
|
||||
</div>
|
||||
<div class="w-1/12 place-items-end" x-data="{ tooltip: false }" x-show="customer.deleted_at == null" >
|
||||
<x-trash-icon class="cursor-pointer h-6"
|
||||
x-on:click="deleteCustomer(index);"
|
||||
x-on:mouseover="tooltip = true"
|
||||
x-on:mouseleave="tooltip = false"
|
||||
/>
|
||||
<div x-show="tooltip"
|
||||
class="text-sm text-white absolute bg-gray-900 rounded-lg p-2 transform -translate-y-16 translate-x-8">
|
||||
{{ __('form.Delete') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-1/12 place-items-end" x-data="{ tooltip: false }" x-show="customer.deleted_at != null" >
|
||||
<x-restore-icon class="cursor-pointer h-6"
|
||||
x-on:click="restoreCustomer(index);"
|
||||
x-on:mouseover="tooltip = true"
|
||||
x-on:mouseleave="tooltip = false"
|
||||
/>
|
||||
<div x-show="tooltip"
|
||||
class="text-sm text-white absolute bg-gray-900 rounded-lg p-2 transform -translate-y-16 translate-x-8">
|
||||
{{ __('form.Restore') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -60,16 +102,79 @@
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
let fetchCustomers = async () => {
|
||||
return await new Promise((resolve, reject) => {
|
||||
axios.get('/customer')
|
||||
.then(function (response) {
|
||||
resolve(response.data);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
})
|
||||
});
|
||||
}
|
||||
function customerForm() {
|
||||
return {
|
||||
customers: [],
|
||||
search_customer: '',
|
||||
|
||||
success: false,
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
init() {
|
||||
let vm = this;
|
||||
axios.get('/customer')
|
||||
.then(function (response) {
|
||||
vm.customers = response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
getFilteredCustomers() {
|
||||
if (this.search_customer === '') {
|
||||
return this.customers;
|
||||
}
|
||||
return this.customers.filter((customer) => {
|
||||
return customer.name
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_customer.replace(/ /g, '').toLowerCase())
|
||||
});
|
||||
},
|
||||
|
||||
deleteCustomer(index) {
|
||||
let vm = this;
|
||||
let customer_key = Object.keys(this.customers).find(key => (this.customers[key].id == this.getFilteredCustomers()[index].id));
|
||||
axios.delete('/customer/' + this.customers[customer_key].id)
|
||||
.then(function (response) {
|
||||
vm.error = false;
|
||||
vm.success = true;
|
||||
vm.message = '';
|
||||
vm.customers[customer_key].deleted_at = 0;
|
||||
window.setTimeout(function () {
|
||||
vm.success = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.error = true;
|
||||
vm.success = false;
|
||||
vm.message = error.response.data.message;
|
||||
});
|
||||
},
|
||||
|
||||
restoreCustomer(index) {
|
||||
let vm = this;
|
||||
let customer_key = Object.keys(this.customers).find(key => (this.customers[key].id == this.getFilteredCustomers()[index].id));
|
||||
axios.get('/customer/' + this.customers[customer_key].id + '/restore')
|
||||
.then(function (response) {
|
||||
vm.error = false;
|
||||
vm.success = true;
|
||||
vm.message = '';
|
||||
vm.customers[customer_key].deleted_at = null;
|
||||
window.setTimeout(function () {
|
||||
vm.success = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.success = false;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<select name="report" id="report" x-model="data.report" class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm w-1/4">
|
||||
<option value="invoice">{{ __('excel.Outgoing invoices') }}</option>
|
||||
<option value="payment">{{ __('excel.Incoming payments') }}</option>
|
||||
<option value="incoming">{{ __('excel.Incoming by issue date') }}</option>
|
||||
<option value="outgoing">{{ __('excel.Outgoing by pay date') }}</option>
|
||||
<option value="incoming">{{ __('excel.Incoming invoices') }}</option>
|
||||
<option value="outgoing">{{ __('excel.Outgoing payments') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
77
resources/views/incoming/create-payment.blade.php
Normal file
77
resources/views/incoming/create-payment.blade.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('incoming.Create new payment') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="paymentForm()">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||
|
||||
<!-- Invoice data -->
|
||||
<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">
|
||||
{{ __('incoming.Select invoice') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __('incoming.Select your invoice for payment') }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="mt-8" x-show="invoices.length == 0">
|
||||
{{ __('invoice.No invoices') }}
|
||||
</div>
|
||||
|
||||
<summary class="cursor-pointer flex flex-row w-full mt-4">
|
||||
<div class="w-1/3 font-bold border-b-2">{{ __('invoice.Invoice Number') }}</div>
|
||||
<div class="w-1/3 font-bold border-b-2">{{ __('supplier.Supplier') }}</div>
|
||||
<div class="w-1/6 font-bold border-b-2 text-right">{{ __('invoice.Sum') }}</div>
|
||||
<div class="w-1/6 font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
||||
</summary>
|
||||
|
||||
<template x-for="(invoice, index) in invoices" x-bind="invoices">
|
||||
<a class="cursor-pointer flex flex-row even:bg-gray-100 odd:bg-white hover:bg-gray-400"
|
||||
:href="'/incoming/' + invoice.id + '/edit'">
|
||||
<div class="w-1/3" x-text="invoice.invoice_number"></div>
|
||||
<div class="w-1/3" x-text="invoice.supplier.name"></div>
|
||||
<div class="w-1/6 text-right" x-text="invoice.gross + ' €'"></div>
|
||||
<div class="w-1/6 text-right" x-text="invoice.issue_date"></div>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function paymentForm() {
|
||||
return {
|
||||
invoices: [],
|
||||
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
init() {
|
||||
let vm = this;
|
||||
axios.get('/incoming_open')
|
||||
.then(function (response) {
|
||||
vm.invoices = response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -84,15 +84,22 @@
|
||||
autocomplete="name" x-model="incoming.pay_date"/>
|
||||
|
||||
</div>
|
||||
|
||||
<x-primary-button x-on:click="submit();" class="absolute right-0 bottom-0">{{ __('form.Save') }}</x-primary-button>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<p class="text-red-600 font-bold mb-8" x-text="message" x-show="error"></p>
|
||||
|
||||
<p x-show="success" x-transition
|
||||
class="text-sm text-green-600 dark:text-green-400 mb-8">{{ __('form.Saved') }}</p>
|
||||
|
||||
<x-primary-button @click="submit">{{ __('form.Save') }}</x-primary-button>
|
||||
<x-primary-button @click="submitAndContinue">{{ __('form.SaveAndContinue') }}</x-primary-button>
|
||||
</div>
|
||||
|
||||
<!-- Supplier data -->
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w">
|
||||
@@ -105,14 +112,15 @@
|
||||
|
||||
<form class="mt-6 space-y-6" @submit.prevent="">
|
||||
|
||||
<div class="flex flex-row">
|
||||
<x-input-label class="w-1/6" for="select_supplier" :value="__('incoming.Select supplier')"/>
|
||||
<select id="select_supplier" name="select_supplier" type="text" x-on:click="setSupplier();"
|
||||
class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm">
|
||||
<div class="flex flex-row w-1/2">
|
||||
<x-input-label class="w-1/3" for="select_supplier" :value="__('incoming.Select supplier')"/>
|
||||
<input list="all_suppliers" id="select_supplier" name="select_supplier" type="text" x-on:change="setSupplier();"
|
||||
class="border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 focus:border-indigo-500 dark:focus:border-indigo-600 focus:ring-indigo-500 dark:focus:ring-indigo-600 rounded-md shadow-sm"/>
|
||||
<datalist id="all_suppliers" x-on:change="alert('hier');">
|
||||
<template x-for="supplier in suppliers">
|
||||
<option :value="supplier.id" x-text="supplier.name"></option>
|
||||
<option :value="supplier.name"></option>
|
||||
</template>
|
||||
</select>
|
||||
</datalist>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row space-x-8 items-start">
|
||||
@@ -269,23 +277,32 @@
|
||||
<script>
|
||||
function incomingForm() {
|
||||
return {
|
||||
incoming: {
|
||||
invoice_number: 'R01',
|
||||
issue_date: "{{ \Illuminate\Support\Facades\Date::now()->format('Y-m-d') }}",
|
||||
due_date: "{{ \Illuminate\Support\Facades\Date::now()->addDays(14)->format('Y-m-d') }}",
|
||||
invoice_type_code: '380',
|
||||
currency_code: 'EUR',
|
||||
net: 0,
|
||||
gross: 0,
|
||||
tax: 0
|
||||
},
|
||||
incoming: {},
|
||||
supplier: {},
|
||||
taxes: [],
|
||||
suppliers: [],
|
||||
|
||||
success: false,
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
init() {
|
||||
this.addTax();
|
||||
this.getSuppliers();
|
||||
this.incoming = this.getInitialIncoming();
|
||||
this.addTax();
|
||||
},
|
||||
|
||||
getInitialIncoming() {
|
||||
return {
|
||||
invoice_number: 'R01',
|
||||
issue_date: "{{ \Illuminate\Support\Facades\Date::now()->format('Y-m-d') }}",
|
||||
due_date: "{{ \Illuminate\Support\Facades\Date::now()->addDays(14)->format('Y-m-d') }}",
|
||||
invoice_type_code: '380',
|
||||
currency_code: 'EUR',
|
||||
net: 0.0,
|
||||
gross: 0.0,
|
||||
tax: 0.0
|
||||
}
|
||||
},
|
||||
|
||||
addTax() {
|
||||
@@ -309,31 +326,31 @@
|
||||
|
||||
setSupplier() {
|
||||
let id = document.querySelector('#select_supplier').value;
|
||||
let supplier_key = Object.keys(this.suppliers).find(key => (this.suppliers[key].id == id));
|
||||
let supplier_key = Object.keys(this.suppliers).find(key => (this.suppliers[key].name == id));
|
||||
this.supplier = this.suppliers[supplier_key];
|
||||
},
|
||||
|
||||
calculateFromGross(index) {
|
||||
this.taxes[index].taxable_amount = this.taxes[index].gross * 100 / (100 + parseFloat(this.taxes[index].percentage));
|
||||
this.taxes[index].taxable_amount = (this.taxes[index].gross * 100 / (100 + parseFloat(this.taxes[index].percentage))).toFixed(2);
|
||||
this.calculateFromNet(index);
|
||||
},
|
||||
|
||||
calculateFromNet(index) {
|
||||
this.taxes[index].amount = this.taxes[index].taxable_amount * this.taxes[index].percentage / 100;
|
||||
this.taxes[index].gross = this.taxes[index].taxable_amount * (100 + parseFloat(this.taxes[index].percentage)) / 100;
|
||||
this.incoming.net = 0;
|
||||
this.incoming.gross = 0;
|
||||
this.incoming.tax = 0;
|
||||
this.taxes[index].amount = (this.taxes[index].taxable_amount * this.taxes[index].percentage / 100).toFixed(2);
|
||||
this.taxes[index].gross = (this.taxes[index].taxable_amount * (100 + parseFloat(this.taxes[index].percentage)) / 100).toFixed(2);
|
||||
this.incoming.net = 0.0;
|
||||
this.incoming.gross = 0.0;
|
||||
this.incoming.tax = 0.0;
|
||||
this.calculateSum();
|
||||
},
|
||||
|
||||
calculateSum() {
|
||||
let vm = this;
|
||||
this.taxes.forEach(function(tax) {
|
||||
vm.incoming.tax += tax.amount * 1;
|
||||
vm.incoming.net += tax.taxable_amount * 1;
|
||||
vm.incoming.tax += parseFloat(tax.amount);
|
||||
vm.incoming.net += parseFloat(tax.taxable_amount);
|
||||
});
|
||||
vm.incoming.gross += (vm.incoming.tax + vm.incoming.net);
|
||||
vm.incoming.gross = (vm.incoming.tax * 1 + vm.incoming.net * 1).toFixed(2);
|
||||
},
|
||||
|
||||
deleteTax(index) {
|
||||
@@ -346,6 +363,28 @@
|
||||
.then(function(response) {
|
||||
window.location.href = '/incoming';
|
||||
})
|
||||
},
|
||||
|
||||
submitAndContinue() {
|
||||
let vm = this;
|
||||
axios.post('/incoming', {incoming: this.incoming, taxes: this.taxes, supplier: this.supplier})
|
||||
.then(function(response) {
|
||||
vm.success = true;
|
||||
vm.error = false;
|
||||
vm.message = '';
|
||||
vm.taxes = [];
|
||||
vm.supplier = {};
|
||||
vm.incoming = vm.getInitialIncoming();
|
||||
document.querySelector('#select_supplier').value = '';
|
||||
vm.addTax();
|
||||
window.setTimeout(function() {
|
||||
vm.success = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
{{ __("incoming.Add new invoice by clicking add") }}
|
||||
</p>
|
||||
</header>
|
||||
<a class="mt-6 inline-block" href="{{ route('incoming.create') }}"><x-primary-button>{{ __('form.Add') }}</x-primary-button></a>
|
||||
<a class="mt-6 inline-block" href="{{ route('incoming.create') }}">
|
||||
<x-primary-button>{{ __('form.Add') }}</x-primary-button>
|
||||
</a>
|
||||
</section>
|
||||
<section class="w-1/2">
|
||||
<header>
|
||||
@@ -35,7 +37,9 @@
|
||||
{{ __("incoming.Upload new xml invoice by clicking upload") }}
|
||||
</p>
|
||||
</header>
|
||||
<a class="mt-6 inline-block" href="{{ route('incoming.upload') }}"><x-primary-button>{{ __('form.Upload') }}</x-primary-button></a>
|
||||
<a class="mt-6 inline-block" href="{{ route('incoming.upload') }}">
|
||||
<x-primary-button>{{ __('form.Upload') }}</x-primary-button>
|
||||
</a>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,11 +51,26 @@
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('incoming.Existing invoices') }}
|
||||
</h2>
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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 class="grid grid-cols-2">
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from"
|
||||
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>
|
||||
</header>
|
||||
|
||||
@@ -63,9 +82,10 @@
|
||||
<div class="w-1/12 font-bold border-b-2 text-right">{{ __('common.Paid at') }}</div>
|
||||
</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">
|
||||
<summary class="cursor-pointer flex flex-row w-full" @click="window.location.href='/incoming/' + invoice.id + '/edit';">
|
||||
<summary class="cursor-pointer flex flex-row w-full"
|
||||
@click="window.location.href='/incoming/' + invoice.id + '/edit';">
|
||||
<div class="w-1/3" x-text="invoice.invoice_number"></div>
|
||||
<div class="w-1/3" x-text="invoice.supplier.name"></div>
|
||||
<div class="w-1/6 text-right" x-text="invoice.gross + ' €'"></div>
|
||||
@@ -108,6 +128,8 @@
|
||||
from: "{{ $first }}",
|
||||
end: "{{ $last }}",
|
||||
invoices: [],
|
||||
search_invoice: '',
|
||||
|
||||
|
||||
init() {
|
||||
this.fetchInvoices();
|
||||
@@ -125,6 +147,22 @@
|
||||
})
|
||||
},
|
||||
|
||||
getFilteredInvoices() {
|
||||
if (this.search_invoice === '') {
|
||||
return this.invoices;
|
||||
}
|
||||
return this.invoices.filter((invoice) => {
|
||||
return invoice.supplier.name
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||
|| invoice.invoice_number
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_invoice.replace(/ /g, '').toLowerCase())
|
||||
});
|
||||
},
|
||||
|
||||
calculateSum() {
|
||||
this.net = 0;
|
||||
this.gross = 0;
|
||||
|
||||
133
resources/views/incoming/payment.blade.php
Normal file
133
resources/views/incoming/payment.blade.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<div class="flex flex-row w-full items-center">
|
||||
<h2 class="grow font-semibold pr-12 text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('incoming.Incoming') }}
|
||||
</h2>
|
||||
<a href="{{ route('excel') }}">
|
||||
<x-excel-icon class="text-gray-800 cursor-pointer right-0"/>
|
||||
</a>
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w-xl">
|
||||
<section>
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('incoming.Add new payment') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __("incoming.Add new payment by clicking add") }}
|
||||
</p>
|
||||
</header>
|
||||
<a class="mt-6 inline-block" href="{{ route('incoming.create-payment') }}"><x-primary-button>{{ __('form.Add') }}</x-primary-button></a>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-4 sm:p-8 bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="max-w" x-data="incomingForm">
|
||||
<section>
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('incoming.Existing invoices') }}
|
||||
</h2>
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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>
|
||||
</header>
|
||||
|
||||
<summary class="cursor-pointer flex flex-row w-full mt-4">
|
||||
<div class="w-1/3 font-bold border-b-2">{{ __('invoice.Invoice Number') }}</div>
|
||||
<div class="w-1/3 font-bold border-b-2">{{ __('supplier.Supplier') }}</div>
|
||||
<div class="w-1/6 font-bold border-b-2 text-right">{{ __('invoice.Sum') }}</div>
|
||||
<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.Paid at') }}</div>
|
||||
</summary>
|
||||
|
||||
<template x-for="invoice in invoices">
|
||||
<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='/incoming/' + invoice.id + '/edit';">
|
||||
<div class="w-1/3" x-text="invoice.invoice_number"></div>
|
||||
<div class="w-1/3" x-text="invoice.supplier.name"></div>
|
||||
<div class="w-1/6 text-right" x-text="invoice.gross + ' €'"></div>
|
||||
<div class="w-1/12 text-right" x-text="invoice.created"></div>
|
||||
<div class="w-1/12 text-right" x-text="invoice.paid"></div>
|
||||
</summary>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<div class="w-full border-t-2"></div>
|
||||
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2">{{ __('invoice.Net') }}</div>
|
||||
<div class="w-1/3 text-right" x-text="net + ' €'"></div>
|
||||
</div>
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2">{{ __('invoice.Tax') }}</div>
|
||||
<div class="w-1/3 text-right" x-text="tax + ' €'"></div>
|
||||
</div>
|
||||
<div class="flex flex-row">
|
||||
<div class="w-1/2 font-bold">{{ __('invoice.Sum') }}</div>
|
||||
<div class="w-1/3 font-bold text-right" x-text="gross + ' €'"></div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function incomingForm() {
|
||||
return {
|
||||
net: 0,
|
||||
gross: 0,
|
||||
tax: 0,
|
||||
from: "{{ $first }}",
|
||||
end: "{{ $last }}",
|
||||
invoices: [],
|
||||
|
||||
init() {
|
||||
this.fetchInvoices();
|
||||
},
|
||||
|
||||
fetchInvoices() {
|
||||
let vm = this;
|
||||
axios.get('/incoming-payment/' + this.from + '/' + this.end)
|
||||
.then(function (response) {
|
||||
vm.invoices = response.data;
|
||||
vm.calculateSum();
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
})
|
||||
},
|
||||
|
||||
calculateSum() {
|
||||
this.net = 0;
|
||||
this.gross = 0;
|
||||
this.tax = 0;
|
||||
for (const [key, invoice] of Object.entries(this.invoices)) {
|
||||
this.net += parseFloat(invoice.net);
|
||||
this.gross += parseFloat(invoice.gross);
|
||||
this.tax += parseFloat(invoice.tax)
|
||||
}
|
||||
this.net = this.net.toFixed(2)
|
||||
this.gross = this.gross.toFixed(2);
|
||||
this.tax = this.tax.toFixed(2);
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -110,7 +110,7 @@
|
||||
<template x-for="(project, index) in getFilteredProject()">
|
||||
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
||||
: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.project_number"></div>
|
||||
<div x-text="project.customer_name"></div>
|
||||
@@ -231,7 +231,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<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"
|
||||
:value="__('invoice.Partial invoice number')"/>
|
||||
<x-text-input id="project_count" name="project_count" type="text"
|
||||
@@ -401,7 +401,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<x-primary-button x-on:click="submit();" class="">{{ __('form.Save') }}</x-primary-button>
|
||||
|
||||
</div>
|
||||
@@ -443,6 +442,7 @@
|
||||
tax: 0,
|
||||
sum: 0,
|
||||
project_id: null,
|
||||
project_count: null,
|
||||
due_date: '{!! \Illuminate\Support\Carbon::today()->addDays(intval($options->payment_terms))->format('Y-m-d') !!}',
|
||||
cash_discount: 0,
|
||||
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++) {
|
||||
let pos = sort_flipped[i];
|
||||
let item = self.items[pos];
|
||||
item.sort = i;
|
||||
const result = axios.post('invoice/' + self.invoice_id + '/item', item)
|
||||
.catch(function (error) {
|
||||
self.error = true;
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<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"
|
||||
:value="__('invoice.Partial invoice number')"/>
|
||||
<x-text-input id="project_count" name="project_count" type="text"
|
||||
@@ -662,6 +662,7 @@
|
||||
for (let i = 0; i < self.items.length; i++) {
|
||||
let pos = sort_flipped[i];
|
||||
let item = self.items[pos];
|
||||
item.sort = i;
|
||||
const result = axios.post('invoice/' + self.invoice.id + '/item', item)
|
||||
.catch(function (error) {
|
||||
self.error = true;
|
||||
|
||||
@@ -36,11 +36,23 @@
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('invoice.Existing invoices') }}
|
||||
</h2>
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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 class="grid grid-cols-2">
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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>
|
||||
</header>
|
||||
|
||||
@@ -53,7 +65,7 @@
|
||||
<div class="w-1/12 font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
||||
</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">
|
||||
<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>
|
||||
@@ -96,6 +108,7 @@
|
||||
from: "{{ $first }}",
|
||||
end: "{{ $last }}",
|
||||
invoices: [],
|
||||
search_invoice: '',
|
||||
sum: 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() {
|
||||
this.sum = 0;
|
||||
this.tax = 0;
|
||||
|
||||
@@ -81,9 +81,9 @@
|
||||
|
||||
@if($invoice->project)
|
||||
<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')"/>
|
||||
<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 }}"
|
||||
class="mt-1 w-2/3"
|
||||
autofocus disabled
|
||||
@@ -91,9 +91,9 @@
|
||||
|
||||
</div>
|
||||
<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')"/>
|
||||
<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 }}"
|
||||
class="mt-1 w-2/3"
|
||||
autofocus disabled
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
<x-dropdown-link :href="route('incoming.index')">
|
||||
{{ __('incoming.Incoming invoices') }}
|
||||
</x-dropdown-link>
|
||||
<x-dropdown-link :href="route('incoming.payment')">
|
||||
{{ __('incoming.Incoming payments') }}
|
||||
</x-dropdown-link>
|
||||
<x-dropdown-link :href="route('supplier.index')">
|
||||
{{ __('supplier.Suppliers') }}
|
||||
</x-dropdown-link>
|
||||
|
||||
@@ -17,11 +17,15 @@
|
||||
{{ __('invoice.Select invoice') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __("invoice.Select your invoice for payment") }}
|
||||
{{ __('invoice.Select your invoice for payment') }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div class="mt-8">
|
||||
<div class="mt-8" x-show="invoices.length == 0">
|
||||
{{ __('invoice.No invoices') }}
|
||||
</div>
|
||||
|
||||
<div class="mt-8" x-show="invoices.length != 0">
|
||||
<template x-for="(invoice, index) in invoices" x-bind="invoices">
|
||||
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
||||
:class="invoice.id == invoice_id ? 'font-bold' : ''"
|
||||
|
||||
@@ -35,28 +35,43 @@
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('invoice.Existing payments') }}
|
||||
</h2>
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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 class="grid grid-cols-2">
|
||||
<div class="flex flex-row space-x-4 items-center mt-4">
|
||||
<x-input-label for="from" :value="__('invoice.From')"/>
|
||||
<x-text-input type="date" id="from" name="from" x-model="from" 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>
|
||||
</header>
|
||||
|
||||
<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 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.Sum') }}</div>
|
||||
<div class="w-1/6 text-right font-bold border-b-2 text-right">{{ __('invoice.Paid at') }}</div>
|
||||
</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">
|
||||
<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 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.paid_amount + ' €'"></div>
|
||||
<div class="w-1/6 text-right" x-text="payment.date"></div>
|
||||
</summary>
|
||||
</details>
|
||||
</template>
|
||||
@@ -90,6 +105,7 @@
|
||||
from: "{{ $first }}",
|
||||
end: "{{ $last }}",
|
||||
payments: [],
|
||||
search_invoice: '',
|
||||
sum: 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() {
|
||||
this.sum = 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.tax += payment.invoice.tax * payment.paid_amount / payment.invoice.sum;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
</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()">
|
||||
<div class="cursor-pointer grid grid-cols-4 even:bg-gray-100 odd:bg-white"
|
||||
:class="customer.id == project.customer_id ? 'font-bold' : ''"
|
||||
@@ -39,7 +45,7 @@
|
||||
<div x-text="customer.name"></div>
|
||||
<div x-text="customer.email"></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>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
@foreach($project->invoices as $invoice)
|
||||
<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;">
|
||||
onclick="window.location.href='/invoice/{{ $invoice->id }}'">
|
||||
<div class="w-1/6">{{ $invoice->number }}</div>
|
||||
<div class="w-1/3">{{ $invoice->customer->name }}</div>
|
||||
<div class="w-1/4">{{ $invoice->address->name }}</div>
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
{{ __("supplier.Add new supplier by clicking add") }}
|
||||
</p>
|
||||
</header>
|
||||
<a class="mt-6 inline-block" href="{{ route('supplier.create') }}"><x-primary-button>{{ __('form.Add') }}</x-primary-button></a>
|
||||
<a class="mt-6 inline-block" href="{{ route('supplier.create') }}">
|
||||
<x-primary-button>{{ __('form.Add') }}</x-primary-button>
|
||||
</a>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,24 +45,56 @@
|
||||
x-on:keydown.window.prevent.slash="$refs.search_supplier.focus()"
|
||||
x-model="search_supplier"/>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
<div class="cursor-pointer grid grid-cols-4 mt-4">
|
||||
<div class="font-bold border-b-2">{{ __('common.Name') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Email') }}</div>
|
||||
<div class="font-bold border-b-2 text-right">{{ __('invoice.Invoices') }}</div>
|
||||
<div class="font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
<p x-show="success" x-transition
|
||||
class="text-sm text-green-600 dark:text-green-400">{{ __('form.Saved') }}</p>
|
||||
|
||||
<div class="flex flex-row mt-4">
|
||||
<div class="w-11/12 grid grid-cols-4">
|
||||
<div class="font-bold border-b-2">{{ __('common.Name') }}</div>
|
||||
<div class="font-bold border-b-2">{{ __('common.Email') }}</div>
|
||||
<div class="font-bold border-b-2 text-right">{{ __('invoice.Invoices') }}</div>
|
||||
<div class="font-bold border-b-2 text-right">{{ __('common.Created at') }}</div>
|
||||
</div>
|
||||
<div class="w-1/12 border-b-2"></div>
|
||||
</div>
|
||||
|
||||
<template x-for="(supplier, index) in getFilteredSuppliers()">
|
||||
<div class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||
<div class="cursor-pointer grid grid-cols-4" x-on:click="window.location.href='/supplier/' + supplier.id;">
|
||||
<div class="even:bg-gray-100 odd:bg-white hover:bg-gray-400 flex flex-row">
|
||||
<div class="w-11/12 grid grid-cols-4"
|
||||
:class="(supplier.deleted_at == null) ? 'cursor-pointer' : 'line-through';"
|
||||
x-on:click="(supplier.deleted_at == null) ? window.location.href='/supplier/' + supplier.id : ''">
|
||||
<div x-text="supplier.name"></div>
|
||||
<div x-text="supplier.email"></div>
|
||||
<div class="text-right" x-text="supplier.invoices.length"></div>
|
||||
<div class="text-right" x-text="supplier.created"></div>
|
||||
</div>
|
||||
<div class="w-1/12 place-items-end" x-data="{ tooltip: false }"
|
||||
x-show="supplier.deleted_at == null">
|
||||
<x-trash-icon class="cursor-pointer h-6"
|
||||
x-on:click="deleteSupplier(index);"
|
||||
x-on:mouseover="tooltip = true"
|
||||
x-on:mouseleave="tooltip = false"
|
||||
/>
|
||||
<div x-show="tooltip"
|
||||
class="text-sm text-white absolute bg-gray-900 rounded-lg p-2 transform -translate-y-16 translate-x-8">
|
||||
{{ __('form.Delete') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-1/12 place-items-end" x-data="{ tooltip: false }"
|
||||
x-show="supplier.deleted_at != null">
|
||||
<x-restore-icon class="cursor-pointer h-6"
|
||||
x-on:click="restoreSupplier(index);"
|
||||
x-on:mouseover="tooltip = true"
|
||||
x-on:mouseleave="tooltip = false"
|
||||
/>
|
||||
<div x-show="tooltip"
|
||||
class="text-sm text-white absolute bg-gray-900 rounded-lg p-2 transform -translate-y-16 translate-x-8">
|
||||
{{ __('form.Restore') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -79,10 +113,14 @@
|
||||
suppliers: [],
|
||||
search_supplier: '',
|
||||
|
||||
success: false,
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
init() {
|
||||
let vm = this;
|
||||
axios.get('/supplier')
|
||||
.then(function(response) {
|
||||
.then(function (response) {
|
||||
vm.suppliers = response.data;
|
||||
})
|
||||
},
|
||||
@@ -93,10 +131,50 @@
|
||||
}
|
||||
return this.suppliers.filter((supplier) => {
|
||||
return supplier.name
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_supplier.replace(/ /g, '').toLowerCase())
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_supplier.replace(/ /g, '').toLowerCase())
|
||||
});
|
||||
},
|
||||
|
||||
deleteSupplier(index) {
|
||||
let vm = this;
|
||||
let supplier_key = Object.keys(this.suppliers).find(key => (this.suppliers[key].id == this.getFilteredSuppliers()[index].id));
|
||||
axios.delete('/supplier/' + this.suppliers[supplier_key].id)
|
||||
.then(function (response) {
|
||||
vm.error = false;
|
||||
vm.success = true;
|
||||
vm.message = '';
|
||||
vm.suppliers[supplier_key].deleted_at = 0;
|
||||
window.setTimeout(function () {
|
||||
vm.success = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(function (error) {
|
||||
vm.error = true;
|
||||
vm.success = false;
|
||||
vm.message = error.response.data.message;
|
||||
});
|
||||
},
|
||||
|
||||
restoreSupplier(index) {
|
||||
let vm = this;
|
||||
let supplier_key = Object.keys(this.suppliers).find(key => (this.suppliers[key].id == this.getFilteredSuppliers()[index].id));
|
||||
axios.get('/supplier/' + this.suppliers[supplier_key].id + '/restore')
|
||||
.then(function (response) {
|
||||
vm.error = false;
|
||||
vm.success = true;
|
||||
vm.message = '';
|
||||
vm.suppliers[supplier_key].deleted_at = null;
|
||||
window.setTimeout(function () {
|
||||
vm.success = false;
|
||||
}, 1000);
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.success = false;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<cbc:PayableAmount currencyID="{{ $invoice->currency_code }}">{{ $invoice->sum }}</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
@foreach($invoice->items as $item)
|
||||
<cac:InvoiceLine>+
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">{{ $item->amount }}</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="{{ $invoice->currency_code }}">{{ $item->amount * $item->price * (100 - $item->discount) / 100 }}</cbc:LineExtensionAmount>
|
||||
|
||||
@@ -31,6 +31,8 @@ Route::group(['as' => 'api.'], function () {
|
||||
});
|
||||
|
||||
Route::apiResource('/customer', CustomerController::class);
|
||||
Route::get('/customer-with-trashed', [CustomerController::class, 'withTrashed']);
|
||||
Route::get('/customer/{id}/restore', [CustomerController::class, 'restore'])->name('customer.restore');
|
||||
Route::apiResource('/customer.address', AddressController::class)->shallow();
|
||||
Route::apiResource('/taxrate', TaxRateController::class)->except(['show']);
|
||||
Route::get('/invoice-filter/{start}/{end}', [InvoiceController::class, 'index'])->name('invoice.index');
|
||||
@@ -48,11 +50,15 @@ Route::group(['as' => 'api.'], function () {
|
||||
Route::post('/excel', [ExcelController::class, 'export'])->name('excel.export');
|
||||
Route::post('/incoming-upload', [IncomingController::class, 'upload'])->name('incoming.upload');
|
||||
Route::get('/incoming-filter/{start}/{end}', [IncomingController::class, 'index'])->name('incoming.index');
|
||||
Route::get('/incoming-payment/{start}/{end}', [IncomingController::class, 'payment'])->name('incoming.payment');
|
||||
Route::get('/incoming_open', [IncomingController::class, 'open'])->name('incoming.open');
|
||||
Route::put('/incoming/{incoming}', [IncomingController::class, 'update'])->name('incoming.update');
|
||||
Route::post('/incoming', [IncomingController::class, 'store'])->name('incoming.store');
|
||||
Route::apiResource('/project', ProjectController::class);
|
||||
Route::apiResource('/dashboard', DashboardController::class)->only(['index', 'update']);
|
||||
Route::apiResource('/supplier', SupplierController::class)->only(['index', 'store', 'update']);
|
||||
Route::apiResource('/supplier', SupplierController::class);
|
||||
Route::get('/supplier-with-trashed', [SupplierController::class, 'withTrashed']);
|
||||
Route::get('/supplier/{id}/restore', [SupplierController::class, 'restore'])->name('supplier.restore');
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ Route::middleware('auth')->group(function () {
|
||||
Route::get('/excel', function() { return view('excel'); })->name('excel');
|
||||
Route::resource('/incoming', IncomingController::class)->only(['index', 'create', 'edit']);
|
||||
Route::get('/incoming-upload', [IncomingController::class, 'upload'])->name('incoming.upload');
|
||||
Route::get('/incoming-payment', [IncomingController::class, 'payment'])->name('incoming.payment');
|
||||
Route::get('/incoming-payment/create', [IncomingController::class, 'createPayment'])->name('incoming.create-payment');
|
||||
Route::resource('/project', ProjectController::class)->only(['index', 'create', 'show', 'edit']);
|
||||
Route::resource('/supplier', SupplierController::class)->only(['index', 'create', 'show', 'edit']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user