
<?php
    $type = $type ?? 'text';
    $options = $options ?? [];
    $editable = $named && !empty($row['_passenger_id']);

    // Tarih değerleri manifesto satırında gg.aa.yyyy biçiminde gelir; input Y-m-d ister
    $rawValue = $value;
    if ($type === 'date' && $value) {
        try {
            $rawValue = \Illuminate\Support\Carbon::createFromFormat('d.m.Y', $value)->format('Y-m-d');
        } catch (\Throwable $e) {
            $rawValue = \Illuminate\Support\Carbon::parse($value)->format('Y-m-d');
        }
    }
?>

<?php if($editable): ?>
    <?php if($type === 'select'): ?>
        <select
            class="pmf-cell"
            data-url="<?php echo e($url); ?>"
            data-sale="<?php echo e($row['_sale_id']); ?>"
            data-passenger="<?php echo e($row['_passenger_id']); ?>"
            data-field="<?php echo e($field); ?>"
            data-prev="<?php echo e($rawValue); ?>"
            onchange="mfSaveCell(this)"
        >
            <option value=""><?php echo e($ph); ?></option>
            <?php $__currentLoopData = $options; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $optValue => $optLabel): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($optValue); ?>" <?php if((string) $rawValue === (string) $optValue): echo 'selected'; endif; ?>><?php echo e($optLabel); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    <?php else: ?>
        <input
            type="<?php echo e($type === 'date' ? 'date' : 'text'); ?>"
            class="pmf-cell"
            value="<?php echo e($rawValue); ?>"
            placeholder="<?php echo e($ph); ?>"
            data-url="<?php echo e($url); ?>"
            data-sale="<?php echo e($row['_sale_id']); ?>"
            data-passenger="<?php echo e($row['_passenger_id']); ?>"
            data-field="<?php echo e($field); ?>"
            data-prev="<?php echo e($rawValue); ?>"
            <?php if($field === 'national_id'): ?> inputmode="numeric" maxlength="11" <?php endif; ?>
            onchange="mfSaveCell(this)"
            onkeydown="if(event.key==='Enter'){this.blur();}"
        >
    <?php endif; ?>
<?php else: ?>
    <span class="pmf-dash" title="Yolcu adı girilmeden düzenlenemez">—</span>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\acente\resources\views/agency/operations/partials/manifest-cell.blade.php ENDPATH**/ ?>