@model LittleShop.DTOs.CreateOrderDto

@{
    ViewData["Title"] = "Create Order";
}

<div class="row mb-4">
    <div class="col">
        <h1><i class="fas fa-plus"></i> Create Order</h1>
    </div>
</div>

<div class="row">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h5><i class="fas fa-user"></i> Customer Information</h5>
            </div>
            <div class="card-body">
                <form method="post" asp-area="Admin" asp-controller="Orders" asp-action="Create">
                    @Html.AntiForgeryToken()
                    @if (ViewData.ModelState[""] != null && ViewData.ModelState[""].Errors.Count > 0)
                    {
                        <div class="alert alert-danger" role="alert">
                            @foreach (var error in ViewData.ModelState[""].Errors)
                            {
                                <div>@error.ErrorMessage</div>
                            }
                        </div>
                    }
                    
                    <div class="mb-3">
                        <label for="IdentityReference" class="form-label">Customer Reference</label>
                        <input name="IdentityReference" id="IdentityReference" class="form-control" required 
                               placeholder="Customer ID or reference" />
                        <small class="text-muted">Anonymous identifier for the customer</small>
                    </div>
                    
                    <h6 class="mt-4 mb-3">Shipping Information</h6>
                    
                    <div class="mb-3">
                        <label for="ShippingName" class="form-label">Recipient Name</label>
                        <input name="ShippingName" id="ShippingName" class="form-control" required />
                    </div>
                    
                    <div class="mb-3">
                        <label for="ShippingAddress" class="form-label">Shipping Address</label>
                        <textarea name="ShippingAddress" id="ShippingAddress" class="form-control" rows="2" required></textarea>
                    </div>
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="ShippingCity" class="form-label">City</label>
                                <input name="ShippingCity" id="ShippingCity" class="form-control" required />
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                <label for="ShippingPostCode" class="form-label">Post Code</label>
                                <input name="ShippingPostCode" id="ShippingPostCode" class="form-control" required />
                            </div>
                        </div>
                    </div>
                    
                    <div class="mb-3">
                        <label for="ShippingCountry" class="form-label">Country</label>
                        <input name="ShippingCountry" id="ShippingCountry" class="form-control" value="United Kingdom" required />
                    </div>
                    
                    <div class="mb-3">
                        <label for="Notes" class="form-label">Order Notes (Optional)</label>
                        <textarea name="Notes" id="Notes" class="form-control" rows="3"></textarea>
                    </div>
                    
                    <div class="d-flex justify-content-between">
                        <a href="@Url.Action("Index")" class="btn btn-secondary">
                            <i class="fas fa-arrow-left"></i> Back to Orders
                        </a>
                        <button type="submit" class="btn btn-primary">
                            <i class="fas fa-save"></i> Create Order
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    
    <div class="col-md-4">
        <div class="card">
            <div class="card-header">
                <h5><i class="fas fa-info-circle"></i> Order Information</h5>
            </div>
            <div class="card-body">
                <p>Create a new order manually for phone or email orders.</p>
                <ul class="list-unstyled">
                    <li><strong>Customer Reference:</strong> Anonymous identifier</li>
                    <li><strong>Shipping Details:</strong> Required for delivery</li>
                    <li><strong>Payment:</strong> Add after order creation</li>
                    <li><strong>Products:</strong> Add items after creation</li>
                </ul>
                <small class="text-muted">Orders created here will appear in the orders list with PendingPayment status.</small>
            </div>
        </div>
    </div>
</div>