@extends('admin.layouts.app') @section('content')

Edit Jinsi Form #{{ $jinsiForm->id_no }}

@csrf @method('PUT')
@error('ward_id') {{ $message }} @enderror
@error('municipality_id') {{ $message }} @enderror
@error('wardchairman_id') {{ $message }} @enderror
@error('requested_by') {{ $message }} @enderror
@error('recommended_by') {{ $message }} @enderror
@error('recommended_position') {{ $message }} @enderror
Products (Each product can have its own tax type and expenses)
@if($jinsiForm->products->count() > 0) @foreach($jinsiForm->products as $index => $product) @php $availableQty = $product->qty + $product->remaining_qty; $usedQtyInOtherForms = \App\Models\JinsiFormProduct::where('kharid_form_product_id', $product->kharid_form_product_id) ->where('jinsi_form_id', '!=', $jinsiForm->id) ->whereHas('jinsiForm', function($q) { $q->where('status', 'active'); }) ->sum('qty'); $originalAvailableQty = $product->kharidFormProduct->maagFormProduct->qty - $usedQtyInOtherForms; @endphp
{{ $product->kharidFormProduct->maagFormProduct->product_name }}
{{ $product->kharidFormProduct->maagFormProduct->specification ?? 'No specification' }}
Unit: {{ $product->kharidFormProduct->maagFormProduct->unit }}
Current Qty: {{ $product->qty }} | Remaining: {{ $product->remaining_qty }} | Total Available: {{ $originalAvailableQty }}
is_long_term ? 'checked' : '' }}>
Available: {{ $originalAvailableQty }}
Remaining after this: {{ $originalAvailableQty - $product->qty }}
Tax: {{ $product->tax_percentage }}% = Rs. {{ number_format($product->tax_amount, 2) }}
Total with Tax: Rs. {{ number_format($product->total_with_tax, 2) }}
@endforeach @endif
Cancel
@push('scripts') @endpush @endsection