<?php $__env->startSection('title', 'Add Manual Order'); ?>
<?php $__env->startSection('page-title', 'Add Manual Order'); ?>

<?php $__env->startSection('breadcrumbs'); ?>
    <li class="breadcrumb-item"><a href="<?php echo e(route('admin.orders.index')); ?>">Orders</a></li>
    <li class="breadcrumb-item active" aria-current="page">Add Manual Order</li>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<form method="POST" action="<?php echo e(route('admin.orders.store')); ?>" class="space-y-6">
    <?php echo csrf_field(); ?>

    <div class="rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-gray-950">
        <div class="mb-5 border-b border-gray-200 pb-4 dark:border-gray-800">
            <h2 class="mb-1 text-lg font-semibold text-gray-900 dark:text-white">Customer details</h2>
            <p class="mb-0 text-sm text-gray-500 dark:text-gray-400">Create a backend order for phone, chat, or in-store purchases.</p>
        </div>

        <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
            <?php if (isset($component)) { $__componentOriginal530746098e8865a2469fd5685420112b = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal530746098e8865a2469fd5685420112b = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.text-input','data' => ['name' => 'customer_name','label' => 'Customer name','required' => true,'placeholder' => 'Customer full name']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.text-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'customer_name','label' => 'Customer name','required' => true,'placeholder' => 'Customer full name']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $attributes = $__attributesOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__attributesOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $component = $__componentOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__componentOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal530746098e8865a2469fd5685420112b = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal530746098e8865a2469fd5685420112b = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.text-input','data' => ['name' => 'customer_phone','label' => 'Phone','required' => true,'placeholder' => '+855...']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.text-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'customer_phone','label' => 'Phone','required' => true,'placeholder' => '+855...']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $attributes = $__attributesOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__attributesOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $component = $__componentOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__componentOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal530746098e8865a2469fd5685420112b = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal530746098e8865a2469fd5685420112b = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.text-input','data' => ['name' => 'customer_email','type' => 'email','label' => 'Email','placeholder' => 'customer@example.com']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.text-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'customer_email','type' => 'email','label' => 'Email','placeholder' => 'customer@example.com']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $attributes = $__attributesOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__attributesOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal530746098e8865a2469fd5685420112b)): ?>
