@extends('layouts.app', ['title' => 'CRM | Kunde']) @section('content') {{-- Neuer Kontakt Modal --}} {{-- Kontakt bearbeiten Modal --}} {{-- Kontakt löschen Modal --}} {{-- Neuer Standort Modal --}} {{-- Standort bearbeiten Modal --}} {{-- Standort löschen Modal --}} {{-- Main Content --}}
{{-- Alert --}} @if(session('msg'))
{{ session('msg') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif {{-- Header --}}

{{ $customer->name }}

@if($customer->customer_code) {{ $customer->customer_code }} @endif {{ $customer->category->name ?? '—' }}
@if(Auth::user()->get_employee->is_mgt) Alle Projekte @endif
{{-- Linke Spalte --}}
{{-- Stammdaten --}}
Stammdaten
@if($customer->address)
{{ $customer->address }}
@endif @if($customer->tel)
{{ $customer->tel }}
@endif @if($customer->mobile)
{{ $customer->mobile }}
@endif @if($customer->fax)
{{ $customer->fax }}
@endif @if($customer->email) @endif @if($customer->website)
{{ $customer->website }}
@endif
{{-- Standorte --}}
Standorte / Niederlassungen {{ $customer->branches->count() }} @if(Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_crm) @endif
@forelse($customer->branches as $item)
{{ $item->name ?: '—' }} @if(Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_crm)
@endif
@if($item->address)
{{ $item->address }}
@endif @if($item->tel)
{{ $item->tel }}
@endif @if($item->mobile)
{{ $item->mobile }}
@endif @if($item->email)
{{ $item->email }}
@endif @if($item->website)
{{ $item->website }}
@endif
@empty
Keine Standorte vorhanden
@endforelse
{{-- Kontaktpersonen --}}
Kontaktpersonen {{ $customer->get_employees->count() }} @if(Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_crm) @endif
@forelse($customer->get_employees as $emp)
{{ $emp->gender == '1' ? 'Herr ' : ($emp->gender == '2' ? 'Frau ' : '') }}{{ $emp->name }}
{{ $emp->position->name ?? '—' }}
@if(Auth::user()->get_employee->is_mgt || Auth::user()->get_employee->is_crm)
@endif
@if($emp->tel)
{{ $emp->tel }}
@endif @if($emp->mobile)
{{ $emp->mobile }}
@endif @if($emp->email)
{{ $emp->email }}
@endif @if($emp->address)
{{ $emp->address }}
@endif @if($emp->note)
{{ $emp->note }}
@endif
@empty
Keine Kontaktpersonen vorhanden
@endforelse
{{-- Rechte Spalte: Timeline (nur mgt) --}} @if(Auth::user()->get_employee->is_mgt)
Verlauf / Hinweise
{{-- Neuer Eintrag --}}
@csrf {{-- Typ-Auswahl --}}
@foreach([ ['4','notes','bi-info-square-fill','Info','text-info'], ['0','call','bi-telephone-fill','Anruf','text-success'], ['1','mail','bi-envelope-fill','E-Mail','text-primary'], ['2','poste','bi-mailbox2','Post','text-secondary'], ['3','personally','bi-people-fill','Persönlich','text-warning'], ] as [$val,$rid,$ico,$lbl,$col]) @endforeach
{{-- Kontakt mit (nur bei Anruf/E-Mail/Post/Persönlich) --}}

{{-- Filter --}}
Filter: @foreach([ ['0','all','bi-list-ul','Alle'], ['1','fnotes','bi-info-square-fill','Info'], ['2','fcall','bi-telephone-fill','Anruf'], ['3','fmail','bi-envelope-fill','E-Mail'], ['4','fposte','bi-mailbox2','Post'], ['5','fpersonally','bi-people-fill','Person'], ] as [$val,$fid,$ico,$lbl]) @endforeach
{{-- Einträge --}} @forelse($customer->contact_history->sortByDesc('created_at') as $tt) @php $isNote = $tt->is_note && !$tt->is_call && !$tt->is_email && !$tt->is_post && !$tt->is_personally; $isCall = (bool)$tt->is_call; $isEmail = (bool)$tt->is_email; $isPost = (bool)$tt->is_post; $isPersonally = (bool)$tt->is_personally; if ($isNote) { $tlIcon = 'bi-info-square-fill'; $tlColor = '#0dcaf0'; } elseif ($isCall) { $tlIcon = 'bi-telephone-fill'; $tlColor = '#198754'; } elseif ($isEmail) { $tlIcon = 'bi-envelope-fill'; $tlColor = '#0d6efd'; } elseif ($isPost) { $tlIcon = 'bi-mailbox2'; $tlColor = '#6c757d'; } else { $tlIcon = 'bi-people-fill'; $tlColor = '#ffc107'; } @endphp
@if(!$isNote && $tt->contact_with) {{ $tt->contact_with }} @endif {{ $tt->created_at ? \Carbon\Carbon::parse($tt->created_at)->format('d.m.Y - H:i') : '—' }}
{!! $tt->note !!}
{{ $tt->employee->first_name }} {{ $tt->employee->last_name }}
@empty
Noch keine Einträge.
@endforelse
@endif
@endsection