@if(request()->segment(1) == 'cylinder_orders' ) {{$t = 'cylinder_order'}} @else {{$t = 'order'}} @endif @extends('layouts.app', ['activePage' => $t , 'titlePage' => __('')]) @section('content') @php // Function to count orders based on status and order type function getOrderCount($status, $orderTypeGas = null) { // Get the user's branch ID $userBranchId = (int) auth()->user()->branche_id; // Check if the user's role is 'branches' $role = \App\Models\Role::where('id', auth()->user()->role)->first(); // Default order query $query = \App\Models\Order::where('incart', 0) ->where('order_type_GAS', null) ->where('status', $status); // If role is 'branches', filter by branch ID if ($role && $role->name == 'branches') { $query = $query->where('branch_id', $userBranchId); } return $query->count(); } @endphp
Pending
{{ getOrderCount('pending', 1) }}
Click
Delivery
{{ getOrderCount('Delivery', 1) }}
Click
Complete
{{ getOrderCount('Complete', 1) }}
Click
Cancel
{{ getOrderCount('Cancel', 1) }}
Click
@csrf @method('post')

{{ __("jamia.order") }}

@if(Request::path() != 'cylinder_orders' ) @endif @foreach ($orders as $order)
{{__("jamia.sl_no")}} {{__("jamia.cln_name")}} {{__("jamia.order_number")}} {{__("jamia.phone")}} {{__("jamia.price")}} {{__("jamia.status")}} طريقه التوصيل {{__("jamia.pay_st")}} تاريخ ووقت الطلب رقم الصندوق {{__("jamia.deliveryMen")}}توصيل مشكور{{__("jamia.action") }}