{
  "$schema": "https://uipkge.dev/schema/registry-item.json",
  "name": "inventory-reorder-forecast",
  "title": "Inventory Reorder Forecast",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-angular/blocks/inventory-reorder-forecast/inventory-reorder-forecast.component.ts",
      "content": "import { ChangeDetectionStrategy, Component, Input, computed, signal } from '@angular/core'\nimport {\n  AlertTriangle,\n  ArrowUpRight,\n  Boxes,\n  Building2,\n  CheckCircle2,\n  Clock,\n  DollarSign,\n  Download,\n  FileCheck,\n  LucideAngularModule,\n  PackageCheck,\n  PackagePlus,\n  Search,\n  TrendingUp,\n  X,\n  Zap,\n} from 'lucide-angular'\nimport { cn } from '@/lib/utils'\nimport { UiBadgeComponent } from '@/ui/badge/badge.component'\nimport { UiButtonComponent } from '@/ui/button/button.component'\nimport {\n  UiCardComponent,\n  UiCardContentComponent,\n  UiCardHeaderComponent,\n  UiCardTitleComponent,\n} from '@/ui/card/card.component'\nimport {\n  UiDialogCloseComponent,\n  UiDialogComponent,\n  UiDialogContentComponent,\n  UiDialogDescriptionComponent,\n  UiDialogFooterComponent,\n  UiDialogHeaderComponent,\n  UiDialogTitleComponent,\n} from '@/ui/dialog/dialog.component'\nimport { UiInputComponent } from '@/ui/input/input.component'\nimport {\n  UiSelectComponent,\n  UiSelectContentComponent,\n  UiSelectItemComponent,\n  UiSelectTriggerComponent,\n  UiSelectValueComponent,\n} from '@/ui/select/select.component'\nimport { UiSeparatorComponent } from '@/ui/separator/separator.component'\nimport {\n  UiTableBodyComponent,\n  UiTableCellComponent,\n  UiTableComponent,\n  UiTableHeadComponent,\n  UiTableHeaderComponent,\n  UiTableRowComponent,\n} from '@/ui/table/table.component'\n\nexport type StockHealthStatus = 'critical' | 'warning' | 'healthy'\n\nexport interface ReorderItem {\n  id: string\n  sku: string\n  name: string\n  category: string\n  supplier: string\n  onHandStock: number\n  safetyStockThreshold: number\n  dailySalesVelocity: number\n  velocityTrend: number\n  daysOfInventoryRemaining: number\n  supplierLeadTimeDays: number\n  recommendedReorderQty: number\n  unitCost: number\n  estimatedPoCost: number\n  status: StockHealthStatus\n}\n\nconst reorderItems: ReorderItem[] = [\n  {\n    id: 'sku-1',\n    sku: 'SKU-RN-105-BLK',\n    name: 'Aero Minimalist Runner 10.5',\n    category: 'Footwear',\n    supplier: 'Apex Footwear Ltd',\n    onHandStock: 42,\n    safetyStockThreshold: 80,\n    dailySalesVelocity: 12.4,\n    velocityTrend: 14.2,\n    daysOfInventoryRemaining: 3.4,\n    supplierLeadTimeDays: 14,\n    recommendedReorderQty: 250,\n    unitCost: 50.0,\n    estimatedPoCost: 12500.0,\n    status: 'critical',\n  },\n  {\n    id: 'sku-2',\n    sku: 'SKU-PK-082-SLT',\n    name: 'Technical Shell Parka L',\n    category: 'Outerwear',\n    supplier: 'Nordic Outerwear Co',\n    onHandStock: 18,\n    safetyStockThreshold: 50,\n    dailySalesVelocity: 4.5,\n    velocityTrend: 8.5,\n    daysOfInventoryRemaining: 4.0,\n    supplierLeadTimeDays: 21,\n    recommendedReorderQty: 120,\n    unitCost: 145.0,\n    estimatedPoCost: 17400.0,\n    status: 'critical',\n  },\n  {\n    id: 'sku-3',\n    sku: 'SKU-HD-419-PRO',\n    name: 'Pro Studio Headphones',\n    category: 'Electronics',\n    supplier: 'Sonic Acoustics Inc',\n    onHandStock: 65,\n    safetyStockThreshold: 85,\n    dailySalesVelocity: 8.2,\n    velocityTrend: 5.0,\n    daysOfInventoryRemaining: 7.9,\n    supplierLeadTimeDays: 10,\n    recommendedReorderQty: 100,\n    unitCost: 110.0,\n    estimatedPoCost: 11000.0,\n    status: 'warning',\n  },\n  {\n    id: 'sku-4',\n    sku: 'SKU-CD-904-BRN',\n    name: 'Leather Cardholder',\n    category: 'Accessories',\n    supplier: 'Tuscan Goods Ltd',\n    onHandStock: 88,\n    safetyStockThreshold: 100,\n    dailySalesVelocity: 6.0,\n    velocityTrend: 2.1,\n    daysOfInventoryRemaining: 14.7,\n    supplierLeadTimeDays: 12,\n    recommendedReorderQty: 150,\n    unitCost: 32.0,\n    estimatedPoCost: 4800.0,\n    status: 'warning',\n  },\n  {\n    id: 'sku-5',\n    sku: 'SKU-WC-331-WHT',\n    name: 'Wireless Charger Mat',\n    category: 'Electronics',\n    supplier: 'Volt Innovations',\n    onHandStock: 340,\n    safetyStockThreshold: 120,\n    dailySalesVelocity: 8.1,\n    velocityTrend: -1.4,\n    daysOfInventoryRemaining: 42.0,\n    supplierLeadTimeDays: 7,\n    recommendedReorderQty: 100,\n    unitCost: 25.5,\n    estimatedPoCost: 2550.0,\n    status: 'healthy',\n  },\n]\n\n/**\n * InventoryReorderForecast -- the React block, 1:1: a supply chain inventory\n * replenishment planner with a facility selector, 4 forecasting KPI metric cards, safety\n * stock triggers, a multi-SKU demand table with search + category + health filters, and\n * single/bulk purchase order generation dialogs with a feedback banner.\n */\n@Component({\n  changeDetection: ChangeDetectionStrategy.Eager,\n  selector: 'ui-inventory-reorder-forecast, [ui-inventory-reorder-forecast]',\n  standalone: true,\n  // React renders the root <div> itself: the host stays out of layout and `class` goes to the root.\n  host: { '[attr.class]': '\"contents\"' },\n  imports: [\n    LucideAngularModule,\n    UiBadgeComponent,\n    UiButtonComponent,\n    UiCardComponent,\n    UiCardContentComponent,\n    UiCardHeaderComponent,\n    UiCardTitleComponent,\n    UiDialogCloseComponent,\n    UiDialogComponent,\n    UiDialogContentComponent,\n    UiDialogDescriptionComponent,\n    UiDialogFooterComponent,\n    UiDialogHeaderComponent,\n    UiDialogTitleComponent,\n    UiInputComponent,\n    UiSelectComponent,\n    UiSelectContentComponent,\n    UiSelectItemComponent,\n    UiSelectTriggerComponent,\n    UiSelectValueComponent,\n    UiSeparatorComponent,\n    UiTableBodyComponent,\n    UiTableCellComponent,\n    UiTableComponent,\n    UiTableHeadComponent,\n    UiTableHeaderComponent,\n    UiTableRowComponent,\n  ],\n  template: `\n    <div data-slot=\"inventory-reorder-forecast\" [class]=\"rootClass\">\n      <!-- Header Section -->\n      <div class=\"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between\">\n        <div class=\"space-y-1\">\n          <div class=\"flex flex-wrap items-center gap-2.5\">\n            <div class=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg\">\n              <lucide-icon [img]=\"Boxes\" class=\"size-4.5\" />\n            </div>\n            <h1 class=\"text-foreground text-xl font-bold tracking-tight sm:text-2xl\">\n              Inventory Demand & Reorder Forecast\n            </h1>\n            <span ui-badge variant=\"warning\" class=\"border-warning/30 bg-warning/10 text-warning gap-1.5\">\n              <span class=\"bg-warning size-1.5 animate-pulse rounded-full\"></span>\n              4 SKUs Need Reorder\n            </span>\n          </div>\n          <p class=\"text-muted-foreground text-xs sm:text-sm\">\n            Multi-channel supply chain replenishment planner with lead-time demand forecasting and automated purchase\n            order generation.\n          </p>\n        </div>\n\n        <div class=\"flex flex-wrap items-center gap-2.5\">\n          <!-- Facility Selector -->\n          <ui-select [value]=\"facility()\" (valueChange)=\"facility.set($event)\">\n            <button ui-select-trigger class=\"w-full sm:w-[280px]\">\n              <lucide-icon [img]=\"Building2\" class=\"text-muted-foreground size-4 shrink-0\" />\n              <ui-select-value placeholder=\"Select fulfillment facility\" />\n            </button>\n            <ui-select-content>\n              <ui-select-item value=\"global-fulfillment\">Global Fulfillment Center</ui-select-item>\n              <ui-select-item value=\"na-west-hub\">North America West Distribution Hub</ui-select-item>\n              <ui-select-item value=\"eu-central-dc\">European Central Logistics Depot</ui-select-item>\n              <ui-select-item value=\"apac-regional\">APAC Regional Hub · Singapore</ui-select-item>\n            </ui-select-content>\n          </ui-select>\n\n          <!-- Export Plan Button -->\n          <button\n            ui-button\n            aria-label=\"Download attachment\"\n            variant=\"outline\"\n            class=\"gap-1.5 shadow-xs\"\n            (click)=\"handleExportPlan()\"\n          >\n            <lucide-icon [img]=\"Download\" class=\"size-4\" />\n            Export Replenishment Plan\n          </button>\n\n          <!-- Primary Action: Generate Bulk POs -->\n          <button ui-button class=\"gap-1.5 shadow-xs\" (click)=\"openBulkPoDialog()\">\n            <lucide-icon [img]=\"PackagePlus\" class=\"size-4\" />\n            Generate Bulk POs\n          </button>\n        </div>\n      </div>\n\n      <!-- Notification / Action Feedback Banner -->\n      @if (actionFeedback()) {\n        <div\n          class=\"border-primary/20 bg-primary/5 text-foreground flex items-center justify-between rounded-lg border px-4 py-3 text-sm shadow-xs transition-colors\"\n        >\n          <div class=\"flex items-center gap-2.5\">\n            <lucide-icon [img]=\"CheckCircle2\" class=\"text-success size-4 shrink-0\" />\n            <span class=\"text-xs font-medium sm:text-sm\">{{ actionFeedback() }}</span>\n          </div>\n          <button\n            ui-button\n            variant=\"ghost\"\n            size=\"xs\"\n            class=\"h-6 w-6 p-0\"\n            aria-label=\"Dismiss notification\"\n            (click)=\"actionFeedback.set(null)\"\n          >\n            <lucide-icon [img]=\"X\" class=\"size-3.5\" />\n          </button>\n        </div>\n      }\n\n      <!-- 4 Forecasting KPI Cards -->\n      <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n        <!-- Metric 1: Critical Reorder SKUs -->\n        <div ui-card class=\"shadow-xs\">\n          <div ui-card-header class=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n            <h3 ui-card-title class=\"text-muted-foreground text-xs font-medium tracking-wider uppercase\">\n              Critical Reorder SKUs\n            </h3>\n            <div class=\"bg-warning/10 text-warning flex size-8 items-center justify-center rounded-md\">\n              <lucide-icon [img]=\"AlertTriangle\" class=\"size-4\" />\n            </div>\n          </div>\n          <div ui-card-content class=\"space-y-1\">\n            <div class=\"flex items-baseline gap-2\">\n              <div class=\"text-warning text-warning text-2xl font-bold tracking-tight tabular-nums\">\n                4 <span class=\"text-muted-foreground text-sm font-normal\">SKUs</span>\n              </div>\n              <span ui-badge variant=\"warning\" class=\"text-xs font-normal\">Action Required</span>\n            </div>\n            <p class=\"text-muted-foreground pt-1 text-xs\">Below safety threshold · 2 in urgent stockout zone</p>\n          </div>\n        </div>\n\n        <!-- Metric 2: Estimated Stockout Days -->\n        <div ui-card class=\"shadow-xs\">\n          <div ui-card-header class=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n            <h3 ui-card-title class=\"text-muted-foreground text-xs font-medium tracking-wider uppercase\">\n              Estimated Stockout Days\n            </h3>\n            <div class=\"bg-destructive/10 text-destructive flex size-8 items-center justify-center rounded-md\">\n              <lucide-icon [img]=\"Clock\" class=\"size-4\" />\n            </div>\n          </div>\n          <div ui-card-content class=\"space-y-1\">\n            <div class=\"flex items-baseline gap-2\">\n              <div class=\"text-foreground text-2xl font-bold tracking-tight tabular-nums\">\n                6.4 <span class=\"text-muted-foreground text-sm font-normal\">Days</span>\n              </div>\n              <span ui-badge variant=\"destructive\" class=\"text-xs font-normal\">Critical Risk</span>\n            </div>\n            <p class=\"text-muted-foreground pt-1 text-xs\">6.4 Days until stockout on top SKU · Urgent PO needed</p>\n          </div>\n        </div>\n\n        <!-- Metric 3: Suggested Purchase Order Value -->\n        <div ui-card class=\"shadow-xs\">\n          <div ui-card-header class=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n            <h3 ui-card-title class=\"text-muted-foreground text-xs font-medium tracking-wider uppercase\">\n              Suggested PO Value\n            </h3>\n            <div class=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-md\">\n              <lucide-icon [img]=\"DollarSign\" class=\"size-4\" />\n            </div>\n          </div>\n          <div ui-card-content class=\"space-y-1\">\n            <div class=\"text-foreground text-2xl font-bold tracking-tight tabular-nums\">$48,250.00</div>\n            <p class=\"text-muted-foreground flex items-center gap-1.5 pt-1 text-xs\">\n              <span class=\"text-success flex items-center font-medium\">\n                <lucide-icon [img]=\"Zap\" class=\"mr-1 inline size-3\" />4 replenishment POs\n              </span>\n              <span>· 620 units total</span>\n            </p>\n          </div>\n        </div>\n\n        <!-- Metric 4: Inventory Turnover Rate -->\n        <div ui-card class=\"shadow-xs\">\n          <div ui-card-header class=\"flex flex-row items-center justify-between space-y-0 pb-2\">\n            <h3 ui-card-title class=\"text-muted-foreground text-xs font-medium tracking-wider uppercase\">\n              Inventory Turnover Rate\n            </h3>\n            <div class=\"bg-success/10 text-success flex size-8 items-center justify-center rounded-md\">\n              <lucide-icon [img]=\"TrendingUp\" class=\"size-4\" />\n            </div>\n          </div>\n          <div ui-card-content class=\"space-y-1\">\n            <div class=\"text-foreground text-2xl font-bold tracking-tight tabular-nums\">\n              8.4x <span class=\"text-muted-foreground text-sm font-normal\">/ year</span>\n            </div>\n            <p class=\"text-muted-foreground flex items-center gap-1.5 pt-1 text-xs\">\n              <span class=\"text-success flex items-center font-medium\">\n                <lucide-icon [img]=\"ArrowUpRight\" class=\"mr-0.5 inline size-3\" />+1.2x\n              </span>\n              <span>vs industry benchmark (7.2x)</span>\n            </p>\n          </div>\n        </div>\n      </div>\n\n      <!-- Reorder Demand Forecast Table Toolbar & Card -->\n      <div ui-card class=\"shadow-xs\">\n        <div ui-card-header class=\"border-border border-b pb-3\">\n          <div class=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n            <div class=\"flex flex-1 flex-wrap items-center gap-2\">\n              <div class=\"relative w-full max-w-sm\">\n                <lucide-icon\n                  [img]=\"Search\"\n                  class=\"text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2\"\n                />\n                <ui-input\n                  [value]=\"searchQuery()\"\n                  (valueChange)=\"searchQuery.set($event)\"\n                  placeholder=\"Search SKU, product name, supplier...\"\n                  class=\"h-9 pl-9 text-xs sm:text-sm\"\n                />\n              </div>\n\n              <!-- Category Filter -->\n              <ui-select [value]=\"categoryFilter()\" (valueChange)=\"categoryFilter.set($event)\">\n                <button ui-select-trigger class=\"h-9 w-[160px] text-xs\">\n                  <ui-select-value placeholder=\"All Categories\" />\n                </button>\n                <ui-select-content>\n                  <ui-select-item value=\"all\">All Categories</ui-select-item>\n                  <ui-select-item value=\"Footwear\">Footwear</ui-select-item>\n                  <ui-select-item value=\"Outerwear\">Outerwear</ui-select-item>\n                  <ui-select-item value=\"Electronics\">Electronics</ui-select-item>\n                  <ui-select-item value=\"Accessories\">Accessories</ui-select-item>\n                </ui-select-content>\n              </ui-select>\n\n              <!-- Status Filter -->\n              <ui-select [value]=\"statusFilter()\" (valueChange)=\"statusFilter.set($event)\">\n                <button ui-select-trigger class=\"h-9 w-[170px] text-xs\">\n                  <ui-select-value placeholder=\"All Health Status\" />\n                </button>\n                <ui-select-content>\n                  <ui-select-item value=\"all\">All Stock Status</ui-select-item>\n                  <ui-select-item value=\"critical\">Critical Stockout (&lt;7d)</ui-select-item>\n                  <ui-select-item value=\"warning\">Reorder Warning (7-15d)</ui-select-item>\n                  <ui-select-item value=\"healthy\">Healthy Stock (&gt;30d)</ui-select-item>\n                </ui-select-content>\n              </ui-select>\n            </div>\n\n            <div class=\"text-muted-foreground flex items-center gap-2 text-xs\">\n              <span>\n                Showing <strong class=\"text-foreground tabular-nums\">{{ filteredItems().length }}</strong> of\n                {{ allItems.length }} forecast SKUs\n              </span>\n            </div>\n          </div>\n        </div>\n\n        <div ui-card-content class=\"p-0\">\n          <!-- Demand Table -->\n          <div class=\"overflow-x-auto\">\n            <table ui-table>\n              <thead ui-table-header>\n                <tr ui-table-row class=\"hover:bg-transparent\">\n                  <th ui-table-head class=\"w-[240px] text-xs font-semibold\">SKU Identifier & Product</th>\n                  <th ui-table-head class=\"text-right text-xs font-semibold\">Current On-Hand</th>\n                  <th ui-table-head class=\"text-right text-xs font-semibold\">Sales Velocity</th>\n                  <th ui-table-head class=\"min-w-[150px] text-xs font-semibold\">Days Remaining</th>\n                  <th ui-table-head class=\"text-right text-xs font-semibold\">Supplier Lead Time</th>\n                  <th ui-table-head class=\"text-right text-xs font-semibold\">Recommended Qty</th>\n                  <th ui-table-head class=\"text-right text-xs font-semibold\">Est. PO Cost</th>\n                  <th ui-table-head class=\"w-[120px] text-right text-xs font-semibold\">Quick Action</th>\n                </tr>\n              </thead>\n              <tbody ui-table-body>\n                @for (item of filteredItems(); track item.id) {\n                  <tr ui-table-row class=\"hover:bg-muted/40 transition-colors\">\n                    <!-- SKU Identifier & Product Name -->\n                    <td ui-table-cell class=\"py-3\">\n                      <div class=\"space-y-1\">\n                        <div class=\"text-foreground font-mono text-xs font-semibold\">{{ item.sku }}</div>\n                        <div class=\"text-foreground text-sm font-medium\">{{ item.name }}</div>\n                        <div class=\"text-muted-foreground flex items-center gap-1.5 text-xs\">\n                          <span>{{ item.category }}</span>\n                          <span>·</span>\n                          <span>{{ item.supplier }}</span>\n                        </div>\n                      </div>\n                    </td>\n\n                    <!-- Current On-Hand Stock -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"text-foreground text-sm font-semibold tabular-nums\">\n                        {{ item.onHandStock.toLocaleString() }}\n                        <span class=\"text-muted-foreground text-xs font-normal\">units</span>\n                      </div>\n                      <div class=\"text-muted-foreground text-xs tabular-nums\">\n                        Safety: {{ item.safetyStockThreshold }} units\n                      </div>\n                    </td>\n\n                    <!-- Average Daily Sales Velocity -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"text-foreground text-sm font-semibold tabular-nums\">\n                        {{ item.dailySalesVelocity.toFixed(1) }}\n                        <span class=\"text-muted-foreground text-xs font-normal\">units/day</span>\n                      </div>\n                      <div\n                        class=\"text-xs font-medium tabular-nums\"\n                        [class]=\"item.velocityTrend >= 0 ? 'text-success' : 'text-destructive'\"\n                      >\n                        {{ item.velocityTrend >= 0 ? '+' : '' }}{{ item.velocityTrend.toFixed(1) }}% 7d\n                      </div>\n                    </td>\n\n                    <!-- Days of Inventory Remaining Badge -->\n                    <td ui-table-cell class=\"py-3\">\n                      <div class=\"space-y-1.5\">\n                        @if (item.status === 'critical') {\n                          <span ui-badge variant=\"destructive\" class=\"gap-1 font-mono text-xs font-semibold\">\n                            <lucide-icon [img]=\"AlertTriangle\" class=\"size-3\" />\n                            {{ item.daysOfInventoryRemaining.toFixed(1) }} Days\n                          </span>\n                        } @else if (item.status === 'warning') {\n                          <span ui-badge variant=\"warning\" class=\"text-warning gap-1 font-mono text-xs font-semibold\">\n                            <lucide-icon [img]=\"Clock\" class=\"size-3\" />\n                            {{ item.daysOfInventoryRemaining.toFixed(1) }} Days\n                          </span>\n                        } @else {\n                          <span ui-badge variant=\"success\" class=\"gap-1 font-mono text-xs font-semibold\">\n                            <lucide-icon [img]=\"CheckCircle2\" class=\"size-3\" />\n                            {{ item.daysOfInventoryRemaining.toFixed(1) }} Days\n                          </span>\n                        }\n                        <div class=\"text-muted-foreground text-xs\">\n                          {{\n                            item.status === 'critical'\n                              ? 'Stockout before delivery'\n                              : item.status === 'warning'\n                                ? 'Reorder buffer thin'\n                                : 'Healthy inventory level'\n                          }}\n                        </div>\n                      </div>\n                    </td>\n\n                    <!-- Supplier Lead Time -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"text-foreground font-mono text-sm font-semibold tabular-nums\">\n                        {{ item.supplierLeadTimeDays }}\n                        <span class=\"text-muted-foreground text-xs font-normal\">Days</span>\n                      </div>\n                      <div class=\"text-muted-foreground text-xs\">Mfg & Freight</div>\n                    </td>\n\n                    <!-- Recommended Reorder Qty -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"text-foreground text-sm font-bold tabular-nums\">\n                        {{ item.recommendedReorderQty }}\n                        <span class=\"text-muted-foreground text-xs font-normal\">units</span>\n                      </div>\n                      <div class=\"text-muted-foreground text-xs\">Optimal batch</div>\n                    </td>\n\n                    <!-- Estimated PO Cost -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"text-foreground font-mono text-sm font-bold tabular-nums\">\n                        {{ money(item.estimatedPoCost) }}\n                      </div>\n                      <div class=\"text-muted-foreground text-xs tabular-nums\">{{ money(item.unitCost) }} / unit</div>\n                    </td>\n\n                    <!-- Quick Action Button -->\n                    <td ui-table-cell class=\"py-3 text-right\">\n                      <div class=\"flex items-center justify-end gap-1.5\">\n                        <button\n                          ui-button\n                          size=\"sm\"\n                          class=\"gap-1 shadow-xs\"\n                          [variant]=\"item.status === 'critical' ? 'default' : 'outline'\"\n                          (click)=\"openCreatePoDialog(item)\"\n                        >\n                          <lucide-icon [img]=\"PackageCheck\" class=\"size-3.5\" />\n                          Create PO\n                        </button>\n                      </div>\n                    </td>\n                  </tr>\n                }\n\n                @if (filteredItems().length === 0) {\n                  <tr ui-table-row>\n                    <td ui-table-cell [attr.colspan]=\"8\" class=\"text-muted-foreground h-32 text-center text-sm\">\n                      No inventory forecast items match your current filter criteria.\n                    </td>\n                  </tr>\n                }\n              </tbody>\n            </table>\n          </div>\n        </div>\n      </div>\n\n      <!-- Create Purchase Order Draft Dialog -->\n      <ui-dialog [open]=\"createPoDialogOpen()\" (openChange)=\"createPoDialogOpen.set($event)\">\n        <ui-dialog-content class=\"sm:max-w-lg\">\n          <div ui-dialog-header>\n            <div class=\"flex items-center gap-2\">\n              <div class=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-md\">\n                <lucide-icon [img]=\"PackageCheck\" class=\"size-4\" />\n              </div>\n              <h2 ui-dialog-title class=\"text-lg font-bold\">Draft Purchase Order</h2>\n            </div>\n            <p ui-dialog-description class=\"text-muted-foreground text-xs\">\n              Review demand velocity, set purchase order quantity, and dispatch replenishment order to supplier.\n            </p>\n          </div>\n\n          @if (selectedSkuItem(); as selected) {\n            <div class=\"space-y-4 py-2\">\n              <!-- SKU Summary Banner -->\n              <div class=\"border-border bg-muted/20 space-y-3 rounded-lg border p-3.5\">\n                <div class=\"flex items-start justify-between gap-2\">\n                  <div>\n                    <div class=\"text-primary font-mono text-xs font-semibold\">{{ selected.sku }}</div>\n                    <div class=\"text-foreground text-sm font-semibold\">{{ selected.name }}</div>\n                    <div class=\"text-muted-foreground text-xs\">{{ selected.supplier }} · {{ selected.category }}</div>\n                  </div>\n                  <span\n                    ui-badge\n                    [variant]=\"\n                      selected.status === 'critical'\n                        ? 'destructive'\n                        : selected.status === 'warning'\n                          ? 'warning'\n                          : 'success'\n                    \"\n                    class=\"text-xs\"\n                  >\n                    {{ selected.daysOfInventoryRemaining }} Days Stock Left\n                  </span>\n                </div>\n\n                <div ui-separator></div>\n\n                <div class=\"grid grid-cols-3 gap-2 text-xs\">\n                  <div>\n                    <span class=\"text-muted-foreground\">On Hand:</span>\n                    <p class=\"text-foreground font-semibold tabular-nums\">{{ selected.onHandStock }} units</p>\n                  </div>\n                  <div>\n                    <span class=\"text-muted-foreground\">Daily Velocity:</span>\n                    <p class=\"text-foreground font-semibold tabular-nums\">{{ selected.dailySalesVelocity }} / day</p>\n                  </div>\n                  <div>\n                    <span class=\"text-muted-foreground\">Lead Time:</span>\n                    <p class=\"text-foreground font-semibold tabular-nums\">{{ selected.supplierLeadTimeDays }} Days</p>\n                  </div>\n                </div>\n              </div>\n\n              <!-- Quantity Input & Quick Chips -->\n              <div class=\"space-y-1.5\">\n                <div class=\"flex items-center justify-between\">\n                  <label class=\"text-foreground text-xs font-medium\">Reorder Quantity (Units)</label>\n                  <span class=\"text-muted-foreground text-xs\">\n                    Recommended: {{ selected.recommendedReorderQty }} units\n                  </span>\n                </div>\n                <ui-input\n                  [value]=\"customReorderQty()\"\n                  (valueChange)=\"setCustomQty($event)\"\n                  type=\"number\"\n                  class=\"text-xs tabular-nums sm:text-sm\"\n                />\n                <div class=\"flex gap-1.5 pt-1\">\n                  <button\n                    type=\"button\"\n                    ui-button\n                    variant=\"outline\"\n                    size=\"xs\"\n                    class=\"flex-1 text-xs\"\n                    (click)=\"setQtyFraction(selected, 0.5)\"\n                  >\n                    50% ({{ halfQty(selected) }})\n                  </button>\n                  <button\n                    type=\"button\"\n                    ui-button\n                    variant=\"outline\"\n                    size=\"xs\"\n                    class=\"flex-1 text-xs\"\n                    (click)=\"setQtyFraction(selected, 1)\"\n                  >\n                    Recommended ({{ selected.recommendedReorderQty }})\n                  </button>\n                  <button\n                    type=\"button\"\n                    ui-button\n                    variant=\"outline\"\n                    size=\"xs\"\n                    class=\"flex-1 text-xs\"\n                    (click)=\"setQtyFraction(selected, 1.5)\"\n                  >\n                    150% ({{ oneHalfQty(selected) }})\n                  </button>\n                </div>\n              </div>\n\n              <!-- Shipping Freight Method -->\n              <div class=\"space-y-1.5\">\n                <label class=\"text-foreground text-xs font-medium\">Inbound Freight Method</label>\n                <ui-select [value]=\"selectedShippingMethod()\" (valueChange)=\"selectedShippingMethod.set($event)\">\n                  <button ui-select-trigger class=\"w-full text-xs\">\n                    <ui-select-value placeholder=\"Select shipping method\" />\n                  </button>\n                  <ui-select-content>\n                    <ui-select-item value=\"standard-freight\">\n                      Standard Consolidated Freight (Est. 14 Days)\n                    </ui-select-item>\n                    <ui-select-item value=\"expedited-air\">Expedited Air Express (Est. 4 Days · +$420)</ui-select-item>\n                    <ui-select-item value=\"ocean-container\">\n                      Full Ocean Container FCL (Est. 28 Days · Economy)\n                    </ui-select-item>\n                  </ui-select-content>\n                </ui-select>\n              </div>\n\n              <!-- Cost Calculation Summary Box -->\n              <div class=\"border-border bg-muted/40 space-y-2 rounded-lg border p-3.5 text-xs\">\n                <div class=\"flex items-center justify-between\">\n                  <span class=\"text-muted-foreground\">Unit Cost:</span>\n                  <span class=\"text-foreground font-mono tabular-nums\">{{ money(selected.unitCost) }}</span>\n                </div>\n                <div class=\"flex items-center justify-between\">\n                  <span class=\"text-muted-foreground\">Units to Order:</span>\n                  <span class=\"text-foreground font-mono tabular-nums\">{{ customReorderQty() }} units</span>\n                </div>\n                <div ui-separator></div>\n                <div class=\"flex items-center justify-between text-sm font-semibold\">\n                  <span class=\"text-foreground\">Total Estimated PO Value:</span>\n                  <span class=\"text-primary font-mono text-base font-bold tabular-nums\">\n                    {{ money(dialogCalculatedCost()) }}\n                  </span>\n                </div>\n              </div>\n            </div>\n          }\n\n          <div ui-dialog-footer class=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n            <button ui-button ui-dialog-close variant=\"outline\">Cancel</button>\n            <button ui-button class=\"gap-1.5\" (click)=\"handleConfirmCreatePo()\">\n              <lucide-icon [img]=\"FileCheck\" class=\"size-4\" />\n              Generate Purchase Order\n            </button>\n          </div>\n        </ui-dialog-content>\n      </ui-dialog>\n\n      <!-- Bulk POs Generation Dialog -->\n      <ui-dialog [open]=\"bulkPoDialogOpen()\" (openChange)=\"bulkPoDialogOpen.set($event)\">\n        <ui-dialog-content class=\"sm:max-w-lg\">\n          <div ui-dialog-header>\n            <div class=\"flex items-center gap-2\">\n              <div class=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-md\">\n                <lucide-icon [img]=\"PackagePlus\" class=\"size-4\" />\n              </div>\n              <h2 ui-dialog-title class=\"text-lg font-bold\">Generate Bulk Purchase Orders</h2>\n            </div>\n            <p ui-dialog-description class=\"text-muted-foreground text-xs\">\n              Automatically create and batch replenishment purchase orders for all SKUs below safe safety threshold.\n            </p>\n          </div>\n\n          <div class=\"space-y-4 py-2\">\n            <!-- Summary Metrics -->\n            <div class=\"border-border bg-muted/20 space-y-3 rounded-lg border p-4\">\n              <div class=\"flex items-center justify-between\">\n                <span class=\"text-muted-foreground text-xs\">Destination Facility:</span>\n                <span ui-badge variant=\"outline\" class=\"text-xs font-medium\">Global Fulfillment Center</span>\n              </div>\n              <div class=\"flex items-center justify-between\">\n                <span class=\"text-muted-foreground text-xs\">Total Purchase Orders:</span>\n                <span class=\"text-foreground text-xs font-semibold tabular-nums\">4 Vendor POs</span>\n              </div>\n              <div class=\"flex items-center justify-between\">\n                <span class=\"text-muted-foreground text-xs\">Total Replenishment Units:</span>\n                <span class=\"text-foreground text-xs font-semibold tabular-nums\">620 Units</span>\n              </div>\n              <div ui-separator></div>\n              <div class=\"flex items-center justify-between\">\n                <span class=\"text-foreground text-xs font-semibold\">Combined Total PO Value:</span>\n                <span class=\"text-primary font-mono text-base font-bold tabular-nums\">$48,250.00</span>\n              </div>\n            </div>\n\n            <!-- PO List Breakdown -->\n            <div class=\"space-y-2\">\n              <div class=\"text-foreground text-xs font-semibold\">Purchase Order Breakdown by Supplier</div>\n              <div class=\"border-border space-y-2 rounded-md border p-2.5 text-xs\">\n                @for (item of criticalAndWarningItems(); track item.id) {\n                  <div class=\"flex items-center justify-between py-1\">\n                    <div>\n                      <span class=\"text-foreground font-medium\">{{ item.supplier }}</span>\n                      <div class=\"text-muted-foreground font-mono text-xs\">\n                        {{ item.sku }} ({{ item.recommendedReorderQty }} units)\n                      </div>\n                    </div>\n                    <span class=\"text-foreground font-mono font-semibold tabular-nums\">\n                      {{ money(item.estimatedPoCost) }}\n                    </span>\n                  </div>\n                }\n              </div>\n            </div>\n          </div>\n\n          <div ui-dialog-footer class=\"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\">\n            <button ui-button ui-dialog-close variant=\"outline\">Cancel</button>\n            <button ui-button class=\"gap-1.5\" (click)=\"handleConfirmBulkPos()\">\n              <lucide-icon [img]=\"PackagePlus\" class=\"size-4\" />\n              Generate 4 Purchase Orders\n            </button>\n          </div>\n        </ui-dialog-content>\n      </ui-dialog>\n    </div>\n  `,\n})\nexport class UiInventoryReorderForecastComponent {\n  protected readonly AlertTriangle = AlertTriangle\n  protected readonly ArrowUpRight = ArrowUpRight\n  protected readonly Boxes = Boxes\n  protected readonly Building2 = Building2\n  protected readonly CheckCircle2 = CheckCircle2\n  protected readonly Clock = Clock\n  protected readonly DollarSign = DollarSign\n  protected readonly Download = Download\n  protected readonly FileCheck = FileCheck\n  protected readonly PackageCheck = PackageCheck\n  protected readonly PackagePlus = PackagePlus\n  protected readonly Search = Search\n  protected readonly TrendingUp = TrendingUp\n  protected readonly X = X\n  protected readonly Zap = Zap\n\n  protected readonly allItems = reorderItems\n\n  @Input('class') className?: string\n\n  readonly facility = signal('global-fulfillment')\n  readonly searchQuery = signal('')\n  readonly categoryFilter = signal('all')\n  readonly statusFilter = signal('all')\n\n  readonly createPoDialogOpen = signal(false)\n  readonly bulkPoDialogOpen = signal(false)\n  readonly selectedSkuItem = signal<ReorderItem | null>(null)\n  readonly customReorderQty = signal<number>(250)\n  readonly selectedShippingMethod = signal('standard-freight')\n\n  readonly actionFeedback = signal<string | null>(null)\n\n  readonly filteredItems = computed(() => {\n    return reorderItems.filter((item) => {\n      const q = this.searchQuery().trim().toLowerCase()\n      const matchesSearch =\n        !q ||\n        item.name.toLowerCase().includes(q) ||\n        item.sku.toLowerCase().includes(q) ||\n        item.category.toLowerCase().includes(q) ||\n        item.supplier.toLowerCase().includes(q)\n\n      const matchesCategory = this.categoryFilter() === 'all' || item.category === this.categoryFilter()\n      const matchesStatus = this.statusFilter() === 'all' || item.status === this.statusFilter()\n\n      return matchesSearch && matchesCategory && matchesStatus\n    })\n  })\n\n  readonly criticalAndWarningItems = computed(() => {\n    return reorderItems.filter((item) => item.status === 'critical' || item.status === 'warning')\n  })\n\n  readonly dialogCalculatedCost = computed(() => {\n    const selected = this.selectedSkuItem()\n    if (!selected) return 0\n    return this.customReorderQty() * selected.unitCost\n  })\n\n  get rootClass(): string {\n    return cn('w-full space-y-6', this.className)\n  }\n\n  money(value: number): string {\n    return '$' + value.toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })\n  }\n\n  setCustomQty(raw: string): void {\n    this.customReorderQty.set(Number(raw) || 0)\n  }\n\n  setQtyFraction(item: ReorderItem, fraction: number): void {\n    this.customReorderQty.set(Math.round(item.recommendedReorderQty * fraction))\n  }\n\n  halfQty(item: ReorderItem): number {\n    return Math.round(item.recommendedReorderQty * 0.5)\n  }\n\n  oneHalfQty(item: ReorderItem): number {\n    return Math.round(item.recommendedReorderQty * 1.5)\n  }\n\n  openCreatePoDialog(item: ReorderItem): void {\n    this.selectedSkuItem.set(item)\n    this.customReorderQty.set(item.recommendedReorderQty)\n    this.selectedShippingMethod.set('standard-freight')\n    this.createPoDialogOpen.set(true)\n  }\n\n  handleConfirmCreatePo(): void {\n    const selected = this.selectedSkuItem()\n    if (!selected) return\n    const poNumber = `PO-2026-${Math.floor(1000 + Math.random() * 9000)}`\n    this.actionFeedback.set(\n      `Draft ${poNumber} created for ${selected.sku} (${this.customReorderQty()} units · $${this.dialogCalculatedCost().toLocaleString('en-US', { minimumFractionDigits: 2 })}) routed to ${selected.supplier}.`,\n    )\n    this.createPoDialogOpen.set(false)\n    setTimeout(() => this.actionFeedback.set(null), 4500)\n  }\n\n  openBulkPoDialog(): void {\n    this.bulkPoDialogOpen.set(true)\n  }\n\n  handleConfirmBulkPos(): void {\n    this.actionFeedback.set(\n      `Successfully generated 4 Purchase Orders (Total $48,250.00) for Global Fulfillment Center replenishment.`,\n    )\n    this.bulkPoDialogOpen.set(false)\n    setTimeout(() => this.actionFeedback.set(null), 5000)\n  }\n\n  handleExportPlan(): void {\n    this.actionFeedback.set(`Replenishment forecast plan for ${reorderItems.length} SKUs exported successfully as CSV.`)\n    setTimeout(() => this.actionFeedback.set(null), 4000)\n  }\n}\n",
      "type": "registry:block",
      "target": "~/src/app/components/blocks/inventory-reorder-forecast/inventory-reorder-forecast.component.ts"
    },
    {
      "path": "packages/registry-angular/blocks/inventory-reorder-forecast/index.ts",
      "content": "export {\n  UiInventoryReorderForecastComponent,\n  type ReorderItem,\n  type StockHealthStatus,\n} from './inventory-reorder-forecast.component'\n",
      "type": "registry:block",
      "target": "~/src/app/components/blocks/inventory-reorder-forecast/index.ts"
    }
  ],
  "dependencies": [
    "lucide-angular"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/angular/badge.json",
    "https://uipkge.dev/r/angular/button.json",
    "https://uipkge.dev/r/angular/card.json",
    "https://uipkge.dev/r/angular/dialog.json",
    "https://uipkge.dev/r/angular/input.json",
    "https://uipkge.dev/r/angular/select.json",
    "https://uipkge.dev/r/angular/separator.json",
    "https://uipkge.dev/r/angular/table.json"
  ],
  "description": "Supply chain inventory replenishment planner with lead-time demand forecasting, 4 forecasting KPI metric cards, safety stock triggers, multi-SKU demand table, and automated purchase order generation.",
  "categories": [
    "logistics",
    "app",
    "ecommerce",
    "dashboard"
  ]
}