<?php $component = $__componentOriginal530746098e8865a2469fd5685420112b; ?>
<?php unset($__componentOriginal530746098e8865a2469fd5685420112b); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.select-input','data' => ['name' => 'payment_method','label' => 'Payment method','placeholder' => 'Select method','options' => ['cod' => 'Cash on delivery', 'aba' => 'ABA', 'bank_transfer' => 'Bank transfer']]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.select-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'payment_method','label' => 'Payment method','placeholder' => 'Select method','options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(['cod' => 'Cash on delivery', 'aba' => 'ABA', 'bank_transfer' => 'Bank transfer'])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $attributes = $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $component = $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal694712473b787cd740db4e46be9da3f9 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal694712473b787cd740db4e46be9da3f9 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.textarea','data' => ['name' => 'shipping_detail','label' => 'Shipping detail','rows' => '3','placeholder' => 'Address, delivery note, or map link','class' => 'md:col-span-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.textarea'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'shipping_detail','label' => 'Shipping detail','rows' => '3','placeholder' => 'Address, delivery note, or map link','class' => 'md:col-span-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal694712473b787cd740db4e46be9da3f9)): ?>
<?php $attributes = $__attributesOriginal694712473b787cd740db4e46be9da3f9; ?>
<?php unset($__attributesOriginal694712473b787cd740db4e46be9da3f9); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal694712473b787cd740db4e46be9da3f9)): ?>
<?php $component = $__componentOriginal694712473b787cd740db4e46be9da3f9; ?>
<?php unset($__componentOriginal694712473b787cd740db4e46be9da3f9); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginal694712473b787cd740db4e46be9da3f9 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal694712473b787cd740db4e46be9da3f9 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.textarea','data' => ['name' => 'note','label' => 'Internal note','rows' => '3','placeholder' => 'Staff notes for this order','class' => 'md:col-span-2']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.textarea'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'note','label' => 'Internal note','rows' => '3','placeholder' => 'Staff notes for this order','class' => 'md:col-span-2']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal694712473b787cd740db4e46be9da3f9)): ?>
<?php $attributes = $__attributesOriginal694712473b787cd740db4e46be9da3f9; ?>
<?php unset($__attributesOriginal694712473b787cd740db4e46be9da3f9); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal694712473b787cd740db4e46be9da3f9)): ?>
<?php $component = $__componentOriginal694712473b787cd740db4e46be9da3f9; ?>
<?php unset($__componentOriginal694712473b787cd740db4e46be9da3f9); ?>
<?php endif; ?>
        </div>
    </div>

    <div class="rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-gray-950">
        <div class="mb-5 flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-center sm:justify-between dark:border-gray-800">
            <div>
                <h2 class="mb-1 text-lg font-semibold text-gray-900 dark:text-white">Order items</h2>
                <p class="mb-0 text-sm text-gray-500 dark:text-gray-400">Choose products and quantities. Prices are captured from the catalog.</p>
            </div>
            <button type="button" id="addItemRow" class="btn-secondary"><i class="fas fa-plus"></i>Add item</button>
        </div>

        <div id="orderItems" class="space-y-3">
            <?php ($oldItems = old('items', [['product_id' => '', 'quantity' => 1]])); ?>
            <?php $__currentLoopData = $oldItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="order-item-row grid grid-cols-1 gap-3 rounded-lg border border-slate-200 p-3 md:grid-cols-[1fr_8rem_auto] dark:border-slate-800">
                    <?php if (isset($component)) { $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.select-input','data' => ['name' => 'items['.e($index).'][product_id]','label' => 'Product','required' => true,'placeholder' => 'Select product','value' => $item['product_id'] ?? '','class' => 'mb-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.select-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'items['.e($index).'][product_id]','label' => 'Product','required' => true,'placeholder' => 'Select product','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($item['product_id'] ?? ''),'class' => 'mb-0']); ?>
                        <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($product->id); ?>" <?php if((string) ($item['product_id'] ?? '') === (string) $product->id): echo 'selected'; endif; ?>>
                                <?php echo e($product->name); ?> - $<?php echo e(number_format((float) $product->price, 2)); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $attributes = $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $component = $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
                    <?php if (isset($component)) { $__componentOriginale7b240ac873e22945c281c841a0f88ab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale7b240ac873e22945c281c841a0f88ab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.number-input','data' => ['name' => 'items['.e($index).'][quantity]','label' => 'Quantity','required' => true,'min' => '1','value' => $item['quantity'] ?? 1,'class' => 'mb-0']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.number-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'items['.e($index).'][quantity]','label' => 'Quantity','required' => true,'min' => '1','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($item['quantity'] ?? 1),'class' => 'mb-0']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $attributes = $__attributesOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__attributesOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $component = $__componentOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__componentOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
                    <button type="button" class="remove-item-row btn-secondary self-end" data-bs-toggle="tooltip" title="Remove item"><i class="fas fa-trash"></i></button>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>

        <?php if (isset($component)) { $__componentOriginal5998e4ce7fb1dc7393ccc9310b967138 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal5998e4ce7fb1dc7393ccc9310b967138 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.validation-error','data' => ['name' => 'items','class' => 'mt-3']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.validation-error'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'items','class' => 'mt-3']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal5998e4ce7fb1dc7393ccc9310b967138)): ?>
<?php $attributes = $__attributesOriginal5998e4ce7fb1dc7393ccc9310b967138; ?>
<?php unset($__attributesOriginal5998e4ce7fb1dc7393ccc9310b967138); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal5998e4ce7fb1dc7393ccc9310b967138)): ?>
<?php $component = $__componentOriginal5998e4ce7fb1dc7393ccc9310b967138; ?>
<?php unset($__componentOriginal5998e4ce7fb1dc7393ccc9310b967138); ?>
<?php endif; ?>
    </div>

    <div class="rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-gray-950">
        <div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4">
            <?php if (isset($component)) { $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.select-input','data' => ['name' => 'order_status','label' => 'Order status','required' => true,'value' => old('order_status', 'pending'),'options' => [
                'pending' => 'Pending',
                'confirmed' => 'Confirmed',
                'processing' => 'Processing',
                'delivering' => 'Delivering',
                'completed' => 'Completed',
                'cancelled' => 'Cancelled',
                'returned' => 'Returned',
            ]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.select-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'order_status','label' => 'Order status','required' => true,'value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('order_status', 'pending')),'options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([
                'pending' => 'Pending',
                'confirmed' => 'Confirmed',
                'processing' => 'Processing',
                'delivering' => 'Delivering',
                'completed' => 'Completed',
                'cancelled' => 'Cancelled',
                'returned' => 'Returned',
            ])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $attributes = $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $component = $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.select-input','data' => ['name' => 'payment_status','label' => 'Payment status','required' => true,'value' => old('payment_status', 'pending'),'options' => [
                'pending' => 'Pending',
                'paid' => 'Paid',
                'failed' => 'Failed',
                'cancelled' => 'Cancelled',
                'refunded' => 'Refunded',
            ]]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.select-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'payment_status','label' => 'Payment status','required' => true,'value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('payment_status', 'pending')),'options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([
                'pending' => 'Pending',
                'paid' => 'Paid',
                'failed' => 'Failed',
                'cancelled' => 'Cancelled',
                'refunded' => 'Refunded',
            ])]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $attributes = $__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__attributesOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230)): ?>
<?php $component = $__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230; ?>
<?php unset($__componentOriginalf05cfa8a3a9bfe3c0fbbaf4a0e88f230); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginale7b240ac873e22945c281c841a0f88ab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale7b240ac873e22945c281c841a0f88ab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.number-input','data' => ['name' => 'shipping_fee','label' => 'Shipping fee','step' => '0.01','min' => '0','value' => old('shipping_fee', 0)]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.number-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'shipping_fee','label' => 'Shipping fee','step' => '0.01','min' => '0','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('shipping_fee', 0))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $attributes = $__attributesOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__attributesOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $component = $__componentOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__componentOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
            <?php if (isset($component)) { $__componentOriginale7b240ac873e22945c281c841a0f88ab = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale7b240ac873e22945c281c841a0f88ab = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.number-input','data' => ['name' => 'discount','label' => 'Discount','step' => '0.01','min' => '0','value' => old('discount', 0)]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.number-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'discount','label' => 'Discount','step' => '0.01','min' => '0','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('discount', 0))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $attributes = $__attributesOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__attributesOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale7b240ac873e22945c281c841a0f88ab)): ?>
<?php $component = $__componentOriginale7b240ac873e22945c281c841a0f88ab; ?>
<?php unset($__componentOriginale7b240ac873e22945c281c841a0f88ab); ?>
<?php endif; ?>
        </div>

        <?php if (isset($component)) { $__componentOriginala07abf6c4ac26573367cdce79eb1edd5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginala07abf6c4ac26573367cdce79eb1edd5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.action-buttons','data' => ['back' => route('admin.orders.index'),'submit' => 'Create Order']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.action-buttons'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['back' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('admin.orders.index')),'submit' => 'Create Order']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginala07abf6c4ac26573367cdce79eb1edd5)): ?>
<?php $attributes = $__attributesOriginala07abf6c4ac26573367cdce79eb1edd5; ?>
<?php unset($__attributesOriginala07abf6c4ac26573367cdce79eb1edd5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginala07abf6c4ac26573367cdce79eb1edd5)): ?>
<?php $component = $__componentOriginala07abf6c4ac26573367cdce79eb1edd5; ?>
<?php unset($__componentOriginala07abf6c4ac26573367cdce79eb1edd5); ?>
<?php endif; ?>
    </div>
</form>

<template id="orderItemTemplate">
    <div class="order-item-row grid grid-cols-1 gap-3 rounded-lg border border-slate-200 p-3 md:grid-cols-[1fr_8rem_auto] dark:border-slate-800">
        <div class="mb-0">
            <label class="form-label text-sm font-medium text-slate-700 dark:text-slate-300">Product <span class="text-danger">*</span></label>
            <select name="__PRODUCT_NAME__" required class="form-select rounded-lg border-slate-200 text-sm shadow-sm focus:border-emerald-500 focus:ring-emerald-500 dark:border-slate-700 dark:bg-slate-900 dark:text-white">
                <option value="">Select product</option>
                <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($product->id); ?>"><?php echo e($product->name); ?> - $<?php echo e(number_format((float) $product->price, 2)); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>
        <div class="mb-0">
            <label class="form-label text-sm font-medium text-slate-700 dark:text-slate-300">Quantity <span class="text-danger">*</span></label>
            <input type="number" min="1" value="1" required name="__QUANTITY_NAME__" class="form-control rounded-lg border-slate-200 text-sm shadow-sm focus:border-emerald-500 focus:ring-emerald-500 dark:border-slate-700 dark:bg-slate-900 dark:text-white">
        </div>
        <button type="button" class="remove-item-row btn-secondary self-end" data-bs-toggle="tooltip" title="Remove item"><i class="fas fa-trash"></i></button>
    </div>
</template>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
<script>
document.addEventListener('DOMContentLoaded', () => {
    const items = document.getElementById('orderItems');
    const template = document.getElementById('orderItemTemplate');
    const addButton = document.getElementById('addItemRow');
    let nextIndex = items.querySelectorAll('.order-item-row').length;

    function syncRemoveButtons() {
        const rows = items.querySelectorAll('.order-item-row');
        rows.forEach(row => row.querySelector('.remove-item-row').disabled = rows.length === 1);
    }

    addButton.addEventListener('click', () => {
        const html = template.innerHTML
            .replace('__PRODUCT_NAME__', `items[${nextIndex}][product_id]`)
            .replace('__QUANTITY_NAME__', `items[${nextIndex}][quantity]`);
        items.insertAdjacentHTML('beforeend', html);
        nextIndex += 1;
        syncRemoveButtons();
    });

    items.addEventListener('click', event => {
        const button = event.target.closest('.remove-item-row');
        if (!button || items.querySelectorAll('.order-item-row').length === 1) return;
        button.closest('.order-item-row').remove();
        syncRemoveButtons();
    });

    syncRemoveButtons();
});
</script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/mac/Documents/e-com/resources/views/admin/orders/create.blade.php ENDPATH**/ ?>