<?php defined('ABSPATH') || exit; $S=\DZQCOD\Core::ST;
$orders=wc_get_orders(['limit'=>30,'orderby'=>'date','order'=>'DESC']); ?>
<div class="wrap dza-wrap" dir="rtl">
<div class="dza-header"><h1>الطباعة</h1></div>
<?php include __DIR__.'/nav.php'; ?>
<div class="dza-content">
<div class="dza-batch-bar"><button class="dza-btn primary" id="batch-print">🖨️ طباعة المحدد</button><label><input type="checkbox" id="check-all"> الكل</label></div>
<table class="dza-table"><thead><tr><th><input type="checkbox"></th><th>#</th><th>العميل</th><th>الهاتف</th><th>الولاية</th><th>المبلغ</th><th>الحالة</th><th></th></tr></thead><tbody>
<?php foreach($orders as $o): $st=str_replace('wc-','',$o->get_status()); $sc=$S[$st]??['l'=>$st,'c'=>'#999','i'=>'']; ?>
<tr><td><input type="checkbox" class="order-check" value="<?php echo (int)$o->get_id(); ?>"></td><td>#<?php echo (int)$o->get_id(); ?></td>
<td><?php echo esc_html($o->get_billing_first_name()); ?></td><td class="ltr"><?php echo esc_html($o->get_billing_phone()); ?></td>
<td><?php echo esc_html($o->get_shipping_state()); ?></td><td class="bold"><?php echo number_format((float)$o->get_total(),0); ?> دج</td>
<td><span class="dza-badge" style="background:<?php echo esc_html($sc['c']); ?>"><?php echo esc_html($sc['l']); ?></span></td>
<td><button class="dza-btn sm print-receipt" data-id="<?php echo (int)$o->get_id(); ?>">🖨️</button></td></tr>
<?php endforeach; ?></tbody></table></div></div>
</div><!--dza-main-->
</div><!--dza-layout-->
