@extends('mainlayout.layout') @section('title') @endsection @push('css') @endpush @php use App\Models\{Property,PropertyOwner,Order,PropertyPlot}; $propertyids = Property::where('propertyownerid', Auth::user()->propertyownerid)->pluck('id')->toArray(); if(Auth::user()->hasRole('propertyowner')){ $orders = Order::query(); $orders = $orders->whereIn('propertyid', $propertyids)->where('userid', $customer->uid)->get(); } @endphp @section('content')

CUSTOMER

First Name

{{$customer->first_name}}

Middle Name

{{$customer->middle_name}}

Last Name

{{$customer->last_name}}

PhoneNumber

{{$customer->phone}}

Orders

@role('superadmin')
{{Order::where('userid',$customer->uid)->count()}}
@endrole @role('propertyowner')
{{$orders->count()}}
@endrole

Success Rate

@php $order_count=$orders->count(); if($order_count < 1) $order_count=1; @endphp {{number_format(($orders-> where('status',2)->count()/$order_count)*100,2,'.',',')}} %

Total Amount

TZS {{number_format($orders->whereIn('status',[0,1,2])->sum('amount'),0,'.',',')}}

Generated Orders

{{$orders->where('status',0)->count()}}

Initialized Orders

{{$orders->where('status',1)->count()}}

Completed

{{$orders->where('status',2)->count()}}

Exipred Orders

{{$orders->where('status',3)->count()}}

Cancelled Orders

{{$orders->where('status',4)->count()}}

{{count($orders)}} Results found

@foreach($orders as $index => $order) @endforeach
# Reference ID Property Plot Amount Status Occured On
{{++$index}} {{$order->referenceid}} {{Property::find($order->propertyid)->name}} {{PropertyPlot::find($order->plotid)->plotnumber}} TZS {{number_format($order->amount,0,'.',',') }} {{$order->status_description}} {{$order->created_at}} View More
@endsection @push('scripts') @endpush