<?php $__env->startSection('title', $sale->sale_number); ?>
<?php $__env->startSection('content'); ?>
<div class="d-flex justify-content-between align-items-center mb-3">
    <h1 class="h4 mb-0"><?php echo e($sale->sale_number); ?></h1>
    <?php if($sale->invoice): ?>
        <div class="d-flex gap-2">
            <a class="btn btn-outline-primary btn-sm" href="<?php echo e(route('invoices.show',$sale->invoice)); ?>"><?php echo e(__('messages.invoice')); ?></a>
            <a class="btn btn-outline-secondary btn-sm" href="<?php echo e(route('invoices.print',$sale->invoice)); ?>"><?php echo e(__('messages.print')); ?></a>
        </div>
    <?php endif; ?>
</div>
<div class="row g-3">
    <div class="col-lg-7">
        <div class="card card-body">
            <div class="row">
                <div class="col-md-6"><div class="text-muted small"><?php echo e(__('messages.customer')); ?></div><a href="<?php echo e(route('customers.show',$sale->customer)); ?>"><?php echo e($sale->customer?->name); ?></a></div>
                <div class="col-md-6"><div class="text-muted small"><?php echo e(__('messages.line')); ?></div><a href="<?php echo e(route('lines.show',$sale->line)); ?>"><?php echo e($sale->line?->phone_number); ?></a></div>
                <div class="col-md-6 mt-3"><div class="text-muted small"><?php echo e(__('messages.plan')); ?></div><?php echo e($sale->plan?->name ?? __('messages.no_plan')); ?></div>
                <div class="col-md-6 mt-3"><div class="text-muted small"><?php echo e(__('messages.date')); ?></div><?php echo e(format_datetime($sale->created_at)); ?></div>
            </div>
            <table class="table compact-table mt-3 mb-0">
                <tbody>
                    <?php $__currentLoopData = $sale->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr><td><?php echo e($item->description); ?></td><td class="text-end"><?php echo e(money($item->total)); ?></td></tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <tr><th><?php echo e(__('messages.total')); ?></th><th class="text-end"><?php echo e(money($sale->total)); ?></th></tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="col-lg-5">
        <div class="card card-body">
            <div class="d-flex justify-content-between"><span><?php echo e(__('messages.line_price')); ?></span><strong><?php echo e(money($sale->line_price)); ?></strong></div>
            <?php if($sale->line_price_overridden): ?>
                <div class="small text-warning"><?php echo e(__('messages.original_price')); ?>: <?php echo e(money($sale->original_line_price)); ?></div>
            <?php endif; ?>
            <div class="d-flex justify-content-between mt-2"><span><?php echo e(__('messages.plan_price')); ?></span><strong><?php echo e(money($sale->plan_price)); ?></strong></div>
            <?php if($sale->plan_price_overridden): ?>
                <div class="small text-warning"><?php echo e(__('messages.original_price')); ?>: <?php echo e(money($sale->original_plan_price)); ?></div>
            <?php endif; ?>
            <?php if($sale->override_reason): ?>
                <div class="small mt-2"><?php echo e(__('messages.reason')); ?>: <?php echo e($sale->override_reason); ?> · <?php echo e($sale->overriddenBy?->name); ?></div>
            <?php endif; ?>
            <hr>
            <div class="d-flex justify-content-between"><span><?php echo e(__('messages.paid')); ?></span><?php echo e(money($sale->paid)); ?></div>
            <div class="d-flex justify-content-between"><span><?php echo e(__('messages.remaining')); ?></span><?php echo e(money($sale->remaining)); ?></div>
            <div class="d-flex justify-content-between"><span><?php echo e(__('messages.user')); ?></span><?php echo e($sale->user?->name); ?></div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\esim\resources\views/sales/show.blade.php ENDPATH**/ ?>