@extends('layouts.app') @section('title', $supplier->display_name) @section('content')

{{ $supplier->display_name }}

Supplier Details

Supplier Information

Company Name
{{ $supplier->name }}
Codename
{{ $supplier->codename }}
Contact Person
@if($supplier->contact_person) {{ $supplier->contact_person }} @else Not specified @endif
Contact Number
@if($supplier->contact_number) {{ $supplier->contact_number }} @else Not provided @endif
Location
@if($supplier->location) {{ $supplier->location }} @else Not specified @endif
@if($supplier->notes)
Notes
{{ $supplier->notes }}
@endif

Quick Actions

Total Quotes

{{ $supplier->priceRecords->count() }}

Item Types

{{ $supplier->priceRecords->groupBy('item_type')->count() }}

Supplier Created

{{ $supplier->created_at->format('M d, Y \a\t h:i A') }}

Last Updated

{{ $supplier->updated_at->format('M d, Y \a\t h:i A') }}

Recent Price Records

View All
@if($supplier->priceRecords->count() > 0) @foreach($supplier->priceRecords->sortByDesc('quoted_at')->take(5) as $record) @endforeach
Item Type Description Quantity Unit Price Quoted Date Actions
{{ $record->item_type }}
@if($record->size_display)
{{ $record->size_display }}
@endif
{{ $record->short_description }}
{{ $record->quantity_with_uom }}
{{ $record->unit_price_formatted }}
{{ $record->postage_display }}
{{ $record->quoted_at->format('M d, Y') }}
{{ $record->quoted_at->diffForHumans() }}
@csrf
@else

No price records found

This supplier doesn't have any price records yet.

Add First Price Record
@endif
@if($supplier->priceRecords->count() > 0)

Item Type Summary

@php $itemTypes = $supplier->priceRecords->groupBy('item_type')->map(function($records, $type) { $latestRecord = $records->sortByDesc('quoted_at')->first(); return [ 'type' => $type, 'count' => $records->count(), 'latest_record' => $latestRecord, 'latest_price' => $latestRecord->unit_price_formatted, 'latest_quantity' => $latestRecord->quantity_with_uom, 'latest_postage' => $latestRecord->postage_display, 'latest_date' => $latestRecord->quoted_at->format('M d, Y'), 'latest_date_full' => $latestRecord->quoted_at, ]; })->sortByDesc(function($item) { return $item['latest_date_full']; }); @endphp @foreach($itemTypes as $item) @endforeach
Item Type Latest Price Quantity Postage Last Quoted Total Records Actions
{{ $item['type'] }}
{{ $item['latest_price'] }}
{{ $item['latest_quantity'] }}
{{ $item['latest_postage'] }}
{{ $item['latest_date'] }}
{{ \Carbon\Carbon::parse($item['latest_date_full'])->diffForHumans() }}
{{ $item['count'] }} {{ $item['count'] == 1 ? 'record' : 'records' }}

Total Item Types

{{ $itemTypes->count() }}

Most Quoted Type

@php $mostQuoted = $itemTypes->sortByDesc('count')->first(); @endphp {{ $mostQuoted['type'] ?? 'N/A' }}

{{ $mostQuoted['count'] ?? 0 }} records

Price Range

@php $minPrice = $supplier->priceRecords->min('unit_price'); $maxPrice = $supplier->priceRecords->max('unit_price'); @endphp RM {{ number_format($minPrice, 2) }} - RM {{ number_format($maxPrice, 2) }}

@endif

Danger Zone

Delete this supplier

Once deleted, this supplier and all associated price records will be permanently removed. @if($supplier->priceRecords->count() > 0)
Warning: This will delete {{ $supplier->priceRecords->count() }} price records! @endif

@csrf @method('DELETE')
@endsection