
<?php $__env->startSection('title', 'Edit Pesanan'); ?>
<?php $__env->startSection('content'); ?>

<div class="container">
    <form method="POST" action="<?php echo e(route('orders.update', $order->id)); ?>">
        <?php echo csrf_field(); ?>
        <?php echo method_field('PUT'); ?>

        <?php if (isset($component)) { $__componentOriginal262894a2c291df91ae9f7b925bf8a923 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal262894a2c291df91ae9f7b925bf8a923 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-text','data' => ['inRowLabel' => 'Nama Customer','name' => 'customer_name','required' => true,'placeholder' => 'Masukkan nama customer','value' => old('customer_name', $order->customer_name),'errorMessage' => $errors->first('customer_name')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-text'); ?>
<?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(['inRowLabel' => 'Nama Customer','name' => 'customer_name','required' => true,'placeholder' => 'Masukkan nama customer','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('customer_name', $order->customer_name)),'errorMessage' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->first('customer_name'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $attributes = $__attributesOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $component = $__componentOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__componentOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>

        <?php if (isset($component)) { $__componentOriginal262894a2c291df91ae9f7b925bf8a923 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal262894a2c291df91ae9f7b925bf8a923 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-text','data' => ['inRowLabel' => 'No. HP Customer','name' => 'customer_phone','placeholder' => 'Masukkan no. HP customer (opsional)','value' => old('customer_phone', $order->customer_phone),'errorMessage' => $errors->first('customer_phone')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-text'); ?>
<?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(['inRowLabel' => 'No. HP Customer','name' => 'customer_phone','placeholder' => 'Masukkan no. HP customer (opsional)','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('customer_phone', $order->customer_phone)),'errorMessage' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->first('customer_phone'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $attributes = $__attributesOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $component = $__componentOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__componentOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>

        <?php if (isset($component)) { $__componentOriginal0005bf01aa83ec4ca92674161039a6ca = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal0005bf01aa83ec4ca92674161039a6ca = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-select','data' => ['inRowLabel' => 'Status','name' => 'status','options' => ['pending'=>'Pending','completed'=>'Completed','scheduled'=>'Scheduled'],'value' => old('status', $order->status)]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-select'); ?>
<?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(['inRowLabel' => 'Status','name' => 'status','options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(['pending'=>'Pending','completed'=>'Completed','scheduled'=>'Scheduled']),'value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('status', $order->status))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal0005bf01aa83ec4ca92674161039a6ca)): ?>
<?php $attributes = $__attributesOriginal0005bf01aa83ec4ca92674161039a6ca; ?>
<?php unset($__attributesOriginal0005bf01aa83ec4ca92674161039a6ca); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal0005bf01aa83ec4ca92674161039a6ca)): ?>
<?php $component = $__componentOriginal0005bf01aa83ec4ca92674161039a6ca; ?>
<?php unset($__componentOriginal0005bf01aa83ec4ca92674161039a6ca); ?>
<?php endif; ?>

        <div id="pickup-wrapper" style="display:none;">
            <?php if (isset($component)) { $__componentOriginal262894a2c291df91ae9f7b925bf8a923 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal262894a2c291df91ae9f7b925bf8a923 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-text','data' => ['inRowLabel' => 'Tanggal Ambil','name' => 'pickup_date','type' => 'date','value' => old('pickup_date', $order->pickup_date ? $order->pickup_date->format('Y-m-d') : ''),'errorMessage' => $errors->first('pickup_date')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-text'); ?>
<?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(['inRowLabel' => 'Tanggal Ambil','name' => 'pickup_date','type' => 'date','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('pickup_date', $order->pickup_date ? $order->pickup_date->format('Y-m-d') : '')),'errorMessage' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->first('pickup_date'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $attributes = $__attributesOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $component = $__componentOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__componentOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>
        </div>

        <?php if (isset($component)) { $__componentOriginal262894a2c291df91ae9f7b925bf8a923 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal262894a2c291df91ae9f7b925bf8a923 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.input-text','data' => ['inRowLabel' => 'Tanggal Order','name' => 'order_date','type' => 'date','required' => true,'value' => old('order_date', $order->order_date ? $order->order_date->format('Y-m-d') : ''),'errorMessage' => $errors->first('order_date')]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('input-text'); ?>
<?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(['inRowLabel' => 'Tanggal Order','name' => 'order_date','type' => 'date','required' => true,'value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('order_date', $order->order_date ? $order->order_date->format('Y-m-d') : '')),'errorMessage' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($errors->first('order_date'))]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $attributes = $__attributesOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__attributesOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal262894a2c291df91ae9f7b925bf8a923)): ?>
<?php $component = $__componentOriginal262894a2c291df91ae9f7b925bf8a923; ?>
<?php unset($__componentOriginal262894a2c291df91ae9f7b925bf8a923); ?>
<?php endif; ?>

        <h5 class="mt-4">Products</h5>
        <p class="text-muted">Isi 0 jika tidak dipesan</p>

        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Produk</th>
                        <th>Jumlah</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <?php
                            $detail = $order->details->firstWhere('product_id', $product->id);
                        ?>
                        <tr>
                            <td>
                                <?php echo e($product->name); ?>

                                (Rp <?php echo e(number_format($product->price,0,',','.')); ?>)
                            </td>
                            <td>
                                <input type="number"
                                       name="products[<?php echo e($product->id); ?>][qty]"
                                       min="0"
                                       class="form-control"
                                       value="<?php echo e(old('products.'.$product->id.'.qty', $detail->qty ?? 0)); ?>">
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>

        <div class="d-flex justify-content-between mt-4">
            <?php if (isset($component)) { $__componentOriginalb04da7a8feb93a7268b6e0eef6b32739 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb04da7a8feb93a7268b6e0eef6b32739 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.gold-button','data' => ['type' => 'button','onclick' => 'window.location.href=\''.e(route('orders.index')).'\'']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('gold-button'); ?>
<?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(['type' => 'button','onclick' => 'window.location.href=\''.e(route('orders.index')).'\'']); ?>
                Back
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb04da7a8feb93a7268b6e0eef6b32739)): ?>
<?php $attributes = $__attributesOriginalb04da7a8feb93a7268b6e0eef6b32739; ?>
<?php unset($__attributesOriginalb04da7a8feb93a7268b6e0eef6b32739); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb04da7a8feb93a7268b6e0eef6b32739)): ?>
<?php $component = $__componentOriginalb04da7a8feb93a7268b6e0eef6b32739; ?>
<?php unset($__componentOriginalb04da7a8feb93a7268b6e0eef6b32739); ?>
<?php endif; ?>

            <?php if (isset($component)) { $__componentOriginald0f1fd2689e4bb7060122a5b91fe8561 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.button','data' => ['type' => 'submit']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('button'); ?>
<?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(['type' => 'submit']); ?>
                Update Order
             <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561)): ?>
<?php $attributes = $__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561; ?>
<?php unset($__attributesOriginald0f1fd2689e4bb7060122a5b91fe8561); ?>
<?php endif; ?>
<?php if (isset($__componentOriginald0f1fd2689e4bb7060122a5b91fe8561)): ?>
<?php $component = $__componentOriginald0f1fd2689e4bb7060122a5b91fe8561; ?>
<?php unset($__componentOriginald0f1fd2689e4bb7060122a5b91fe8561); ?>
<?php endif; ?>
        </div>
    </form>
</div>

<script>
document.addEventListener("DOMContentLoaded", function(){
    const statusSelect = document.querySelector('[name="status"]');
    const pickupWrapper = document.getElementById('pickup-wrapper');

    function togglePickup(){
        pickupWrapper.style.display =
            statusSelect.value === 'scheduled' ? 'block' : 'none';
    }

    togglePickup();
    statusSelect.addEventListener('change', togglePickup);
});
</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\PAW\PiaZhang\resources\views/orders/edit.blade.php ENDPATH**/ ?>