{{-- Formula Builder — Clinical Medical Form Edition Variables: $formula (edit), $usedCodes (edit) --}} @php $isEdit = isset($formula); $nameValue = old('name', $isEdit ? $formula->NAME : ''); $equationValue = old('equation', $isEdit ? $formula->DISPLAY_EQUATION : ''); @endphp {{-- ════════════════ HTML ════════════════ --}} @if ($errors->any())
Please correct the following:
@endif {{-- ① Name ───────────────────────────────────────── --}}
1
Formula Name
Name / Label
@error('name')
{{ $message }}
@enderror
{{-- ①(b) Options ───────────────────────────────────── --}}
✓
Formula Options
Flags
{{-- ② + ③ Main builder row ─────────────────────── --}}
{{-- LEFT: Test Picker ─────────────────────────── --}}
2
Lab Tests
{{-- Picker mode tabs --}}
{{-- Single tests panel --}}
Click a test to insert into the formula
{{-- Analysis parameters panel (e.g. CBC → Platelets) --}}
{{-- RIGHT: Builder ─────────────────────────────── --}}
3
Build Formula Numbers from keyboard · everything else via buttons
{{-- ── Formula Display Paper ─────────── --}}
Formula Expression Ready
Click a test from the left panel, then add operators below…
{{-- Raw formula one-liner --}}
{{-- Validation messages --}}
{{-- ── Patient Variables ──────────────── --}}
Patient Variables
{{-- ── Functions ──────────────────────── --}}
Math Functions
@foreach([ 'pow(' => 'pow(base, exponent)', 'min(' => 'min(a, b) — smaller', 'max(' => 'max(a, b) — larger', 'abs(' => 'abs(n) — absolute value', 'sqrt(' => 'sqrt(n) — square root', 'round(' => 'round(n) — round', ] as $fn => $hint) @endforeach
{{-- ── Operators ───────────────────────── --}}
Operators & Symbols
{{-- Parens + comma + dot --}} {{-- Arithmetic --}} {{-- Comparison --}} {{-- Ternary --}} {{-- Edit --}}
{{-- Legend --}}
KEY: Test result Patient variable Function Number Operator
{{-- /cf-card-body --}}
{{-- /cf-builder --}}
{{-- /cf-main-row --}} {{-- ④ Formula Tester ───────────────────────────── --}}
4
Test Calculator — Verify Result

Enter sample lab results and patient data to verify the formula calculates correctly before saving.

Calculated Result
—
{{-- ⑤ Accepted Range per Lab Test ─────────────────── --}} {{-- Actions ─────────────────────────────────────── --}}
@if (!$isEdit || !is_null($formula->PROFILE_ID)) @endif Back to Formulas
@push('formula-scripts') @endpush