feat(inventory): «موجودی اولیه» rebrand + create-on-the-fly global catalog entries

- PURCHASE rebranded to «موجودی اولیه» in the تغییر موجودی screen
  (tab, description, empty-state copy; submit button reads
  «ثبت موجودی اولیه» automatically).
- Material/brand/unit inputs of that form are now searchable Comboboxes
  with «…به عنوان جدید» affordance; submitting an unknown name creates
  the entry on the fly in the global catalogs (new apiV26.catalog.* →
  POST /materials with null category, /brands, /units) so initial stock
  no longer requires a procurement prerequisite.
- The hub timeline chip for PURCHASE stays «خرید» because real deliveries
  from کالاهای در راه also post as PURCHASE.
This commit is contained in:
2026-09-06 19:03:42 +03:30
parent fd1831b3fc
commit 468ce64d29
2 changed files with 99 additions and 40 deletions
+27
View File
@@ -1485,4 +1485,31 @@ export const apiV26 = {
postData("/pm/receipts", body),
receipts: async (): Promise<ConfirmedReceipt[]> => getData<ConfirmedReceipt[]>("/pm/receipts"),
},
// ساخت موجودیت‌های کاتالوگ سراسری از داخل پنل انبار (موجودی اولیه):
// متریال/برند/واحد جدید بدون وابستگی به دفتر تدارکات ساخته می‌شوند.
catalog: {
createUnit: async (name: string): Promise<{ id: number; code: string; name_fa: string | null }> =>
postData("/units", {
code: norm(name) || "unit",
name_fa: name,
dimension: null,
si_factor: 1,
is_base: false,
}),
createBrand: async (name: string): Promise<{ id: string; name: string }> =>
postData("/brands", { name, country: null }),
createMaterial: async (opts: {
name: string; canonical_unit_id: number; brand_ids: string[];
}): Promise<{ id: string; name: string }> =>
postData("/materials", {
name: opts.name,
category_id: null, // دسته از اولین تأمین‌کننده‌ی مرتبط استنتاج می‌شود (v2.5)
topic: null,
canonical_unit_id: opts.canonical_unit_id,
status: "active",
brand_ids: opts.brand_ids,
attributes: [],
}),
},
};