@extends('WarehouseDashboard.header.header') @section('content')
{{__('Create Consignment')}}

{{__('All Consignments')}}



@foreach($consignments as $consignment) @php $consignmentOrders = $consignment->consignmentOrders->pluck("order_shipment_id"); $count = count($consignmentOrders); $ordersShipmentAll = \App\Models\OrderShipment::whereIn("id", $consignmentOrders); $ordersShipment = $ordersShipmentAll->get(); $pluckStatuses = $ordersShipmentAll->pluck("status"); //dd(array_search(3,[1,2,3,3,3,4],true)); $values = array_count_values($pluckStatuses->toArray()); $isComplete = $values[5] ?? 0; //if ($isComplete > 0 && $isComplete < $count ) $status = "In Progress"; if ($isComplete > 0 && $isComplete == $count) $status = "Complete"; @endphp @endforeach
{{__('ID')}} {{__('Warehouse')}} {{__('Total Orders')}} {{__('Driver')}} {{__('Status')}} {{__('Created at')}} {{__('Show')}}
{{$consignment->id}} {{$consignment->warehouse->{"name_".\Illuminate\Support\Facades\App::getLocale()} }} {{count($consignment->consignmentOrders)}} @if($consignment->driver_id != null) {{$consignment->driver ? $consignment->driver->name : null }} @else --}} @foreach($drivers as $driver) @endforeach @endif {{$status}} {{$consignment->created_at}}
{{ $consignments->links() }}
@endsection @section('js-scripts') @endsection