@extends('layouts.master') @section('page_title', 'Next Call Status Details') @section('title', 'Next Call Status Details') @section('main_item', 'Oder') @section('sub_item', 'Call Status Details') @php function randomPastelColor() { // Pastel colors have high lightness and medium saturation $h = rand(0, 360); $s = rand(60, 80); // saturation % $l = rand(70, 90); // lightness % // Convert HSL to HEX (helper function below) return hslToHex($h, $s, $l); } function hslToHex($h, $s, $l) { $s /= 100; $l /= 100; $c = (1 - abs(2 * $l - 1)) * $s; $x = $c * (1 - abs(fmod($h / 60, 2) - 1)); $m = $l - $c/2; if ($h < 60) { $r = $c; $g = $x; $b = 0; } else if ($h < 120){ $r = $x; $g = $c; $b = 0; } else if ($h < 180){ $r = 0; $g = $c; $b = $x; } else if ($h < 240){ $r = 0; $g = $x; $b = $c; } else if ($h < 300){ $r = $x; $g = 0; $b = $c; } else { $r = $c; $g = 0; $b = $x; } $r = round(($r + $m) * 255); $g = round(($g + $m) * 255); $b = round(($b + $m) * 255); return sprintf("#%02x%02x%02x", $r, $g, $b); } $colorIndex = 0; $saleColors = []; $seenKeys = []; // Count how many times each sale+customer key appears $counts = []; foreach ($sales as $sale) { if ($sale->status === 'pending' && $sale->duplicate_status == 'pending') { $key = $sale->contact_id . '-' . $sale->product_id; $counts[$key] = ($counts[$key] ?? 0) + 1; } } @endphp @section('content')

Filter

business_location != '1') style="display: none" @endif>
order_batch_enable != '1') style="display: none" @endif>
product_filter_enable != '1') style="display: none" @endif>
Reset
{{--
Download Excel
--}}
@foreach ($sales as $sale) @php $key = $sale->contact_id . '-' . $sale->product_id; $isDuplicate = false; $rowColor = null; if ($sale->status === 'pending' && ($counts[$key] ?? 0) > 1) { if (!isset($saleColors[$key])) { $saleColors[$key] = randomPastelColor(); } $rowColor = $saleColors[$key]; $isDuplicate = true; } @endphp @endforeach
Action Call Status Order ID Waybill No Resources customer_profile_enable != '1') style="display: none" @endif>Oders Count Business Location Customer Mobile No Land Mark Invoice Total Product Name Product Sku Last Status Remark Previous Call Date Call Attempt Sale Date Updated order_batch_enable != '1') style="display: none" @endif>Campaign Batch ID
@php @endphp @php // $city = City::where('id', $sale->customer->city)->first(); @endphp @if ($sale->call_status == 'pending') Pending @elseif ($sale->call_status == 'confirm') Confirm @elseif ($sale->call_status == 'not_confirm') Not Confirm @elseif ($sale->call_status == 'cancel') Cancel Order @elseif ($sale->call_status == 'hold_oders') Hold Order @else Not Available @endif @if ($sale->call_status != 'cancel') {{-- // if ($city->name_en != 'Other') --}} @endif @if ($sale->call_status == 'duplicate') Duplicate {{-- // } --}} @endif @if (!empty($sale->invoice_no)) {{ $sale->invoice_no }} @elseif(!empty($sale->ref_no)) {{ $sale->ref_no }} @else N/A @endif @if (!empty($sale->waybill_no)) {{ $sale->waybill_prefix . $sale->waybill_no . $sale->waybill_postfix }} @else N/A @endif @if ($sale->resources == 'whats_app') Whats App @elseif ($sale->resources == 'face_book_leeds') Face Book Leads @elseif ($sale->resources == 'face_book_massenger') Face Book Massenger @elseif ($sale->resources == 'bulk_order') Bulk Order @elseif ($sale->resources == 'daraz') Daraz @elseif ($sale->resources == 'follow_up') Follow Up @elseif ($sale->resources == 'tamil_order') Tamil Order @elseif ($sale->resources == 'missed_call') Missed Call @elseif ($sale->resources == 'call_order') Call order @elseif ($sale->resources == 'voucher') Voucher Order @elseif ($sale->resources == 'flagship_store') Flagship store @elseif ($sale->resources == 'meta') Meta @elseif ($sale->resources == 'online') Online @else N/A @endif @if ($sale->call_status != 'cancel') @endif customer_profile_enable != '1') style="display: none" @endif> @php $contact_id = $sale->contact_id; $id = $contact_id; $totle_orders = App\Sale::where('sale_type', 'order') ->where('contact_id', $contact_id) ->count(); @endphp {{ $totle_orders }} @if (!empty($sale->location)) {{ $sale->business_locations->name }} @else N/A @endif {{ $sale->customer->name }} @if ($sale->customer->is_default == 2) Banned @endif {{ $sale->customer->mobile }} {{ $sale->customer->mobile_2 }} {{ $sale->customer->landmark }} {{ number_format($sale->invoice_nettotal, 2) }} @php $items = $sale->saleItems; $p_names = ''; foreach ($items as $item) { // Retrieve the quantity from the stocks table $re_qty = DB::table('stocks')->where('id', $item->stock_id)->value('qty'); // Append the product name and quantity wrapped in a badge span $p_names .= $item->product->product_name . ' - ' . $re_qty . ', '; } @endphp {!! Str::replaceLast(', ', '', $p_names) !!} @php $items = $sale->saleItems; $skus = ''; foreach ($items as $item) { $skus .= $item->product->sku . ', '; } @endphp {{ Str::replaceLast(', ', '', $skus) }} @php $call_status = App\CallStatus::where('sale_id', $sale->id) ->get() ->last(); @endphp @if (!empty($call_status->call_status_reason)) {{ $call_status->call_status_reason }} @else N/A @endif @php $call_status = App\CallStatus::where('sale_id', $sale->id) ->get() ->last(); @endphp @if (!empty($call_status->remark)) {{ $call_status->remark }} @else N/A @endif @php $call_status = App\CallStatus::where('sale_id', $sale->id) ->get() ->last(); @endphp @if (!empty($call_status->next_call_date)) {{ Carbon\Carbon::parse($call_status->updated_at)->format('Y-m-d') }} @else N/A @endif @php $call_status = App\CallStatus::where('sale_id', $sale->id)->count(); @endphp {{ $call_status }} @php $dates = Carbon\Carbon::parse($sale->sale_date)->toDateString(); @endphp {{ $dates }} {{ Carbon\Carbon::parse($sale->updated_at)->toDateString() }} order_batch_enable != '1') style="display: none" @endif> @php $campaign_id = App\OrderBatch::where('id', $sale->order_batch)->first(); $dates = Carbon\Carbon::parse($sale->created_at)->toDateString(); @endphp @if (!empty($campaign_id->batch_name)) {{ $campaign_id->batch_name . '-' . $dates }} @else N/A @endif
Total
{{ $sales->appends($_GET)->links() }}
@php $count = $sales->count(); @endphp
Total Count   {{ $count }}
@endsection @section('scripts') @endsection