{{-- Faithful (DORMANT — no Mailable/wiring yet) port of the HTML body built by legacy MailHandler::sendEmailBNTtoUser (public/referenceonly/mailhandler.php L7130–7261). Ported region: - banner heading L7161–7162 - header table (query1) L7164–7192 - detail table (query2) L7194–7243 FAITHFULNESS NOTES (this legacy email diverges from the "house style"): - It does NOT use the #570086 purple sub-banners. Its only heading is a line whose text embeds the caller-supplied $subject (L7162). Kept exactly — no purple bar added. - Header table is a bare with no rules/border/cellpadding (L7175). - Detail table is
with a #abc header row and #eee on odd (1-based) rows — NO rules/border/cellpadding attrs on this table either (L7202–7204,7224). Reproduced verbatim. - number_format(v, 2, '.', ',') — US grouping (dec '.', thousands ',') — on all numeric cells (L7234–7238); all numeric cells text-align:right. - Principal cell falls back: ASTPrincipalName if non-empty, else the joined principal.PrincipalName (L7228–7232). All values use {{ }} auto-escaping (safer than legacy raw concat). Null-safe ?-> mirrors legacy LEFT JOINs (missing lookups render empty). EXPECTED VARIABLE CONTRACT -------------------------- $bnt — one App\Models\BudgetAndTarget row representing the header group. (Legacy query1 GROUPs by periode/division/company/creator/sales, so one $bnt stands for the whole group; a Mailable would pass the first/ representative row. See notes re: multi-group emails.) $bnt->budgetAndTargetPeriode?->PeriodeName (bntp.PeriodeName) → PeriodeBnT $bnt->company?->CompanyName (c.CompanyName) → Company (UPPER + bold) $bnt->division?->DivisionName (d.DivisionName) → Division $bnt->userIDInput?->Nama (u.Nama) → Creator $bnt->userIDSales?->Nama (uu.Nama) → Sales $subject — free-text label supplied by the caller; embedded in the banner heading AND (in legacy) used as the mail Subject. $rows — the budget/target detail lines (legacy query2). Each an App\Models\BudgetAndTarget row. Per-column source: $r->ASTPrincipalName (bnt.ASTPrincipalName) → Principal (preferred) $r->principal?->PrincipalName (p.PrincipalName) → Principal (fallback) $r->ASTProductName (bnt.ASTProductName) → Product $r->QtBudget (bnt.QtBudget) → Budget(KG) $r->QtTarget (bnt.QtTarget) → Target(KG) $r->UnitPriceUSD (bnt.UnitPriceUSD) → UnitPrice(USD) $r->ValueBudgetUSD (bnt.ValueBudgetUSD) → BudgetValue(USD) $r->ValueTargetUSD (bnt.ValueTargetUSD) → TargetValue(USD) PER-VARIANT FLAGS (this legacy fn has no real variants — defaults reproduce it byte-for-byte; flags exist only so the template renders standalone / is reusable): $rows default [] — the detail line collection $decSep default '.' — number_format decimal separator (legacy '.') $thouSep default ',' — number_format thousands separator (legacy ',') --}} @php $rows = $rows ?? []; $decSep = $decSep ?? '.'; $thouSep = $thouSep ?? ','; $num = fn ($v) => number_format((float) $v, 2, $decSep, $thouSep); @endphp Colorindo Chemtra Budget and Target - {{ $subject }} {{-- Header (legacy query1 group) --}}
PeriodeBnT : {{ $bnt->budgetAndTargetPeriode?->PeriodeName }}
Company : {{ Str::upper((string) ($bnt->company?->CompanyName ?? '')) }}
Division : {{ $bnt->division?->DivisionName }}
Creator/Sales : {{ $bnt->userIDInput?->Nama }} / {{ $bnt->userIDSales?->Nama }}
{{-- Detail (legacy query2 lines) --}} @foreach ($rows as $i => $r) @php $n = $i + 1; @endphp @endforeach
# Principal Product Budget(KG) Target(KG) UnitPrice(USD) BudgetValue(USD) TargetValue(USD)
{{ $n }} {{ $r->ASTPrincipalName != '' ? $r->ASTPrincipalName : $r->principal?->PrincipalName }} {{ $r->ASTProductName }} {{ $num($r->QtBudget) }} {{ $num($r->QtTarget) }} {{ $num($r->UnitPriceUSD) }} {{ $num($r->ValueBudgetUSD) }} {{ $num($r->ValueTargetUSD) }}