<?php $__env->startSection('page-title', 'Quotations'); ?>

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <div class="row mb-3">
        <div class="col-md-6">
            <h3>Quotation List</h3>
        </div>
        <div class="col-md-6 text-end">
            <a href="<?php echo e(route('quotations.create')); ?>" class="btn btn-primary">Add New Quotation</a>
            <a href="<?php echo e(route('quotations.sales')); ?>" class="btn btn-success">Sales Proposals</a>
        </div>
    </div>

    <?php if(session('success')): ?>
        <div class="alert alert-success"><?php echo e(session('success')); ?></div>
    <?php endif; ?>

    <div class="card">
        <div class="card-body">
            <table class="table table-bordered table-striped">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Date</th>
                        <th>Client</th>
                        <th>Company</th>
                        <th>Total</th>
                        <th>Status</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $quotations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $quotation): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr>
                            <td><?php echo e($quotation->quotation_number); ?></td>
                            <td><?php echo e($quotation->date ? \Illuminate\Support\Carbon::parse($quotation->date)->format('Y-m-d') : ''); ?></td>
                            <td><?php echo e($quotation->bill_to); ?></td>
                            <td><?php echo e($quotation->company_name); ?></td>
                            <td><?php echo e(number_format($quotation->total,2)); ?></td>
                            <td><?php echo e(ucfirst($quotation->status)); ?></td>
                            <td>
                                <a href="<?php echo e(route('quotations.show', $quotation)); ?>" class="btn btn-sm btn-secondary" target="_blank">Print</a>
                                <a href="<?php echo e(route('quotations.edit', $quotation)); ?>" class="btn btn-sm btn-info">Edit</a>
                                <form action="<?php echo e(route('quotations.destroy', $quotation)); ?>" method="POST" style="display:inline-block;" onsubmit="return confirm('Delete this quotation?');">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field('DELETE'); ?>
                                    <button class="btn btn-sm btn-danger">Delete</button>
                                </form>

                                <?php if($quotation->status !== 'sale'): ?>
                                    <form action="<?php echo e(route('quotations.updateStatus', $quotation)); ?>" method="POST" style="display:inline-block;">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('PATCH'); ?>
                                        <input type="hidden" name="status" value="sale">
                                        <button class="btn btn-sm btn-success">Sale</button>
                                    </form>
                                <?php endif; ?>
                                <?php if($quotation->status !== 'not_sale'): ?>
                                    <form action="<?php echo e(route('quotations.updateStatus', $quotation)); ?>" method="POST" style="display:inline-block;">
                                        <?php echo csrf_field(); ?>
                                        <?php echo method_field('PATCH'); ?>
                                        <input type="hidden" name="status" value="not_sale">
                                        <button class="btn btn-sm btn-warning">Not Sale</button>
                                    </form>
                                <?php endif; ?>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="7" class="text-center">No quotations found.</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\startup sabbir\Desktop\jannat\accounting-system\resources\views/quotations/index.blade.php ENDPATH**/ ?>