@php use App\Models\{News, User, Customer, Customer_questions}; use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; $current_user = auth()->user(); $current_route_name = Route::current()->getName(); $modal_show = false; $placeholder = '
X.) ID: XXX
bestätigt 1 von 3

TEST / EXAMPLE - Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid exercitationem fugit delectus aperiam facilis suscipit qui cum, corporis in! Libero culpa, nam odio in porro ullam molestiae rem tempora! Saepe.

von mir aktualisiert vor 3 std. 5 min.
TEST
'; $placeholder2 = ' '; @endphp
@php /* ---------------------------------------------------------------- / Customer questions / ---------------------------------------------------------------- */ $customer_questions = new Customer_questions; $check_route_names = [ 'orders.edit', 'customers.edit' ]; $in_route = in_array($current_route_name, $check_route_names); if ( $in_route ) { $current_id = request()->segment(2); } $active_questions = $customer_questions->where('status', 1); $sum_current_order_questions = $current_route_name === 'orders.edit' ? $customer_questions->where('order_id', $current_id)->where('status', 6)->count() : 0; $questions_counter = $active_questions->count() + $sum_current_order_questions; @endphp
Kundenfragen @if ($questions_counter > 0) {{ $questions_counter }} @endif
@if ($questions_counter === 0)
poweful
@else @includeIf('news._form_customer_questions') @endif
@php /* ---------------------------------------------------------------- / reported problems / ---------------------------------------------------------------- */ @endphp
gemeldete Probleme
{{-- Neuer Eintrag --}}
univers
@php /* ---------------------------------------------------------------- / Tasks given / ---------------------------------------------------------------- */ $my_inbox_tasks = News::where('accepted' , $current_user->id ) ->where(function ($query) use ($current_user) { $query->whereNull('archived') ->orWhere('archived', 'not like' , '%,'.$current_user->id.',%'); }) ->where(function ($query) use ($current_user) { $query->whereNull('done') ->orWhere('done', '!=' , $current_user->id); }) ->orderBy('updated_at', "desc") ->get(); $my_tasks_counter = $my_inbox_tasks->count(); @endphp
erteilte Aufgaben @if ($my_tasks_counter > 0) {{ $my_tasks_counter }} @endif
{{-- Neuer Eintrag --}}
@if ($my_tasks_counter == 0)
univers
@else {{-- * ALL NOT ARCHIVED NEWS --}} {{-- -------------------------- --}} @foreach ($my_inbox_tasks as $index => $element) @if(strpos($element->archived , ','.$current_user->id.',') === false) @php //------------------------------------------------------------------------------------------------------ $selected_date = $element->updated_at == $element->created_at ? $element->created_at : $element->updated_at; $selected_form = $element->updated_at == $element->created_at ? '' : 'aktualisiert'; $selected_user = $element->publisher == $current_user->id ? 'von mir' : ('von ' .'' .User::where('id', $element->publisher)->first()->name .'' ); $output_time = diff_time_to_human($selected_date); //------------------------------------------------------------------------------------------------------ @endphp
@if($element->publisher === $current_user->id)
@else
@endif {{-- News Head --}}
{{ ($my_news_counter - $index).'.) ' }} {{ 'ID: ' .$element->id }}
@if ($element->priority === 1) WICHTIG @endif @if ($element->priority === 2) @if (empty($element->accepted)) MIT BESTÄTIGUNG @else bestätigt @endif @endif @if ($element->publisher === $current_user->id) @php $all_read_user = explode( ',' , str_replace(',,', ',' , trim( $element->read, ',' )) ); $all_target_user = \array_diff( explode( ',' , str_replace(',,', ',' , trim( $element->target, ',' )) ) , ['all']); @endphp @if ($all_read_user < $all_target_user) {{ count($all_read_user) }} von {{ count($all_target_user) }} @else alle {{ count($all_read_user) }} @endif @endif
{{-- News Buttons --}}
@if (strpos($element->read , ','.$current_user->id.',') === false) @else @if ($element->priority === 2) @if ($element->done !== $current_user->id && empty($element->done)) @else @endif @else @endif @endif @if (now()->diffInDays($selected_date) > 60) @endif
{{-- News Text --}}

publisher == $current_user->id ? '' : 'style="cursor:text;"' !!}> {!! $element->text !!}

