@extends('layouts.app') @section('title', isset($order) ? 'Edit Order' : 'Add Order') @section('content') {{-- ========================================================= PAGE HEADER ========================================================= --}}

{{ isset($order) ? 'Edit Order' : 'Create Order' }}

{{ isset($order) ? 'Update the customer order and invoice details.' : 'Create a new stationery distribution order for a customer.' }}

{{-- ========================================================= CUSTOMER + ORDER DETAILS ========================================================= --}}
{{-- CUSTOMER INFORMATION --}}

Customer Information

{{-- CUSTOMER --}}
@error('customer_id') {{ $message }} @enderror
{{-- PHONE --}}
{{-- SHOP --}}
{{-- AREA --}}
{{-- ORDER DETAILS --}}

Order Details

{{-- STATUS --}}
@error('order_status') {{ $message }} @enderror
{{-- TAKEN BY --}}
{{-- ORDER DATE --}}
{{-- ========================================================= ORDER FORM ========================================================= --}}
@csrf @if(isset($order)) @method('PUT') @endif {{-- ===================================================== ORDER ITEMS ====================================================== --}}

Order Items

@php $existingDetails = isset($order) ? $order->details : collect(); @endphp @if($existingDetails->count() > 0) @foreach($existingDetails as $index => $detail) @php $inventoryItem = $items->firstWhere( 'item_id', $detail->item_id ); @endphp {{-- PRODUCT --}} {{-- ITEM CODE --}} {{-- STOCK --}} {{-- PURCHASE PRICE --}} {{-- SALE PRICE --}} {{-- QUANTITY --}} {{-- TOTAL --}} {{-- DELETE --}} @endforeach @else {{-- FIRST EMPTY ROW --}} {{-- PRODUCT --}} {{-- CODE --}} {{-- STOCK --}} {{-- PURCHASE PRICE --}} {{-- SALE PRICE --}} {{-- QUANTITY --}} {{-- SUBTOTAL --}} {{-- DELETE --}} @endif
# Item Name Item Code Stock Purchase Price Sale Price Quantity Total Action
{{ $index + 1 }} {{ $inventoryItem->item_quantity ?? 0 }} Max/reference: Rs. {{ number_format((float)($inventoryItem->item_saleprice ?? 0), 2) }} Quantity exceeds available stock.
1 - Max/reference: Rs. 0.00 Quantity exceeds available stock.
{{-- ========================================================= INSTRUCTIONS + SUMMARY ========================================================== --}}
{{-- INSTRUCTIONS --}}

Instructions

{{-- SUMMARY --}}

Order Summary

  • Total Items 0
  • Total Quantity 0
  • Subtotal Rs. 0.00
  • Discount
  • Grand Total Rs. 0.00
{{-- ========================================================= ACTION BUTTONS ========================================================== --}}
Cancel
{{-- ========================================================= JAVASCRIPT ========================================================= --}} @endsection