@extends('layouts.app')
@section('title', 'Item Supplier Details')

@section('content')
<div class="card">
    <div class="card-body">
        <div class="d-flex justify-content-between align-items-center mb-3">
            <h6 class="card-title mb-0">Item Supplier Details</h6>
            <div class="d-flex gap-2">
                <a href="{{ route('item-suppliers.edit', $item_supplier) }}" class="btn btn-primary">Edit</a>
                <a href="{{ route('item-suppliers.index') }}" class="btn btn-secondary">Back to List</a>
            </div>
        </div>

        <div class="row g-3">
            <div class="col-md-6">
                <label class="form-label fw-bold">Item</label>
                <p class="form-control-plaintext">{{ $item_supplier->item->name }} ({{ $item_supplier->item->sku }})</p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Supplier</label>
                <p class="form-control-plaintext">{{ $item_supplier->contact->name }} ({{ $item_supplier->contact->type }})</p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Primary Supplier</label>
                <p class="form-control-plaintext">
                    @if($item_supplier->is_primary)
                        <span class="badge badge-success">Yes</span>
                    @else
                        <span class="badge badge-secondary">No</span>
                    @endif
                </p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Lead Time</label>
                <p class="form-control-plaintext">
                    {{ $item_supplier->lead_time_days ? $item_supplier->lead_time_days . 'days' : 'Not specified' }}
                </p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Minimum Order Quantity</label>
                <p class="form-control-plaintext">
                    {{ $item_supplier->min_order_qty ? number_format($item_supplier->min_order_qty, 4) : 'Not specified' }}
                </p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Last Price</label>
                <p class="form-control-plaintext">
                    {{ $item_supplier->last_price ? 'PKR ' . number_format($item_supplier->last_price, 4) : 'Not specified' }}
                </p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Created At</label>
                <p class="form-control-plaintext">{{ $item_supplier->created_at->format('M d, Y H:i') }}</p>
            </div>

            <div class="col-md-6">
                <label class="form-label fw-bold">Last Updated</label>
                <p class="form-control-plaintext">{{ $item_supplier->updated_at->format('M d, Y H:i') }}</p>
            </div>
        </div>
    </div>
</div>
@endsection
