
<?php $__env->startSection('title', isset($zoneRule) ? 'Edit Zone Rule' : 'Add Zone Rule'); ?>
<?php $__env->startSection('breadcrumb'); ?>
    <a href="<?php echo e(route('admin.zone-rules.index')); ?>" class="breadcrumb-link">Zone Rules</a>
    <span class="breadcrumb-sep">/</span>
    <span class="current"><?php echo e(isset($zoneRule) ? 'Edit' : 'Add'); ?></span>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="page-header">
    <h1 class="page-title">
        <span class="title-icon"><i data-lucide="sliders" style="width:20px;height:20px;"></i></span>
        <?php echo e(isset($zoneRule) ? 'Edit Zone Rule' : 'Add Zone Rule'); ?>

    </h1>
</div>

<div class="admin-table-wrap" style="max-width:800px;">
    <form method="POST" action="<?php echo e(isset($zoneRule) ? route('admin.zone-rules.update', $zoneRule) : route('admin.zone-rules.store')); ?>">
        <?php echo csrf_field(); ?>
        <?php if(isset($zoneRule)): ?> <?php echo method_field('PUT'); ?> <?php endif; ?>

        <div style="padding:20px;">
            
            <div class="section-label" style="font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--vsc-text-secondary);margin-bottom:12px;">Zone Identification</div>
            <div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:24px;">
                <div class="form-group">
                    <label class="form-label">Zone <span style="color:var(--vsc-red);">*</span></label>
                    <select name="zone_id" class="form-control <?php $__errorArgs = ['zone_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required>
                        <option value="">Select Zone</option>
                        <?php $__currentLoopData = $zones; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $zone): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($zone->id); ?>" <?php echo e(old('zone_id', $zoneRule->zone_id ?? '') == $zone->id ? 'selected' : ''); ?>>
                                <?php echo e($zone->name); ?> (<?php echo e($zone->state?->code ?? ''); ?>)
                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                    <?php $__errorArgs = ['zone_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div class="form-group">
                    <label class="form-label">City (optional)</label>
                    <select name="city_id" class="form-control <?php $__errorArgs = ['city_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>">
                        <option value="">Any City</option>
                        <?php $__currentLoopData = $cities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $city): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($city->id); ?>" <?php echo e(old('city_id', $zoneRule->city_id ?? '') == $city->id ? 'selected' : ''); ?>><?php echo e($city->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                    <?php $__errorArgs = ['city_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>

            
            <div class="section-label" style="font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--vsc-text-secondary);margin-bottom:12px;">Road Width Range (metres)</div>
            <div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:24px;">
                <div class="form-group">
                    <label class="form-label">Min Road Width (m)</label>
                    <input type="number" name="road_width_min_m" step="0.1" class="form-control"
                        value="<?php echo e(old('road_width_min_m', $zoneRule->road_width_min_m ?? '')); ?>" placeholder="e.g. 9">
                </div>
                <div class="form-group">
                    <label class="form-label">Max Road Width (m)</label>
                    <input type="number" name="road_width_max_m" step="0.1" class="form-control"
                        value="<?php echo e(old('road_width_max_m', $zoneRule->road_width_max_m ?? '')); ?>" placeholder="e.g. 12 (blank = no upper limit)">
                </div>
            </div>

            
            <div class="section-label" style="font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--vsc-text-secondary);margin-bottom:12px;">Building Parameters</div>
            <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px;margin-bottom:24px;">
                <div class="form-group">
                    <label class="form-label">Max FAR <span style="color:var(--vsc-red);">*</span></label>
                    <input type="number" name="max_far" step="0.01" class="form-control <?php $__errorArgs = ['max_far'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                        value="<?php echo e(old('max_far', $zoneRule->max_far ?? '')); ?>" required placeholder="e.g. 2.5">
                    <?php $__errorArgs = ['max_far'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div class="form-group">
                    <label class="form-label">Max Height (m)</label>
                    <input type="number" name="max_height_m" step="0.1" class="form-control"
                        value="<?php echo e(old('max_height_m', $zoneRule->max_height_m ?? '')); ?>" placeholder="e.g. 70">
                </div>
                <div class="form-group">
                    <label class="form-label">Max Ground Coverage</label>
                    <input type="number" name="max_ground_coverage" step="0.01" min="0" max="1" class="form-control"
                        value="<?php echo e(old('max_ground_coverage', $zoneRule->max_ground_coverage ?? '')); ?>" placeholder="0–1, e.g. 0.40">
                    <small style="color:var(--vsc-text-secondary);font-size:11px;">Decimal (0.40 = 40%)</small>
                </div>
                <div class="form-group">
                    <label class="form-label">Open Space %</label>
                    <input type="number" name="open_space_pct" step="0.01" min="0" max="100" class="form-control"
                        value="<?php echo e(old('open_space_pct', $zoneRule->open_space_pct ?? '')); ?>" placeholder="e.g. 10">
                </div>
                <div class="form-group">
                    <label class="form-label">Parking Ratio (ECS/sqm)</label>
                    <input type="number" name="parking_ratio_ecs" step="0.0001" class="form-control"
                        value="<?php echo e(old('parking_ratio_ecs', $zoneRule->parking_ratio_ecs ?? '')); ?>" placeholder="e.g. 0.0028">
                </div>
            </div>

            
            <div class="section-label" style="font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--vsc-text-secondary);margin-bottom:12px;">Setbacks (metres)</div>
            <div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:16px;margin-bottom:24px;">
                <div class="form-group">
                    <label class="form-label">Front Setback (m)</label>
                    <input type="number" name="front_setback_m" step="0.1" class="form-control"
                        value="<?php echo e(old('front_setback_m', $zoneRule->front_setback_m ?? '')); ?>" placeholder="e.g. 3">
                </div>
                <div class="form-group">
                    <label class="form-label">Side Setback (m)</label>
                    <input type="number" name="side_setback_m" step="0.1" class="form-control"
                        value="<?php echo e(old('side_setback_m', $zoneRule->side_setback_m ?? '')); ?>" placeholder="e.g. 1.5">
                </div>
                <div class="form-group">
                    <label class="form-label">Rear Setback (m)</label>
                    <input type="number" name="rear_setback_m" step="0.1" class="form-control"
                        value="<?php echo e(old('rear_setback_m', $zoneRule->rear_setback_m ?? '')); ?>" placeholder="e.g. 3">
                </div>
            </div>

            
            <div class="section-label" style="font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--vsc-text-secondary);margin-bottom:12px;">Metadata</div>
            <div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px;">
                <div class="form-group">
                    <label class="form-label">Rule Source</label>
                    <input type="text" name="rule_source" class="form-control"
                        value="<?php echo e(old('rule_source', $zoneRule->rule_source ?? '')); ?>" placeholder="e.g. DCPR 2034 Table 12">
                </div>
                <div class="form-group">
                    <label class="form-label">Version / Amendment</label>
                    <input type="text" name="version" class="form-control"
                        value="<?php echo e(old('version', $zoneRule->version ?? '')); ?>" placeholder="e.g. 2024-A">
                </div>
                <div class="form-group" style="grid-column:span 2;">
                    <label class="form-label">Special Conditions / Notes</label>
                    <textarea name="special_conditions" class="form-control" rows="2"
                        placeholder="e.g. Applicable only for plots > 1000 sqm"><?php echo e(old('special_conditions', $zoneRule->special_conditions ?? '')); ?></textarea>
                </div>
            </div>

            <div class="form-group">
                <label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
                    <input type="hidden" name="is_active" value="0">
                    <input type="checkbox" name="is_active" value="1" <?php echo e(old('is_active', $zoneRule->is_active ?? true) ? 'checked' : ''); ?>>
                    <span class="form-label" style="margin:0;">Active</span>
                </label>
            </div>
        </div>

        <div style="padding:16px 20px;border-top:1px solid var(--vsc-border-light);display:flex;gap:8px;">
            <button type="submit" class="btn btn-primary"><i data-lucide="save" style="width:14px;height:14px;"></i> <?php echo e(isset($zoneRule) ? 'Update' : 'Create'); ?></button>
            <a href="<?php echo e(route('admin.zone-rules.index')); ?>" class="btn btn-secondary">Cancel</a>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp_lite_8_4\www\landfeasibility\resources\views/admin/zone-rules/form.blade.php ENDPATH**/ ?>