@fayz-ai/plugin-inventory 0.13.1 → 0.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/data/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAyEtD,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAuClD,CAAA"}
1
+ {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/data/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAmFtD,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAuClD,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React3, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
2
2
  import { toast, defineKpiWidget, defineCustomWidget, PageTransition, ModulePage, Button, SubpageHeader, SearchSelect, cn, DatePicker, ListView, ConfirmDialog, Badge, DraftCommitBar, Switch, useSaveBar, DataTable, DashboardCanvas, Thumbnail, Modal, ModalContent, ModalHeader, ModalTitle, ModalDescription, ModalBody, ModalFooter, StockEntryForm, KpiCard, Card, CardHeader, CardTitle, CardContent, Skeleton } from '@fayz-ai/ui';
3
3
  import { createPluginContext, PluginSettingsPanel, dedup, useTenantPluginSettings, useModuleNavigation, usePluginOnboardingGate, PluginOnboardingGateSkeleton, createViewRouter, ModuleActionBar, SettingsGroup, ToggleRow, usePermissionOptional, CrudListView, useLimitGuard, invalidateRelationOptions, CrudFormSkeleton, CrudFormPage, CrudDetailPage, formatCurrency, useAgentSurface, askAI, PermissionGate, QuickActionsButton, invalidateLimit } from '@fayz-ai/admin';
4
- import { createSafeDataProvider, registerTranslations, countByTenant, useTranslation, getActiveUnitId, createPendingCommand, errorMessage, useDataChanged, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
4
+ import { recordRailFields, RECORD_GROUP, activeFacet, createSafeDataProvider, registerTranslations, countByTenant, useTranslation, getActiveUnitId, createPendingCommand, errorMessage, useDataChanged, getSupabaseClientOptional, getActiveTenantId } from '@fayz-ai/core';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { Trash2, ArrowRightLeft, RefreshCw, ArrowUpRight, ArrowDownRight, Package, Ruler, MapPin, Loader2, Check, ChevronRight, CircleSlash, CircleCheck, ListFilter, CalendarRange, PackageCheck, ClipboardCheck, AlertTriangle, Plus, BookOpen, Layers, Clock, Coins, Building2, Undo2, PackageX } from 'lucide-react';
7
7
  import { createStore as createStore$1 } from 'zustand/vanilla';
@@ -554,13 +554,22 @@ function buildProductEntity(t2, productTypes, currency, onStockChanged, provider
554
554
  relation: { table: T.stockLocations, labelField: "name" },
555
555
  placeholder: t2("inventory.productForm.optional"),
556
556
  showInTable: false
557
- }
557
+ },
558
+ // O rail de todo cadastro. `isActive` já era LIDO na lista (a linha
559
+ // aparece esmaecida) e não tinha campo: dava para ver que um produto
560
+ // estava inativo e não dava para reativá-lo.
561
+ ...recordRailFields({ tagsTable: "products", activeLabel: t2("common.active") })
558
562
  ];
559
563
  return {
560
564
  name: t2("inventory.stock.product"),
561
565
  namePlural: t2("inventory.nav.products"),
562
566
  icon: "Package",
563
567
  displayField: "name",
568
+ // MOSTRAR e TROCAR são coisas diferentes. `image` só existe quando há
569
+ // provider, porque é ele que sabe enviar o arquivo — mas sem `imageField` a
570
+ // página do produto ficava sem foto mesmo com a foto na linha, enquanto a
571
+ // lista a desenhava. O campo responde por desenhar; `image`, por substituir.
572
+ imageField: "imageUrl",
564
573
  image: provider?.uploadProductImage ? productImage(provider) : void 0,
565
574
  fields,
566
575
  fieldGroups: [
@@ -568,9 +577,15 @@ function buildProductEntity(t2, productTypes, currency, onStockChanged, provider
568
577
  { id: "classification", label: t2("inventory.productForm.classification"), description: t2("inventory.productForm.classificationDesc"), columns: 1 },
569
578
  { id: "pricing", label: t2("inventory.productForm.pricing"), columns: 3 },
570
579
  { id: "stock", label: t2("inventory.productForm.stockLevels"), description: t2("inventory.productForm.stockLevelsDesc"), columns: 2 },
571
- { id: "organization", label: t2("inventory.productForm.organization"), description: t2("inventory.productForm.organizationDesc"), columns: 2 }
580
+ { id: "organization", label: t2("inventory.productForm.organization"), description: t2("inventory.productForm.organizationDesc"), columns: 2 },
581
+ { ...RECORD_GROUP }
582
+ ],
583
+ // Duas facetas: o TIPO (o que a coisa é) e a SITUAÇÃO (se vale). A
584
+ // segunda abre em «Ativos», como toda lista de cadastro.
585
+ facets: [
586
+ { field: "productType", allLabel: t2("crud.list.allFacet") },
587
+ activeFacet({ active: t2("common.active"), inactive: t2("common.inactive"), all: t2("crud.list.allFacet") })
572
588
  ],
573
- facets: [{ field: "productType", allLabel: t2("crud.list.allFacet") }],
574
589
  detailTabs: [
575
590
  {
576
591
  id: "stock",
@@ -5818,8 +5833,6 @@ function createInventoryStore(provider) {
5818
5833
  }
5819
5834
  }));
5820
5835
  }
