Create routes and views for suppliers.
This commit is contained in:
@@ -5,13 +5,68 @@ namespace App\Http\Controllers\Api;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Supplier;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$suppliers = Supplier::orderBy('name')->get();
|
||||
$suppliers = Supplier::orderBy('name')->with(['invoices'])->get();
|
||||
return response()->json($suppliers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$supplierData = $request->validate([
|
||||
'name' => 'required|string',
|
||||
'registration_name' => 'nullable|string',
|
||||
'email' => 'nullable|email',
|
||||
'address' => 'nullable|string',
|
||||
'city' => 'nullable|string',
|
||||
'zip' => 'nullable|string',
|
||||
'country_code' => 'nullable|string',
|
||||
'tax_fc' => 'nullable|string',
|
||||
'tax_vat' => 'nullable|string',
|
||||
'contact_name' => 'nullable|string',
|
||||
'contact_phone' => 'nullable|string',
|
||||
'contact_email' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$supplier = new Supplier($supplierData);
|
||||
$supplier->save();
|
||||
|
||||
return response()->json($supplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Supplier $supplier): JsonResponse
|
||||
{
|
||||
$supplierData = $request->validate([
|
||||
'name' => 'required|string',
|
||||
'registration_name' => 'nullable|string',
|
||||
'email' => 'nullable|email',
|
||||
'address' => 'nullable|string',
|
||||
'city' => 'nullable|string',
|
||||
'zip' => 'nullable|string',
|
||||
'country_code' => 'nullable|string',
|
||||
'tax_fc' => 'nullable|string',
|
||||
'tax_vat' => 'nullable|string',
|
||||
'contact_name' => 'nullable|string',
|
||||
'contact_phone' => 'nullable|string',
|
||||
'contact_email' => 'nullable|string',
|
||||
]);
|
||||
|
||||
$supplier->update($supplierData);
|
||||
|
||||
return response()->json($supplier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
41
app/Http/Controllers/SupplierController.php
Normal file
41
app/Http/Controllers/SupplierController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Supplier;
|
||||
|
||||
class SupplierController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('supplier.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('supplier.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Supplier $supplier)
|
||||
{
|
||||
return view('supplier.show', ['supplier' => $supplier]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Supplier $supplier)
|
||||
{
|
||||
return view('supplier.edit', ['supplier' => $supplier]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Supplier extends Model
|
||||
{
|
||||
@@ -28,6 +27,22 @@ class Supplier extends Model
|
||||
'contact_email',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are appended with attribute getters.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $appends = [
|
||||
'created',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the issue_date attribute in local time format.
|
||||
*/
|
||||
public function getCreatedAttribute(): string
|
||||
{
|
||||
return $this->created_at->format('d.m.Y');
|
||||
}
|
||||
/**
|
||||
* Get the supplier's incoming invoices.
|
||||
*/
|
||||
|
||||
@@ -12,5 +12,10 @@ return [
|
||||
*/
|
||||
|
||||
'Supplier' => 'Lieferant',
|
||||
'Suppliers' => 'Lieferanten',
|
||||
'Add new supplier' => 'Neuen Lieferanten anlegen',
|
||||
'Add new supplier by clicking add' => 'Neuen Lieferanten durch Klick auf "Anlegen" erstellen.',
|
||||
'Existing suppliers' => 'Bestehende Lieferanten',
|
||||
'Search supplier' => 'Suche Lieferant',
|
||||
|
||||
];
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<div class="flex flex-row w-full">
|
||||
<h2 class="grow font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
<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') }}" class="relative flex flex-row">
|
||||
<x-excel-icon class="text-gray-800 cursor-pointer"/>
|
||||
<a href="{{ route('excel') }}">
|
||||
<x-excel-icon class="text-gray-800 cursor-pointer right-0"/>
|
||||
</a>
|
||||
</div>
|
||||
</x-slot>
|
||||
@@ -19,7 +19,6 @@
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('incoming.Add new invoice') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __("incoming.Add new invoice by clicking add") }}
|
||||
</p>
|
||||
|
||||
@@ -32,10 +32,29 @@
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'taxrate.')">
|
||||
{{ __('configuration.Taxrates') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('incoming.index')"
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'incoming.')">
|
||||
{{ __('incoming.Incoming') }}
|
||||
</x-nav-link>
|
||||
<div class="hidden sm:flex sm:items-center sm:ms-6">
|
||||
<x-dropdown align="right" width="48">
|
||||
<x-slot name="trigger">
|
||||
<x-nav-link href=""
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), ['incoming.', 'supplier.'])"
|
||||
@click.prevent="">
|
||||
{{ __('incoming.Incoming') }}
|
||||
<div class="ms-1">
|
||||
<x-down-icon/>
|
||||
</div>
|
||||
</x-nav-link>
|
||||
</x-slot>
|
||||
|
||||
<x-slot name="content">
|
||||
<x-dropdown-link :href="route('incoming.index')">
|
||||
{{ __('incoming.Incoming') }}
|
||||
</x-dropdown-link>
|
||||
<x-dropdown-link :href="route('supplier.index')">
|
||||
{{ __('supplier.Suppliers') }}
|
||||
</x-dropdown-link>
|
||||
</x-slot>
|
||||
</x-dropdown>
|
||||
</div>
|
||||
<x-nav-link :href="route('option.index')"
|
||||
:active="\Illuminate\Support\Str::startsWith(request()->route()->getName(), 'option.')">
|
||||
{{ __('configuration.Options') }}
|
||||
|
||||
133
resources/views/supplier/create.blade.php
Normal file
133
resources/views/supplier/create.blade.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('supplier.Add new supplier') }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="supplierForm()">
|
||||
<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">
|
||||
<section>
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('supplier.Supplier') }}
|
||||
</h2>
|
||||
</header>
|
||||
<form class="mt-6 space-y-6" @submit.prevent="">
|
||||
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
|
||||
<div class="flex flex-row space-x-8 items-start">
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="name" :value="__('common.Name')"/>
|
||||
<x-text-input id="name" name="name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('name')" autofocus
|
||||
autocomplete="name" x-model="supplier.name"/>
|
||||
|
||||
<x-input-label for="registration_name" :value="__('common.Registration name')"/>
|
||||
<x-text-input id="registration_name" name="registration_name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('registration_name')" autofocus
|
||||
autocomplete="registration_name"
|
||||
x-model="supplier.registration_name"/>
|
||||
|
||||
<x-input-label for="email" :value="__('common.Email')"/>
|
||||
<x-text-input id="email" name="email" type="email"
|
||||
class="mt-1 col-span-2" :value="old('email')"
|
||||
autocomplete="email" x-model="supplier.email"/>
|
||||
|
||||
<x-input-label for="address" :value="__('common.Address')"/>
|
||||
<x-text-input id="address" name="address" type="text"
|
||||
class="mt-1 col-span-2" :value="old('address')"
|
||||
autocomplete="address"
|
||||
x-model="supplier.address"/>
|
||||
|
||||
<x-input-label for="zip" :value="__('common.Zip Code')"/>
|
||||
<x-text-input id="zip" name="zip" type="text"
|
||||
class="mt-1 col-span-2" :value="old('zip')"
|
||||
autocomplete="zip"
|
||||
x-model="supplier.zip"/>
|
||||
|
||||
<x-input-label for="city" :value="__('common.City')"/>
|
||||
<x-text-input id="city" name="city" type="text"
|
||||
class="mt-1 col-span-2" :value="old('city')"
|
||||
autocomplete="city"
|
||||
x-model="supplier.city"/>
|
||||
</div>
|
||||
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="country_code" :value="__('common.Country code')"/>
|
||||
<x-text-input id="country_code" name="country_code" type="text"
|
||||
class="mt-1 col-span-2" :value="old('country_code')"
|
||||
autocomplete="country_code"
|
||||
x-model="supplier.country_code"/>
|
||||
|
||||
<x-input-label for="tax_fc" :value="__('common.Tax FC')"/>
|
||||
<x-text-input id="tax_fc" name="tax_fc" type="text"
|
||||
class="mt-1 col-span-2" :value="old('tax_fc')"
|
||||
autocomplete="tax_fc"
|
||||
x-model="supplier.tax_fc"/>
|
||||
|
||||
<x-input-label for="tax_vat" :value="__('common.Tax VAT')"/>
|
||||
<x-text-input id="tax_vat" name="tax_vat" type="text"
|
||||
class="mt-1 col-span-2" :value="old('tax_vat')"
|
||||
autocomplete="tax_vat"
|
||||
x-model="supplier.tax_vat"/>
|
||||
|
||||
<x-input-label for="contact_name" :value="__('common.Contact name')"/>
|
||||
<x-text-input id="contact_name" name="contact_name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('contact_name')"
|
||||
autocomplete="contact_name"
|
||||
x-model="supplier.contact_name"/>
|
||||
|
||||
<x-input-label for="contact_phone" :value="__('common.Contact phone')"/>
|
||||
<x-text-input id="contact_phone" name="contact_phone" type="text"
|
||||
class="mt-1 col-span-2" :value="old('contact_phone')"
|
||||
autocomplete="contact_phone"
|
||||
x-model="supplier.contact_phone"/>
|
||||
|
||||
<x-input-label for="contact_email" :value="__('common.Contact email')"/>
|
||||
<x-text-input id="contact_email" name="t" type="email"
|
||||
class="mt-1 col-span-2" :value="old('contact_email')"
|
||||
autocomplete="contact_email"
|
||||
x-model="supplier.contact_email"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4 pt-4">
|
||||
<x-primary-button @click="createSupplier()">{{ __('form.Save') }}</x-primary-button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function supplierForm() {
|
||||
return {
|
||||
supplier: {},
|
||||
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
createSupplier() {
|
||||
let vm = this;
|
||||
axios.post('/supplier', this.supplier)
|
||||
.then(function(response) {
|
||||
window.location.href = '/supplier'
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
134
resources/views/supplier/edit.blade.php
Normal file
134
resources/views/supplier/edit.blade.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('supplier.Supplier') }}: {{ $supplier->name }}
|
||||
</h2>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12" x-data="supplierForm()">
|
||||
<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">
|
||||
<section>
|
||||
<header>
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('supplier.Supplier') }}
|
||||
</h2>
|
||||
</header>
|
||||
<form class="mt-6 space-y-6" @submit.prevent="">
|
||||
|
||||
<p class="text-red-600 font-bold" x-text="message" x-show="error"></p>
|
||||
|
||||
<div class="flex flex-row space-x-8 items-start">
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="name" :value="__('common.Name')"/>
|
||||
<x-text-input id="name" name="name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('name')" autofocus
|
||||
autocomplete="name" x-model="supplier.name"/>
|
||||
|
||||
<x-input-label for="registration_name" :value="__('common.Registration name')"/>
|
||||
<x-text-input id="registration_name" name="registration_name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('registration_name')" autofocus
|
||||
autocomplete="registration_name"
|
||||
x-model="supplier.registration_name"/>
|
||||
|
||||
<x-input-label for="email" :value="__('common.Email')"/>
|
||||
<x-text-input id="email" name="email" type="email"
|
||||
class="mt-1 col-span-2" :value="old('email')"
|
||||
autocomplete="email" x-model="supplier.email"/>
|
||||
|
||||
<x-input-label for="address" :value="__('common.Address')"/>
|
||||
<x-text-input id="address" name="address" type="text"
|
||||
class="mt-1 col-span-2" :value="old('address')"
|
||||
autocomplete="address"
|
||||
x-model="supplier.address"/>
|
||||
|
||||
<x-input-label for="zip" :value="__('common.Zip Code')"/>
|
||||
<x-text-input id="zip" name="zip" type="text"
|
||||
class="mt-1 col-span-2" :value="old('zip')"
|
||||
autocomplete="zip"
|
||||
x-model="supplier.zip"/>
|
||||
|
||||
<x-input-label for="city" :value="__('common.City')"/>
|
||||
<x-text-input id="city" name="city" type="text"
|
||||
class="mt-1 col-span-2" :value="old('city')"
|
||||
autocomplete="city"
|
||||
x-model="supplier.city"/>
|
||||
</div>
|
||||
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="country_code" :value="__('common.Country code')"/>
|
||||
<x-text-input id="country_code" name="country_code" type="text"
|
||||
class="mt-1 col-span-2" :value="old('country_code')"
|
||||
autocomplete="country_code"
|
||||
x-model="supplier.country_code"/>
|
||||
|
||||
<x-input-label for="tax_fc" :value="__('common.Tax FC')"/>
|
||||
<x-text-input id="tax_fc" name="tax_fc" type="text"
|
||||
class="mt-1 col-span-2" :value="old('tax_fc')"
|
||||
autocomplete="tax_fc"
|
||||
x-model="supplier.tax_fc"/>
|
||||
|
||||
<x-input-label for="tax_vat" :value="__('common.Tax VAT')"/>
|
||||
<x-text-input id="tax_vat" name="tax_vat" type="text"
|
||||
class="mt-1 col-span-2" :value="old('tax_vat')"
|
||||
autocomplete="tax_vat"
|
||||
x-model="supplier.tax_vat"/>
|
||||
|
||||
<x-input-label for="contact_name" :value="__('common.Contact name')"/>
|
||||
<x-text-input id="contact_name" name="contact_name" type="text"
|
||||
class="mt-1 col-span-2" :value="old('contact_name')"
|
||||
autocomplete="contact_name"
|
||||
x-model="supplier.contact_name"/>
|
||||
|
||||
<x-input-label for="contact_phone" :value="__('common.Contact phone')"/>
|
||||
<x-text-input id="contact_phone" name="contact_phone" type="text"
|
||||
class="mt-1 col-span-2" :value="old('contact_phone')"
|
||||
autocomplete="contact_phone"
|
||||
x-model="supplier.contact_phone"/>
|
||||
|
||||
<x-input-label for="contact_email" :value="__('common.Contact email')"/>
|
||||
<x-text-input id="contact_email" name="t" type="email"
|
||||
class="mt-1 col-span-2" :value="old('contact_email')"
|
||||
autocomplete="contact_email"
|
||||
x-model="supplier.contact_email"/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-4 pt-4">
|
||||
<x-primary-button @click="updateSupplier()">{{ __('form.Save') }}</x-primary-button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function supplierForm() {
|
||||
return {
|
||||
supplier: {!! $supplier !!},
|
||||
|
||||
error: false,
|
||||
message: '',
|
||||
|
||||
updateSupplier() {
|
||||
let vm = this;
|
||||
axios.put('/supplier/' + this.supplier.id, this.supplier)
|
||||
.then(function(response) {
|
||||
window.location.href = '/supplier';
|
||||
})
|
||||
.catch(function(error) {
|
||||
vm.error = true;
|
||||
vm.message = error.response.data.message;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
103
resources/views/supplier/index.blade.php
Normal file
103
resources/views/supplier/index.blade.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<div class="flex flex-row w-full items-center">
|
||||
<h2 class="shrinḱ-0 font-semibold pr-12 text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('supplier.Suppliers') }}
|
||||
</h2>
|
||||
</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">
|
||||
{{ __('supplier.Add new supplier') }}
|
||||
</h2>
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ __("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>
|
||||
</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="supplierForm()">
|
||||
<section>
|
||||
<header class="grid grid-cols-2">
|
||||
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
||||
{{ __('supplier.Existing suppliers') }}
|
||||
</h2>
|
||||
<div class="flex flex-row items-center gap-8">
|
||||
<x-input-label for="search_supplier" :value="__('common.Search')"/>
|
||||
<x-text-input id="search_supplier" name="search_supplier" type="text"
|
||||
class="mt-1 block w-full"
|
||||
x-ref="search_supplier"
|
||||
autofocus
|
||||
placeholder="{{ __('supplier.Search supplier') }}"
|
||||
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>
|
||||
</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 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>
|
||||
</template>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-app-layout>
|
||||
|
||||
<script>
|
||||
function supplierForm() {
|
||||
return {
|
||||
suppliers: [],
|
||||
search_supplier: '',
|
||||
|
||||
init() {
|
||||
let vm = this;
|
||||
axios.get('/supplier')
|
||||
.then(function(response) {
|
||||
vm.suppliers = response.data;
|
||||
})
|
||||
},
|
||||
|
||||
getFilteredSuppliers() {
|
||||
if (this.search_supplier === '') {
|
||||
return this.suppliers;
|
||||
}
|
||||
return this.suppliers.filter((supplier) => {
|
||||
return supplier.name
|
||||
.replace(/ /g, '')
|
||||
.toLowerCase()
|
||||
.includes(this.search_supplier.replace(/ /g, '').toLowerCase())
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
146
resources/views/supplier/show.blade.php
Normal file
146
resources/views/supplier/show.blade.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
||||
{{ __('supplier.Supplier') }}: {{ $supplier->name }}
|
||||
</h2>
|
||||
</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">
|
||||
<a class="inline-block" href="{{ route('supplier.edit', $supplier->id) }}">
|
||||
<x-primary-button>{{ __('form.Edit') }}</x-primary-button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">
|
||||
{{ __('supplier.Supplier') }}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<form class="mt-6 space-y-6" @submit.prevent="">
|
||||
|
||||
<div class="flex flex-row space-x-8 items-start">
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="name" :value="__('common.Name')"/>
|
||||
<x-text-input id="name" name="name" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->name }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="registration_name" :value="__('common.Registration name')"/>
|
||||
<x-text-input id="registration_name" name="registration_name" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->registration_name }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="email" :value="__('common.Email')"/>
|
||||
<x-text-input id="email" name="email" type="email"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->email }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="address" :value="__('common.Address')"/>
|
||||
<x-text-input id="address" name="address" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->address }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="zip" :value="__('common.Zip Code')"/>
|
||||
<x-text-input id="zip" name="zip" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->zip }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="city" :value="__('common.City')"/>
|
||||
<x-text-input id="city" name="city" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->city }}"
|
||||
disabled/>
|
||||
</div>
|
||||
|
||||
<div class="w-1/2 grid grid-cols-3 items-center">
|
||||
<x-input-label for="country_code" :value="__('common.Country code')"/>
|
||||
<x-text-input id="country_code" name="country_code" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->country_code }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="tax_fc" :value="__('common.Tax FC')"/>
|
||||
<x-text-input id="tax_fc" name="tax_fc" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->tax_fc }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="tax_vat" :value="__('common.Tax VAT')"/>
|
||||
<x-text-input id="tax_vat" name="tax_vat" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->tax_vat }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="contact_name" :value="__('common.Contact name')"/>
|
||||
<x-text-input id="contact_name" name="contact_name" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->contact_name }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="contact_phone" :value="__('common.Contact phone')"/>
|
||||
<x-text-input id="contact_phone" name="contact_phone" type="text"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->contact_phone }}"
|
||||
disabled/>
|
||||
|
||||
<x-input-label for="contact_email" :value="__('common.Contact email')"/>
|
||||
<x-text-input id="contact_email" name="t" type="email"
|
||||
class="mt-1 col-span-2" value="{{ $supplier->contact_email }}"
|
||||
disabled/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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.Incoming') }}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<summary class="cursor-pointer flex flex-row w-full mt-4">
|
||||
<div class="w-1/6 font-bold border-b-2">{{ __('invoice.Invoice Number') }}</div>
|
||||
<div class="w-1/3 font-bold border-b-2">{{ __('common.Name') }}</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>
|
||||
<div class="w-1/6 font-bold border-b-2 text-right">{{ __('common.Paid at') }}</div>
|
||||
</summary>
|
||||
|
||||
@php
|
||||
$sum = 0;
|
||||
@endphp
|
||||
@foreach($supplier->invoices as $invoice)
|
||||
@php($sum += $invoice->net)
|
||||
<details class="even:bg-gray-100 odd:bg-white hover:bg-gray-400">
|
||||
<summary class="cursor-pointer flex flex-row w-full" onclick="window.location.href='/incoming/{{ $invoice->id }}/edit'">
|
||||
<div class="w-1/6">{{ $invoice->invoice_number }}</div>
|
||||
<div class="w-1/3">{{ $supplier->name }}</div>
|
||||
<div class="w-1/6 text-right">{{ \Illuminate\Support\Number::currency($invoice->net) }}</div>
|
||||
<div class="w-1/6 text-right">{{ $invoice->created }}</div>
|
||||
<div class="w-1/6 text-right">{{ $invoice->paid }}</div>
|
||||
</summary>
|
||||
</details>
|
||||
@endforeach
|
||||
|
||||
<div class="flex flex-row font-bold border-t-2">
|
||||
<div class="w-1/6"></div>
|
||||
<div class="w-1/3">{{ __('invoice.Sum') }}</div>
|
||||
<div class="w-1/6 text-right" x-text="invoice.sum + ' €'">{{ \Illuminate\Support\Number::currency($sum) }}</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
@@ -52,7 +52,7 @@ Route::group(['as' => 'api.'], function () {
|
||||
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']);
|
||||
Route::apiResource('/supplier', SupplierController::class)->only(['index', 'store', 'update']);
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Http\Controllers\PaymentController;
|
||||
use App\Http\Controllers\PdfController;
|
||||
use App\Http\Controllers\ProfileController;
|
||||
use App\Http\Controllers\ProjectController;
|
||||
use App\Http\Controllers\SupplierController;
|
||||
use App\Http\Controllers\TaxrateController;
|
||||
use App\Models\Dashboard;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@@ -38,6 +39,7 @@ Route::middleware('auth')->group(function () {
|
||||
Route::resource('/incoming', IncomingController::class)->only(['index', 'create', 'edit']);
|
||||
Route::get('/incoming-upload', [IncomingController::class, 'upload'])->name('incoming.upload');
|
||||
Route::resource('/project', ProjectController::class)->only(['index', 'create', 'show', 'edit']);
|
||||
Route::resource('/supplier', SupplierController::class)->only(['index', 'create', 'show', 'edit']);
|
||||
});
|
||||
|
||||
require __DIR__.'/auth.php';
|
||||
|
||||
Reference in New Issue
Block a user