{{-- News bottom --}} {!! $selected_user .' ' .$selected_form .' ' .$output_time !!} @if (!empty($element->accepted))
@if ($element->accepted === $current_user->id) von mir angenommen @else von
@endif {{-- END check archived --}} @endforeach {{-- *------------------------- --}} @endif
@php /* ---------------------------------------------------------------- / News / ---------------------------------------------------------------- */ $archived_news = News::where('archived' , 'like' , '%,'.$current_user->id.',%' ) ->orderBy('updated_at', "desc") ->get(); foreach ($archived_news as $index => $element) { if ($element->resubmission == date('Y-m-d').' 00:00:00'){ News::where('id',$element->id)->update([ // 'read' => NULL, // 'accepted' => NULL, // 'confirmed' => NULL, 'archived' => NULL, 'resubmission' => NULL, 'updated_at' => DB::raw('updated_at'), ]); } } $my_inbox_news = News::where('target' , 'like' , '%,'.$current_user->id.',%' ) ->where(function ($query) use ($current_user) { $query->whereNull('archived') ->orWhere('archived', 'not like' , '%,'.$current_user->id.',%'); }) ->where(function ($query) use ($current_user) { $query->whereNull('accepted') ->orWhere('accepted', '!=', $current_user->id); }) ->orderBy('updated_at', "desc") ->get(); $my_news_counter = $my_inbox_news->count(); $to_accept_news_counter = $unread_news_counter = $count_important_messages = 0; foreach ($my_inbox_news as $index => $element) { if(strpos($element->read , ','.$current_user->id.',') === false){ $unread_news_counter++; if ($element->priority > 0 && strpos($element->archived , ','.$current_user->id.',') === false) { //------------------------------------------------------------------------------------------------------ $selected_date = $element->updated_at == $element->created_at ? $element->created_at : $element->updated_at; $selected_form = $element->updated_at == $element->created_at ? '' : 'aktualisiert'; $selected_user = $element->publisher == $current_user->id ? 'von mir' : ('von ' .'' .User::where('id', $element->publisher)->first()->name .'' ); $output_time = diff_time_to_human($selected_date); //------------------------------------------------------------------------------------------------------ $count_important_messages ++; $modal_show = true; } } if ($element->priority > 0 && empty($element->accepted)) { $to_accept_news_counter++; } } @endphp
meine Aufgaben und News @if ($unread_news_counter > 0) {{ $unread_news_counter }} @endif @if ($to_accept_news_counter > 0) {{ $to_accept_news_counter }} @endif
@if (count($my_inbox_news) === 0)
cleanup
@else {{-- * ALL NOT ARCHIVED NEWS --}} {{-- -------------------------- --}} @foreach ($my_inbox_news as $index => $element) @if(strpos($element->archived , ','.$current_user->id.',') === false) @php //------------------------------------------------------------------------------------------------------ $selected_date = $element->updated_at == $element->created_at ? $element->created_at : $element->updated_at; $selected_form = $element->updated_at == $element->created_at ? '' : 'aktualisiert'; $selected_user = $element->publisher == $current_user->id ? 'von mir' : ('von ' .'' .User::where('id', $element->publisher)->first()->name .'' ); $output_time = diff_time_to_human($selected_date); //------------------------------------------------------------------------------------------------------ @endphp
@if($element->publisher === $current_user->id)
@else
@endif {{-- News Head --}}
{{ ($my_news_counter - $index).'.) ' }} {{ 'ID: ' .$element->id }}
@if ($element->priority === 1) WICHTIG @endif @if ($element->priority === 2) @if (empty($element->accepted)) MIT BESTÄTIGUNG @else bestätigt @endif @endif @if ($element->publisher === $current_user->id) @php $all_read_user = explode( ',' , str_replace(',,', ',' , trim( $element->read, ',' )) ); $all_target_user = \array_diff( explode( ',' , str_replace(',,', ',' , trim( $element->target, ',' )) ) , ['all']); @endphp @if ($all_read_user < $all_target_user) {{ count($all_read_user) }} von {{ count($all_target_user) }} @else alle {{ count($all_read_user) }} @endif @endif
{{-- News Buttons --}}
@if (strpos($element->read , ','.$current_user->id.',') === false) @else @if ($element->priority === 2) @if ($element->accepted !== $current_user->id && empty($element->accepted)) @else @endif @else @endif @endif @if (now()->diffInDays($selected_date) > 60) @endif
{{-- News Text --}}

publisher == $current_user->id ? '' : 'style="cursor:text;"' !!}> {!! $element->text !!}

{{-- News bottom --}} {!! $selected_user .' ' .$selected_form .' ' .$output_time !!} @if (!empty($element->accepted))
@if ($element->accepted === $current_user->id) von mir angenommen @else von {{ User::where('id', $element->accepted)->first()->name }} angenommen @endif @endif @if (!empty($element->kuid)) @php $customer = Customer::where('id', $element->kuid)->first(); @endphp
in Bezug auf {{ $customer->KuNr }} - {{ $customer->company }} @endif
@endif {{-- END check archived --}} @endforeach {{-- *------------------------- --}} @endif
@if ($modal_show) @section('modal')