@extends('layouts.app') @section('header','New Quotation') @section('content')<form class="panel" method="post" action="/quotations">@csrf<label>Customer<select name="customer_id" required>@foreach($customers as $c)<option value="{{$c->id}}">{{$c->name}} — {{$c->company}}</option>@endforeach</select></label><h2>Items</h2><div id="items"><div class="quote-item"><input name="items[0][description]" placeholder="Description" required><input name="items[0][quantity]" type="number" step="0.01" value="1" placeholder="Qty" required><input name="items[0][unit_price]" type="number" step="0.01" placeholder="Unit Price" required><input name="items[0][discount]" type="number" step="0.01" value="0" placeholder="Discount"></div></div><button type="button" class="btn" onclick="addItem()">+ Add Item</button><label>Tax Amount<input name="tax" type="number" step="0.01" value="0"></label><label>Notes<textarea name="notes"></textarea></label><button class="btn">Create Quotation</button></form><script>let i=1;function addItem(){document.getElementById('items').insertAdjacentHTML('beforeend',`<div class="quote-item"><input name="items[${i}][description]" placeholder="Description" required><input name="items[${i}][quantity]" type="number" step="0.01" value="1" required><input name="items[${i}][unit_price]" type="number" step="0.01" required><input name="items[${i}][discount]" type="number" step="0.01" value="0"></div>`);i++}</script>@endsection
