@extends('layouts.app') @section('title', 'Normalize Drug Categories') @section('content')

Normalize Drug Categories

Collapse legacy categories onto the approved 20-category list. One click per row.

Bulk Editor → ← Back to Drug List
{{-- Summary + legacy-category counts --}} @php $total = $drugs->count(); $canonInUse = $drugs->filter(fn($d) => $d->category && in_array($d->category, $canonical, true))->count(); $uncategorized = $drugs->filter(fn($d) => !$d->category)->count(); $legacy = $total - $canonInUse - $uncategorized; @endphp

Status

{{ $canonInUse }} / {{ $total }} on approved list

Need attention

{{ $legacy }} legacy · {{ $uncategorized }} uncategorized

@if($legacyCounts->count())

Legacy categories in use

@foreach($legacyCounts as $legacyName => $count) @endforeach
@endif
{{-- Toolbar --}}
No changes
{{-- Sheet --}}
@foreach($drugs as $d) @php $isCanon = $d->category && in_array($d->category, $canonical, true); $isUncat = !$d->category; $isLegacy = $d->category && !$isCanon; // Initial value for the dropdown: whichever is most useful // — if already canonical, keep it; else suggest; else blank. $initial = $isCanon ? $d->category : ($d->suggested_category ?: ''); @endphp @endforeach
Code Drug (name · generic) Current Suggested Assign Category *
{{ $d->code }}
{{ $d->name }}
@if($d->generic_name)
{{ $d->generic_name }}
@endif
@if($isCanon) {{ $d->category }} @elseif($isLegacy) {{ $d->category }} @else — none — @endif @if($d->suggested_category && $d->suggested_category !== $d->category) {{ $d->suggested_category }} @elseif($d->suggested_category && $d->suggested_category === $d->category) (same) @else No match @endif @if($d->suggested_category) @endif
@endsection