Compare commits
10 Commits
7b4d8f7fb0
...
eb8750c9ef
| Author | SHA1 | Date | |
|---|---|---|---|
| eb8750c9ef | |||
| 2011a24753 | |||
| 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: '0 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:
|
||||
@@ -23,23 +22,57 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- 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
|
||||
env:
|
||||
ACTIONS_RUNTIME_TOKEN: ''
|
||||
with:
|
||||
tags: cs-git.ddnss.de/ri-st/project:master
|
||||
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 }}
|
||||
grype-version: 'v0.90.0'
|
||||
|
||||
- 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 }}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -99,7 +99,7 @@ class Invoice extends Model
|
||||
*/
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
return $this->belongsTo(Customer::class)->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,7 @@ class Project extends Model
|
||||
*/
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
return $this->belongsTo(Customer::class)->withTrashed();
|
||||
}
|
||||
|
||||
public function invoices(): HasMany
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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',
|
||||
|
||||
@@ -26,5 +26,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',
|
||||
|
||||
];
|
||||
|
||||
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,78 @@
|
||||
</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-with-trashed')
|
||||
.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;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -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' : ''"
|
||||
|
||||
@@ -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) {
|
||||
axios.get('/supplier-with-trashed')
|
||||
.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;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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