@extends('backend.partials.master') @section('title') Customer Sale Price {{ !empty($old) ? 'Edit' : 'Create' }} @endsection @section('maincontent') @php $groupedProducts = !empty($old) ? $old->groupBy('product_id') : collect(); @endphp {{ !empty($old) ? 'Edit' : 'Create' }} Customer Sale Price @csrf @if(!empty($old)) @method('PUT') @endif Lot No * Select Lot No @foreach($productlot as $lot) lot_no ?? '') == $lot ? 'selected' : '' }}> {{ $lot }} @endforeach @error('lot_no') {{ $message }} @enderror Sr No Lot No Product Purchase Price Expense Commission % @foreach($customers as $customer) {{ $customer->fname }} @endforeach @if(!empty($old)) @foreach($groupedProducts as $pIndex => $items) @php $first = $items->first(); // product common data @endphp {{ $loop->iteration }} {{ $first->lot_no }} {{ $first->product_name }} {{ number_format($first->rate, 2) }} {{-- Customer-wise prices --}} @foreach($customers as $cIndex => $customer) @php $row = DB::table('customer_selling_prices') ->where('product_id',$first->product_id) ->where('customer_id', $customer->id) ->first(); @endphp @endforeach @endforeach @endif {{ !empty($old) ? 'Update' : 'Create' }} Cancel @endsection @push('scripts') @endpush