Warenwirtschaft: AP-00 bis AP-08 + aktualisierter Entwicklungsplan
Umsetzung der Warenwirtschafts-/Produktmanagement-Erweiterung gemaess Entwicklungsplan V4.0: - AP-00: Regressionsbasis fuer 5.1-Features (ProductPhase51Test) - AP-01: URL-Bugfixes B1/B2 (suppliers/packaging-items, breitere url-Spalten) - AP-04/04.1: iPad-taugliche, vereinheitlichte Tabellen-Aktionen - AP-05: Einstellungen "Allgemein" mit UST-Saetzen (tax_rates) und Lieferzeit-Vorlagen (delivery_times, inkl. Tage-Feld) - AP-06: Lieferanten um Bestellweg, Bestell-Mail/-URL und Lieferzeit erweitert - AP-07/07.1: INCI um Lieferanten-Mehrfachwahl, UST und Lieferzeit erweitert; Lieferanten-Detailansicht im Modal mit pflegbaren INCI-/Verpackungslisten - AP-08: Einkauf um UST-Snapshot, Netto/Brutto-Automatik und Duplizieren erweitert Entwicklungsplan aktualisiert: alle Klaerungspunkte (§5) vom Kunden beantwortet und in die jeweiligen APs eingearbeitet (AP-02/03/09/13/15), neues AP-18 (Hinweise-Doku unter Einstellungen) ergaenzt. Naechster Schritt eindeutig markiert: AP-09 (Produktion auf Hersteller-Rezeptur, kein Fallback, Warnung).
This commit is contained in:
parent
ca3eb663fe
commit
78679e0c55
67 changed files with 3523 additions and 101 deletions
161
resources/views/admin/inventory/suppliers/_details.blade.php
Normal file
161
resources/views/admin/inventory/suppliers/_details.blade.php
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
@php
|
||||
$orderMethodLabels = [
|
||||
'email' => __('Per E-Mail'),
|
||||
'online_shop' => __('Online-Shop'),
|
||||
];
|
||||
@endphp
|
||||
<div id="supplier-details" data-supplier-id="{{ $supplier->id }}">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-5">{{ __('Name') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->name }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Land') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->country?->de ?? '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Kategorien') }}</dt>
|
||||
<dd class="col-sm-7">
|
||||
@forelse($supplier->supplierCategories as $cat)
|
||||
<span class="badge badge-secondary">{{ $cat->name }}</span>
|
||||
@empty
|
||||
—
|
||||
@endforelse
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Webseite') }}</dt>
|
||||
<dd class="col-sm-7">
|
||||
@if($supplier->url)
|
||||
<a href="{{ $supplier->url }}" target="_blank" rel="noopener">{{ $supplier->url }}</a>
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<dl class="row mb-0">
|
||||
<dt class="col-sm-5">{{ __('Bestellweg') }}</dt>
|
||||
<dd class="col-sm-7">{{ $orderMethodLabels[$supplier->order_method] ?? '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Bestell-E-Mail') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->order_email ?: '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Bestell-URL') }}</dt>
|
||||
<dd class="col-sm-7">
|
||||
@if($supplier->order_url)
|
||||
<a href="{{ $supplier->order_url }}" target="_blank" rel="noopener">{{ $supplier->order_url }}</a>
|
||||
@else
|
||||
—
|
||||
@endif
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Lieferzeit') }}</dt>
|
||||
<dd class="col-sm-7">
|
||||
{{ $supplier->delivery_time ?: '—' }}
|
||||
@if($supplier->delivery_time_days !== null)
|
||||
<span class="text-muted">({{ $supplier->delivery_time_days }} {{ __('Tage') }})</span>
|
||||
@endif
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Ansprechpartner') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->contact_person ?: '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('E-Mail') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->email ?: '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-5">{{ __('Telefon') }}</dt>
|
||||
<dd class="col-sm-7">{{ $supplier->phone ?: '—' }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($supplier->notes)
|
||||
<div class="mt-2">
|
||||
<strong>{{ __('Notizen') }}:</strong>
|
||||
<div class="text-muted">{!! nl2br(e($supplier->notes)) !!}</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<h6 class="font-weight-bold">{{ __('Zugeordnete INCIs') }}</h6>
|
||||
<ul class="list-group mb-2" id="supplier-ingredient-list">
|
||||
@forelse($supplier->ingredients as $ingredient)
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center py-1">
|
||||
<span>{{ $ingredient->name }}</span>
|
||||
<span class="text-nowrap">
|
||||
<a href="{{ route('admin_product_ingredient_edit', $ingredient->id) }}" target="_blank"
|
||||
class="btn btn-link p-0 mr-2" title="{{ __('Zur Bearbeitung') }}">
|
||||
<i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-link text-danger p-0 js-detach-ingredient"
|
||||
data-url="{{ route('admin.inventory.suppliers.ingredients.detach', [$supplier, $ingredient]) }}"
|
||||
title="{{ __('Entfernen') }}">
|
||||
<i class="far fa-trash-alt"></i>
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
@empty
|
||||
<li class="list-group-item text-muted py-1">{{ __('Noch keine INCIs zugeordnet.') }}</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
<div class="input-group input-group-sm">
|
||||
<select class="form-control" id="add-ingredient-select">
|
||||
<option value="">{{ __('INCI wählen …') }}</option>
|
||||
@foreach($availableIngredients as $ingredient)
|
||||
<option value="{{ $ingredient->id }}">{{ $ingredient->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary js-attach-ingredient"
|
||||
data-url="{{ route('admin.inventory.suppliers.ingredients.attach', $supplier) }}"
|
||||
data-select="#add-ingredient-select">
|
||||
{{ __('Hinzufügen') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mb-3">
|
||||
<h6 class="font-weight-bold">{{ __('Zugeordnete Verpackungsartikel') }}</h6>
|
||||
<ul class="list-group mb-2" id="supplier-packaging-list">
|
||||
@forelse($supplier->packagingItems as $item)
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center py-1">
|
||||
<span>{{ $item->name }}</span>
|
||||
<span class="text-nowrap">
|
||||
<a href="{{ route('admin.inventory.packaging-items.edit', $item) }}" target="_blank"
|
||||
class="btn btn-link p-0 mr-2" title="{{ __('Zur Bearbeitung') }}">
|
||||
<i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
<button type="button" class="btn btn-link text-danger p-0 js-detach-packaging"
|
||||
data-url="{{ route('admin.inventory.suppliers.packaging-items.detach', [$supplier, $item]) }}"
|
||||
title="{{ __('Entfernen') }}">
|
||||
<i class="far fa-trash-alt"></i>
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
@empty
|
||||
<li class="list-group-item text-muted py-1">{{ __('Noch keine Verpackungsartikel zugeordnet.') }}</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
<div class="input-group input-group-sm">
|
||||
<select class="form-control" id="add-packaging-select">
|
||||
<option value="">{{ __('Verpackungsartikel wählen …') }}</option>
|
||||
@foreach($availablePackagingItems as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary js-attach-packaging"
|
||||
data-url="{{ route('admin.inventory.suppliers.packaging-items.attach', $supplier) }}"
|
||||
data-select="#add-packaging-select">
|
||||
{{ __('Hinzufügen') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -2,89 +2,166 @@
|
|||
|
||||
@section('content')
|
||||
@php
|
||||
$selectedCategoryIds = old('supplier_category_ids', $model->exists ? $model->supplierCategories->pluck('id')->all() : []);
|
||||
$selectedCategoryIds = old(
|
||||
'supplier_category_ids',
|
||||
$model->exists ? $model->supplierCategories->pluck('id')->all() : [],
|
||||
);
|
||||
@endphp
|
||||
<div class="card">
|
||||
<h6 class="card-header">{{ $model->exists ? __('Lieferant bearbeiten') : __('Lieferant anlegen') }}</h6>
|
||||
<div class="card-body">
|
||||
<form method="post" action="{{ $model->exists ? route('admin.inventory.suppliers.update', $model) : route('admin.inventory.suppliers.store') }}">
|
||||
<form method="post"
|
||||
action="{{ $model->exists ? route('admin.inventory.suppliers.update', $model) : route('admin.inventory.suppliers.store') }}">
|
||||
@csrf
|
||||
@if($model->exists)
|
||||
@if ($model->exists)
|
||||
@method('PUT')
|
||||
@endif
|
||||
|
||||
<div class="form-group">
|
||||
<label for="name">{{ __('Name') }}</label>
|
||||
<input type="text" name="name" id="name" class="form-control @error('name') is-invalid @enderror"
|
||||
value="{{ old('name', $model->name) }}" required>
|
||||
<input type="text" name="name" id="name"
|
||||
class="form-control @error('name') is-invalid @enderror" value="{{ old('name', $model->name) }}"
|
||||
required>
|
||||
@error('name')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="supplier_category_ids">{{ __('Kategorien') }}</label>
|
||||
<div class="light-style">
|
||||
<select name="supplier_category_ids[]" id="supplier_category_ids" class="w-100" multiple="multiple" data-placeholder="{{ __('Kategorien wählen') }}">
|
||||
@foreach($supplierCategories as $cat)
|
||||
<option value="{{ $cat->id }}" @selected(in_array($cat->id, $selectedCategoryIds, true))>{{ $cat->name }}</option>
|
||||
<select name="supplier_category_ids[]" id="supplier_category_ids" class="w-100" multiple="multiple"
|
||||
data-placeholder="{{ __('Kategorien wählen') }}">
|
||||
@foreach ($supplierCategories as $cat)
|
||||
<option value="{{ $cat->id }}" @selected(in_array($cat->id, $selectedCategoryIds, true))>{{ $cat->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@error('supplier_category_ids')
|
||||
<div class="text-danger small">{{ $message }}</div>
|
||||
<div class="text-danger small">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="country_id">{{ __('Land') }}</label>
|
||||
<select name="country_id" id="country_id" class="form-control @error('country_id') is-invalid @enderror" required>
|
||||
<select name="country_id" id="country_id" class="form-control @error('country_id') is-invalid @enderror"
|
||||
required>
|
||||
<option value="">{{ __('Bitte wählen') }}</option>
|
||||
@foreach($countries as $country)
|
||||
<option value="{{ $country->id }}" @selected((string)old('country_id', $model->country_id) === (string)$country->id)>
|
||||
@foreach ($countries as $country)
|
||||
<option value="{{ $country->id }}" @selected((string) old('country_id', $model->country_id) === (string) $country->id)>
|
||||
{{ $country->de }} ({{ $country->code }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('country_id')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="url">{{ __('Webseite') }}</label>
|
||||
<input type="url" name="url" id="url" class="form-control @error('url') is-invalid @enderror"
|
||||
value="{{ old('url', $model->url) }}">
|
||||
<input type="text" name="url" id="url"
|
||||
class="form-control @error('url') is-invalid @enderror" value="{{ old('url', $model->url) }}"
|
||||
placeholder="https://">
|
||||
@error('url')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
@php
|
||||
$orderMethod = old('order_method', $model->order_method);
|
||||
@endphp
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="order_method">{{ __('Bestellweg') }}</label>
|
||||
<select name="order_method" id="order_method"
|
||||
class="form-control custom-select @error('order_method') is-invalid @enderror">
|
||||
<option value="" @selected($orderMethod === null || $orderMethod === '')>{{ __('Keine Angabe') }}</option>
|
||||
<option value="email" @selected($orderMethod === 'email')>{{ __('Per E-Mail') }}</option>
|
||||
<option value="online_shop" @selected($orderMethod === 'online_shop')>{{ __('Online-Shop') }}</option>
|
||||
</select>
|
||||
@error('order_method')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="delivery_time">{{ __('Lieferzeit') }}</label>
|
||||
<input type="text" name="delivery_time" id="delivery_time" list="delivery_time_options"
|
||||
class="form-control @error('delivery_time') is-invalid @enderror"
|
||||
value="{{ old('delivery_time', $model->delivery_time) }}"
|
||||
placeholder="{{ __('z. B. 3–5 Werktage') }}">
|
||||
<datalist id="delivery_time_options">
|
||||
@foreach ($deliveryTimes as $deliveryTime)
|
||||
<option value="{{ $deliveryTime->label }}" data-days="{{ $deliveryTime->days }}"></option>
|
||||
@endforeach
|
||||
</datalist>
|
||||
@error('delivery_time')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="delivery_time_days">{{ __('Tage') }}</label>
|
||||
<input type="number" name="delivery_time_days" id="delivery_time_days" min="0" max="65535"
|
||||
class="form-control @error('delivery_time_days') is-invalid @enderror"
|
||||
value="{{ old('delivery_time_days', $model->delivery_time_days) }}"
|
||||
placeholder="{{ __('z. B. 5') }}">
|
||||
@error('delivery_time_days')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group js-order-email" @if ($orderMethod !== 'email') style="display: none;" @endif>
|
||||
<label for="order_email">{{ __('Bestell-E-Mail') }} <small
|
||||
class="text-muted">{{ __('(falls abweichend)') }}</small></label>
|
||||
<input type="email" name="order_email" id="order_email"
|
||||
class="form-control @error('order_email') is-invalid @enderror"
|
||||
value="{{ old('order_email', $model->order_email) }}">
|
||||
@error('order_email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group js-order-url" @if ($orderMethod !== 'online_shop') style="display: none;" @endif>
|
||||
<label for="order_url">{{ __('Bestell-URL') }} <small
|
||||
class="text-muted">{{ __('(falls abweichend)') }}</small></label>
|
||||
<input type="text" name="order_url" id="order_url"
|
||||
class="form-control @error('order_url') is-invalid @enderror"
|
||||
value="{{ old('order_url', $model->order_url) }}" placeholder="https://">
|
||||
@error('order_url')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="contact_person">{{ __('Ansprechpartner') }}</label>
|
||||
<input type="text" name="contact_person" id="contact_person" class="form-control @error('contact_person') is-invalid @enderror"
|
||||
value="{{ old('contact_person', $model->contact_person) }}">
|
||||
<input type="text" name="contact_person" id="contact_person"
|
||||
class="form-control @error('contact_person') is-invalid @enderror"
|
||||
value="{{ old('contact_person', $model->contact_person) }}">
|
||||
@error('contact_person')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email">{{ __('E-Mail') }}</label>
|
||||
<input type="email" name="email" id="email" class="form-control @error('email') is-invalid @enderror"
|
||||
value="{{ old('email', $model->email) }}">
|
||||
<input type="email" name="email" id="email"
|
||||
class="form-control @error('email') is-invalid @enderror"
|
||||
value="{{ old('email', $model->email) }}">
|
||||
@error('email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="phone">{{ __('Telefon') }}</label>
|
||||
<input type="text" name="phone" id="phone" class="form-control @error('phone') is-invalid @enderror"
|
||||
value="{{ old('phone', $model->phone) }}">
|
||||
<input type="text" name="phone" id="phone"
|
||||
class="form-control @error('phone') is-invalid @enderror"
|
||||
value="{{ old('phone', $model->phone) }}">
|
||||
@error('phone')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
|
|
@ -92,20 +169,21 @@
|
|||
<label for="notes">{{ __('Notizen') }}</label>
|
||||
<textarea name="notes" id="notes" rows="3" class="form-control @error('notes') is-invalid @enderror">{{ old('notes', $model->notes) }}</textarea>
|
||||
@error('notes')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input type="checkbox" name="active" value="1" class="custom-control-input"
|
||||
@checked(old('active', $model->active))>
|
||||
@checked(old('active', $model->active))>
|
||||
<span class="custom-control-label">{{ __('Aktiv') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">{{ __('Speichern') }}</button>
|
||||
<a href="{{ route('admin.inventory.suppliers.index') }}" class="btn btn-outline-secondary">{{ __('Zurück') }}</a>
|
||||
<a href="{{ route('admin.inventory.suppliers.index') }}"
|
||||
class="btn btn-outline-secondary">{{ __('Zurück') }}</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -113,13 +191,33 @@
|
|||
|
||||
@section('scripts')
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
$('#supplier_category_ids').select2({
|
||||
theme: 'default',
|
||||
placeholder: '{{ __('Kategorien wählen') }}',
|
||||
width: '100%',
|
||||
closeOnSelect: false
|
||||
});
|
||||
|
||||
function toggleOrderFields() {
|
||||
var method = $('#order_method').val();
|
||||
$('.js-order-email').toggle(method === 'email');
|
||||
$('.js-order-url').toggle(method === 'online_shop');
|
||||
}
|
||||
|
||||
$('#order_method').on('change', toggleOrderFields);
|
||||
toggleOrderFields();
|
||||
|
||||
$('#delivery_time').on('input change', function () {
|
||||
var value = $(this).val();
|
||||
var option = $('#delivery_time_options option').filter(function () {
|
||||
return this.value === value;
|
||||
}).first();
|
||||
|
||||
if (option.length && option.data('days') !== undefined && option.data('days') !== '') {
|
||||
$('#delivery_time_days').val(option.data('days'));
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
@extends('layouts.layout-2')
|
||||
|
||||
@section('content')
|
||||
@include('admin.inventory.partials.table-actions-style')
|
||||
<div class="card">
|
||||
<h6 class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>{{ __('Lieferanten') }}</span>
|
||||
<a href="{{ route('admin.inventory.suppliers.create') }}" class="btn btn-sm btn-primary">{{ __('Neu anlegen') }}</a>
|
||||
</h6>
|
||||
<div class="card-datatable table-responsive">
|
||||
<table class="datatables-style table table-striped table-bordered">
|
||||
<table class="datatables-style table table-striped table-bordered wawi-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="max-width: 60px;"> </th>
|
||||
|
|
@ -21,8 +22,13 @@
|
|||
<tbody>
|
||||
@foreach($values as $value)
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ route('admin.inventory.suppliers.edit', $value) }}" class="btn icon-btn btn-sm btn-primary">
|
||||
<td class="text-nowrap">
|
||||
<button type="button" class="btn icon-btn btn-sm btn-info js-show-supplier"
|
||||
data-url="{{ route('admin.inventory.suppliers.show', $value) }}"
|
||||
data-name="{{ $value->name }}" title="{{ __('Ansicht') }}">
|
||||
<span class="far fa-eye"></span>
|
||||
</button>
|
||||
<a href="{{ route('admin.inventory.suppliers.edit', $value) }}" class="btn icon-btn btn-sm btn-primary" title="{{ __('Bearbeiten') }}">
|
||||
<span class="far fa-edit"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
|
@ -54,6 +60,22 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="supplierShowModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ __('Lieferant') }}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" id="supplierShowBody">
|
||||
<div class="text-center text-muted py-4">{{ __('Lädt …') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('.datatables-style').dataTable({
|
||||
|
|
@ -62,6 +84,46 @@
|
|||
"order": [[1, "asc"]],
|
||||
"language": {"url": "/js/German.json"}
|
||||
});
|
||||
|
||||
var csrfToken = $('meta[name="csrf-token"]').attr('content');
|
||||
var $modal = $('#supplierShowModal');
|
||||
var $body = $('#supplierShowBody');
|
||||
|
||||
function loadDetails(url, method) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: method || 'GET',
|
||||
headers: {'X-CSRF-TOKEN': csrfToken},
|
||||
data: method && method !== 'GET' ? arguments[2] : undefined
|
||||
}).done(function (html) {
|
||||
$body.html(html);
|
||||
}).fail(function () {
|
||||
$body.html('<div class="alert alert-danger mb-0">{{ __('Fehler beim Laden.') }}</div>');
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('click', '.js-show-supplier', function () {
|
||||
$modal.find('.modal-title').text($(this).data('name'));
|
||||
$body.html('<div class="text-center text-muted py-4">{{ __('Lädt …') }}</div>');
|
||||
loadDetails($(this).data('url'), 'GET');
|
||||
$modal.modal('show');
|
||||
});
|
||||
|
||||
$(document).on('click', '.js-attach-ingredient, .js-attach-packaging', function () {
|
||||
var $btn = $(this);
|
||||
var value = $($btn.data('select')).val();
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
var payload = $btn.hasClass('js-attach-ingredient')
|
||||
? {ingredient_id: value}
|
||||
: {packaging_item_id: value};
|
||||
loadDetails($btn.data('url'), 'POST', payload);
|
||||
});
|
||||
|
||||
$(document).on('click', '.js-detach-ingredient, .js-detach-packaging', function () {
|
||||
loadDetails($(this).data('url'), 'DELETE');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue