@extends('backend.partials.master') @section('title') Customer Purchase Price @endsection @section('maincontent') @php // 👉 जर route = view असेल तर READ-ONLY mode $isView = request()->routeIs('CustomerSalePrice.view'); @endphp @if($isView) View Customer Purchase Price @else Customer Purchase Price @endif {{-- ❌ VIEW MODE मध्ये form submit नको --}} @csrf {{-- ================= LOT NO ================= --}} Lot No {{-- ================= TABLE ================= --}} Sr No Lot No Product Rate Expense Commission % @foreach($customers as $c) {{ $c->fname }} @endforeach @forelse($products as $productId => $items) @php $first = $items->first(); // common data @endphp {{ $loop->iteration }} {{ $first->lot_no }} {{ $first->product_name }} {{ number_format($first->rate, 2) }} {{ number_format($first->expense, 2) }} {{ number_format($first->commission_percent, 2) }}% {{-- 🔹 Customer-wise price --}} @foreach($customers as $c) @php $price = $items->firstWhere('customer_id', $c->id); @endphp {{ $price ? number_format($price->sale_price, 2) : '—' }} @endforeach @empty No Data Found @endforelse {{-- ================= BUTTONS ================= --}} Back @endsection @push('scripts') @endpush