@fayz-ai/admin 0.67.0 → 0.67.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.
@@ -1478,7 +1478,7 @@ function RelatedSection({ parentId, related, compact }) {
1478
1478
  }
1479
1479
  setLoading(true);
1480
1480
  try {
1481
- const result = await provider.list({ page: 1, pageSize: 100 });
1481
+ const result = await provider.list({ page: 1, pageSize: related.pageSize ?? 100 });
1482
1482
  setRows(result?.data ?? []);
1483
1483
  setError(null);
1484
1484
  } catch (e) {
@@ -1486,10 +1486,44 @@ function RelatedSection({ parentId, related, compact }) {
1486
1486
  } finally {
1487
1487
  setLoading(false);
1488
1488
  }
1489
- }, [provider, orfa]);
1489
+ }, [provider, orfa, related.pageSize]);
1490
1490
  React8.useEffect(() => {
1491
1491
  void load();
1492
1492
  }, [load]);
1493
+ const [runningAction, setRunningAction] = React8.useState(null);
1494
+ async function runAction(action) {
1495
+ setRunningAction(action.id);
1496
+ try {
1497
+ const message = await action.run(parentId);
1498
+ if (message) toast.success(message);
1499
+ await load();
1500
+ } catch (e) {
1501
+ toast.error(errorMessage(e));
1502
+ } finally {
1503
+ setRunningAction(null);
1504
+ }
1505
+ }
1506
+ const actionButtons = !orfa && related.actions?.length ? related.actions.map((action) => {
1507
+ const ActionIcon = action.icon ? ICON_MAP[action.icon] ?? null : null;
1508
+ return /* @__PURE__ */ jsxs(
1509
+ Button,
1510
+ {
1511
+ type: "button",
1512
+ size: "sm",
1513
+ variant: "ghost",
1514
+ className: "h-8",
1515
+ disabled: runningAction !== null,
1516
+ onClick: () => {
1517
+ void runAction(action);
1518
+ },
1519
+ children: [
1520
+ ActionIcon && /* @__PURE__ */ jsx(ActionIcon, { className: "mr-1 h-3.5 w-3.5" }),
1521
+ action.label
1522
+ ]
1523
+ },
1524
+ action.id
1525
+ );
1526
+ }) : null;
1493
1527
  const guardadas = React8.useRef([]);
1494
1528
  guardadas.current = rows;
1495
1529
  React8.useEffect(() => {
@@ -1784,21 +1818,24 @@ function RelatedSection({ parentId, related, compact }) {
1784
1818
  Icon && /* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5 text-muted-foreground" }),
1785
1819
  label2
1786
1820
  ] }),
1787
- /* @__PURE__ */ jsxs(
1788
- Button,
1789
- {
1790
- type: "button",
1791
- size: "sm",
1792
- variant: "outline",
1793
- className: "h-8",
1794
- disabled: draft !== null,
1795
- onClick: () => setDraft({}),
1796
- children: [
1797
- /* @__PURE__ */ jsx(Plus, { className: "mr-1 h-3.5 w-3.5" }),
1798
- related.entity.name
1799
- ]
1800
- }
1801
- )
1821
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1822
+ actionButtons,
1823
+ /* @__PURE__ */ jsxs(
1824
+ Button,
1825
+ {
1826
+ type: "button",
1827
+ size: "sm",
1828
+ variant: "outline",
1829
+ className: "h-8",
1830
+ disabled: draft !== null,
1831
+ onClick: () => setDraft({}),
1832
+ children: [
1833
+ /* @__PURE__ */ jsx(Plus, { className: "mr-1 h-3.5 w-3.5" }),
1834
+ related.entity.name
1835
+ ]
1836
+ }
1837
+ )
1838
+ ] })
1802
1839
  ] }),
1803
1840
  error ? /* @__PURE__ */ jsx("p", { className: "rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-xs text-destructive-soft-foreground", children: error }) : loading ? /* @__PURE__ */ jsx("div", { className: "h-8 w-40 animate-pulse rounded bg-muted/40" }) : rows.length === 0 && draft === null ? /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: compact ? "py-3" : "py-4", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: related.emptyHint ?? "\u2014" }) }) }) : /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-0", children: [
1804
1841
  /* @__PURE__ */ jsx(
@@ -7862,5 +7899,5 @@ function CrudRecordModal({
7862
7899
  }
7863
7900
 
7864
7901
  export { AddressFormModal, CrudCardGrid, CrudDetailPage, CrudDetailSkeleton, CrudFormPage, CrudFormSkeleton, CrudListView, CrudPage, CrudRecordModal, EntitlementGate, EntityLink, InlineEditor, InlineField, LimitGate, PermissionGate, RecordMetaFooter, RelatedListTab, TagChip, TagsField, UnitMembersTab, WidgetSlot, applyFieldRules, createCrudPage, createCrudStore, duplicateWrite, exportToCSV, fetchMyPersonRecord, findMyPersonCandidate, formatFieldValue, getCrudNavTabs, getPersonPath, getTabCountProviders, humanizeWriteError, invalidateRelationOptions, invalidateTabCounts, linkPersonToLogin, registerCrudNavTabs, registerEntityPath, registerTabCountProvider, unregisterTabCountProvider, useFieldRules, useHeaderAction, useHeaderActions, useInviteStore, useModuleAccess, useMyPersonId, usePersonTabCounts, useSystemPermission, useUnitFilter, useUnitSwitchingStore, useWidgetSurface };
7865
- //# sourceMappingURL=chunk-RLZCH4NU.js.map
7866
- //# sourceMappingURL=chunk-RLZCH4NU.js.map
7902
+ //# sourceMappingURL=chunk-F54JFP54.js.map
7903
+ //# sourceMappingURL=chunk-F54JFP54.js.map