<?php if($entity->status == 0): ?>
<div class="btn-group">
    <button 
            type="button"
            class="btn btn-success"
            title="<?php echo app('translator')->get('Potvrdi placanje'); ?>"
            data-title="<?php echo app('translator')->get('Potvrdi placanje'); ?>"
            data-action="delete"
            data-id="<?php echo e($entity->id); ?>"
            data-text="Da li ste sigurni da želite da potvrdite placanje fakture #~b~#"
            data-label="<?php echo e($entity->id_invoice); ?>"
            data-ajax-url="<?php echo e(route('truck.invoices_procurement_paid', ['entity' => $entity->id])); ?>"
        >
            Potvrdi placanje
    </button>
</div>
<?php else: ?>
    <?php if($entity->date_done): ?>
    <div class="btn-group">
        <button 
                type="button"
                class="btn btn-light"
                disabled
            >
            <?php echo e(\Carbon\Carbon::parse($entity->date_done)->format('d-m-Y')); ?>

            </button>
    </div>
    <?php endif; ?>
<?php endif; ?>

<div class="btn-group">
    <button type="button" class="btn btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        Opcije
    </button>
    <div class="dropdown-menu">
        <a 
            href="<?php echo e(route('truck.invoices_procurement_edit', ['entity' => $entity->id])); ?>" 
            class="dropdown-item btn btn-warning"
            title="<?php echo app('translator')->get('Izmeni'); ?>"
        >
            <i class="fa fa-pencil"></i> Izmeni
        </a>
        <button 
            type="button"
            class="dropdown-item btn btn-danger"
            title="<?php echo app('translator')->get('Obriši'); ?>"
            data-title="<?php echo app('translator')->get('Obriši'); ?>"
            data-action="delete"
            data-id="<?php echo e($entity->id); ?>"
            data-text="Da li ste sigurni da želite da obrišete fakturu #~b~#"
            data-label="<?php echo e($entity->id_invoice); ?>"
            data-ajax-url="<?php echo e(route('truck.invoices_procurement_delete', ['entity' => $entity->id])); ?>"
        >
            <i class="fa fa-trash"></i> Obriši
        </button>
        <button 
            type="button"
            class="dropdown-item btn btn-info"
            title="<?php echo app('translator')->get('Pregled'); ?>"
            onclick="showProcurementInvoice(<?php echo e($entity->id); ?>)"
        >
            <i class="fa fa-file-text-o"></i> Pregled fakture
        </button>
    </div>
</div>
<script>
    function showProcurementInvoice(invoiceId) {
        // Generišemo URL koristeći imenovanu rutu
        var invoiceUrl = "<?php echo e(route('truck.invoices_procurement.A4View', ['id' => 'INVOICE_ID_PLACEHOLDER'])); ?>".replace('INVOICE_ID_PLACEHOLDER', invoiceId);
        document.getElementById('invoiceFrame').src = invoiceUrl;
        $('#invoiceProcurementModal').modal('show');
    }
</script><?php /**PATH /opt/cms/resources/views/truck/invoices_procurement/partials/table/actions.blade.php ENDPATH**/ ?>