<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="rounded-2xl border border-sky-200/70 bg-gradient-to-r from-sky-50 to-green-50 px-5 py-4">
            <h2 class="text-xl font-semibold leading-tight text-sky-900">
                <?php echo e(__('Edit Package')); ?>

            </h2>
        </div>
     <?php $__env->endSlot(); ?>

    <div class="py-8">
        <div class="mx-auto max-w-2xl px-4 sm:px-6 lg:px-8">
            <div class="overflow-hidden rounded-2xl border border-sky-200/70 bg-white shadow-sm">
                <div class="p-6">
                    <form action="<?php echo e(route('admin.packages.update', $package)); ?>" method="POST" class="space-y-6">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('PUT'); ?>

                        <div>
                            <label for="name" class="block text-sm font-medium text-gray-700"><?php echo e(__('Package Name')); ?></label>
                            <input type="text" id="name" name="name" value="<?php echo e(old('name', $package->name)); ?>"
                                class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('name') ? 'border-red-500' : 'border-sky-300'); ?>"
                                placeholder="e.g., Basic, Standard, Premium" required />
                            <?php $__errorArgs = ['name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div>
                            <label for="description" class="block text-sm font-medium text-gray-700"><?php echo e(__('Description')); ?></label>
                            <textarea id="description" name="description" rows="3"
                                class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('description') ? 'border-red-500' : 'border-sky-300'); ?>"
                                placeholder="Package description"><?php echo e(old('description', $package->description)); ?></textarea>
                            <?php $__errorArgs = ['description'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        </div>

                        <div class="grid grid-cols-2 gap-4">
                            <div>
                                <label for="driver_limit" class="block text-sm font-medium text-gray-700"><?php echo e(__('Driver Limit')); ?></label>
                                <input type="number" id="driver_limit" name="driver_limit" value="<?php echo e(old('driver_limit', $package->driver_limit)); ?>" min="1"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('driver_limit') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required />
                                <?php $__errorArgs = ['driver_limit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div>
                                <label for="truck_limit" class="block text-sm font-medium text-gray-700"><?php echo e(__('Truck Limit')); ?></label>
                                <input type="number" id="truck_limit" name="truck_limit" value="<?php echo e(old('truck_limit', $package->truck_limit)); ?>" min="1"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('truck_limit') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required />
                                <?php $__errorArgs = ['truck_limit'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>

                        <div class="grid grid-cols-3 gap-4">
                            <div>
                                <label for="base_price" class="block text-sm font-medium text-gray-700"><?php echo e(__('Base Price ($)')); ?></label>
                                <input type="number" id="base_price" name="base_price" value="<?php echo e(old('base_price', $package->base_price)); ?>" min="0" step="0.01"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('base_price') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required />
                                <?php $__errorArgs = ['base_price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div>
                                <label for="price_per_driver" class="block text-sm font-medium text-gray-700"><?php echo e(__('Price Per Driver ($)')); ?></label>
                                <input type="number" id="price_per_driver" name="price_per_driver" value="<?php echo e(old('price_per_driver', $package->price_per_driver)); ?>" min="0" step="0.01"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('price_per_driver') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required />
                                <?php $__errorArgs = ['price_per_driver'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div>
                                <label for="price" class="block text-sm font-medium text-gray-700"><?php echo e(__('Legacy Price ($)')); ?></label>
                                <input type="number" id="price" name="price" value="<?php echo e(old('price', $package->price)); ?>" min="0" step="0.01"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('price') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required />
                                <?php $__errorArgs = ['price'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            <div>
                                <label for="billing_cycle" class="block text-sm font-medium text-gray-700"><?php echo e(__('Billing Cycle')); ?></label>
                                <select id="billing_cycle" name="billing_cycle"
                                    class="mt-1 block w-full rounded-md border px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500 <?php echo e($errors->has('billing_cycle') ? 'border-red-500' : 'border-sky-300'); ?>"
                                    required>
                                    <option value="monthly" <?php echo e(old('billing_cycle', $package->billing_cycle) === 'monthly' ? 'selected' : ''); ?>><?php echo e(__('Monthly')); ?></option>
                                    <option value="weekly" <?php echo e(old('billing_cycle', $package->billing_cycle) === 'weekly' ? 'selected' : ''); ?>><?php echo e(__('Weekly')); ?></option>
                                </select>
                                <?php $__errorArgs = ['billing_cycle'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="mt-1 text-sm text-red-500"><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>
                        </div>

                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2"><?php echo e(__('Features')); ?></label>
                            <div id="features-container" class="space-y-2">
                                <?php $__empty_1 = true; $__currentLoopData = old('features', $package->features ?? []); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php if(is_array($feature) && isset($feature['key'])): ?>
                                        <div class="flex gap-2">
                                            <input type="text" name="features[<?php echo e($index); ?>][key]" value="<?php echo e($feature['key']); ?>"
                                                placeholder="Feature name"
                                                class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                                            <input type="text" name="features[<?php echo e($index); ?>][value]" value="<?php echo e($feature['value']); ?>"
                                                placeholder="Feature value"
                                                class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                                            <button type="button" onclick="removeFeature(<?php echo e($index); ?>)"
                                                class="px-3 py-2 bg-red-600 text-white rounded hover:bg-red-700">
                                                <?php echo e(__('Remove')); ?>

                                            </button>
                                        </div>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <div class="flex gap-2">
                                        <input type="text" name="features[0][key]" placeholder="Feature name"
                                            class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                                        <input type="text" name="features[0][value]" placeholder="Feature value"
                                            class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                                        <button type="button" onclick="removeFeature(0)"
                                            class="px-3 py-2 bg-red-600 text-white rounded hover:bg-red-700">
                                            <?php echo e(__('Remove')); ?>

                                        </button>
                                    </div>
                                <?php endif; ?>
                            </div>
                            <button type="button" onclick="addFeature()"
                                class="mt-2 rounded bg-gray-600 px-4 py-2 text-white hover:bg-gray-700">
                                + <?php echo e(__('Add Feature')); ?>

                            </button>
                        </div>

                        <div class="flex items-center">
                            <input type="checkbox" id="is_active" name="is_active" value="1" <?php echo e(old('is_active', $package->is_active) ? 'checked' : ''); ?>

                                class="rounded border-sky-300 text-sky-600 shadow-sm focus:border-sky-400 focus:ring focus:ring-sky-200 focus:ring-opacity-50" />
                            <label for="is_active" class="ml-2 text-sm text-gray-700"><?php echo e(__('Active')); ?></label>
                        </div>

                        <div class="flex gap-4">
                            <button type="submit"
                                class="rounded bg-sky-600 px-4 py-2 font-semibold text-white transition hover:bg-sky-700">
                                <?php echo e(__('Update Package')); ?>

                            </button>
                            <a href="<?php echo e(route('admin.packages.index')); ?>"
                                class="rounded bg-gray-600 px-4 py-2 font-semibold text-white transition hover:bg-gray-700">
                                <?php echo e(__('Cancel')); ?>

                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script>
        function addFeature() {
            const container = document.getElementById('features-container');
            const index = container.children.length;
            const html = `
                <div class="flex gap-2">
                    <input type="text" name="features[${index}][key]" placeholder="Feature name"
                        class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                    <input type="text" name="features[${index}][value]" placeholder="Feature value"
                        class="flex-1 rounded-md border border-sky-300 px-3 py-2 shadow-sm focus:border-sky-500 focus:outline-none focus:ring-sky-500" />
                    <button type="button" onclick="removeFeature(${index})"
                        class="px-3 py-2 bg-red-600 text-white rounded hover:bg-red-700">
                        <?php echo e(__('Remove')); ?>

                    </button>
                </div>
            `;
            container.insertAdjacentHTML('beforeend', html);
        }

        function removeFeature(index) {
            const elements = document.querySelectorAll('#features-container > div');
            if (elements[index]) {
                elements[index].remove();
            }
        }
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH D:\true-trucker\web\resources\views/admin/packages/edit.blade.php ENDPATH**/ ?>