

<?php $__env->startSection('title', 'Quote Details'); ?>

<?php $__env->startSection('content'); ?>
<div class="tw-bg-gray-50 tw-min-h-screen tw-py-8">
    <div class="container">
        <div class="row g-4">
            <!-- Sidebar -->
            <div class="col-lg-3">
                <?php echo $__env->make('seller.partials.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            </div>

            <!-- Main Content -->
            <div class="col-lg-9">
    <!-- Breadcrumb -->
    <nav aria-label="breadcrumb" class="mb-4">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="<?php echo e(route('seller.dashboard')); ?>">Dashboard</a></li>
            <li class="breadcrumb-item"><a href="<?php echo e(route('seller.quotes.index')); ?>">My Quotes</a></li>
            <li class="breadcrumb-item active">Quote #<?php echo e($quote->id); ?></li>
        </ol>
    </nav>

    <div class="row g-4">
        <!-- Left: RFQ Details -->
        <div class="col-lg-6">
            <div class="card border-0 shadow-sm h-100">
                <div class="card-header bg-white py-3">
                    <h5 class="fw-bold mb-0">
                        <i class="bi bi-file-earmark-text me-2 text-primary"></i>
                        Buyer Requirement
                    </h5>
                </div>
                <div class="card-body">
                    <?php if($quote->rfq): ?>
                        <h4 class="fw-bold mb-3"><?php echo e($quote->rfq->title); ?></h4>

                        <div class="row g-3 mb-4">
                            <div class="col-6">
                                <div class="tw-bg-gray-50 tw-rounded-lg tw-p-3">
                                    <small class="text-muted">Quantity</small>
                                    <div class="fw-bold"><?php echo e($quote->rfq->quantity ?? 'N/A'); ?></div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="tw-bg-gray-50 tw-rounded-lg tw-p-3">
                                    <small class="text-muted">Budget</small>
                                    <div class="fw-bold"><?php echo e($quote->rfq->budget ? '₹' . number_format($quote->rfq->budget) : 'Open'); ?></div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="tw-bg-gray-50 tw-rounded-lg tw-p-3">
                                    <small class="text-muted">Location</small>
                                    <div class="fw-bold"><?php echo e($quote->rfq->delivery_location ?? 'India'); ?></div>
                                </div>
                            </div>
                            <div class="col-6">
                                <div class="tw-bg-gray-50 tw-rounded-lg tw-p-3">
                                    <small class="text-muted">Posted</small>
                                    <div class="fw-bold"><?php echo e($quote->rfq->created_at->format('d M Y')); ?></div>
                                </div>
                            </div>
                        </div>

                        <h6 class="fw-bold mb-2">Description</h6>
                        <p class="text-muted" style="white-space: pre-line;"><?php echo e($quote->rfq->description); ?></p>

                        <hr>

                        <h6 class="fw-bold mb-3">Buyer Info</h6>
                        <div class="d-flex align-items-center">
                            <div class="tw-w-12 tw-h-12 tw-bg-orange-100 tw-rounded-full tw-flex tw-items-center tw-justify-center me-3 tw-text-orange-600 tw-font-bold tw-text-lg">
                                <?php echo e(strtoupper(substr($quote->rfq->buyer?->user?->name ?? 'B', 0, 1))); ?>

                            </div>
                            <div>
                                <div class="fw-bold"><?php echo e($quote->rfq->buyer?->user?->name ?? 'N/A'); ?></div>
                                <small class="text-muted"><?php echo e($quote->rfq->buyer?->company_name ?? ''); ?></small>
                            </div>
                        </div>
                    <?php else: ?>
                        <p class="text-muted">RFQ data not available.</p>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <!-- Right: My Quote -->
        <div class="col-lg-6">
            <div class="card border-0 shadow-sm mb-4">
                <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
                    <h5 class="fw-bold mb-0">
                        <i class="bi bi-send me-2 text-success"></i>
                        Your Quote
                    </h5>
                    <?php echo $quote->status_badge; ?>

                </div>
                <div class="card-body">
                    <div class="row g-3 mb-4">
                        <div class="col-6">
                            <div class="tw-bg-green-50 tw-rounded-lg tw-p-4 text-center">
                                <small class="text-muted">Quoted Price</small>
                                <div class="tw-text-2xl tw-font-bold tw-text-green-600">₹<?php echo e(number_format($quote->price, 2)); ?></div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="tw-bg-blue-50 tw-rounded-lg tw-p-4 text-center">
                                <small class="text-muted">Delivery</small>
                                <div class="tw-text-lg tw-font-bold tw-text-blue-600"><?php echo e($quote->delivery_timeline); ?></div>
                            </div>
                        </div>
                    </div>

                    <?php if($quote->message): ?>
                        <h6 class="fw-bold mb-2">Your Message</h6>
                        <div class="tw-bg-gray-50 tw-rounded-lg tw-p-3 mb-4">
                            <p class="mb-0" style="white-space: pre-line;"><?php echo e($quote->message); ?></p>
                        </div>
                    <?php endif; ?>

                    <?php if($quote->revised_price): ?>
                        <div class="alert alert-info">
                            <h6 class="fw-bold mb-1"><i class="bi bi-pencil me-1"></i> Revised Quote</h6>
                            <p class="mb-0">New Price: <strong>₹<?php echo e(number_format($quote->revised_price, 2)); ?></strong></p>
                            <?php if($quote->revised_message): ?>
                                <p class="mb-0 mt-2"><?php echo e($quote->revised_message); ?></p>
                            <?php endif; ?>
                            <small class="text-muted">Revised on <?php echo e($quote->seller_revised_at?->format('d M Y H:i')); ?></small>
                        </div>
                    <?php endif; ?>

                    <?php if($quote->buyer_response): ?>
                        <div class="alert alert-warning">
                            <h6 class="fw-bold mb-1"><i class="bi bi-chat-dots me-1"></i> Buyer's Response</h6>
                            <p class="mb-0"><?php echo e($quote->buyer_response); ?></p>
                        </div>
                    <?php endif; ?>

                    <!-- Revise Quote Button (if in negotiation) -->
                    <?php if($quote->status === 'negotiation' || $quote->status === 'under_review'): ?>
                        <hr>
                        <h6 class="fw-bold mb-3">Revise Your Quote</h6>
                        <form action="<?php echo e(route('seller.quotes.revise', $quote)); ?>" method="POST">
                            <?php echo csrf_field(); ?>
                            <div class="mb-3">
                                <label class="form-label">New Price (₹)</label>
                                <input type="number" name="revised_price" class="form-control" value="<?php echo e($quote->revised_price ?? $quote->price); ?>" required min="1">
                            </div>
                            <div class="mb-3">
                                <label class="form-label">Message</label>
                                <textarea name="revised_message" class="form-control" rows="3" placeholder="Explain your revised offer..."><?php echo e($quote->revised_message); ?></textarea>
                            </div>
                            <button type="submit" class="btn btn-primary">
                                <i class="bi bi-pencil me-1"></i> Submit Revision
                            </button>
                        </form>
                    <?php endif; ?>
                </div>
            </div>

            <!-- Status Timeline -->
            <div class="card border-0 shadow-sm">
                <div class="card-header bg-white py-3">
                    <h5 class="fw-bold mb-0">
                        <i class="bi bi-clock-history me-2 text-primary"></i>
                        Status Timeline
                    </h5>
                </div>
                <div class="card-body">
                    <div class="timeline">
                        <div class="timeline-item d-flex mb-3">
                            <div class="tw-w-10 tw-h-10 tw-bg-green-100 tw-rounded-full tw-flex tw-items-center tw-justify-center me-3 tw-flex-shrink-0">
                                <i class="bi bi-send tw-text-green-600"></i>
                            </div>
                            <div>
                                <div class="fw-bold">Quote Submitted</div>
                                <small class="text-muted"><?php echo e($quote->created_at->format('d M Y, H:i')); ?></small>
                            </div>
                        </div>

                        <?php if($quote->buyer_viewed_at): ?>
                            <div class="timeline-item d-flex mb-3">
                                <div class="tw-w-10 tw-h-10 tw-bg-blue-100 tw-rounded-full tw-flex tw-items-center tw-justify-center me-3 tw-flex-shrink-0">
                                    <i class="bi bi-eye tw-text-blue-600"></i>
                                </div>
                                <div>
                                    <div class="fw-bold">Viewed by Buyer</div>
                                    <small class="text-muted"><?php echo e($quote->buyer_viewed_at->format('d M Y, H:i')); ?></small>
                                </div>
                            </div>
                        <?php endif; ?>

                        <?php if($quote->status === 'accepted'): ?>
                            <div class="timeline-item d-flex">
                                <div class="tw-w-10 tw-h-10 tw-bg-green-500 tw-rounded-full tw-flex tw-items-center tw-justify-center me-3 tw-flex-shrink-0">
                                    <i class="bi bi-check-lg tw-text-white"></i>
                                </div>
                                <div>
                                    <div class="fw-bold text-success">Quote Accepted!</div>
                                    <small class="text-muted"><?php echo e($quote->updated_at->format('d M Y, H:i')); ?></small>
                                </div>
                            </div>
                        <?php elseif($quote->status === 'rejected'): ?>
                            <div class="timeline-item d-flex">
                                <div class="tw-w-10 tw-h-10 tw-bg-red-500 tw-rounded-full tw-flex tw-items-center tw-justify-center me-3 tw-flex-shrink-0">
                                    <i class="bi bi-x-lg tw-text-white"></i>
                                </div>
                                <div>
                                    <div class="fw-bold text-danger">Quote Rejected</div>
                                    <small class="text-muted"><?php echo e($quote->updated_at->format('d M Y, H:i')); ?></small>
                                </div>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="mt-4">
        <a href="<?php echo e(route('seller.quotes.index')); ?>" class="btn btn-outline-secondary">
            <i class="bi bi-arrow-left me-1"></i> Back to My Quotes
        </a>
    </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/u281583269/domains/theminiport.com/public_html/resources/views/seller/quotes/show.blade.php ENDPATH**/ ?>