@php $user = Auth::user(); $infoboxes = []; $role_group_leader = $user->roles->contains('name', 'Csoportvezető'); @endphp {{-- Ajánlatok, Megrendelések --}} @can('show-offer') @php $infoboxes['offers'] = [ 'title' => 'Ajánlatok', 'description' => '', 'total_url' => route('offers.index'), 'buttons' => [ [ 'title' => 'Webes', 'quantity' => App\Models\Offer::WebTask()->count(), 'url' => route('offers.index', ['view' => 'WebTask']), ], [ 'title' => 'Készíteni', 'quantity' => App\Models\Offer::Prepare()->count(), 'url' => route('offers.index', ['view' => 'Prepare']), ], [ 'title' => 'Ügyfél jelez', 'quantity' => App\Models\Offer::ClientIndicates()->count(), 'url' => route('offers.index', ['view' => 'ClientIndicates']), ], [ 'title' => 'Ügyfelet keresni', 'quantity' => App\Models\Offer::ContactingClient()->count(), 'url' => route('offers.index', ['view' => 'ContactingClient']), ], [ 'title' => 'Ügyfél válaszok', 'quantity' => App\Models\Offer::ClientResponse()->count(), 'url' => route('offers.index', ['view' => 'ClientResponse']), ], [ 'title' => 'Felmérésre vár', 'quantity' => App\Models\Offer::WaitingForSurvey()->count(), 'url' => route('offers.index', ['view' => 'WaitingForSurvey']), ], ] ]; $infoboxes['orders'] = [ 'title' => 'Megrendelések', 'description' => '', 'total_url' => route('orders.index'), 'buttons' => [ [ 'title' => 'Szerződést küldeni', 'quantity' => App\Models\Order::SendOrder()->count(), 'url' => route('orders.index', ['view' => 'SendOrder']), ], [ 'title' => 'Szerződést várjuk', 'quantity' => App\Models\Order::WaitingForSignedContract()->count(), 'url' => route('orders.index', ['view' => 'WaitingForSignedContract']), ], [ 'title' => 'Előleget várjuk', 'quantity' => App\Models\Order::AwaitingAdvancePayment()->count(), 'url' => route('orders.index', ['view' => 'AwaitingAdvancePayment']), ], [ 'title' => 'Felmérésre vár', 'quantity' => App\Models\Order::WaitingForSurvey()->count(), 'url' => route('orders.index', ['view' => 'WaitingForSurvey']), ], [ 'title' => 'Ellenőrzésre vár', 'quantity' => App\Models\Order::AwaitingInspection()->count(), 'url' => route('orders.index', ['view' => 'AwaitingInspection']), ], [ 'title' => 'Beszállítók felvétele', 'quantity' => App\Models\Order::HiringSuppliers()->count(), 'url' => route('orders.index', ['view' => 'HiringSuppliers']), ], [ 'title' => 'Pótbeszállítók felvétele', 'quantity' => App\Models\Order::AdditionalSuppliers()->count(), 'url' => route('orders.index', ['view' => 'AdditionalSuppliers']), ], [ 'title' => 'Hibajegy', 'quantity' => App\Models\IssueTicket::organize()->count(), 'url' => route('issuetickets.index', ['view' => 'organize']), ], [ 'title' => 'Folyamatban', 'quantity' => App\Models\Order::OnGoing()->count(), 'url' => route('orders.index', ['view' => 'OnGoing']), ], [ 'title' => 'Vállalt határidő lejárt', 'quantity' => App\Models\Order::DeadlineExpired()->count(), 'url' => route('orders.index', ['view' => 'DeadlineExpired']), ], ] ]; @endphp @endcan {{-- Felmérések --}} @can('show-survey') @php $infoboxes['surveys'] = [ 'title' => 'Felmérések', 'description' => '', 'total_url' => route('surveys.index'), 'buttons' => [ [ 'title' => 'Szervezni', 'quantity' => App\Models\Survey::organize()->count(), 'url' => route('surveys.index', ['view' => 'organize']), ], [ 'title' => 'Újra keresni', 'quantity' => App\Models\Survey::searchAgain()->count(), 'url' => route('surveys.index', ['view' => 'searchAgain']), ], [ 'title' => 'Ügyfél keres', 'quantity' => App\Models\Survey::clientLooking()->count(), 'url' => route('surveys.index', ['view' => 'clientLooking']), ], [ 'title' => 'Leszervezve', 'quantity' => App\Models\Survey::organized()->count(), 'url' => route('surveys.index', ['view' => 'organized']), ], [ 'title' => 'Mai felmérések', 'quantity' => App\Models\Survey::report()->current()->count(), 'url' => route('surveys.index', ['view' => 'report']), ], [ 'title' => 'Elmaradt jelentés', 'quantity' => App\Models\Survey::missedReport()->count(), 'url' => route('surveys.index', ['view' => 'missedReport']), ], ] ]; @endphp @endcan {{-- Rendelés lemondása --}} @can('show-offer') @php $infoboxes['order_cancellation'] = [ 'title' => 'Lemondott megrendelések', 'description' => '', 'total_url' => route('orders.index', ['view' => 'cancel']), 'buttons' => [ [ 'title' => 'Jóváhagyásra vár', 'quantity' => App\Models\Order::cancelAwaitingApproval()->count(), 'url' => route('orders.index', ['view' => 'cancelAwaitingApproval']), ], [ 'title' => 'Jóváhagyva', 'quantity' => App\Models\Order::cancelApproved()->count(), 'url' => route('orders.index', ['view' => 'cancelApproved']), ], [ 'title' => 'Lemondott', 'quantity' => App\Models\Order::canceled()->count(), 'url' => route('orders.index', ['view' => 'canceled']), ], ] ]; @endphp @endcan {{-- Beszállítói ajánlatok, Beszállítói megrendelések --}} @can('show-supplier-offer') @php $infoboxes['supplier_offers'] = [ 'title' => 'Beszállítói ajánlatok', 'description' => '', 'total_url' => route('supplier_offers.index'), 'buttons' => [ [ 'title' => 'Küldeni', 'quantity' => App\Models\SupplierOffer::toSend()->count(), 'url' => route('supplier_offers.index', ['view' => 'toSend']), ], [ 'title' => 'Várjuk', 'quantity' => App\Models\SupplierOffer::waitingForResponse()->count(), 'url' => route('supplier_offers.index', ['view' => 'waitingForResponse']), ], [ 'title' => 'Beszállítót hívni', 'quantity' => App\Models\SupplierOffer::callSupplier()->count(), 'url' => route('supplier_offers.index', ['view' => 'callSupplier']), ], ] ]; $infoboxes['supplier_orders'] = [ 'title' => 'Beszállítói rendelések', 'description' => '', 'total_url' => route('supplier_orders.index'), 'buttons' => [ [ 'title' => 'Rendelni', 'quantity' => App\Models\SupplierOrder::ToOrder()->count(), 'url' => route('supplier_orders.index', ['view' => 'toOrder']), ], [ 'title' => 'Visszaigazolást várjuk', 'quantity' => App\Models\SupplierOrder::AwaitingConfirmation()->count(), 'url' => route('supplier_orders.index', ['view' => 'AwaitingConfirmation']), ], [ 'title' => 'Visszaigazolás késik', 'quantity' => App\Models\SupplierOrder::ConfirmationDelayed()->count(), 'url' => route('supplier_orders.index', ['view' => 'ConfirmationDelayed']), ], [ 'title' => 'Jóváhagyásra vár', 'quantity' => App\Models\SupplierOrder::AwaitingApproval()->count(), 'url' => route('supplier_orders.index', ['view' => 'AwaitingApproval']), ], [ 'title' => 'Beérkezésre vár', 'quantity' => App\Models\SupplierOrder::WaitingToReceive()->count(), 'url' => route('supplier_orders.index', ['view' => 'WaitingToReceive']), ], [ 'title' => 'Szállítólevél feltöltése', 'quantity' => App\Models\SupplierOrder::SupplierWaybillAwaitingUpload()->count(), 'url' => route('supplier_orders.index', ['view' => 'SupplierWaybillAwaitingUpload']), ], [ 'title' => 'Beszállító határideje lejárt', 'quantity' => App\Models\SupplierOrder::SupplierDeadlineExpired()->count(), 'url' => route('supplier_orders.index', ['view' => 'SupplierDeadlineExpired']), ], [ 'title' => 'Lemondásra vár', 'quantity' => App\Models\SupplierOrder::SupplierOrderCancellation()->count(), 'url' => route('supplier_orders.index', ['view' => 'SupplierOrderCancellation']), ], [ 'title' => 'Hiányosan érkezett', 'quantity' => App\Models\Order::orderIncomplete()->count(), 'url' => route('orders.index', ['view' => 'OrderIncomplete']), ], ] ]; @endphp @endcan {{-- Munkás munkája --}} @if(auth()->user()->can('show-worker-work')) {{-- sorrend fontos --}} @php $vehicles = $user->vehicles()->select('vehicles.id', 'plate_number')->distinct()->get(); if(!$role_group_leader) { foreach ($vehicles as $vehicle) { $infoboxes['works_'.$vehicle->id] = [ 'title' => 'Munkák ('.$vehicle->plate_number.')', 'description' => '', 'total_url' => route('works.index', ['vehicle_id' => $vehicle->id]), 'buttons' => [ [ 'title' => 'Mai munkák', 'quantity' => (new App\Models\Work)->getUserWorks()->report()->current()->vehicle($vehicle->id)->count(), 'url' => route('works.index', ['view' => 'report', 'vehicle_id' => $vehicle->id]), ], [ 'title' => 'Elmaradt jelentés', 'quantity' => (new App\Models\Work)->getUserWorks()->missedReport()->vehicle($vehicle->id)->count(), 'url' => route('works.index', ['view' => 'missedReport', 'vehicle_id' => $vehicle->id]), ], ] ]; } } @endphp @endif {{-- Munkák --}} @can('show-work') @php $infoboxes['works'] = [ 'title' => 'Munkák', 'description' => '', 'total_url' => route('works.index'), 'buttons' => [ [ 'title' => 'Szervezni', 'quantity' => App\Models\Work::organize()->count(), 'url' => route('works.index', ['view' => 'organize']), ], [ 'title' => 'Újra keresni', 'quantity' => App\Models\Work::searchAgain()->count(), 'url' => route('works.index', ['view' => 'searchAgain']), ], [ 'title' => 'Ügyfél keres', 'quantity' => App\Models\Work::clientLooking()->count(), 'url' => route('works.index', ['view' => 'clientLooking']), ], [ 'title' => 'Leszervezve', 'quantity' => App\Models\Work::organized()->count(), 'url' => route('works.index', ['view' => 'organized']), ], [ 'title' => 'Mai munkák', 'quantity' => App\Models\Work::report()->current()->count(), 'url' => route('works.index', ['view' => 'report']), ], [ 'title' => 'Elmaradt jelentés', 'quantity' => (new App\Models\Work)->missedReport()->count(), 'url' => route('works.index', ['view' => 'missedReport']), ], ] ]; if($role_group_leader) { // Ha csoportvezető akkor rendszámonként írjuk ki a listákat $vehicles = App\Models\Vehicle::all(); foreach ($vehicles as $vehicle) { $infoboxes['works_'.$vehicle->id] = [ 'title' => 'Munkák ('.$vehicle->plate_number.')', 'description' => '', 'total_url' => route('works.index', ['vehicle_id' => $vehicle->id]), 'buttons' => [ [ 'title' => 'Mai munkák', 'quantity' => App\Models\Work::report()->vehicle($vehicle->id)->current()->count(), 'url' => route('works.index', ['view' => 'report', 'vehicle_id' => $vehicle->id]), ], [ 'title' => 'Elmaradt jelentés', 'quantity' => (new App\Models\Work)->missedReport()->vehicle($vehicle->id)->count(), 'url' => route('works.index', ['view' => 'missedReport', 'vehicle_id' => $vehicle->id]), ], ] ]; } } @endphp @endcan @can('show-work') @php $roles = ['Iroda', 'Ügyvezető', 'Admin']; if ($user->roles->whereIn('name', $roles)->isNotEmpty()) { $infoboxes['works'] = [ 'title' => 'Munkák', 'description' => '', 'total_url' => route('works.index'), 'buttons' => [ [ 'title' => 'Szervezni', 'quantity' => App\Models\Work::organize()->count(), 'url' => route('works.index', ['view' => 'organize']), ], [ 'title' => 'Újra keresni', 'quantity' => App\Models\Work::searchAgain()->count(), 'url' => route('works.index', ['view' => 'searchAgain']), ], [ 'title' => 'Ügyfél keres', 'quantity' => App\Models\Work::clientLooking()->count(), 'url' => route('works.index', ['view' => 'clientLooking']), ], [ 'title' => 'Leszervezve', 'quantity' => App\Models\Work::organized()->count(), 'url' => route('works.index', ['view' => 'organized']), ], [ 'title' => 'Mai munkák', 'quantity' => App\Models\Work::report()->current()->count(), 'url' => route('works.index', ['view' => 'report']), ], [ 'title' => 'Elmaradt jelentés', 'quantity' => (new App\Models\Work)->missedReport()->count(), 'url' => route('works.index', ['view' => 'missedReport']), ], ] ]; } @endphp @endcan {{-- Ajánlat --}} @can('show-offer') @php $infoboxes['issue_tickets'] = [ 'title' => 'Hibajegyek', 'description' => '', 'total_url' => route('issuetickets.index'), 'buttons' => [ [ 'title' => 'Kezelendő', 'quantity' => App\Models\IssueTicket::handled()->count(), 'url' => route('issuetickets.index', ['view' => 'handled']), ], [ 'title' => 'Rendelni', 'quantity' => App\Models\IssueTicket::toOrder()->count(), 'url' => route('issuetickets.index', ['view' => 'toOrder']), ], [ 'title' => 'Alapanyagra vár', 'quantity' => App\Models\IssueTicket::awaitingMaterials()->count(), 'url' => route('issuetickets.index', ['view' => 'awaitingMaterials']), ], [ 'title' => 'Elkészülésre vár', 'quantity' => App\Models\IssueTicket::awaitingReady()->count(), 'url' => route('issuetickets.index', ['view' => 'awaitingReady']), ], ] ]; @endphp @endcan {{-- Pénzügy --}} @can('show-offer') @php $infoboxes['finance'] = [ 'title' => 'Pénzügy', 'description' => '', 'total_url' => route('payments.index'), 'buttons' => [ [ 'title' => 'Fizetés egyeztetése', 'quantity' => App\Models\Order::PaymentReconciliation()->count(), 'url' => route('orders.index', ['view' => 'PaymentReconciliation']), ], [ 'title' => 'Bejön fizetni', 'quantity' => App\Models\Order::ComesInToPay()->count(), 'url' => route('orders.index', ['view' => 'ComesInToPay']), ], [ 'title' => 'Nem jött be fizetni', 'quantity' => App\Models\Order::DidntComeInToPay()->count(), 'url' => route('orders.index', ['view' => 'DidntComeInToPay']), ], [ 'title' => 'Számlázni kell', 'quantity' => App\Models\Order::NeedToBeInvoiced()->count(), 'url' => route('orders.index', ['view' => 'NeedToBeInvoiced']), ], [ 'title' => 'Utalást várjuk', 'quantity' => App\Models\Order::WaitingForTheTransfer()->count(), 'url' => route('orders.index', ['view' => 'WaitingForTheTransfer']), ], [ 'title' => 'Nem utalt', 'quantity' => App\Models\Order::DidNotTransfer()->count(), 'url' => route('orders.index', ['view' => 'DidNotTransfer']), ], [ 'title' => 'Helyszínen fizet', 'quantity' => App\Models\Order::PayLocally()->count(), 'url' => route('orders.index', ['view' => 'PayLocally']),], [ 'title' => 'Helyszínen nem fizetett', 'quantity' => App\Models\Order::DidntPaidLocally()->count(), 'url' => route('orders.index', ['view' => 'DidntPaidLocally']), ], [ 'title' => 'Munkavégzés utáni utalás', 'quantity' => App\Models\Order::TransferAfterWork()->count(), 'url' => route('orders.index', ['view' => 'TransferAfterWork']), ], [ 'title' => 'Készpénz igazolás', 'quantity' => App\Models\Payment::CashCertificate()->count(), 'url' => route('payments.index', ['view' => 'CashCertificate']), ], ] ]; @endphp @endcan @php // rendezés -> $order = ['offers', 'supplier_offers', 'surveys', 'orders', 'supplier_orders', 'works', 'issue_tickets', 'finance', 'order_cancellation']; $infoboxes_ordered = []; foreach ($order as $key) { if (isset($infoboxes[$key])) $infoboxes_ordered[$key] = $infoboxes[$key]; } $remaining_part = array_diff_key($infoboxes, $infoboxes_ordered); $infoboxes = array_merge($infoboxes_ordered, $remaining_part); // rendezés <- @endphp @extends('layouts.admin') @section('main-content') @include('dashboard.components.grid_short')