<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>إذن تجهيز بضاعة - أمر #<?php echo e($purchaseOrder->id); ?></title>
    <style>
        * { font-family: 'xbriyaz', sans-serif; }
        body { margin: 20px; font-size: 12px; color: #333; direction: rtl; text-align: right; }
        .header { text-align: center; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid #10b981; }
        .logo { font-size: 22px; font-weight: bold; color: #10b981; }
        .title { font-size: 16px; margin-top: 8px; color: #333; }
        .meta { margin: 18px 0; }
        .meta-row { padding: 4px 0; }
        .meta-label { font-weight: bold; color: #666; display: inline-block; width: 120px; }
        table { width: 100%; border-collapse: collapse; margin: 20px 0; }
        th, td { border: 1px solid #ddd; padding: 10px; text-align: right; }
        th { background: #f8fafc; font-weight: bold; }
        .footer { margin-top: 30px; text-align: center; font-size: 10px; color: #888; }
    </style>
</head>
<body dir="rtl">
    <div class="header">
        <div class="logo">تاجر بلس</div>
        <div class="title">إذن تجهيز بضاعة - أمر شراء #<?php echo e($purchaseOrder->id); ?></div>
    </div>

    <div class="meta">
        <div class="meta-row"><span class="meta-label">رقم أمر الشراء:</span> #<?php echo e($purchaseOrder->id); ?></div>
        <div class="meta-row"><span class="meta-label">المورد:</span> <?php echo e($purchaseOrder->supplier?->name ?? '—'); ?></div>
        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($purchaseOrder->sourceOrder): ?>
        <div class="meta-row"><span class="meta-label">الطلب المرتبط:</span> #<?php echo e($purchaseOrder->sourceOrder->id); ?></div>
        <div class="meta-row"><span class="meta-label">التاريخ:</span> <?php echo e($purchaseOrder->created_at->format('Y-m-d')); ?></div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </div>

    <table dir="rtl">
        <thead>
            <tr>
                <th>#</th>
                <th style="width:70px;">الصورة</th>
                <th>اسم الصنف</th>
                <th>النقشة</th>
                <th>الكمية</th>
            </tr>
        </thead>
        <tbody>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $purchaseOrder->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoop($loop->index); ?><?php endif; ?>
            <?php
                $variant = $item->variant;
                $imgPath = $variant?->image_thumbnail ?? $variant?->image_webp ?? $variant?->image;
                $imgSrc = null;
                if ($imgPath) {
                    $fullPath = storage_path('app/public/' . $imgPath);
                    if (file_exists($fullPath)) {
                        $imgSrc = $imgPath;
                    }
                }
            ?>
            <tr>
                <td><?php echo e($i + 1); ?></td>
                <td>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($imgSrc): ?>
                        <img src="<?php echo e($imgSrc); ?>" alt="" style="width:60px; height:60px; object-fit:cover;" />
                    <?php else: ?>
                        <div style="width:60px; height:60px; background:#f1f5f9; display:flex; align-items:center; justify-content:center; color:#94a3b8; font-size:10px;">—</div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </td>
                <td><?php echo e($item->variant?->product?->name ?? 'منتج'); ?></td>
                <td><?php echo e($item->variant?->pattern_name ?? '-'); ?></td>
                <td><?php echo e($item->quantity); ?></td>
            </tr>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
        </tbody>
    </table>

    <div class="footer" style="margin-top: 40px;">
        يرجى تجهيز البضاعة أعلاه وتنسيق التسليم مع الإدارة
    </div>
</body>
</html>
<?php /**PATH E:\Laravel-Project\tager_plus\resources\views/pdf/supplier-preparation-slip.blade.php ENDPATH**/ ?>