5821
-
5822
- // src/data/registries.ts
5823
5836
  var supplierEntity = {
5824
5837
  name: "Supplier",
5825
5838
  namePlural: "Suppliers",
@@ -5851,11 +5864,14 @@ var measurementUnitEntity = {
5851
5864
  namePlural: "Measurement Units",
5852
5865
  icon: "Ruler",
5853
5866
  displayField: "name",
5867
+ formColumns: 2,
5868
+ facets: [activeFacet({ active: "Ativos", inactive: "Inativos", all: "Todos" })],
5869
+ fieldGroups: [{ id: "identity", label: "Identifica\xE7\xE3o", columns: 2 }, { ...RECORD_GROUP }],
5854
5870
  defaultSort: "name",
5855
5871
  fields: [
5856
- { key: "name", label: "Name", type: "text", required: true, showInTable: true },
5857
- { key: "abbreviation", label: "Abbreviation", type: "text", required: true, showInTable: true },
5858
- { key: "isActive", label: "Active", type: "boolean", showInTable: true, defaultValue: true }
5872
+ { key: "name", label: "Name", type: "text", required: true, showInTable: true, group: "identity" },
5873
+ { key: "abbreviation", label: "Abbreviation", type: "text", required: true, showInTable: true, group: "identity" },
5874
+ ...recordRailFields({ tagsTable: T.measurementUnits, activeLabel: "Ativo", unit: false })
5859
5875
  ],
5860
5876
  data: { table: T.measurementUnits, tenantScoped: true }
5861
5877
  };
@@ -5864,11 +5880,14 @@ var productCategoryEntity = {
5864
5880
  namePlural: "Product Categories",
5865
5881
  icon: "Tag",
5866
5882
  displayField: "name",
5883
+ formColumns: 2,
5884
+ facets: [activeFacet({ active: "Ativos", inactive: "Inativos", all: "Todos" })],
5885
+ fieldGroups: [{ id: "identity", label: "Identifica\xE7\xE3o", columns: 2 }, { ...RECORD_GROUP }],
5867
5886
  defaultSort: "name",
5868
5887
  fields: [
5869
- { key: "name", label: "Name", type: "text", required: true, showInTable: true },
5870
- { key: "parentId", label: "Parent", type: "text", showInTable: false },
5871
- { key: "isActive", label: "Active", type: "boolean", showInTable: true, defaultValue: true }
5888
+ { key: "name", label: "Name", type: "text", required: true, showInTable: true, group: "identity" },
5889
+ { key: "parentId", label: "Parent", type: "text", showInTable: false, group: "identity" },
5890
+ ...recordRailFields({ tagsTable: T.productCategories, activeLabel: "Ativo", unit: false })
5872
5891
  ],
5873
5892
  data: { table: T.productCategories, tenantScoped: true }
5874
5893
  };
@@ -5877,11 +5896,14 @@ var stockLocationEntity = {
5877
5896
  namePlural: "Stock Locations",
5878
5897
  icon: "Warehouse",
5879
5898
  displayField: "name",
5899
+ formColumns: 2,
5900
+ facets: [activeFacet({ active: "Ativos", inactive: "Inativos", all: "Todos" })],
5901
+ fieldGroups: [{ id: "identity", label: "Identifica\xE7\xE3o", columns: 2 }, { ...RECORD_GROUP }],
5880
5902
  defaultSort: "name",
5881
5903
  fields: [
5882
- { key: "name", label: "Name", type: "text", required: true, showInTable: true },
5883
- { key: "description", label: "Description", type: "textarea", showInTable: true },
5884
- { key: "isActive", label: "Active", type: "boolean", showInTable: true, defaultValue: true }
5904
+ { key: "name", label: "Name", type: "text", required: true, showInTable: true, group: "identity" },
5905
+ { key: "description", label: "Description", type: "textarea", showInTable: true, group: "identity" },
5906
+ ...recordRailFields({ tagsTable: T.stockLocations, activeLabel: "Ativo", unit: true })
5885
5907
  ],
5886
5908
  data: { table: T.stockLocations, tenantScoped: true }
5887
5909
  };